$selectedhuburl = optional_param('publichub', false, PARAM_URL);
$unlistedhuburl = optional_param('unlistedurl', false, PARAM_TEXT);
$password = optional_param('password', '', PARAM_RAW);
-
+ $registeringhuburl = null;
if (!empty($unlistedhuburl)) {
if (clean_param($unlistedhuburl, PARAM_URL) !== '') {
- $huburl = $unlistedhuburl;
+ $registeringhuburl = $unlistedhuburl;
}
} else if (!empty($selectedhuburl)) {
- $huburl = $selectedhuburl;
+ $registeringhuburl = $selectedhuburl;
}
// a hub has been selected, redirect to the hub registration page
- if (empty($cancel) and !empty($huburl) and confirm_sesskey()) {
- $hubname = optional_param(clean_param($huburl, PARAM_ALPHANUMEXT), '', PARAM_TEXT);
- $params = array('sesskey' => sesskey(), 'huburl' => $huburl,
+ if (empty($cancel) and !empty($registeringhuburl) and confirm_sesskey()) {
+ $hubname = optional_param(clean_param($registeringhuburl, PARAM_ALPHANUMEXT), '', PARAM_TEXT);
+ $params = array('sesskey' => sesskey(), 'huburl' => $registeringhuburl,
'password' => $password, 'hubname' => $hubname);
redirect(new moodle_url($CFG->wwwroot . "/" . $CFG->admin . "/registration/register.php",
$params));
$temp->add(new admin_setting_configcheckbox('enablegroupmembersonly', new lang_string('enablegroupmembersonly', 'admin'), new lang_string('configenablegroupmembersonly', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('dndallowtextandlinks', new lang_string('dndallowtextandlinks', 'admin'), new lang_string('configdndallowtextandlinks', 'admin'), 0));
+ $temp->add(new admin_setting_configcheckbox('enablecssoptimiser', new lang_string('enablecssoptimiser','admin'), new lang_string('enablecssoptimiser_desc','admin'), 0));
$ADMIN->add('experimental', $temp);
$checkbox->set_affects_modinfo(true);
$optionalsubsystems->add(new admin_setting_configcheckbox('enableplagiarism', new lang_string('enableplagiarism','plagiarism'), new lang_string('configenableplagiarism','plagiarism'), 0));
-
- $optionalsubsystems->add(new admin_setting_configcheckbox('enablecssoptimiser', new lang_string('enablecssoptimiser','admin'), new lang_string('enablecssoptimiser_desc','admin'), 0));
}
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2012050300;
-$plugin->requires = 2012050300;
+$plugin->version = 2012061700;
+$plugin->requires = 2012061700;
$plugin->component = 'tool_assignmentupgrade';
-$plugin->dependencies = array('mod_assign' => 2012050300);
+$plugin->dependencies = array('mod_assign' => 2012061700);
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011092100; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'tool_bloglevelupgrade'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011092100; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'tool_capability'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011092500;
-$plugin->requires = 2011092100;
+$plugin->version = 2012061700;
+$plugin->requires = 2012061700;
$plugin->component = 'tool_customlang'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011092100; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'tool_dbtransfer'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011092100; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'tool_generator'; // Full name of the plugin (used for diagnostics)
$plugin->maturity = MATURITY_ALPHA; // this version's maturity level
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011092100; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'tool_health'; // Full name of the plugin (used for diagnostics)
$plugin->maturity = MATURITY_ALPHA; // this version's maturity level
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011092100; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'tool_innodb'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011092100; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'tool_langimport'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011092100; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'tool_multilangupgrade'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2012040500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2012040500; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'tool_phpunit'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011092100; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'tool_profiling'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011092500;
-$plugin->requires = 2011092100;
+$plugin->version = 2012061700;
+$plugin->requires = 2012061700;
$plugin->component = 'tool_qeupgradehelper'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011092100; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'tool_replace'; // Full name of the plugin (used for diagnostics)
$plugin->maturity = MATURITY_ALPHA; // this version's maturity level
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011092500;
-$plugin->requires = 2011092100;
+$plugin->version = 2012061700;
+$plugin->requires = 2012061700;
$plugin->component = 'tool_spamcleaner'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011092500;
-$plugin->requires = 2011092100;
+$plugin->version = 2012061700;
+$plugin->requires = 2012061700;
$plugin->component = 'tool_timezoneimport'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011092100; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'tool_unittest'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011092100; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'tool_unsuproles'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011092100; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'tool_uploaduser'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011092100; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'tool_xmldb'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'auth_cas'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'auth_db'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die;
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'auth_email'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'auth_fc'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'auth_imap'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'auth_ldap'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'auth_manual'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'auth_mnet'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'auth_nntp'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'auth_nologin'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'auth_none'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'auth_pam'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'auth_pop3'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'auth_radius'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'auth_shibboleth'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'auth_webservice'; // Full name of the plugin (used for diagnostics)
case backup::TYPE_1SECTION :
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
require_capability('moodle/backup:backupsection', $coursecontext);
- if (!empty($section->name)) {
+ if ((string)$section->name !== '') {
$sectionname = format_string($section->name, true, array('context' => $coursecontext));
$heading = get_string('backupsection', 'backup', $sectionname);
$PAGE->navbar->add($sectionname);
$array_index++;
if ($item->nodeName == "item") {
+ $identifierref = '';
+ if ($item->hasAttribute('identifierref')) {
+ $identifierref = $item->getAttribute('identifierref');
+ }
- $identifierref = $xpath->query('@identifierref', $item);
- $identifierref = !empty($identifierref->item(0)->nodeValue) ? $identifierref->item(0)->nodeValue : '';
-
- $title = $xpath->query('imscc:title', $item);
- $title = !empty($title->item(0)->nodeValue) ? $title->item(0)->nodeValue : '';
+ $title = '';
+ $titles = $xpath->query('imscc:title', $item);
+ if ($titles->length > 0) {
+ $title = $titles->item(0)->nodeValue;
+ }
$cc_type = $this->get_item_cc_type($identifierref);
$moodle_type = $this->convert_to_moodle_type($cc_type);
+ //Fix the label issue - MDL-33523
+ if (empty($identifierref) && empty($title)) {
+ $moodle_type = TYPE_UNKNOWN;
+ }
}
elseif ($item->nodeName == "resource") {
if (!empty($labels) && ($labels->length > 0)) {
$tname = 'course_files';
$dpath = cc2moodle::$path_to_manifest_folder . DIRECTORY_SEPARATOR . $tname;
- $rfpath = 'folder.gif';
+ $rfpath = 'files.gif';
$fpath = $dpath . DIRECTORY_SEPARATOR . $rfpath;
if (!file_exists($dpath)) {
mkdir($dpath);
}
//copy the folder.gif file
- $folder_gif = "{$CFG->dirroot}/pix/f/folder.gif";
+ $folder_gif = "{$CFG->dirroot}/pix/i/files.gif";
copy($folder_gif, $fpath);
$all_files[] = $rfpath;
}
if (!empty($labels) && ($labels->length > 0)) {
$tname = 'course_files';
$dpath = cc2moodle::$path_to_manifest_folder . DIRECTORY_SEPARATOR . $tname;
- $rfpath = 'folder.gif';
- $fpath = $dpath . DIRECTORY_SEPARATOR . 'folder.gif';
+ $rfpath = 'files.gif';
+ $fpath = $dpath . DIRECTORY_SEPARATOR . 'files.gif';
if (!file_exists($dpath)) {
mkdir($dpath);
}
//copy the folder.gif file
- $folder_gif = "{$CFG->dirroot}/pix/f/folder.gif";
+ $folder_gif = "{$CFG->dirroot}/pix/i/files.gif";
copy($folder_gif, $fpath);
$all_files[] = $rfpath;
}
'[#date_now#]');
$title = isset($instance['title']) && !empty($instance['title']) ? $instance['title'] : 'Untitled';
- $content = "<img src=\"$@FILEPHP@$$@SLASH@$"."folder.gif\" alt=\"Folder\" title=\"{$title}\" /> {$title}";
+ $content = "<img src=\"$@FILEPHP@$$@SLASH@$"."files.gif\" alt=\"Folder\" title=\"{$title}\" /> {$title}";
$replace_values = array($instance['instance'],
self::safexml($title),
self::safexml($content),
require_once($CFG->dirroot . '/backup/util/helper/convert_helper.class.php');
- //Checking if we have some converter involved in the process
- $converters = convert_helper::available_converters(false);
- //Conversion status
+ // Look for converter steps only in type course and mode general backup operations.
$conversion = false;
- foreach ($converters as $value) {
- if ($this->get_setting_value($value)) {
- //zip class
- $zip_contents = "{$value}_zip_contents";
- $store_backup_file = "{$value}_store_backup_file";
- $convert = "{$value}_backup_convert";
-
- $this->add_step(new $convert("package_convert_{$value}"));
- $this->add_step(new $zip_contents("zip_contents_{$value}"));
- $this->add_step(new $store_backup_file("save_backupfile_{$value}"));
- if (!$conversion) {
- $conversion = true;
+ if ($this->plan->get_type() == backup::TYPE_1COURSE and $this->plan->get_mode() == backup::MODE_GENERAL) {
+ $converters = convert_helper::available_converters(false);
+ foreach ($converters as $value) {
+ if ($this->get_setting_value($value)) {
+ // Zip class.
+ $zip_contents = "{$value}_zip_contents";
+ $store_backup_file = "{$value}_store_backup_file";
+ $convert = "{$value}_backup_convert";
+
+ $this->add_step(new $convert("package_convert_{$value}"));
+ $this->add_step(new $zip_contents("zip_contents_{$value}"));
+ $this->add_step(new $store_backup_file("save_backupfile_{$value}"));
+ if (!$conversion) {
+ $conversion = true;
+ }
}
}
}
-
// On backup::MODE_IMPORT, we don't have to zip nor store the the file, skip these steps
if (($this->plan->get_mode() != backup::MODE_IMPORT) && !$conversion) {
// Generate the zip file (mbz extension)
$filename->set_ui_filename(get_string('filename', 'backup'), 'backup.mbz', array('size'=>50));
$this->add_setting($filename);
- //Sample custom settings
- $converters = convert_helper::available_converters(false);
- foreach ($converters as $cnv) {
- $formatcnv = new backup_users_setting($cnv, base_setting::IS_BOOLEAN, false);
- $formatcnv->set_ui(new backup_setting_ui_checkbox($formatcnv, get_string('backupformat'.$cnv, 'backup')));
- $this->add_setting($formatcnv);
+ // Present converter settings only in type course and mode general backup operations.
+ $converters = array();
+ if ($this->plan->get_type() == backup::TYPE_1COURSE and $this->plan->get_mode() == backup::MODE_GENERAL) {
+ $converters = convert_helper::available_converters(false);
+ foreach ($converters as $cnv) {
+ $formatcnv = new backup_users_setting($cnv, base_setting::IS_BOOLEAN, false);
+ $formatcnv->set_ui(new backup_setting_ui_checkbox($formatcnv, get_string('backupformat'.$cnv, 'backup')));
+ $this->add_setting($formatcnv);
+ }
}
// Define users setting (keeping it on hand to define dependencies)
// Section exists, update non-empty information
} else {
$section->id = $secrec->id;
- if (empty($secrec->name)) {
+ if ((string)$secrec->name === '') {
$section->name = $data->name;
}
if (empty($secrec->summary)) {
throw new backup_task_exception('section_task_section_not_found', $sectionid);
}
- return new backup_section_task(empty($section->name) ? $section->section : $section->name, $sectionid);
+ return new backup_section_task((string)$section->name === '' ? $section->section : $section->name, $sectionid);
}
/**
return $this->controller->get_backupid();
}
+ public function get_type() {
+ return $this->controller->get_type();
+ }
+
public function get_mode() {
return $this->controller->get_mode();
}
* @param string $label
*/
public function set_label($label) {
- if (empty($label) || $label !== clean_param($label, PARAM_TEXT)) {
+ if ((string)$label === '' || $label !== clean_param($label, PARAM_TEXT)) {
throw new base_setting_ui_exception('setting_invalid_ui_label');
}
$this->label = $label;
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_activity_modules'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_admin_bookmarks'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_blog_menu'; // Full name of the plugin (used for diagnostics)
require_once($CFG->dirroot .'/blog/lib.php');
require_once($CFG->dirroot .'/blog/locallib.php');
+ if (empty($this->config)) {
+ $this->config = new stdClass();
+ }
+
if (empty($this->config->recentbloginterval)) {
$this->config->recentbloginterval = 8400;
}
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_blog_recent'; // Full name of the plugin (used for diagnostics)
// require the libs and do the work
require_once($CFG->dirroot .'/blog/lib.php');
+ if (empty($this->config)) {
+ $this->config = new stdClass();
+ }
+
if (empty($this->config->timewithin)) {
$this->config->timewithin = BLOCK_BLOG_TAGS_DEFAULTTIMEWITHIN;
}
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_blog_tags'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_calendar_month'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_calendar_upcoming'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_comments'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_community'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_completionstatus';
-$plugin->dependencies = array('report_completion' => 2011110200);
\ No newline at end of file
+$plugin->dependencies = array('report_completion' => 2012061700);
\ No newline at end of file
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_course_list'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_course_overview'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_course_summary'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_feedback'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_glossary_random'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_html'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_login'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_mentees'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_messages'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_mnet_hosts'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_myprofile'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_navigation'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_news_items'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_online_users'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_participants'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_private_files'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_quiz_results'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_recent_activity'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_rss_client'; // Full name of the plugin (used for diagnostics)
$plugin->cron = 300; // Set min time between cron executions to 300 secs (5 mins)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_search_forums'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_section_links'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_selfcompletion'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_settings'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_site_main_menu'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_social_activities'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_tag_flickr'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_tag_youtube'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'block_tags'; // Full name of the plugin (used for diagnostics)
// '/filedir' => '/var/www/moodle/filedir', // for custom $CFG->filedir locations
// );
//
+// YUI caching may be sometimes improved by slasharguments:
+// $CFG->yuislasharguments = 1;
+// Some servers may need a special rewrite rule to work around internal path length limitations:
+// RewriteRule (^.*/theme/yui_combo\.php)(/.*) $1?file=$2
//
//
// This setting will prevent the 'My Courses' page being displayed when a student
function dndupload_add_to_course($course, $modnames) {
global $CFG, $PAGE;
- $showstatus = optional_param('editingenabled', false, PARAM_BOOL);
+ $showstatus = optional_param('notifyeditingon', false, PARAM_BOOL);
// Get all handlers.
$handler = new dndupload_handler($course, $modnames);
echo json_encode($resp);
die();
}
-}
\ No newline at end of file
+}
* @return array
* @since Moodle 2.2
*/
- public static function get_course_contents($courseid, $options) {
+ public static function get_course_contents($courseid, $options = array()) {
global $CFG, $DB;
require_once($CFG->dirroot . "/course/lib.php");
* @return array
* @since Moodle 2.2
*/
- public static function get_courses($options) {
+ public static function get_courses($options = array()) {
global $CFG, $DB;
require_once($CFG->dirroot . "/course/lib.php");
* @return array New course info
* @since Moodle 2.3
*/
- public static function duplicate_course($courseid, $fullname, $shortname, $categoryid, $visible, $options) {
+ public static function duplicate_course($courseid, $fullname, $shortname, $categoryid, $visible = 1, $options = array()) {
global $CFG, $USER, $DB;
require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php');
require_once($CFG->dirroot . '/backup/util/includes/restore_includes.php');
' - user must have \'moodle/category:manage\' to search on theme'),
'value' => new external_value(PARAM_RAW, 'the value to match')
)
- ), VALUE_DEFAULT, array()
+ ), 'criteria', VALUE_DEFAULT, array()
),
'addsubcategories' => new external_value(PARAM_BOOL, 'return the sub categories infos
(1 - default) otherwise only the category info (0)', VALUE_DEFAULT, 1)
// Finally move the category.
move_category($category, $parent_cat);
$category->parent = $cat['parent'];
+ // Get updated path by move_category().
+ $category->path = $DB->get_field('course_categories', 'path',
+ array('id' => $category->id));
}
$DB->update_record('course_categories', $category);
}
*
* @param stdClass $section The course_section entry from DB
* @param stdClass $course The course entry from DB
+ * @param array $mods course modules indexed by id (from get_all_mods)
* @return string HTML to output.
*/
- protected function section_summary($section, $course) {
+ protected function section_summary($section, $course, $mods) {
+ $classattr = 'section main section-summary clearfix';
+ $linkclasses = '';
+
// If section is hidden then display grey section link
- $classattr = 'section-summary clearfix';
- If (!$section->visible) {
- $classattr .= ' dimmed_text';
+ if (!$section->visible) {
+ $classattr .= ' hidden';
+ $linkclasses .= ' dimmed_text';
+ } else if ($this->is_section_current($section, $course)) {
+ $classattr .= ' current';
}
$o = '';
- $o.= html_writer::start_tag('li', array('id' => 'section-'.$section->section,
- 'class' => $classattr));
+ $o .= html_writer::start_tag('li', array('id' => 'section-'.$section->section, 'class' => $classattr));
- $title = get_section_name($course, $section);
- $o.= html_writer::start_tag('a', array('href' => course_get_url($course, $section->section)));
- $o.= $this->output->heading($title, 3, 'header section-title');
- $o.= html_writer::end_tag('a');
+ $o .= html_writer::tag('div', '', array('class' => 'left side'));
+ $o .= html_writer::tag('div', '', array('class' => 'right side'));
+ $o .= html_writer::start_tag('div', array('class' => 'content'));
+
+ $title = html_writer::tag('a', get_section_name($course, $section),
+ array('href' => course_get_url($course, $section->section), 'class' => $linkclasses));
+ $o .= $this->output->heading($title, 3, 'section-title');
$o.= html_writer::start_tag('div', array('class' => 'summarytext'));
$o.= $this->format_summary_text($section);
$o.= html_writer::end_tag('div');
+ $o.= $this->section_activity_summary($section, $mods);
- $o .= $this->section_availability_message($section);
+ $o.= $this->section_availability_message($section);
- $o.= html_writer::end_tag('li');
+ $o .= html_writer::end_tag('div');
+ $o .= html_writer::end_tag('li');
return $o;
}
+ /**
+ * Generate a summary of the activites in a section
+ *
+ * @param stdClass $section The course_section entry from DB
+ * @param array $mods course modules indexed by id (from get_all_mods)
+ * @return string HTML to output.
+ */
+ private function section_activity_summary($section, $mods) {
+ if (empty($section->sequence)) {
+ return '';
+ }
+
+ // Generate array with count of activities in this section:
+ $sectionmods = array();
+ $modsequence = explode(',', $section->sequence);
+ foreach ($modsequence as $cmid) {
+ $thismod = $mods[$cmid];
+
+ if ($thismod->modname == 'label') {
+ // Labels are special (not interesting for students)!
+ continue;
+ }
+
+ if ($thismod->uservisible) {
+ if (isset($sectionmods[$thismod->modname])) {
+ $sectionmods[$thismod->modname]['count']++;
+ } else {
+ $sectionmods[$thismod->modname]['name'] = $thismod->modplural;
+ $sectionmods[$thismod->modname]['count'] = 1;
+ }
+ }
+ }
+
+ if (empty($sectionmods)) {
+ // No sections
+ return '';
+ }
+
+ // Output section activities summary:
+ $o = '';
+ $o.= html_writer::start_tag('div', array('class' => 'section-summary-activities mdl-right'));
+ foreach ($sectionmods as $mod) {
+ $o.= html_writer::start_tag('span', array('class' => 'activity-count'));
+ $o.= $mod['name'].': '.$mod['count'];
+ $o.= html_writer::end_tag('span');
+ }
+ $o.= html_writer::end_tag('div');
+ return $o;
+ }
+
/**
* If section is not visible to current user, display the message about that
* ('Not available until...', that sort of thing). Otherwise, returns blank.
)
);
- $strcancel= get_string('cancel');
-
- $o.= html_writer::start_tag('li', array('class' => 'clipboard'));
+ $o.= html_writer::start_tag('div', array('class' => 'clipboard'));
$o.= strip_tags(get_string('activityclipboard', '', $USER->activitycopyname));
$o.= ' ('.html_writer::link($url, get_string('cancel')).')';
- $o.= html_writer::end_tag('li');
+ $o.= html_writer::end_tag('div');
}
return $o;
return;
}
+ // Copy activity clipboard..
+ echo $this->course_activity_clipboard($course, $displaysection);
+
// General section if non-empty.
$thissection = $sections[0];
if ($thissection->summary or $thissection->sequence or $PAGE->user_is_editing()) {
echo $this->section_header($thissection, $course, true);
print_section($course, $thissection, $mods, $modnamesused, true);
if ($PAGE->user_is_editing()) {
- print_section_add_menus($course, 0, $modnames);
+ print_section_add_menus($course, 0, $modnames, false, false, true);
}
echo $this->section_footer();
echo $this->end_section_list();
$sectiontitle .= html_writer::end_tag('div');
echo $sectiontitle;
- // Copy activity clipboard..
- echo $this->course_activity_clipboard($course, $displaysection);
-
// Now the list of sections..
echo $this->start_section_list();
print_section($course, $thissection, $mods, $modnamesused, true, '100%', false, true);
if ($PAGE->user_is_editing()) {
- print_section_add_menus($course, $displaysection, $modnames);
+ print_section_add_menus($course, $displaysection, $modnames, false, false, true);
}
echo $this->section_footer();
echo $this->end_section_list();
if (!$PAGE->user_is_editing() && $course->coursedisplay == COURSE_DISPLAY_MULTIPAGE) {
// Display section summary only.
- echo $this->section_summary($thissection, $course);
+ echo $this->section_summary($thissection, $course, $mods);
} else {
echo $this->section_header($thissection, $course, false);
if ($thissection->uservisible) {
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011120100; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011120100; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'format_scorm'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011120100; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011120100; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'format_social'; // Full name of the plugin (used for diagnostics)
function callback_topics_get_section_name($course, $section) {
// We can't add a node without any text
- if (!empty($section->name)) {
+ if ((string)$section->name !== '') {
return format_string($section->name, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id)));
} else if ($section->section == 0) {
return get_string('section0name', 'format_topics');
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2012042900; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2012042800.03; // Requires this Moodle version.
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2012061700; // Requires this Moodle version.
$plugin->component = 'format_topics'; // Full name of the plugin (used for diagnostics).
*/
function callback_weeks_get_section_name($course, $section) {
// We can't add a node without text
- if (!empty($section->name)) {
+ if ((string)$section->name !== '') {
// Return the name the user set.
return format_string($section->name, true, array('context' => context_course::instance($course->id)));
} else if ($section->section == 0) {
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2012042900; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2012042800.03; // Requires this Moodle version.
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2012061700; // Requires this Moodle version.
$plugin->component = 'format_weeks'; // Full name of the plugin (used for diagnostics).
/**
* Prints the menus to add activities and resources.
*/
-function print_section_add_menus($course, $section, $modnames, $vertical=false, $return=false) {
+function print_section_add_menus($course, $section, $modnames, $vertical=false, $return=false, $sectionreturn = false) {
global $CFG, $OUTPUT;
// check to see if user can add menus
// We need to add the section section to the link for each module
$sectionlink = '§ion=' . $section;
+ // We need to add the section to return to
+ if ($sectionreturn) {
+ $sectionreturnlink = '&sr=' . $section;
+ } else {
+ $sectionreturnlink = '&sr=0';
+ }
+
foreach ($modules as $module) {
if (isset($module->types)) {
// This module has a subtype
// NOTE: this is legacy stuff, module subtypes are very strongly discouraged!!
$subtypes = array();
foreach ($module->types as $subtype) {
- $subtypes[$subtype->link . $sectionlink] = $subtype->title;
+ $subtypes[$subtype->link . $sectionlink . $sectionreturnlink] = $subtype->title;
}
// Sort module subtypes into the list
} else {
// This module has no subtypes
if ($module->archetype == MOD_ARCHETYPE_RESOURCE) {
- $resources[$module->link . $sectionlink] = $module->title;
+ $resources[$module->link . $sectionlink . $sectionreturnlink] = $module->title;
} else if ($module->archetype === MOD_ARCHETYPE_SYSTEM) {
// System modules cannot be added by user, do not add to dropdown
} else {
- $activities[$module->link . $sectionlink] = $module->title;
+ $activities[$module->link . $sectionlink . $sectionreturnlink] = $module->title;
}
}
}
$modchooser.= html_writer::start_tag('div', array('class' => 'section-modchooser'));
$icon = $OUTPUT->pix_icon('t/add', $straddeither);
$span = html_writer::tag('span', $straddeither, array('class' => 'section-modchooser-text'));
- $modchooser.= html_writer::link('#', $icon.$span, array('class' => 'section-modchooser-link'));
+ $modchooser .= html_writer::tag('span', $icon . $span, array('class' => 'section-modchooser-link'));
$modchooser.= html_writer::end_tag('div');
$modchooser.= html_writer::end_tag('div');
* @param object $course The Course
* @param array $modnames An array containing the list of modules and their
* names
+ * @param int $sectionreturn The section to return to
* @return array A list of stdClass objects containing metadata about each
* module
*/
-function get_module_metadata($course, $modnames) {
+function get_module_metadata($course, $modnames, $sectionreturn = 0) {
global $CFG, $OUTPUT;
// get_module_metadata will be called once per section on the page and courses may show
}
$return = array();
- $urlbase = "/course/mod.php?id=$course->id&sesskey=".sesskey().'&add=';
+ $urlbase = "/course/mod.php?id=$course->id&sesskey=".sesskey().'&sr='.$sectionreturn.'&add=';
foreach($modnames as $modname => $modnamestr) {
if (!course_allowed_module($course, $modname)) {
continue;
}
}
- // Adjust destination to reflect the actual section
- $moveup = false;
- if ($section > $destination) {
- $destination++;
- $moveup = true;
- }
-
// If we move the highlighted section itself, then just highlight the destination.
// Adjust the higlighted section location if we move something over it either direction.
if ($section == $course->marker) {
course_set_marker($course->id, $destination);
- } elseif ($moveup && $section > $course->marker && $course->marker >= $destination) {
+ } elseif ($section > $course->marker && $course->marker >= $destination) {
course_set_marker($course->id, $course->marker+1);
- } elseif (!$moveup && $section < $course->marker && $course->marker <= $destination) {
+ } elseif ($section < $course->marker && $course->marker <= $destination) {
course_set_marker($course->id, $course->marker-1);
}
$type = optional_param('type', '', PARAM_ALPHA);
$returntomod = optional_param('return', 0, PARAM_BOOL);
- redirect("$CFG->wwwroot/course/modedit.php?add=$add&type=$type&course=$id§ion=$section&return=$returntomod");
+ redirect("$CFG->wwwroot/course/modedit.php?add=$add&type=$type&course=$id§ion=$section&return=$returntomod&sr=$sectionreturn");
} else if (!empty($update)) {
$cm = get_coursemodule_from_id('', $update, 0, true, MUST_EXIST);
$returntomod = optional_param('return', 0, PARAM_BOOL);
- redirect("$CFG->wwwroot/course/modedit.php?update=$update&return=$returntomod");
+ redirect("$CFG->wwwroot/course/modedit.php?update=$update&return=$returntomod&sr=$sectionreturn");
} else if (!empty($duplicate)) {
$cm = get_coursemodule_from_id('', $duplicate, 0, true, MUST_EXIST);
echo $OUTPUT->confirm(
get_string('duplicateconfirm', 'core', $a),
new single_button(
- new moodle_url('/course/modduplicate.php', array('cmid' => $cm->id, 'course' => $course->id)),
+ new moodle_url('/course/modduplicate.php', array(
+ 'cmid' => $cm->id, 'course' => $course->id, 'sr' => $sectionreturn)),
get_string('continue'),
'post'),
new single_button(
if (!$confirm or !confirm_sesskey()) {
$fullmodulename = get_string('modulename', $cm->modname);
- $optionsyes = array('confirm'=>1, 'delete'=>$cm->id, 'sesskey'=>sesskey());
- $optionsno = array('id'=>$cm->course);
+ $optionsyes = array('confirm'=>1, 'delete'=>$cm->id, 'sesskey'=>sesskey(), 'sr' => $sectionreturn);
$strdeletecheck = get_string('deletecheck', '', $fullmodulename);
$strdeletecheckfull = get_string('deletecheckfull', '', "$fullmodulename '$cm->name'");
// print_simple_box_start('center', '60%', '#FFAAAA', 20, 'noticebox');
echo $OUTPUT->box_start('noticebox');
$formcontinue = new single_button(new moodle_url("$CFG->wwwroot/course/mod.php", $optionsyes), get_string('yes'));
- $formcancel = new single_button(new moodle_url($return, $optionsno), get_string('no'), 'get');
+ $formcancel = new single_button($return, get_string('no'), 'get');
echo $OUTPUT->confirm($strdeletecheckfull, $formcontinue, $formcancel);
echo $OUTPUT->box_end();
echo $OUTPUT->footer();
moveto_module($cm, $section, $beforecm);
+ $sectionreturn = $USER->activitycopysectionreturn;
unset($USER->activitycopy);
unset($USER->activitycopycourse);
unset($USER->activitycopyname);
+ unset($USER->activitycopysectionreturn);
rebuild_course_cache($section->course);
$section = $DB->get_record('course_sections', array('id'=>$cm->section), '*', MUST_EXIST);
- $USER->activitycopy = $copy;
- $USER->activitycopycourse = $cm->course;
- $USER->activitycopyname = $cm->name;
+ $USER->activitycopy = $copy;
+ $USER->activitycopycourse = $cm->course;
+ $USER->activitycopyname = $cm->name;
+ $USER->activitycopysectionreturn = $sectionreturn;
redirect(course_get_url($course, $sectionreturn));
require_once($CFG->dirroot . '/backup/util/includes/restore_includes.php');
require_once($CFG->libdir . '/filelib.php');
-$cmid = required_param('cmid', PARAM_INT);
-$courseid = required_param('course', PARAM_INT);
+$cmid = required_param('cmid', PARAM_INT);
+$courseid = required_param('course', PARAM_INT);
+$sectionreturn = optional_param('sr', 0, PARAM_INT);
$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
$cm = get_coursemodule_from_id('', $cmid, $course->id, true, MUST_EXIST);
get_string('duplicatecontedit'),
'get'),
new single_button(
- new moodle_url('/course/view.php#section-' . $cm->sectionnum, array('id' => $cm->course)),
+ course_get_url($course, $sectionreturn),
get_string('duplicatecontcourse'),
'get')
);
} else {
echo $output->notification(get_string('duplicatesuccess', 'core', $a), 'notifysuccess');
- echo $output->continue_button(
- new moodle_url('/course/view.php#section-' . $cm->sectionnum, array('id' => $course->id))
- );
+ echo $output->continue_button(course_get_url($course, $sectionreturn));
}
echo $output->footer();
$update = optional_param('update', 0, PARAM_INT);
$return = optional_param('return', 0, PARAM_BOOL); //return to course/view.php if false or mod/modname/view.php if true
$type = optional_param('type', '', PARAM_ALPHANUM); //TODO: hopefully will be removed in 2.0
+$sectionreturn = optional_param('sr', 0, PARAM_INT);
$url = new moodle_url('/course/modedit.php');
+$url->param('sr', $sectionreturn);
if (!empty($return)) {
$url->param('return', $return);
}
$data->coursemodule = '';
$data->add = $add;
$data->return = 0; //must be false if this is an add, go back to course view on cancel
+ $data->sr = $sectionreturn;
if (plugin_supports('mod', $data->modulename, FEATURE_MOD_INTRO, true)) {
$draftid_editor = file_get_submitted_draft_itemid('introeditor');
$data->modulename = $module->name;
$data->instance = $cm->instance;
$data->return = $return;
+ $data->sr = $sectionreturn;
$data->update = $update;
$data->completion = $cm->completion;
$data->completionview = $cm->completionview;
if ($return && !empty($cm->id)) {
redirect("$CFG->wwwroot/mod/$module->name/view.php?id=$cm->id");
} else {
- redirect(course_get_url($course, $cw->section));
+ redirect(course_get_url($course, $sectionreturn));
}
} else if ($fromform = $mform->get_data()) {
if (empty($fromform->coursemodule)) {
redirect($gradingman->get_management_url($returnurl));
}
} else {
- redirect(course_get_url($course, $cw->section));
+ redirect(course_get_url($course, $sectionreturn));
}
exit;
$mform->addElement('hidden', 'return', 0);
$mform->setType('return', PARAM_BOOL);
+
+ $mform->addElement('hidden', 'sr', 0);
+ $mform->setType('sr', PARAM_INT);
}
public function standard_grading_coursemodule_elements() {
echo $renderer->dependency_notification(get_string('dependenciesenforced', 'backup'));
}
echo $renderer->progress_bar($backup->get_progress_bar());
- echo $backup->display();
+ echo $backup->display($renderer);
echo $OUTPUT->footer();
die();
}
// Put all options into one tag 'alloptions' to allow us to handle scrolling
$formcontent .= html_writer::start_tag('div', array('class' => 'alloptions'));
- // First display Resources
- $resources = array_filter($modules,
- create_function('$mod', 'return ($mod->archetype === MOD_CLASS_RESOURCE);'));
- if (count($resources)) {
- $formcontent .= $this->course_modchooser_title('resources');
- $formcontent .= $this->course_modchooser_module_types($resources);
- }
-
- // Then activities
+ // Activities
$activities = array_filter($modules,
create_function('$mod', 'return ($mod->archetype !== MOD_CLASS_RESOURCE);'));
if (count($activities)) {
$formcontent .= $this->course_modchooser_module_types($activities);
}
+ // Resources
+ $resources = array_filter($modules,
+ create_function('$mod', 'return ($mod->archetype === MOD_CLASS_RESOURCE);'));
+ if (count($resources)) {
+ $formcontent .= $this->course_modchooser_title('resources');
+ $formcontent .= $this->course_modchooser_module_types($resources);
+ }
+
$formcontent .= html_writer::end_tag('div'); // modoptions
$formcontent .= html_writer::end_tag('div'); // types
$formcontent .= html_writer::start_tag('div', array('class' => 'submitbuttons'));
- $formcontent .= html_writer::tag('input', '',
- array('type' => 'submit', 'name' => 'addcancel', 'id' => 'addcancel', 'value' => get_string('cancel')));
$formcontent .= html_writer::tag('input', '',
array('type' => 'submit', 'name' => 'submitbutton', 'id' => 'submitbutton', 'value' => get_string('add')));
+ $formcontent .= html_writer::tag('input', '',
+ array('type' => 'submit', 'name' => 'addcancel', 'id' => 'addcancel', 'value' => get_string('cancel')));
$formcontent .= html_writer::end_tag('div');
$formcontent .= html_writer::end_tag('form');
$this->assertFalse($neworder);
}
- public function test_move_section() {
+ public function test_move_section_down() {
global $DB;
$this->resetAfterTest(true);
}
ksort($oldsections);
+ // Test move section down..
move_section_to($course, 2, 4);
$sections = array();
foreach ($DB->get_records('course_sections', array('course'=>$course->id)) as $section) {
$this->assertEquals($oldsections[6], $sections[6]);
}
+ public function test_move_section_up() {
+ global $DB;
+ $this->resetAfterTest(true);
+
+ $this->getDataGenerator()->create_course(array('numsections'=>5), array('createsections'=>true));
+ $course = $this->getDataGenerator()->create_course(array('numsections'=>10), array('createsections'=>true));
+ $oldsections = array();
+ foreach ($DB->get_records('course_sections', array('course'=>$course->id)) as $section) {
+ $oldsections[$section->section] = $section->id;
+ }
+ ksort($oldsections);
+
+ // Test move section up..
+ move_section_to($course, 6, 4);
+ $sections = array();
+ foreach ($DB->get_records('course_sections', array('course'=>$course->id)) as $section) {
+ $sections[$section->section] = $section->id;
+ }
+ ksort($sections);
+
+ $this->assertEquals($oldsections[0], $sections[0]);
+ $this->assertEquals($oldsections[1], $sections[1]);
+ $this->assertEquals($oldsections[2], $sections[2]);
+ $this->assertEquals($oldsections[3], $sections[3]);
+ $this->assertEquals($oldsections[4], $sections[5]);
+ $this->assertEquals($oldsections[5], $sections[6]);
+ $this->assertEquals($oldsections[6], $sections[4]);
+ }
+
+ public function test_move_section_marker() {
+ global $DB;
+ $this->resetAfterTest(true);
+
+ $this->getDataGenerator()->create_course(array('numsections'=>5), array('createsections'=>true));
+ $course = $this->getDataGenerator()->create_course(array('numsections'=>10), array('createsections'=>true));
+
+ // Set course marker to the section we are going to move..
+ course_set_marker($course->id, 2);
+ // Verify that the course marker is set correctly.
+ $course = $DB->get_record('course', array('id' => $course->id));
+ $this->assertEquals(2, $course->marker);
+
+ // Test move the marked section down..
+ move_section_to($course, 2, 4);
+
+ // Verify that the coruse marker has been moved along with the section..
+ $course = $DB->get_record('course', array('id' => $course->id));
+ $this->assertEquals(4, $course->marker);
+
+ // Test move the marked section up..
+ move_section_to($course, 4, 3);
+
+ // Verify that the course marker has been moved along with the section..
+ $course = $DB->get_record('course', array('id' => $course->id));
+ $this->assertEquals(3, $course->marker);
+
+ // Test moving a non-marked section above the marked section..
+ move_section_to($course, 4, 2);
+
+ // Verify that the course marker has been moved down to accomodate..
+ $course = $DB->get_record('course', array('id' => $course->id));
+ $this->assertEquals(4, $course->marker);
+
+ // Test moving a non-marked section below the marked section..
+ move_section_to($course, 3, 6);
+
+ // Verify that the course marker has been up to accomodate..
+ $course = $DB->get_record('course', array('id' => $course->id));
+ $this->assertEquals(3, $course->marker);
+ }
+
public function test_get_course_display_name_for_list() {
global $CFG;
$this->resetAfterTest(true);
if ($course->id == SITEID) {
redirect($CFG->wwwroot .'/?redirect=0');
} else {
- $url = new moodle_url($PAGE->url, array('editingenabled' => 1));
+ $url = new moodle_url($PAGE->url, array('notifyeditingon' => 1));
redirect($url);
}
} else if (($edit == 0) and confirm_sesskey()) {
if (include_course_ajax($course, $modnamesused)) {
// Add the module chooser
$renderer = $PAGE->get_renderer('core', 'course');
- echo $renderer->course_modchooser(get_module_metadata($course, $modnames), $course);
+ echo $renderer->course_modchooser(get_module_metadata($course, $modnames, $displaysection), $course);
}
echo $OUTPUT->footer();
var CSS = {
PAGECONTENT : 'div#page-content',
SECTION : 'li.section',
- SECTIONMODCHOOSER : 'a.section-modchooser-link',
+ SECTIONMODCHOOSER : 'span.section-modchooser-link',
SITEMENU : 'div.block_site_main_menu',
SITETOPIC : 'div.sitetopic'
};
}, this);
},
_setup_for_section : function(section, sectionid) {
- var chooserlink = section.one(CSS.SECTIONMODCHOOSER);
+ var chooserspan = section.one(CSS.SECTIONMODCHOOSER);
+ var chooserlink = Y.Node.create("<a href='#' />");
+ chooserspan.get('children').each(function(node) {
+ chooserlink.appendChild(node);
+ });
+ chooserspan.insertBefore(chooserlink);
chooserlink.on('click', this.display_mod_chooser, this, sectionid);
},
/**
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112902; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'enrol_authorize'; // Full name of the plugin (used for diagnostics)
$plugin->cron = 180;
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'enrol_category'; // Full name of the plugin (used for diagnostics)
$plugin->cron = 60;
\ No newline at end of file
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112901; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'enrol_cohort'; // Full name of the plugin (used for diagnostics)
$plugin->cron = 60*60; // run cron every hour by default, it is not out-of-sync often
\ No newline at end of file
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2012031000; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2012022300; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'enrol_database'; // Full name of the plugin (used for diagnostics)
//TODO: should we add cron sync?
\ No newline at end of file
* }
* @return array An array of users
*/
- public static function get_enrolled_users($courseid, $options) {
+ public static function get_enrolled_users($courseid, $options = array()) {
global $CFG, $USER, $DB;
require_once($CFG->dirroot . "/user/lib.php");
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112901; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'enrol_flatfile'; // Full name of the plugin (used for diagnostics)
$plugin->cron = 60;
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112901; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'enrol_guest'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112901; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'enrol_imsenterprise'; // Full name of the plugin (used for diagnostics)
$plugin->cron = 60;
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'enrol_ldap'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112901; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'enrol_manual'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112901; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'enrol_meta'; // Full name of the plugin (used for diagnostics)
$plugin->cron = 60*60; // run cron every hour by default, it is not out-of-sync often
\ No newline at end of file
* Do not allow multiple instances for single remote host
*
* @param array $data raw form data
- * @return array
+ * @param array $files
+ * @return array of errors
*/
- function validation($data) {
+ function validation($data, $files) {
global $DB;
$errors = array();
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'enrol_mnet'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112901; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'enrol_paypal'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'enrol_self'; // Full name of the plugin (used for diagnostics)
$plugin->cron = 180;
\ No newline at end of file
if (this.get('center') && !e.prevVal && e.newVal) {
this.centerDialogue();
}
+ if (this.get('draggable')) {
+ var titlebar = '#' + this.get('id') + ' .' + CSS.HEADER;
+ this.plug(Y.Plugin.Drag, {handles : [titlebar]});
+ this.dd.addInvalid('div.closebutton');
+ Y.one(titlebar).setStyle('cursor', 'move');
+ }
break;
}
},
center : {
validator : Y.Lang.isBoolean,
value : true
+ },
+ draggable : {
+ validator : Y.Lang.isBoolean,
+ value : false
}
}
});
M.core.exception = EXCEPTION;
M.core.ajaxException = AJAXEXCEPTION;
-}, '@VERSION@', {requires:['base','node','overlay','event-key', 'moodle-enrol-notification-skin']});
\ No newline at end of file
+}, '@VERSION@', {requires:['base','node','overlay','event-key', 'moodle-enrol-notification-skin', 'dd-plugin']});
'filearea' => new external_value(PARAM_TEXT, 'file area'),
'itemid' => new external_value(PARAM_INT, 'associated id'),
'filepath' => new external_value(PARAM_PATH, 'file path'),
- 'filename' => new external_value(PARAM_FILE, 'file name')
+ 'filename' => new external_value(PARAM_FILE, 'file name'),
+ 'modified' => new external_value(PARAM_INT, 'timestamp to return files changed after this time.', VALUE_DEFAULT, null)
)
);
}
* @param int $itemid item id
* @param string $filepath file path
* @param string $filename file name
+ * @param int $modified timestamp to return files changed after this time.
* @return array
* @since Moodle 2.2
*/
- public static function get_files($contextid, $component, $filearea, $itemid, $filepath, $filename) {
+ public static function get_files($contextid, $component, $filearea, $itemid, $filepath, $filename, $modified = null) {
global $CFG, $USER, $OUTPUT;
- $fileinfo = self::validate_parameters(self::get_files_parameters(), array('contextid'=>$contextid, 'component'=>$component, 'filearea'=>$filearea, 'itemid'=>$itemid, 'filepath'=>$filepath, 'filename'=>$filename));
+ $fileinfo = self::validate_parameters(self::get_files_parameters(), array(
+ 'contextid'=>$contextid, 'component'=>$component, 'filearea'=>$filearea,
+ 'itemid'=>$itemid, 'filepath'=>$filepath, 'filename'=>$filename, 'modified'=>$modified));
$browser = get_file_browser();
$return = array();
$return['parents'] = array();
$return['files'] = array();
- if ($file = $browser->get_file_info($context, $fileinfo['component'], $fileinfo['filearea'], $fileinfo['itemid'], $fileinfo['filepath'], $fileinfo['filename'])) {
+ $list = array();
+ if ($file = $browser->get_file_info(
+ $context, $fileinfo['component'], $fileinfo['filearea'], $fileinfo['itemid'],
+ $fileinfo['filepath'], $fileinfo['filename'])) {
$level = $file->get_parent();
while ($level) {
$params = $level->get_params();
array_unshift($return['parents'], $params);
$level = $level->get_parent();
}
- $list = array();
$children = $file->get_children();
foreach ($children as $child) {
$params = $child->get_params();
+ $timemodified = $child->get_timemodified();
if ($child->is_directory()) {
- $node = array(
- 'contextid' => $params['contextid'],
- 'component' => $params['component'],
- 'filearea' => $params['filearea'],
- 'itemid' => $params['itemid'],
- 'filepath' => $params['filepath'],
- 'filename' => $child->get_visible_name(),
- 'url' => null,
- 'isdir' => true
- );
- $list[] = $node;
+ if ((is_null($modified)) or ($modified < $timemodified)) {
+ $node = array(
+ 'contextid' => $params['contextid'],
+ 'component' => $params['component'],
+ 'filearea' => $params['filearea'],
+ 'itemid' => $params['itemid'],
+ 'filepath' => $params['filepath'],
+ 'filename' => $child->get_visible_name(),
+ 'url' => null,
+ 'isdir' => true,
+ 'timemodified' => $timemodified
+ );
+ $list[] = $node;
+ }
} else {
- $node = array(
- 'contextid' => $params['contextid'],
- 'component' => $params['component'],
- 'filearea' => $params['filearea'],
- 'itemid' => $params['itemid'],
- 'filepath' => $params['filepath'],
- 'filename' => $child->get_visible_name(),
- 'url' => $child->get_url(),
- 'isdir' => false
- );
- $list[] = $node;
+ if ((is_null($modified)) or ($modified < $timemodified)) {
+ $node = array(
+ 'contextid' => $params['contextid'],
+ 'component' => $params['component'],
+ 'filearea' => $params['filearea'],
+ 'itemid' => $params['itemid'],
+ 'filepath' => $params['filepath'],
+ 'filename' => $child->get_visible_name(),
+ 'url' => $child->get_url(),
+ 'isdir' => false,
+ 'timemodified' => $timemodified
+ );
+ $list[] = $node;
+ }
}
}
}
'filename' => new external_value(PARAM_FILE, ''),
'isdir' => new external_value(PARAM_BOOL, ''),
'url' => new external_value(PARAM_TEXT, ''),
+ 'timemodified' => new external_value(PARAM_INT, ''),
)
)
)
public static function upload($contextid, $component, $filearea, $itemid, $filepath, $filename, $filecontent) {
global $USER, $CFG;
- $fileinfo = self::validate_parameters(self::upload_parameters(), array('contextid'=>$contextid, 'component'=>$component, 'filearea'=>$filearea, 'itemid'=>$itemid, 'filepath'=>$filepath, 'filename'=>$filename, 'filecontent'=>$filecontent));
+ $fileinfo = self::validate_parameters(self::upload_parameters(), array(
+ 'contextid'=>$contextid, 'component'=>$component, 'filearea'=>$filearea, 'itemid'=>$itemid,
+ 'filepath'=>$filepath, 'filename'=>$filename, 'filecontent'=>$filecontent));
if (!isset($fileinfo['filecontent'])) {
throw new moodle_exception('nofile');
}
- // saving file
+ // Saving file.
$dir = make_temp_directory('wsupload');
if (empty($fileinfo['filename'])) {
$savedfilepath = $dir.$filename;
}
-
file_put_contents($savedfilepath, base64_decode($fileinfo['filecontent']));
unset($fileinfo['filecontent']);
}
if (isset($fileinfo['itemid'])) {
- // TODO MDL-31116 in user private area, itemid is always 0
+ // TODO MDL-31116 in user private area, itemid is always 0.
$itemid = 0;
} else {
throw new coding_exception('itemid cannot be empty');
if (!($fileinfo['component'] == 'user' and $fileinfo['filearea'] == 'private')) {
throw new coding_exception('File can be uploaded to user private area only');
} else {
- // TODO MDL-31116 hard-coded to use user_private area
+ // TODO MDL-31116 hard-coded to use user_private area.
$component = 'user';
$filearea = 'private';
}
$browser = get_file_browser();
- // check existing file
+ // Check existing file.
if ($file = $browser->get_file_info($context, $component, $filearea, $itemid, $filepath, $filename)) {
throw new moodle_exception('fileexist');
}
- // move file to filepool
+ // Move file to filepool.
if ($dir = $browser->get_file_info($context, $component, $filearea, $itemid, $filepath, '.')) {
$info = $dir->create_file_from_pathname($filename, $savedfilepath);
$params = $info->get_params();
* Must have one top element, CSS for this element must define width and height of the window;
*
* content of element with class 'fp-dlg-text' will be replaced with dialog text;
- * elements with classes 'fp-dlg-butoverwrite', 'fp-dlg-butrename' and 'fp-dlg-butcancel' will
+ * elements with classes 'fp-dlg-butoverwrite', 'fp-dlg-butrename',
+ * 'fp-dlg-butoverwriteall', 'fp-dlg-butrenameall' and 'fp-dlg-butcancel' will
* hold onclick events;
*
* content of element with class 'fp-dlg-butrename' will be substituted with appropriate string
return preg_replace('/\{\!\}/', '', $rv);
}
+ /**
+ * FilePicker JS template for popup dialogue window asking for action when file with the same name already exists (multiple-file version).
+ *
+ * Must have one top element, CSS for this element must define width and height of the window;
+ *
+ * content of element with class 'fp-dlg-text' will be replaced with dialog text;
+ * elements with classes 'fp-dlg-butoverwrite', 'fp-dlg-butrename' and 'fp-dlg-butcancel' will
+ * hold onclick events;
+ *
+ * content of element with class 'fp-dlg-butrename' will be substituted with appropriate string
+ * (Note that it may have long text)
+ *
+ * @return string
+ */
+ private function fp_js_template_processexistingfilemultiple() {
+ $rv = '
+<div class="file-picker fp-dlg">
+ <p class="{!}fp-dlg-text"></p>
+ <a class="{!}fp-dlg-butoverwrite fp-panel-button" href="#">'.get_string('overwrite', 'repository').'</a>
+ <a class="{!}fp-dlg-butcancel fp-panel-button" href="#">'.get_string('cancel').'</a>
+ <a class="{!}fp-dlg-butrename fp-panel-button" href="#"></a>
+ <br/>
+ <a class="{!}fp-dlg-butoverwriteall fp-panel-button" href="#">'.get_string('overwriteall', 'repository').'</a>
+ <a class="{!}fp-dlg-butrenameall fp-panel-button" href="#">'.get_string('renameall', 'repository').'</a>
+</div>';
+ return preg_replace('/\{\!\}/', '', $rv);
+ }
+
/**
* FilePicker JS template for repository login form including templates for each element type
*
--- /dev/null
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Filter post install hook
+ *
+ * @package filter_activitynames
+ * @copyright 2012 Petr Skoda {@link http://skodak.org}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+function xmldb_filter_activitynames_install() {
+ global $CFG;
+ require_once("$CFG->libdir/filterlib.php");
+
+ filter_set_global_state('filter/activitynames', TEXTFILTER_ON);
+}
+
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'filter_activitynames'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'filter_algebra'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'filter_censor'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011102800;
-$plugin->requires = 2011102700; // Requires this Moodle version
+$plugin->version = 2012061700;
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component= 'filter_data';
-$plugin->dependencies = array('mod_data' => 2011102800);
+$plugin->dependencies = array('mod_data' => 2012061700);
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'filter_emailprotect'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'filter_emoticon'; // Full name of the plugin (used for diagnostics)
*/
class filter_glossary extends moodle_text_filter {
+ public function setup($page, $context) {
+ // This only requires execution once per request.
+ static $jsinitialised = false;
+ if (empty($jsinitialised)) {
+ $page->requires->yui_module(
+ 'moodle-filter_glossary-autolinker',
+ 'M.filter_glossary.init_filter_autolinking',
+ array(array('courseid' => 0)));
+ $jsinitialised = true;
+ }
+ }
+
public function filter($text, array $options = array()) {
- global $CFG, $DB, $GLOSSARY_EXCLUDECONCEPTS, $PAGE;
+ global $CFG, $DB, $GLOSSARY_EXCLUDECONCEPTS;
// Trivial-cache - keyed on $cachedcontextid
static $cachedcontextid;
static $conceptlist;
- static $jsinitialised; // To control unique js init
static $nothingtodo; // To avoid processing if no glossaries / concepts are found
// Try to get current course
}
$conceptlist = filter_remove_duplicates($conceptlist);
-
- if (empty($jsinitialised)) {
- // Add a JavaScript event to open popup's here. This only ever need to be
- // added once!
- $PAGE->requires->yui_module(
- 'moodle-filter_glossary-autolinker',
- 'M.filter_glossary.init_filter_autolinking',
- array(array('courseid' => $courseid)));
- $jsinitialised = true;
- }
}
if (!empty($GLOSSARY_EXCLUDECONCEPTS)) {
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011102800;
-$plugin->requires = 2011102700; // Requires this Moodle version
+$plugin->version = 2012061700;
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component= 'filter_glossary';
-$plugin->dependencies = array('mod_glossary' => 2011102800);
+$plugin->dependencies = array('mod_glossary' => 2012061700);
POPUPNAME = 'name',
POPUPOPTIONS = 'options',
TITLE = 'title',
- COURSEID = 'courseid',
WIDTH = 'width',
HEIGHT = 'height',
MENUBAR = 'menubar',
status : {value : true},
directories : {value : false},
fullscreen : {value : false},
- dependent : {value : true},
- courseid : {value : 1}
+ dependent : {value : true}
}
});
function xmldb_filter_mediaplugin_install() {
global $CFG;
+ require_once("$CFG->libdir/filterlib.php");
+ filter_set_global_state('filter/mediaplugin', TEXTFILTER_ON);
}
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011121200; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011120500; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'filter_mediaplugin'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'filter_multilang'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'filter_tex'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'filter_tidy'; // Full name of the plugin (used for diagnostics)
This file describes API changes in core filter API and plugins,
information provided here is intended especially for developers.
+=== 2.3 ===
+
+* new setup() method added to moodle_text_filter, invoked before
+ filtering happens, used to add all the requirements to the page
+ (js, css...) and/or other init tasks. See filter/glossary for
+ an example using the API (and MDL-32279 for its justification).
+
=== 2.2 ===
* legacy filters and legacy locations have been deprecated, so any
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011112900; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'filter_urltolink'; // Full name of the plugin (used for diagnostics)