mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 18:06:51 +02:00
Merge branch 'MDL-26244_url' of https://github.com/andyjdavis/moodle
This commit is contained in:
commit
2d0316d60d
3 changed files with 15 additions and 15 deletions
|
@ -79,7 +79,7 @@ class MoodleQuickForm_url extends HTML_QuickForm_text{
|
|||
* @return string
|
||||
*/
|
||||
function toHtml(){
|
||||
global $CFG, $COURSE, $USER, $PAGE, $OUTPUT;
|
||||
global $PAGE, $OUTPUT;
|
||||
|
||||
$id = $this->_attributes['id'];
|
||||
$elname = $this->_attributes['name'];
|
||||
|
@ -94,20 +94,9 @@ class MoodleQuickForm_url extends HTML_QuickForm_text{
|
|||
if (empty($this->_options['usefilepicker'])) {
|
||||
return $str;
|
||||
}
|
||||
$strsaved = get_string('filesaved', 'repository');
|
||||
$straddlink = get_string('choosealink', 'repository');
|
||||
if ($COURSE->id == SITEID) {
|
||||
$context = context_system::instance();
|
||||
} else {
|
||||
$context = context_course::instance($COURSE->id);
|
||||
}
|
||||
|
||||
$client_id = uniqid();
|
||||
|
||||
$str .= <<<EOD
|
||||
<button id="filepicker-button-{$client_id}" style="display:none">
|
||||
$straddlink
|
||||
</button>
|
||||
EOD;
|
||||
$args = new stdClass();
|
||||
$args->accepted_types = '*';
|
||||
$args->return_types = FILE_EXTERNAL;
|
||||
|
@ -117,6 +106,15 @@ EOD;
|
|||
$fp = new file_picker($args);
|
||||
$options = $fp->options;
|
||||
|
||||
if (count($options->repositories) > 0) {
|
||||
$straddlink = get_string('choosealink', 'repository');
|
||||
$str .= <<<EOD
|
||||
<button id="filepicker-button-{$client_id}" style="display:none">
|
||||
$straddlink
|
||||
</button>
|
||||
EOD;
|
||||
}
|
||||
|
||||
// print out file picker
|
||||
$str .= $OUTPUT->render($fp);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue