mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
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
This commit is contained in:
parent
6109f2112c
commit
24054bb28a
@ -54,17 +54,17 @@ class data_field_url extends data_field_base {
|
||||
$str .= '<table><tr><td align="right">';
|
||||
$str .= get_string('url','data').':</td><td>';
|
||||
$str .= '<label class="accesshide" for="' . $fieldid . '">'. $this->field->name .'</label>';
|
||||
$str .= '<input type="text" name="field_'.$this->field->id.'_0" id="'.$fieldid.'" value="'.$url.'" size="60" /></td></tr>';
|
||||
$str .= '<input type="text" name="field_'.$this->field->id.'_0" id="'.$fieldid.'" value="'.$url.'" size="60" />';
|
||||
$str .= '<button id="filepicker-button-'.$options->client_id.'" style="display:none">'.$straddlink.'</button></td></tr>';
|
||||
$str .= '<tr><td align="right">'.get_string('text','data').':</td><td><input type="text" name="field_'.$this->field->id.'_1" id="field_'.$this->field->id.'_1" value="'.s($text).'" size="60" /></td></tr>';
|
||||
$str .= '</table>';
|
||||
} else {
|
||||
// Just the URL field
|
||||
$str .= '<label class="accesshide" for="' . $fieldid . '">'. $this->field->name .'</label>';
|
||||
$str .= '<input type="text" name="field_'.$this->field->id.'_0" id="'.$fieldid.'" value="'.s($url).'" size="60" />';
|
||||
$str .= '<button id="filepicker-button-'.$options->client_id.'" style="display:none">'.$straddlink.'</button>';
|
||||
}
|
||||
|
||||
$str .= '<button id="filepicker-button-'.$options->client_id.'" style="display:none">'.$straddlink.'</button>';
|
||||
|
||||
// print out file picker
|
||||
//$str .= $OUTPUT->render($fp);
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user