From 24054bb28a9c4841f3ad7f898817d967744d53c1 Mon Sep 17 00:00:00 2001 From: Adrian Greeve Date: Tue, 30 Oct 2012 14:41:56 +0800 Subject: [PATCH] MDL-36112 - mod/data: Importing URLs no longer generates php warnings. Also included a slight alteration of the URL field class to display the Choose a link button next to the right input area. Made an alteration to the url field class --- mod/data/field/url/field.class.php | 6 +++--- mod/data/import.php | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/mod/data/field/url/field.class.php b/mod/data/field/url/field.class.php index 89c8c7cee26..00a96ee0827 100644 --- a/mod/data/field/url/field.class.php +++ b/mod/data/field/url/field.class.php @@ -54,17 +54,17 @@ class data_field_url extends data_field_base { $str .= ''; + $str .= ''; + $str .= ''; $str .= ''; $str .= '
'; $str .= get_string('url','data').':'; $str .= ''; - $str .= '
'.get_string('text','data').':
'; } else { // Just the URL field $str .= ''; $str .= ''; + $str .= ''; } - $str .= ''; - // print out file picker //$str .= $OUTPUT->render($fp); diff --git a/mod/data/import.php b/mod/data/import.php index c1c5979bae1..5a4526b10c3 100644 --- a/mod/data/import.php +++ b/mod/data/import.php @@ -159,7 +159,10 @@ if (!$formdata = $form->get_data()) { if (preg_match("/^(latlong|url)$/", $field->type)) { $values = explode(" ", $value, 2); $content->content = $values[0]; - $content->content1 = $values[1]; + // The url field doesn't always have two values (unforced autolinking). + if (count($values) > 1) { + $content->content1 = $values[1]; + } } else { $content->content = $value; }