Merge branch 'master' of https://github.com/moodle/moodle
This commit is contained in:
@@ -242,6 +242,7 @@ function get_table_row($filterinfo, $isfirstrow, $islastactive, $applytostrings)
|
||||
|
||||
// Disable/off/on
|
||||
$select = new single_select(filters_action_url($filter, 'setstate'), 'newstate', $activechoices, $filterinfo->active, null, 'active' . basename($filter));
|
||||
$select->set_label(get_string('isactive', 'filters'), array('class' => 'accesshide'));
|
||||
$row[] = $OUTPUT->render($select);
|
||||
|
||||
// Re-order
|
||||
@@ -263,6 +264,7 @@ function get_table_row($filterinfo, $isfirstrow, $islastactive, $applytostrings)
|
||||
|
||||
// Apply to strings.
|
||||
$select = new single_select(filters_action_url($filter, 'setapplyto'), 'stringstoo', $applytochoices, $applytostrings, null, 'applyto' . basename($filter));
|
||||
$select->set_label(get_string('applyto', 'filters'), array('class' => 'accesshide'));
|
||||
$select->disabled = $filterinfo->active == TEXTFILTER_DISABLED;
|
||||
$row[] = $OUTPUT->render($select);
|
||||
|
||||
|
||||
@@ -203,17 +203,18 @@ echo get_string('username') . ":\n";
|
||||
if (!empty($formerror['username'])) {
|
||||
echo '<span class="error"> * </span>';
|
||||
}
|
||||
echo '<input type="text" name="username" size="20" maxlength="100" />';
|
||||
echo html_writer::label(get_string('username'), 'menuusername', false, array('class' => 'accesshide'));
|
||||
echo '<input id="menuusername" type="text" name="username" size="20" maxlength="100" />';
|
||||
|
||||
// choose a remote host
|
||||
echo " " . get_string('remotehost', 'mnet') . ":\n";
|
||||
echo " " . html_writer::label(get_string('remotehost', 'mnet'), 'menumnet_host_id') . ":\n";
|
||||
if (!empty($formerror['mnet_host_id'])) {
|
||||
echo '<span class="error"> * </span>';
|
||||
}
|
||||
echo html_writer::select($mnethosts, 'mnet_host_id');
|
||||
|
||||
// choose an access level
|
||||
echo " " . get_string('accesslevel', 'mnet') . ":\n";
|
||||
echo " " . html_writer::label(get_string('accesslevel', 'mnet'), 'menuaccessctrl') . ":\n";
|
||||
if (!empty($formerror['accessctrl'])) {
|
||||
echo '<span class="error"> * </span>';
|
||||
}
|
||||
|
||||
@@ -197,6 +197,7 @@ if (($action == 'edit') || ($action == 'new')) {
|
||||
$currentaction = 'hide';
|
||||
}
|
||||
$select = new single_select(portfolio_action_url($pluginid, 'pf'), 'action', $actionchoicesforexisting, $currentaction, null, 'applyto' . $pluginid);
|
||||
$select->set_label(get_string('action'), array('class' => 'accesshide'));
|
||||
$table->data[] = array($pluginname, $OUTPUT->render($select), $settings);
|
||||
}
|
||||
if (!in_array($plugin, $usedplugins)) {
|
||||
@@ -218,6 +219,7 @@ if (($action == 'edit') || ($action == 'new')) {
|
||||
$insaneplugins[] = $p;
|
||||
} else {
|
||||
$select = new single_select(portfolio_action_url($p, 'pf'), 'action', $actionchoicesfornew, 'delete', null, 'applyto' . $p);
|
||||
$select->set_label(get_string('action'), array('class' => 'accesshide'));
|
||||
$table->data[] = array(portfolio_static_function($p, 'get_name'), $OUTPUT->render($select), '');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -352,7 +352,7 @@ if (($action == 'edit') || ($action == 'new')) {
|
||||
}
|
||||
|
||||
$select = new single_select(repository_action_url($typename, 'repos'), 'action', $actionchoicesforexisting, $currentaction, null, 'applyto' . basename($typename));
|
||||
|
||||
$select->set_label(get_string('action'), array('class' => 'accesshide'));
|
||||
// Display up/down link
|
||||
$updown = '';
|
||||
$spacer = $OUTPUT->spacer(array('height'=>15, 'width'=>15)); // should be done with CSS instead
|
||||
@@ -389,6 +389,7 @@ if (($action == 'edit') || ($action == 'new')) {
|
||||
// Check that it has not already been listed
|
||||
if (!in_array($plugin, $alreadyplugins)) {
|
||||
$select = new single_select(repository_action_url($plugin, 'repos'), 'action', $actionchoicesfornew, 'delete', null, 'applyto' . basename($plugin));
|
||||
$select->set_label(get_string('action'), array('class' => 'accesshide'));
|
||||
$table->data[] = array(get_string('pluginname', 'repository_'.$plugin), $OUTPUT->render($select), '', '');
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@
|
||||
$timezones = get_list_of_timezones();
|
||||
|
||||
echo '<center><form action="timezone.php" method="post">';
|
||||
echo "$strusers ($strall): ";
|
||||
echo html_writer::label($strusers . ' (' . $strall . '): ', 'menuzone');
|
||||
echo html_writer::select($timezones, "zone", $current, array('99'=>get_string("serverlocaltime")));
|
||||
echo "<input type=\"hidden\" name=\"sesskey\" value=\"".sesskey()."\" />";
|
||||
echo '<input type="submit" value="'.s($strsavechanges).'" />';
|
||||
|
||||
@@ -287,7 +287,7 @@ $url = new moodle_url('/admin/tool/langimport/index.php', array('mode' => DELETI
|
||||
echo html_writer::start_tag('td', array('valign' => 'top'));
|
||||
echo html_writer::start_tag('form', array('id' => 'uninstallform', 'action' => $url->out(), 'method' => 'post'));
|
||||
echo html_writer::start_tag('fieldset');
|
||||
echo html_writer::label(get_string('installedlangs', 'tool_langimport'), 'uninstalllang');
|
||||
echo html_writer::label(get_string('installedlangs', 'tool_langimport'), 'menuuninstalllang');
|
||||
echo html_writer::empty_tag('br');
|
||||
echo html_writer::select($installedlangs, 'uninstalllang', '', false, array('size' => 15));
|
||||
echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()));
|
||||
@@ -315,7 +315,7 @@ if (!empty($options)) {
|
||||
$url = new moodle_url('/admin/tool/langimport/index.php', array('mode' => INSTALLATION_OF_SELECTED_LANG));
|
||||
echo html_writer::start_tag('form', array('id' => 'installform', 'action' => $url->out(), 'method' => 'post'));
|
||||
echo html_writer::start_tag('fieldset');
|
||||
echo html_writer::label(get_string('availablelangs','install'), 'pack');
|
||||
echo html_writer::label(get_string('availablelangs','install'), 'menupack');
|
||||
echo html_writer::empty_tag('br');
|
||||
echo html_writer::select($options, 'pack[]', '', false, array('size' => 15, 'multiple' => 'multiple'));
|
||||
echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()));
|
||||
|
||||
@@ -96,6 +96,7 @@ echo $OUTPUT->box_start(); // The forms section at the top
|
||||
|
||||
<form method="post" action="index.php">
|
||||
<div>
|
||||
<label class="accesshide" for="keyword_el"><?php print_string('spamkeyword', 'tool_spamcleaner') ?></label>
|
||||
<input type="text" name="keyword" id="keyword_el" value="<?php p($keyword) ?>" />
|
||||
<input type="hidden" name="sesskey" value="<?php echo sesskey();?>" />
|
||||
<input type="submit" value="<?php echo get_string('spamsearch', 'tool_spamcleaner')?>" />
|
||||
|
||||
@@ -38,6 +38,7 @@ $string['spamfromcomments'] = 'From comments:';
|
||||
$string['spamfrommessages'] = 'From messages:';
|
||||
$string['spamfromforumpost'] = 'From forum post:';
|
||||
$string['spaminvalidresult'] = 'Unknown but invalid result';
|
||||
$string['spamkeyword'] = 'Keyword';
|
||||
$string['spamoperation'] = 'Operation';
|
||||
$string['spamresult'] = 'Results of searching user profiles containing:';
|
||||
$string['spamsearch'] = 'Search for these keywords';
|
||||
|
||||
@@ -113,7 +113,7 @@ class new_table_from_mysql extends XMLDBAction {
|
||||
$o.= ' <input type="hidden" name ="postaction" value="edit_table" />';
|
||||
$o.= ' <input type="hidden" name ="sesskey" value="' . sesskey() . '" />';
|
||||
$o.= ' <table id="formelements" class="boxaligncenter" cellpadding="5">';
|
||||
$o.= ' <tr><td><label for="table" accesskey="t">' . $this->str['createtable'] .' </label>' . html_writer::select($selecttables, 'table') . '<label for="after" accesskey="a">' . $this->str['aftertable'] . ' </label>' .html_writer::select($aftertables, 'after') . '</td></tr>';
|
||||
$o.= ' <tr><td><label for="menutable" accesskey="t">' . $this->str['createtable'] .' </label>' . html_writer::select($selecttables, 'table') . '<label for="menuafter" accesskey="a">' . $this->str['aftertable'] . ' </label>' .html_writer::select($aftertables, 'after') . '</td></tr>';
|
||||
$o.= ' <tr><td colspan="2" align="center"><input type="submit" value="' .$this->str['create'] . '" /></td></tr>';
|
||||
$o.= ' <tr><td colspan="2" align="center"><a href="index.php?action=edit_xml_file&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['back'] . ']</a></td></tr>';
|
||||
$o.= ' </table>';
|
||||
|
||||
@@ -114,7 +114,7 @@ class view_structure_php extends XMLDBAction {
|
||||
$o.= ' <input type="hidden" name ="dir" value="' . str_replace($CFG->dirroot, '', $dirpath) . '" />';
|
||||
$o.= ' <input type="hidden" name ="action" value="view_structure_php" />';
|
||||
$o.= ' <table id="formelements" class="boxaligncenter" cellpadding="5">';
|
||||
$o.= ' <tr><td><label for="action" accesskey="c">' . $this->str['selectaction'] .' </label>' . html_writer::select($popcommands, 'command', $commandparam, false) . ' <label for="table" accesskey="t">' . $this->str['selecttable'] . ' </label>' .html_writer::select($poptables, 'table', $tableparam, false) . '</td></tr>';
|
||||
$o.= ' <tr><td><label for="menucommand" accesskey="c">' . $this->str['selectaction'] .' </label>' . html_writer::select($popcommands, 'command', $commandparam, false) . ' <label for="menutable" accesskey="t">' . $this->str['selecttable'] . ' </label>' .html_writer::select($poptables, 'table', $tableparam, false) . '</td></tr>';
|
||||
$o.= ' <tr><td colspan="2" align="center"><input type="submit" value="' .$this->str['view'] . '" /></td></tr>';
|
||||
$o.= ' </table>';
|
||||
$o.= '</div></form>';
|
||||
|
||||
@@ -163,7 +163,7 @@ class view_table_php extends XMLDBAction {
|
||||
$o.= ' <input type="hidden" name ="table" value="' . s($tableparam) . '" />';
|
||||
$o.= ' <input type="hidden" name ="action" value="view_table_php" />';
|
||||
$o.= ' <table id="formelements" class="boxaligncenter" cellpadding="5">';
|
||||
$o.= ' <tr><td><label for="action" accesskey="c">' . $this->str['selectaction'] .' </label>' . html_writer::select($popcommands, 'command', $commandparam, false) . ' <label for="fieldkeyindex" accesskey="f">' . $this->str['selectfieldkeyindex'] . ' </label>' .html_writer::select($popfields, 'fieldkeyindex', $origfieldkeyindexparam, false) . '</td></tr>';
|
||||
$o.= ' <tr><td><label for="menucommand" accesskey="c">' . $this->str['selectaction'] .' </label>' . html_writer::select($popcommands, 'command', $commandparam, false) . ' <label for="menufieldkeyindex" accesskey="f">' . $this->str['selectfieldkeyindex'] . ' </label>' .html_writer::select($popfields, 'fieldkeyindex', $origfieldkeyindexparam, false) . '</td></tr>';
|
||||
$o.= ' <tr><td colspan="2" align="center"><input type="submit" value="' .$this->str['view'] . '" /></td></tr>';
|
||||
$o.= ' </table>';
|
||||
$o.= '</div></form>';
|
||||
|
||||
+14
-14
@@ -94,9 +94,9 @@ $yesno = array( get_string('no'), get_string('yes') );
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('auth_cas_hostname_key', 'auth_cas') ?>:</td>
|
||||
<td align="right"><label for="hostname"><?php print_string('auth_cas_hostname_key', 'auth_cas') ?>: </label></td>
|
||||
<td>
|
||||
<input name="hostname" type="text" size="30" value="<?php echo $config->hostname ?>" />
|
||||
<input name="hostname" id="hostname" type="text" size="30" value="<?php echo $config->hostname ?>" />
|
||||
<?php if (isset($err['hostname'])) { echo $OUTPUT->error_text($err['hostname']); } ?>
|
||||
</td>
|
||||
<td>
|
||||
@@ -105,10 +105,10 @@ $yesno = array( get_string('no'), get_string('yes') );
|
||||
</tr>
|
||||
<tr valign="top" class="required">
|
||||
<td align="right">
|
||||
<?php print_string('auth_cas_baseuri_key', 'auth_cas') ?>:
|
||||
<label for="baseuri"><?php print_string('auth_cas_baseuri_key', 'auth_cas') ?>: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input name="baseuri" type="text" size="30" value="<?php echo $config->baseuri ?>" />
|
||||
<input name="baseuri" id="baseuri" type="text" size="30" value="<?php echo $config->baseuri ?>" />
|
||||
<?php if (isset($err['baseuri'])) { echo $OUTPUT->error_text($err['baseuri']); } ?>
|
||||
</td>
|
||||
<td>
|
||||
@@ -117,10 +117,10 @@ $yesno = array( get_string('no'), get_string('yes') );
|
||||
</tr>
|
||||
<tr valign="top" class="required">
|
||||
<td align="right">
|
||||
<?php print_string('auth_cas_port_key', 'auth_cas') ?>:
|
||||
<label for="port"><?php print_string('auth_cas_port_key', 'auth_cas') ?>: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input name="port" type="text" size="30" value="<?php echo $config->port ?>" />
|
||||
<input name="port" id="port" type="text" size="30" value="<?php echo $config->port ?>" />
|
||||
<?php if (isset($err['port'])) { echo $OUTPUT->error_text($err['port']); } ?>
|
||||
</td>
|
||||
<td>
|
||||
@@ -129,7 +129,7 @@ $yesno = array( get_string('no'), get_string('yes') );
|
||||
</tr>
|
||||
<tr valign="top" class="required">
|
||||
<td align="right">
|
||||
<?php print_string('auth_cas_casversion', 'auth_cas') ?>:
|
||||
<?php echo html_writer::label(get_string('auth_cas_casversion', 'auth_cas'), 'menucasversion'); ?>:
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
@@ -145,7 +145,7 @@ $yesno = array( get_string('no'), get_string('yes') );
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('auth_cas_language_key', 'auth_cas') ?>:</td>
|
||||
<td align="right"><?php echo html_writer::label(get_string('auth_cas_language_key', 'auth_cas'), 'menulanguage'); ?>:</td>
|
||||
<td>
|
||||
<?php echo html_writer::select($CASLANGUAGES, 'language', $config->language, false); ?>
|
||||
</td>
|
||||
@@ -155,7 +155,7 @@ $yesno = array( get_string('no'), get_string('yes') );
|
||||
</tr>
|
||||
<tr valign="top" class="required">
|
||||
<td align="right">
|
||||
<?php print_string('auth_cas_proxycas_key', 'auth_cas') ?>:
|
||||
<?php echo html_writer::label(get_string('auth_cas_proxycas_key', 'auth_cas'), 'menuproxycas'); ?>:
|
||||
</td>
|
||||
<td>
|
||||
<?php echo html_writer::select($yesno, 'proxycas', $config->proxycas, false); ?>
|
||||
@@ -165,7 +165,7 @@ $yesno = array( get_string('no'), get_string('yes') );
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('auth_cas_logoutcas_key', 'auth_cas') ?>:</td>
|
||||
<td align="right"><?php echo html_writer::label(get_string('auth_cas_logoutcas_key', 'auth_cas'), 'menulogoutcas'); ?>:</td>
|
||||
<td>
|
||||
<?php echo html_writer::select($yesno, 'logoutcas', $config->logoutcas, false); ?>
|
||||
</td>
|
||||
@@ -174,7 +174,7 @@ $yesno = array( get_string('no'), get_string('yes') );
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('auth_cas_multiauth_key', 'auth_cas') ?>:</td>
|
||||
<td align="right"><?php echo html_writer::label(get_string('auth_cas_multiauth_key', 'auth_cas'), 'menumultiauth'); ?>:</td>
|
||||
<td>
|
||||
<?php echo html_writer::select($yesno, 'multiauth', $config->multiauth, false); ?>
|
||||
</td>
|
||||
@@ -183,7 +183,7 @@ $yesno = array( get_string('no'), get_string('yes') );
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('auth_cas_certificate_check_key', 'auth_cas') ?>:</td>
|
||||
<td align="right"><?php echo html_writer::label(get_string('auth_cas_certificate_check_key', 'auth_cas'), 'menucertificate_check'); ?>:</td>
|
||||
<td>
|
||||
<?php echo html_writer::select($yesno, 'certificate_check', $config->certificate_check, false); ?>
|
||||
</td>
|
||||
@@ -192,7 +192,7 @@ $yesno = array( get_string('no'), get_string('yes') );
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('auth_cas_certificate_path_key', 'auth_cas') ?>:</td>
|
||||
<td align="right"><label for="certificate_path"><?php print_string('auth_cas_certificate_path_key', 'auth_cas') ?>: </label></td>
|
||||
<td>
|
||||
<input name="certificate_path" id="certificate_path" type="text" size="30" value="<?php echo $config->certificate_path ?>" />
|
||||
<?php if (isset($err['certificate_path'])) echo $OUTPUT->error_text($err['certificate_path']); ?>
|
||||
@@ -219,7 +219,7 @@ $yesno = array( get_string('no'), get_string('yes') );
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><label for="menuversion"><?php print_string('auth_ldap_version_key', 'auth_ldap') ?></label></td>
|
||||
<td align="right"><label for="menuldap_version"><?php print_string('auth_ldap_version_key', 'auth_ldap') ?></label></td>
|
||||
<td>
|
||||
<?php
|
||||
$versions = array();
|
||||
|
||||
+12
-12
@@ -27,9 +27,9 @@
|
||||
<table cellspacing="0" cellpadding="5" border="0">
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string("auth_fchost_key", "auth_fc") ?>:</td>
|
||||
<td align="right"><label for="host"><?php print_string("auth_fchost_key", "auth_fc") ?>:</label></td>
|
||||
<td>
|
||||
<input name="host" type="text" size="30" value="<?php echo $config->host?>" />
|
||||
<input name="host" id="host" type="text" size="30" value="<?php echo $config->host?>" />
|
||||
<?php if (isset($err["host"])) echo $OUTPUT->error_text($err["host"]); ?>
|
||||
</td>
|
||||
<td>
|
||||
@@ -38,9 +38,9 @@
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string("auth_fcfppport_key", "auth_fc") ?>:</td>
|
||||
<td align="right"><label for="fppport"><?php print_string("auth_fcfppport_key", "auth_fc") ?>: </label></td>
|
||||
<td>
|
||||
<input name="fppport" type="text" size="30" value="<?php echo $config->fppport?>" />
|
||||
<input name="fppport" id="fppport" type="text" size="30" value="<?php echo $config->fppport?>" />
|
||||
<?php if (isset($err["fppport"])) echo $OUTPUT->error_text($err["host"]); ?>
|
||||
</td>
|
||||
<td>
|
||||
@@ -49,9 +49,9 @@
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string("auth_fcuserid_key", "auth_fc") ?>:</td>
|
||||
<td align="right"><label for="userid"><?php print_string("auth_fcuserid_key", "auth_fc") ?>:</label></td>
|
||||
<td>
|
||||
<input name="userid" type="text" size="30" maxlength="15" value="<?php echo $config->userid?>" />
|
||||
<input name="userid" id="userid" type="text" size="30" maxlength="15" value="<?php echo $config->userid?>" />
|
||||
<?php if (isset($err["userid"])) echo $OUTPUT->error_text($err["userid"]); ?>
|
||||
</td>
|
||||
<td>
|
||||
@@ -59,9 +59,9 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string("auth_fcpasswd_key", "auth_fc") ?>:</td>
|
||||
<td align="right"><label for="passwd"><?php print_string("auth_fcpasswd_key", "auth_fc") ?>:</label></td>
|
||||
<td>
|
||||
<input name="passwd" type="password" size="30" maxlength="12" value="<?php echo $config->passwd?>" />
|
||||
<input name="passwd" id="passwd" type="password" size="30" maxlength="12" value="<?php echo $config->passwd?>" />
|
||||
<?php if (isset($err["passwd"])) echo $OUTPUT->error_text($err["passwd"]); ?>
|
||||
</td>
|
||||
<td>
|
||||
@@ -70,9 +70,9 @@
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string("auth_fccreators_key", "auth_fc") ?>:</td>
|
||||
<td align="right"><label for="creators"><?php print_string("auth_fccreators_key", "auth_fc") ?>: </label></td>
|
||||
<td>
|
||||
<input name="creators" type="text" size="30" value="<?php echo $config->creators?>" />
|
||||
<input name="creators" id="creators" type="text" size="30" value="<?php echo $config->creators?>" />
|
||||
<?php if (isset($err["creators"])) echo $OUTPUT->error_text($err["creators"]); ?>
|
||||
</td>
|
||||
<td>
|
||||
@@ -81,9 +81,9 @@
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string('auth_fcchangepasswordurl', 'auth_fc') ?>: </td>
|
||||
<td align="right"><label for="changepasswordurl"><?php print_string('auth_fcchangepasswordurl', 'auth_fc') ?>: </label></td>
|
||||
<td>
|
||||
<input name="changepasswordurl" type="text" value="<?php echo $config->changepasswordurl ?>" />
|
||||
<input name="changepasswordurl" id="changepasswordurl" type="text" value="<?php echo $config->changepasswordurl ?>" />
|
||||
<?php
|
||||
|
||||
if (isset($err['changepasswordurl'])) {
|
||||
|
||||
@@ -18,9 +18,9 @@ if (!isset($config->changepasswordurl)) {
|
||||
<table cellspacing="0" cellpadding="5" border="0">
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('auth_imaphost_key', 'auth_imap') ?>: </td>
|
||||
<td align="right"><label for="host"><?php print_string('auth_imaphost_key', 'auth_imap') ?>: </label></td>
|
||||
<td>
|
||||
<input name="host" type="text" size="30" value="<?php echo $config->host ?>" />
|
||||
<input name="host" id="host" type="text" size="30" value="<?php echo $config->host ?>" />
|
||||
<?php
|
||||
|
||||
if (isset($err['host'])) {
|
||||
@@ -40,7 +40,7 @@ if (!isset($config->changepasswordurl)) {
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('auth_imaptype_key', 'auth_imap') ?>: </td>
|
||||
<td align="right"><?php echo html_writer::label(get_string('auth_imaptype_key', 'auth_imap'), 'menutype'); ?>: </td>
|
||||
<td>
|
||||
<?php
|
||||
|
||||
@@ -56,9 +56,9 @@ if (!isset($config->changepasswordurl)) {
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('auth_imapport_key', 'auth_imap') ?>: </td>
|
||||
<td align="right"><label for="port"><?php print_string('auth_imapport_key', 'auth_imap') ?>: </label></td>
|
||||
<td>
|
||||
<input name="port" type="text" size="6" value="<?php echo $config->port ?>" />
|
||||
<input name="port" id="port" type="text" size="6" value="<?php echo $config->port ?>" />
|
||||
<?php
|
||||
|
||||
if (isset($err['port'])) {
|
||||
@@ -71,9 +71,9 @@ if (!isset($config->changepasswordurl)) {
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string('auth_imapchangepasswordurl_key', 'auth_imap') ?>: </td>
|
||||
<td align="right"><label for="changepasswordurl"><?php print_string('auth_imapchangepasswordurl_key', 'auth_imap') ?>: </label></td>
|
||||
<td>
|
||||
<input name="changepasswordurl" type="text" value="<?php echo $config->changepasswordurl ?>" />
|
||||
<input name="changepasswordurl" id="changepasswordurl" type="text" value="<?php echo $config->changepasswordurl ?>" />
|
||||
<?php
|
||||
|
||||
if (isset($err['changepasswordurl'])) {
|
||||
|
||||
@@ -118,7 +118,7 @@ $yesno = array(get_string('no'), get_string('yes'));
|
||||
</tr>
|
||||
<tr valign="top" class="required">
|
||||
<td align="right">
|
||||
<label for="menuversion"><?php print_string('auth_ldap_version_key', 'auth_ldap') ?></label>
|
||||
<label for="menuldap_version"><?php print_string('auth_ldap_version_key', 'auth_ldap') ?></label>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
|
||||
@@ -22,9 +22,9 @@ if (empty($CFG->mnet_dispatcher_mode) || $CFG->mnet_dispatcher_mode !== 'strict'
|
||||
<table cellspacing="0" cellpadding="5">
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('rpc_negotiation_timeout', 'auth_mnet'); ?>: </td>
|
||||
<td align="right"><label for="rpc_negotiation_timeout"><?php print_string('rpc_negotiation_timeout', 'auth_mnet'); ?>: </label></td>
|
||||
<td>
|
||||
<input name="rpc_negotiation_timeout" type="text" size="5" value="<?php echo $config->rpc_negotiation_timeout ?>" />
|
||||
<input name="rpc_negotiation_timeout" id="rpc_negotiation_timeout" type="text" size="5" value="<?php echo $config->rpc_negotiation_timeout ?>" />
|
||||
<?php
|
||||
|
||||
if (isset($err['rpc_negotiation_timeout'])) {
|
||||
@@ -45,7 +45,7 @@ if (empty($CFG->mnet_dispatcher_mode) || $CFG->mnet_dispatcher_mode !== 'strict'
|
||||
<?php /*
|
||||
See MDL-21327 for why this is commented out
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('auto_add_remote_users', 'auth_mnet'); ?>: </td>
|
||||
<td align="right"><?php echo html_writer::label(get_string('auto_add_remote_users', 'auth_mnet'), 'menuauto_add_remote_users'); ?>: </td>
|
||||
<td>
|
||||
<?php
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@ if (!isset($config->changepasswordurl)) {
|
||||
<table cellspacing="0" cellpadding="5" border="0">
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('auth_nntphost_key', 'auth_nntp') ?>: </td>
|
||||
<td align="right"><label for="host"><?php print_string('auth_nntphost_key', 'auth_nntp') ?>: </label></td>
|
||||
<td>
|
||||
<input name="host" type="text" size="30" value="<?php echo $config->host ?>" />
|
||||
<input name="host" id="host" type="text" size="30" value="<?php echo $config->host ?>" />
|
||||
<?php
|
||||
|
||||
if (isset($err["host"])) {
|
||||
@@ -37,9 +37,9 @@ if (!isset($config->changepasswordurl)) {
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('auth_nntpport_key', 'auth_nntp') ?>: </td>
|
||||
<td align="right"><label for="port"><?php print_string('auth_nntpport_key', 'auth_nntp') ?>: </label></td>
|
||||
<td>
|
||||
<input name="port" type="text" size="6" value="<?php echo $config->port ?>" />
|
||||
<input name="port" id="port" type="text" size="6" value="<?php echo $config->port ?>" />
|
||||
<?php
|
||||
|
||||
if (isset($err["port"])) {
|
||||
@@ -52,9 +52,9 @@ if (!isset($config->changepasswordurl)) {
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string('auth_nntpchangepasswordurl_key', 'auth_nntp') ?>: </td>
|
||||
<td align="right"><label for="changepasswordurl"><?php print_string('auth_nntpchangepasswordurl_key', 'auth_nntp') ?>: </label></td>
|
||||
<td>
|
||||
<input name="changepasswordurl" type="text" value="<?php echo $config->changepasswordurl ?>" />
|
||||
<input name="changepasswordurl" id="changepasswordurl" type="text" value="<?php echo $config->changepasswordurl ?>" />
|
||||
<?php
|
||||
|
||||
if (isset($err['changepasswordurl'])) {
|
||||
|
||||
@@ -21,9 +21,9 @@ if (!isset($config->changepasswordurl)) {
|
||||
<table cellspacing="0" cellpadding="5" border="0">
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('auth_pop3host_key', 'auth_pop3') ?>: </td>
|
||||
<td align="right"><label for="host"><?php print_string('auth_pop3host_key', 'auth_pop3') ?>: </label></td>
|
||||
<td>
|
||||
<input name="host" type="text" size="30" value="<?php echo $config->host ?>" />
|
||||
<input name="host" id="host" type="text" size="30" value="<?php echo $config->host ?>" />
|
||||
<?php
|
||||
|
||||
if (isset($err['host'])) {
|
||||
@@ -43,7 +43,7 @@ if (!isset($config->changepasswordurl)) {
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('auth_pop3type_key', 'auth_pop3') ?>: </td>
|
||||
<td align="right"><?php echo html_writer::label(get_string('auth_pop3type_key', 'auth_pop3'), 'menutype'); ?>: </td>
|
||||
<td>
|
||||
<?php
|
||||
|
||||
@@ -59,9 +59,9 @@ if (!isset($config->changepasswordurl)) {
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('auth_pop3port_key', 'auth_pop3') ?>: </td>
|
||||
<td align="right"><label for="port"><?php print_string('auth_pop3port_key', 'auth_pop3') ?>: </label></td>
|
||||
<td>
|
||||
<input name="port" type="text" size="6" value="<?php echo $config->port ?>" />
|
||||
<input name="port" id="port" type="text" size="6" value="<?php echo $config->port ?>" />
|
||||
<?php
|
||||
|
||||
if (isset($err['port'])) {
|
||||
@@ -74,9 +74,9 @@ if (!isset($config->changepasswordurl)) {
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('auth_pop3mailbox_key', 'auth_pop3') ?>: </td>
|
||||
<td align="right"><label for="mailbox"><?php print_string('auth_pop3mailbox_key', 'auth_pop3') ?>: </label></td>
|
||||
<td>
|
||||
<input name="mailbox" type="text" size="6" value="<?php echo $config->mailbox ?>" />
|
||||
<input name="mailbox" id="mailbox" type="text" size="6" value="<?php echo $config->mailbox ?>" />
|
||||
<?php
|
||||
|
||||
if (isset($err['mailbox'])) {
|
||||
@@ -89,9 +89,9 @@ if (!isset($config->changepasswordurl)) {
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string('auth_pop3changepasswordurl_key', 'auth_pop3') ?>: </td>
|
||||
<td align="right"><label for="changepasswordurl"><?php print_string('auth_pop3changepasswordurl_key', 'auth_pop3') ?>: </label></td>
|
||||
<td>
|
||||
<input name="changepasswordurl" type="text" value="<?php echo $config->changepasswordurl ?>" />
|
||||
<input name="changepasswordurl" id="changepasswordurl" type="text" value="<?php echo $config->changepasswordurl ?>" />
|
||||
<?php
|
||||
|
||||
if (isset($err['changepasswordurl'])) {
|
||||
|
||||
@@ -30,9 +30,9 @@ if (!isset($config->changepasswordurl)) {
|
||||
<table cellspacing="0" cellpadding="5" border="0">
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string('auth_radiushost_key', 'auth_radius') ?>: </td>
|
||||
<td align="right"><label for="host"><?php print_string('auth_radiushost_key', 'auth_radius') ?>: </label></td>
|
||||
<td>
|
||||
<input name="host" type="text" size="30" value="<?php echo $config->host ?>" />
|
||||
<input name="host" id="host" type="text" size="30" value="<?php echo $config->host ?>" />
|
||||
<?php
|
||||
|
||||
if (isset($err['host'])) {
|
||||
@@ -45,9 +45,9 @@ if (!isset($config->changepasswordurl)) {
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string('auth_radiusnasport_key', 'auth_radius') ?>: </td>
|
||||
<td align="right"><label for="nasport"><?php print_string('auth_radiusnasport_key', 'auth_radius') ?>: </label></td>
|
||||
<td>
|
||||
<input name="nasport" type="text" size="6" value="<?php echo $config->nasport ?>" />
|
||||
<input name="nasport" id="nasport" type="text" size="6" value="<?php echo $config->nasport ?>" />
|
||||
<?php
|
||||
|
||||
if (isset($err['nasport'])) {
|
||||
@@ -60,7 +60,7 @@ if (!isset($config->changepasswordurl)) {
|
||||
</tr>
|
||||
|
||||
<tr valign="top" >
|
||||
<td align="right"><?php print_string('auth_radiustype_key', 'auth_radius') ?>: </td>
|
||||
<td align="right"><?php echo html_writer::label(get_string('auth_radiustype_key', 'auth_radius'), 'menuradiustype'); ?>: </td>
|
||||
<td>
|
||||
<?php
|
||||
|
||||
@@ -82,9 +82,9 @@ if (!isset($config->changepasswordurl)) {
|
||||
|
||||
|
||||
<tr valign="top" >
|
||||
<td align="right"><?php print_string('auth_radiussecret_key', 'auth_radius') ?>: </td>
|
||||
<td align="right"><label for="secret"><?php print_string('auth_radiussecret_key', 'auth_radius') ?>: </label></td>
|
||||
<td>
|
||||
<input name="secret" type="text" size="6" value="<?php echo $config->secret ?>" />
|
||||
<input name="secret" id="secret" type="text" size="6" value="<?php echo $config->secret ?>" />
|
||||
<?php
|
||||
|
||||
if (isset($err['secret'])) {
|
||||
@@ -97,9 +97,9 @@ if (!isset($config->changepasswordurl)) {
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string('auth_radiuschangepasswordurl_key', 'auth_radius') ?>: </td>
|
||||
<td align="right"><label for="changepasswordurl"><?php print_string('auth_radiuschangepasswordurl_key', 'auth_radius') ?>: </label></td>
|
||||
<td>
|
||||
<input name="changepasswordurl" type="text" value="<?php echo $config->changepasswordurl ?>" />
|
||||
<input name="changepasswordurl" id="changepasswordurl" type="text" value="<?php echo $config->changepasswordurl ?>" />
|
||||
<?php
|
||||
|
||||
if (isset($err['changepasswordurl'])) {
|
||||
|
||||
+12
-12
@@ -20,17 +20,17 @@
|
||||
<table cellspacing="0" cellpadding="5" border="0">
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string("username") ?>:</td>
|
||||
<td align="right"><label for="user_attribute"><?php print_string("username") ?>: </label></td>
|
||||
<td>
|
||||
<input name="user_attribute" type="text" size="30" value="<?php echo $config->user_attribute ?>" />
|
||||
<input id="user_attribute" name="user_attribute" type="text" size="30" value="<?php echo $config->user_attribute ?>" />
|
||||
</td>
|
||||
<td><?php print_string("auth_shib_username_description", "auth_shibboleth") ?></td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string("auth_shib_convert_data", "auth_shibboleth") ?>:</td>
|
||||
<td align="right"><label for="convert_data"><?php print_string("auth_shib_convert_data", "auth_shibboleth") ?>: </label></td>
|
||||
<td>
|
||||
<input name="convert_data" type="text" size="30" value="<?php echo $config->convert_data?>" />
|
||||
<input name="convert_data" id="convert_data" type="text" size="30" value="<?php echo $config->convert_data?>" />
|
||||
<?php
|
||||
|
||||
if ($config->convert_data and $config->convert_data != '' and !is_readable($config->convert_data)) {
|
||||
@@ -82,9 +82,9 @@ urn:mace:organization2:providerID, Example Organization 2, /Shibboleth.sso/WAYF/
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string("auth_shib_logout_url", "auth_shibboleth") ?>:</td>
|
||||
<td align="right"><label for="logout_handler"><?php print_string("auth_shib_logout_url", "auth_shibboleth") ?>: </label></td>
|
||||
<td>
|
||||
<input name="logout_handler" type="text" size="30" value="<?php
|
||||
<input name="logout_handler" id="logout_handler" type="text" size="30" value="<?php
|
||||
if ( isset($config->logout_handler) and !empty($config->logout_handler)){
|
||||
echo $config->logout_handler;
|
||||
}
|
||||
@@ -94,9 +94,9 @@ urn:mace:organization2:providerID, Example Organization 2, /Shibboleth.sso/WAYF/
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string("auth_shib_logout_return_url", "auth_shibboleth") ?>:</td>
|
||||
<td align="right"><label for="logout_return_url"><?php print_string("auth_shib_logout_return_url", "auth_shibboleth") ?>: </label></td>
|
||||
<td>
|
||||
<input name="logout_return_url" type="text" size="30" value="<?php
|
||||
<input name="logout_return_url" id="logout_return_url" type="text" size="30" value="<?php
|
||||
if ( isset($config->logout_return_url) and !empty($config->logout_return_url)){
|
||||
echo $config->logout_return_url;
|
||||
}
|
||||
@@ -106,9 +106,9 @@ urn:mace:organization2:providerID, Example Organization 2, /Shibboleth.sso/WAYF/
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string("auth_shib_auth_method", "auth_shibboleth") ?>:</td>
|
||||
<td align="right"><label for="login_name"><?php print_string("auth_shib_auth_method", "auth_shibboleth") ?>: </label></td>
|
||||
<td>
|
||||
<input name="login_name" type="text" size="30" value="<?php
|
||||
<input name="login_name" id="login_name" type="text" size="30" value="<?php
|
||||
if ( isset($config->login_name) and !empty($config->login_name)){
|
||||
echo htmlentities($config->login_name);
|
||||
} else {
|
||||
@@ -120,9 +120,9 @@ urn:mace:organization2:providerID, Example Organization 2, /Shibboleth.sso/WAYF/
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string('auth_shib_changepasswordurl', 'auth_shibboleth') ?>: </td>
|
||||
<td align="right"><label for="changepasswordurl"><?php print_string('auth_shib_changepasswordurl', 'auth_shibboleth') ?>: </label></td>
|
||||
<td>
|
||||
<input name="changepasswordurl" type="text" value="<?php echo $config->changepasswordurl ?>" />
|
||||
<input name="changepasswordurl" id="changepasswordurl" type="text" value="<?php echo $config->changepasswordurl ?>" />
|
||||
<?php
|
||||
|
||||
if (isset($err['changepasswordurl'])) {
|
||||
|
||||
@@ -29,9 +29,9 @@ if ($show_instructions) {
|
||||
|
||||
?>
|
||||
<div class="guestsub">
|
||||
<p><?php print_string("auth_shibboleth_select_organization", "auth_shibboleth"); ?></p>
|
||||
<p><label for="idp"><?php print_string("auth_shibboleth_select_organization", "auth_shibboleth"); ?></label></p>
|
||||
<form action="login.php" method="post" id="guestlogin">
|
||||
<select name="idp">
|
||||
<select id="idp" name="idp">
|
||||
<option value="-" ><?php print_string("auth_shibboleth_select_member", "auth_shibboleth"); ?></option>
|
||||
<?php
|
||||
print_idp_list();
|
||||
|
||||
+3
-3
@@ -56,11 +56,11 @@ require_login($course, false, $cm);
|
||||
|
||||
switch ($type) {
|
||||
case backup::TYPE_1COURSE :
|
||||
require_capability('moodle/backup:backupcourse', get_context_instance(CONTEXT_COURSE, $course->id));
|
||||
require_capability('moodle/backup:backupcourse', context_course::instance($course->id));
|
||||
$heading = get_string('backupcourse', 'backup', $course->shortname);
|
||||
break;
|
||||
case backup::TYPE_1SECTION :
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$coursecontext = context_course::instance($course->id);
|
||||
require_capability('moodle/backup:backupsection', $coursecontext);
|
||||
if ((string)$section->name !== '') {
|
||||
$sectionname = format_string($section->name, true, array('context' => $coursecontext));
|
||||
@@ -72,7 +72,7 @@ switch ($type) {
|
||||
}
|
||||
break;
|
||||
case backup::TYPE_1ACTIVITY :
|
||||
require_capability('moodle/backup:backupactivity', get_context_instance(CONTEXT_MODULE, $cm->id));
|
||||
require_capability('moodle/backup:backupactivity', context_module::instance($cm->id));
|
||||
$heading = get_string('backupactivity', 'backup', $cm->name);
|
||||
break;
|
||||
default :
|
||||
|
||||
@@ -36,7 +36,7 @@ $filearea = optional_param('filearea', null, PARAM_AREA);
|
||||
$returnurl = optional_param('returnurl', null, PARAM_URL);
|
||||
|
||||
list($context, $course, $cm) = get_context_info_array($currentcontext);
|
||||
$filecontext = get_context_instance_by_id($contextid);
|
||||
$filecontext = context::instance_by_id($contextid, IGNORE_MISSING);
|
||||
|
||||
$url = new moodle_url('/backup/backupfilesedit.php', array('currentcontext'=>$currentcontext, 'contextid'=>$contextid, 'component'=>$component, 'filearea'=>$filearea));
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ class imscc11_store_backup_file extends backup_execution_step {
|
||||
$id = $dinfo[0]->id; // Id of activity/section/course (depends of type)
|
||||
$courseid = $dinfo[0]->courseid; // Id of the course
|
||||
|
||||
$ctxid = get_context_instance(CONTEXT_USER, $userid)->id;
|
||||
$ctxid = context_user::instance($userid)->id;
|
||||
$component = 'user';
|
||||
$filearea = 'backup';
|
||||
$itemid = 0;
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@ $restoretarget = optional_param('target', backup::TARGET_CURRENT_ADDING, PARAM_I
|
||||
|
||||
// Load the course and context
|
||||
$course = $DB->get_record('course', array('id'=>$courseid), '*', MUST_EXIST);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $courseid);
|
||||
$context = context_course::instance($courseid);
|
||||
|
||||
// Must pass login
|
||||
require_login($course);
|
||||
@@ -50,7 +50,7 @@ if ($importcourseid === false) {
|
||||
|
||||
// Load the course +context to import from
|
||||
$importcourse = $DB->get_record('course', array('id'=>$importcourseid), '*', MUST_EXIST);
|
||||
$importcontext = get_context_instance(CONTEXT_COURSE, $importcourseid);
|
||||
$importcontext = context_course::instance($importcourseid);
|
||||
|
||||
// Make sure the user can backup from that course
|
||||
require_capability('moodle/backup:backuptargetimport', $importcontext);
|
||||
|
||||
+1
-1
@@ -6,6 +6,6 @@
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/backup:backupcourse', get_context_instance(CONTEXT_SYSTEM));
|
||||
require_capability('moodle/backup:backupcourse', context_system::instance());
|
||||
|
||||
redirect("$CFG->wwwroot/report/backups/index.php", '', 'admin', 1);
|
||||
|
||||
@@ -64,7 +64,7 @@ abstract class backup_activity_task extends backup_task {
|
||||
$this->sectionid = $coursemodule->section;
|
||||
$this->modulename = $coursemodule->modname;
|
||||
$this->activityid = $coursemodule->instance;
|
||||
$this->contextid = get_context_instance(CONTEXT_MODULE, $this->moduleid)->id;
|
||||
$this->contextid = context_module::instance($this->moduleid)->id;
|
||||
|
||||
parent::__construct($name, $plan);
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ abstract class backup_block_task extends backup_task {
|
||||
|
||||
$this->blockid = $blockid;
|
||||
$this->blockname = $block->blockname;
|
||||
$this->contextid = get_context_instance(CONTEXT_BLOCK, $this->blockid)->id;
|
||||
$this->contextid = context_block::instance($this->blockid)->id;
|
||||
$this->moduleid = $moduleid;
|
||||
$this->modulename = null;
|
||||
$this->parentcontextid = null;
|
||||
@@ -71,7 +71,7 @@ abstract class backup_block_task extends backup_task {
|
||||
|
||||
$this->moduleid = $moduleid;
|
||||
$this->modulename = $coursemodule->modname;
|
||||
$this->parentcontextid = get_context_instance(CONTEXT_MODULE, $this->moduleid)->id;
|
||||
$this->parentcontextid = context_module::instance($this->moduleid)->id;
|
||||
}
|
||||
|
||||
parent::__construct($name, $plan);
|
||||
|
||||
@@ -42,7 +42,7 @@ class backup_course_task extends backup_task {
|
||||
public function __construct($name, $courseid, $plan = null) {
|
||||
|
||||
$this->courseid = $courseid;
|
||||
$this->contextid = get_context_instance(CONTEXT_COURSE, $this->courseid)->id;
|
||||
$this->contextid = context_course::instance($this->courseid)->id;
|
||||
|
||||
parent::__construct($name, $plan);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ class backup_final_task extends backup_task {
|
||||
global $CFG;
|
||||
|
||||
// Set the backup::VAR_CONTEXTID setting to course context as far as next steps require that
|
||||
$coursectxid = get_context_instance(CONTEXT_COURSE, $this->get_courseid())->id;
|
||||
$coursectxid = context_course::instance($this->get_courseid())->id;
|
||||
$this->add_setting(new backup_activity_generic_setting(backup::VAR_CONTEXTID, base_setting::IS_INTEGER, $coursectxid));
|
||||
|
||||
// Set the backup::VAR_COURSEID setting to course, we'll need that in some steps
|
||||
|
||||
@@ -71,7 +71,7 @@ class backup_section_task extends backup_task {
|
||||
public function build() {
|
||||
|
||||
// Set the backup::VAR_CONTEXTID setting to course context as far as next steps require that
|
||||
$coursectxid = get_context_instance(CONTEXT_COURSE, $this->get_courseid())->id;
|
||||
$coursectxid = context_course::instance($this->get_courseid())->id;
|
||||
$this->add_setting(new backup_activity_generic_setting(backup::VAR_CONTEXTID, base_setting::IS_INTEGER, $coursectxid));
|
||||
|
||||
// Add some extra settings that related processors are going to need
|
||||
|
||||
@@ -667,7 +667,7 @@ class backup_final_scales_structure_step extends backup_structure_step {
|
||||
AND bi.itemname = 'scalefinal'", array(backup::VAR_BACKUPID));
|
||||
|
||||
// Annotate scale files (they store files in system context, so pass it instead of default one)
|
||||
$scale->annotate_files('grade', 'scale', 'id', get_context_instance(CONTEXT_SYSTEM)->id);
|
||||
$scale->annotate_files('grade', 'scale', 'id', context_system::instance()->id);
|
||||
|
||||
// Return main element (scalesdef)
|
||||
return $scalesdef;
|
||||
@@ -704,7 +704,7 @@ class backup_final_outcomes_structure_step extends backup_structure_step {
|
||||
AND bi.itemname = 'outcomefinal'", array(backup::VAR_BACKUPID));
|
||||
|
||||
// Annotate outcome files (they store files in system context, so pass it instead of default one)
|
||||
$outcome->annotate_files('grade', 'outcome', 'id', get_context_instance(CONTEXT_SYSTEM)->id);
|
||||
$outcome->annotate_files('grade', 'outcome', 'id', context_system::instance()->id);
|
||||
|
||||
// Return main element (outcomesdef)
|
||||
return $outcomesdef;
|
||||
@@ -1470,8 +1470,8 @@ class backup_main_structure_step extends backup_structure_step {
|
||||
$info['original_course_fullname'] = $originalcourseinfo->fullname;
|
||||
$info['original_course_shortname'] = $originalcourseinfo->shortname;
|
||||
$info['original_course_startdate'] = $originalcourseinfo->startdate;
|
||||
$info['original_course_contextid'] = get_context_instance(CONTEXT_COURSE, $this->get_courseid())->id;
|
||||
$info['original_system_contextid'] = get_context_instance(CONTEXT_SYSTEM)->id;
|
||||
$info['original_course_contextid'] = context_course::instance($this->get_courseid())->id;
|
||||
$info['original_system_contextid'] = context_system::instance()->id;
|
||||
|
||||
// Get more information from controller
|
||||
list($dinfo, $cinfo, $sinfo) = backup_controller_dbops::get_moodle_backup_information($this->get_backupid());
|
||||
@@ -1835,7 +1835,7 @@ class backup_annotate_all_user_files extends backup_execution_step {
|
||||
'backupid' => $this->get_backupid(), 'itemname' => 'userfinal'));
|
||||
foreach ($rs as $record) {
|
||||
$userid = $record->itemid;
|
||||
$userctx = get_context_instance(CONTEXT_USER, $userid);
|
||||
$userctx = context_user::instance($userid);
|
||||
if (!$userctx) {
|
||||
continue; // User has not context, sure it's a deleted user, so cannot have files
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ class restore_course_task extends restore_task {
|
||||
public function build() {
|
||||
|
||||
// Define the task contextid (the course one)
|
||||
$this->contextid = get_context_instance(CONTEXT_COURSE, $this->get_courseid())->id;
|
||||
$this->contextid = context_course::instance($this->get_courseid())->id;
|
||||
|
||||
// Executed conditionally if restoring to new course or if overwrite_conf setting is enabled
|
||||
if ($this->get_target() == backup::TARGET_NEW_COURSE || $this->get_setting_value('overwrite_conf') == true) {
|
||||
|
||||
@@ -74,7 +74,7 @@ class restore_section_task extends restore_task {
|
||||
public function build() {
|
||||
|
||||
// Define the task contextid (the course one)
|
||||
$this->contextid = get_context_instance(CONTEXT_COURSE, $this->get_courseid())->id;
|
||||
$this->contextid = context_course::instance($this->get_courseid())->id;
|
||||
|
||||
// We always try to restore as much info from sections as possible, no matter of the type
|
||||
// of restore (new, existing, deleting, import...). MDL-27764
|
||||
|
||||
@@ -42,11 +42,11 @@ class restore_create_and_clean_temp_stuff extends restore_execution_step {
|
||||
}
|
||||
// Create the old-course-ctxid to new-course-ctxid mapping, we need that available since the beginning
|
||||
$itemid = $this->task->get_old_contextid();
|
||||
$newitemid = get_context_instance(CONTEXT_COURSE, $this->get_courseid())->id;
|
||||
$newitemid = context_course::instance($this->get_courseid())->id;
|
||||
restore_dbops::set_backup_ids_record($this->get_restoreid(), 'context', $itemid, $newitemid);
|
||||
// Create the old-system-ctxid to new-system-ctxid mapping, we need that available since the beginning
|
||||
$itemid = $this->task->get_old_system_contextid();
|
||||
$newitemid = get_context_instance(CONTEXT_SYSTEM)->id;
|
||||
$newitemid = context_system::instance()->id;
|
||||
restore_dbops::set_backup_ids_record($this->get_restoreid(), 'context', $itemid, $newitemid);
|
||||
// Create the old-course-id to new-course-id mapping, we need that available since the beginning
|
||||
$itemid = $this->task->get_old_courseid();
|
||||
@@ -268,7 +268,7 @@ class restore_gradebook_structure_step extends restore_structure_step {
|
||||
$data = (object)$data;
|
||||
$oldid = $data->id;
|
||||
|
||||
$data->contextid = get_context_instance(CONTEXT_COURSE, $this->get_courseid())->id;
|
||||
$data->contextid = context_course::instance($this->get_courseid())->id;
|
||||
|
||||
$newitemid = $DB->insert_record('grade_letters', $data);
|
||||
$this->set_mapping('grade_letter', $oldid, $newitemid);
|
||||
@@ -888,7 +888,7 @@ class restore_scales_structure_step extends restore_structure_step {
|
||||
$data->courseid = $data->courseid ? $this->get_courseid() : 0;
|
||||
// If global scale (course=0), check the user has perms to create it
|
||||
// falling to course scale if not
|
||||
$systemctx = get_context_instance(CONTEXT_SYSTEM);
|
||||
$systemctx = context_system::instance();
|
||||
if ($data->courseid == 0 && !has_capability('moodle/course:managescales', $systemctx , $this->task->get_userid())) {
|
||||
$data->courseid = $this->get_courseid();
|
||||
}
|
||||
@@ -950,7 +950,7 @@ class restore_outcomes_structure_step extends restore_structure_step {
|
||||
$data->courseid = $data->courseid ? $this->get_courseid() : null;
|
||||
// If global outcome (course=null), check the user has perms to create it
|
||||
// falling to course outcome if not
|
||||
$systemctx = get_context_instance(CONTEXT_SYSTEM);
|
||||
$systemctx = context_system::instance();
|
||||
if (is_null($data->courseid) && !has_capability('moodle/grade:manageoutcomes', $systemctx , $this->task->get_userid())) {
|
||||
$data->courseid = $this->get_courseid();
|
||||
}
|
||||
@@ -1275,7 +1275,7 @@ class restore_course_structure_step extends restore_structure_step {
|
||||
$data->fullname = $fullname;
|
||||
$data->shortname= $shortname;
|
||||
|
||||
$context = get_context_instance_by_id($this->task->get_contextid());
|
||||
$context = context::instance_by_id($this->task->get_contextid());
|
||||
if (has_capability('moodle/course:changeidnumber', $context, $this->task->get_userid())) {
|
||||
$data->idnumber = '';
|
||||
} else {
|
||||
@@ -1769,6 +1769,23 @@ class restore_calendarevents_structure_step extends restore_structure_step {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Handle events with empty eventtype //MDL-32827
|
||||
if(empty($data->eventtype)) {
|
||||
if ($data->courseid == $SITE->id) { // Site event
|
||||
$data->eventtype = "site";
|
||||
} else if ($data->courseid != 0 && $data->groupid == 0 && ($data->modulename == 'assignment' || $data->modulename == 'assign')) {
|
||||
// Course assingment event
|
||||
$data->eventtype = "due";
|
||||
} else if ($data->courseid != 0 && $data->groupid == 0) { // Course event
|
||||
$data->eventtype = "course";
|
||||
} else if ($data->groupid) { // Group event
|
||||
$data->eventtype = "group";
|
||||
} else if ($data->userid) { // User event
|
||||
$data->eventtype = "user";
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$params = array(
|
||||
'name' => $data->name,
|
||||
@@ -2484,7 +2501,7 @@ class restore_block_instance_structure_step extends restore_structure_step {
|
||||
// Save the mapping (with restorefiles support)
|
||||
$this->set_mapping('block_instance', $oldid, $newitemid, true);
|
||||
// Create the block context
|
||||
$newcontextid = get_context_instance(CONTEXT_BLOCK, $newitemid)->id;
|
||||
$newcontextid = context_block::instance($newitemid)->id;
|
||||
// Save the block contexts mapping and sent it to task
|
||||
$this->set_mapping('context', $oldcontextid, $newcontextid);
|
||||
$this->task->set_contextid($newcontextid);
|
||||
@@ -2619,7 +2636,7 @@ class restore_module_structure_step extends restore_structure_step {
|
||||
// set the new course_module id in the task
|
||||
$this->task->set_moduleid($newitemid);
|
||||
// we can now create the context safely
|
||||
$ctxid = get_context_instance(CONTEXT_MODULE, $newitemid)->id;
|
||||
$ctxid = context_module::instance($newitemid)->id;
|
||||
// set the new context id in the task
|
||||
$this->task->set_contextid($ctxid);
|
||||
// update sequence field in course_section
|
||||
|
||||
@@ -43,7 +43,7 @@ list($context, $course, $cm) = get_context_info_array($contextid);
|
||||
|
||||
// will be used when restore
|
||||
if (!empty($filecontextid)) {
|
||||
$filecontext = get_context_instance_by_id($filecontextid);
|
||||
$filecontext = context::instance_by_id($filecontextid);
|
||||
}
|
||||
|
||||
$url = new moodle_url('/backup/restorefile.php', array('contextid'=>$contextid));
|
||||
@@ -116,7 +116,7 @@ if ($context->contextlevel == CONTEXT_MODULE) {
|
||||
echo $OUTPUT->heading_with_help(get_string('choosefilefromactivitybackup', 'backup'), 'choosefilefromuserbackup', 'backup');
|
||||
echo $OUTPUT->container_start();
|
||||
$treeview_options = array();
|
||||
$user_context = get_context_instance(CONTEXT_USER, $USER->id);
|
||||
$user_context = context_user::instance($USER->id);
|
||||
$treeview_options['filecontext'] = $context;
|
||||
$treeview_options['currentcontext'] = $context;
|
||||
$treeview_options['component'] = 'backup';
|
||||
@@ -142,7 +142,7 @@ echo $OUTPUT->container_end();
|
||||
echo $OUTPUT->heading_with_help(get_string('choosefilefromuserbackup', 'backup'), 'choosefilefromuserbackup', 'backup');
|
||||
echo $OUTPUT->container_start();
|
||||
$treeview_options = array();
|
||||
$user_context = get_context_instance(CONTEXT_USER, $USER->id);
|
||||
$user_context = context_user::instance($USER->id);
|
||||
$treeview_options['filecontext'] = $user_context;
|
||||
$treeview_options['currentcontext'] = $context;
|
||||
$treeview_options['component'] = 'user';
|
||||
@@ -157,7 +157,7 @@ if (!empty($automatedbackups)) {
|
||||
echo $OUTPUT->heading_with_help(get_string('choosefilefromautomatedbackup', 'backup'), 'choosefilefromautomatedbackup', 'backup');
|
||||
echo $OUTPUT->container_start();
|
||||
$treeview_options = array();
|
||||
$user_context = get_context_instance(CONTEXT_USER, $USER->id);
|
||||
$user_context = context_user::instance($USER->id);
|
||||
$treeview_options['filecontext'] = $context;
|
||||
$treeview_options['currentcontext'] = $context;
|
||||
$treeview_options['component'] = 'backup';
|
||||
|
||||
@@ -95,7 +95,7 @@ abstract class backup_check {
|
||||
$type = $backup_controller->get_type();
|
||||
$mode = $backup_controller->get_mode();
|
||||
$courseid = $backup_controller->get_courseid();
|
||||
$coursectx= get_context_instance(CONTEXT_COURSE, $courseid);
|
||||
$coursectx= context_course::instance($courseid);
|
||||
$userid = $backup_controller->get_userid();
|
||||
$id = $backup_controller->get_id(); // courseid / sectionid / cmid
|
||||
|
||||
@@ -118,7 +118,7 @@ abstract class backup_check {
|
||||
break;
|
||||
case backup::TYPE_1ACTIVITY :
|
||||
get_coursemodule_from_id(null, $id, $courseid, false, MUST_EXIST); // cm exists
|
||||
$modulectx = get_context_instance(CONTEXT_MODULE, $id);
|
||||
$modulectx = context_module::instance($id);
|
||||
$typecapstocheck['moodle/backup:backupactivity'] = $modulectx;
|
||||
break;
|
||||
default :
|
||||
|
||||
@@ -62,7 +62,7 @@ abstract class restore_check {
|
||||
$type = $restore_controller->get_type();
|
||||
$mode = $restore_controller->get_mode();
|
||||
$courseid = $restore_controller->get_courseid();
|
||||
$coursectx= get_context_instance(CONTEXT_COURSE, $courseid);
|
||||
$coursectx= context_course::instance($courseid);
|
||||
$userid = $restore_controller->get_userid();
|
||||
|
||||
// Note: all the checks along the function MUST be performed for $userid, that
|
||||
|
||||
@@ -39,7 +39,7 @@ abstract class backup_plan_dbops extends backup_dbops {
|
||||
global $DB;
|
||||
|
||||
// Get the context of the module
|
||||
$contextid = get_context_instance(CONTEXT_MODULE, $moduleid)->id;
|
||||
$contextid = context_module::instance($moduleid)->id;
|
||||
|
||||
// Get all the block instances which parentcontextid is the module contextid
|
||||
$blockids = array();
|
||||
@@ -57,7 +57,7 @@ abstract class backup_plan_dbops extends backup_dbops {
|
||||
global $DB;
|
||||
|
||||
// Get the context of the course
|
||||
$contextid = get_context_instance(CONTEXT_COURSE, $courseid)->id;
|
||||
$contextid = context_course::instance($courseid)->id;
|
||||
|
||||
// Get all the block instances which parentcontextid is the course contextid
|
||||
$blockids = array();
|
||||
@@ -214,7 +214,7 @@ abstract class backup_plan_dbops extends backup_dbops {
|
||||
switch ($type) {
|
||||
case backup::TYPE_1COURSE:
|
||||
$shortname = $DB->get_field('course', 'shortname', array('id' => $id));
|
||||
$context = get_context_instance(CONTEXT_COURSE, $id);
|
||||
$context = context_course::instance($id);
|
||||
$shortname = format_string($shortname, true, array('context' => $context));
|
||||
break;
|
||||
case backup::TYPE_1SECTION:
|
||||
|
||||
@@ -346,7 +346,7 @@ abstract class restore_dbops {
|
||||
global $CFG, $DB;
|
||||
|
||||
// Gather various information about roles
|
||||
$coursectx = get_context_instance(CONTEXT_COURSE, $courseid);
|
||||
$coursectx = context_course::instance($courseid);
|
||||
$assignablerolesshortname = get_assignable_roles($coursectx, ROLENAME_SHORT, false, $userid);
|
||||
|
||||
// Note: under 1.9 we had one function restore_samerole() that performed one complete
|
||||
@@ -719,7 +719,7 @@ abstract class restore_dbops {
|
||||
switch ($contextlevel) {
|
||||
// For system is easy, the best context is the system context
|
||||
case CONTEXT_SYSTEM:
|
||||
$targetcontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$targetcontext = context_system::instance();
|
||||
break;
|
||||
|
||||
// For coursecat, we are going to look for stamps in all the
|
||||
@@ -739,8 +739,8 @@ abstract class restore_dbops {
|
||||
}
|
||||
$contexts = array();
|
||||
// Build the array of contexts we are going to look
|
||||
$systemctx = get_context_instance(CONTEXT_SYSTEM);
|
||||
$coursectx = get_context_instance(CONTEXT_COURSE, $courseid);
|
||||
$systemctx = context_system::instance();
|
||||
$coursectx = context_course::instance($courseid);
|
||||
$parentctxs= get_parent_contexts($coursectx);
|
||||
foreach ($parentctxs as $parentctx) {
|
||||
// Exclude system context
|
||||
@@ -761,14 +761,14 @@ abstract class restore_dbops {
|
||||
$matchingcontexts = $DB->get_records_sql($sql, $params);
|
||||
// Only if ONE and ONLY ONE context is found, use it as valid target
|
||||
if (count($matchingcontexts) == 1) {
|
||||
$targetcontext = get_context_instance_by_id(reset($matchingcontexts)->contextid);
|
||||
$targetcontext = context::instance_by_id(reset($matchingcontexts)->contextid);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// For course is easy, the best context is the course context
|
||||
case CONTEXT_COURSE:
|
||||
$targetcontext = get_context_instance(CONTEXT_COURSE, $courseid);
|
||||
$targetcontext = context_course::instance($courseid);
|
||||
break;
|
||||
|
||||
// For module is easy, there is not best context, as far as the
|
||||
@@ -777,7 +777,7 @@ abstract class restore_dbops {
|
||||
// case is handled by {@link prechek_precheck_qbanks_by_level}
|
||||
// in an special way
|
||||
case CONTEXT_MODULE:
|
||||
$targetcontext = get_context_instance(CONTEXT_COURSE, $courseid);
|
||||
$targetcontext = context_course::instance($courseid);
|
||||
break;
|
||||
}
|
||||
return $targetcontext;
|
||||
@@ -1065,7 +1065,7 @@ abstract class restore_dbops {
|
||||
// but for deleted users that don't have a context anymore (MDL-30192). We are done for them
|
||||
// and nothing else (custom fields, prefs, tags, files...) will be created.
|
||||
if (empty($user->deleted)) {
|
||||
$newuserctxid = $user->deleted ? 0 : get_context_instance(CONTEXT_USER, $newuserid)->id;
|
||||
$newuserctxid = $user->deleted ? 0 : context_user::instance($newuserid)->id;
|
||||
self::set_backup_ids_record($restoreid, 'context', $recuser->parentitemid, $newuserctxid);
|
||||
|
||||
// Process custom fields
|
||||
@@ -1342,7 +1342,7 @@ abstract class restore_dbops {
|
||||
$mnethosts = $DB->get_records('mnet_host', array(), 'wwwroot', 'wwwroot, id');
|
||||
|
||||
// Calculate the context we are going to use for capability checking
|
||||
$context = get_context_instance(CONTEXT_COURSE, $courseid);
|
||||
$context = context_course::instance($courseid);
|
||||
|
||||
// Calculate if we have perms to create users, by checking:
|
||||
// to 'moodle/restore:createuser' and 'moodle/restore:userinfo'
|
||||
@@ -1510,7 +1510,7 @@ abstract class restore_dbops {
|
||||
global $DB;
|
||||
|
||||
// Get the course context
|
||||
$coursectx = get_context_instance(CONTEXT_COURSE, $courseid);
|
||||
$coursectx = context_course::instance($courseid);
|
||||
// Get all the mapped roles we have
|
||||
$rs = $DB->get_recordset('backup_ids_temp', array('backupid' => $restoreid, 'itemname' => 'role'), '', 'itemid');
|
||||
foreach ($rs as $recrole) {
|
||||
|
||||
@@ -207,7 +207,7 @@ abstract class backup_cron_automated_helper {
|
||||
|
||||
//Build the message subject
|
||||
$site = get_site();
|
||||
$prefix = format_string($site->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, SITEID))).": ";
|
||||
$prefix = format_string($site->shortname, true, array('context' => context_course::instance(SITEID))).": ";
|
||||
if ($haserrors) {
|
||||
$prefix .= "[".strtoupper(get_string('error'))."] ";
|
||||
}
|
||||
@@ -478,7 +478,7 @@ abstract class backup_cron_automated_helper {
|
||||
// Clean up excess backups in the course backup filearea
|
||||
if ($storage == 0 || $storage == 2) {
|
||||
$fs = get_file_storage();
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$context = context_course::instance($course->id);
|
||||
$component = 'backup';
|
||||
$filearea = 'automated';
|
||||
$itemid = 0;
|
||||
|
||||
@@ -226,19 +226,19 @@ abstract class backup_helper {
|
||||
$itemid = 0;
|
||||
switch ($backuptype) {
|
||||
case backup::TYPE_1ACTIVITY:
|
||||
$ctxid = get_context_instance(CONTEXT_MODULE, $id)->id;
|
||||
$ctxid = context_module::instance($id)->id;
|
||||
$component = 'backup';
|
||||
$filearea = 'activity';
|
||||
$itemid = 0;
|
||||
break;
|
||||
case backup::TYPE_1SECTION:
|
||||
$ctxid = get_context_instance(CONTEXT_COURSE, $courseid)->id;
|
||||
$ctxid = context_course::instance($courseid)->id;
|
||||
$component = 'backup';
|
||||
$filearea = 'section';
|
||||
$itemid = $id;
|
||||
break;
|
||||
case backup::TYPE_1COURSE:
|
||||
$ctxid = get_context_instance(CONTEXT_COURSE, $courseid)->id;
|
||||
$ctxid = context_course::instance($courseid)->id;
|
||||
$component = 'backup';
|
||||
$filearea = 'course';
|
||||
$itemid = 0;
|
||||
@@ -273,7 +273,7 @@ abstract class backup_helper {
|
||||
// are sent to user's "user_tohub" file area. The upload process
|
||||
// will be responsible for cleaning that filearea once finished
|
||||
if ($backupmode == backup::MODE_HUB) {
|
||||
$ctxid = get_context_instance(CONTEXT_USER, $userid)->id;
|
||||
$ctxid = context_user::instance($userid)->id;
|
||||
$component = 'user';
|
||||
$filearea = 'tohub';
|
||||
$itemid = 0;
|
||||
@@ -284,7 +284,7 @@ abstract class backup_helper {
|
||||
// file area. Maintenance of such area is responsibility of
|
||||
// the user via corresponding file manager frontend
|
||||
if ($backupmode == backup::MODE_GENERAL && (!$hasusers || $isannon)) {
|
||||
$ctxid = get_context_instance(CONTEXT_USER, $userid)->id;
|
||||
$ctxid = context_user::instance($userid)->id;
|
||||
$component = 'user';
|
||||
$filearea = 'backup';
|
||||
$itemid = 0;
|
||||
|
||||
@@ -99,7 +99,7 @@ abstract class restore_prechecks_helper {
|
||||
// If restoring to different site and restoring users and backup has mnet users warn/error
|
||||
if (!$samesite && $restoreusers && $hasmnetusers) {
|
||||
// User is admin (can create users at sysctx), warn
|
||||
if (has_capability('moodle/user:create', get_context_instance(CONTEXT_SYSTEM), $controller->get_userid())) {
|
||||
if (has_capability('moodle/user:create', context_system::instance(), $controller->get_userid())) {
|
||||
$warnings[] = get_string('mnetrestore_extusers_admin', 'admin');
|
||||
// User not admin
|
||||
} else {
|
||||
|
||||
@@ -256,7 +256,7 @@ abstract class restore_structure_step extends restore_step {
|
||||
|
||||
// Re-enforce 'moodle/restore:rolldates' capability for the user in the course, just in case
|
||||
} else if (!has_capability('moodle/restore:rolldates',
|
||||
get_context_instance(CONTEXT_COURSE, $this->get_courseid()),
|
||||
context_course::instance($this->get_courseid()),
|
||||
$this->task->get_userid())) {
|
||||
$cache[$this->get_restoreid()] = 0;
|
||||
|
||||
|
||||
@@ -473,12 +473,12 @@ class backup_ui_stage_complete extends backup_ui_stage_final {
|
||||
case 'activity':
|
||||
$cmid = $this->get_ui()->get_controller()->get_id();
|
||||
$cm = get_coursemodule_from_id(null, $cmid, $courseid);
|
||||
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
$modcontext = context_module::instance($cm->id);
|
||||
$restorerul = new moodle_url('/backup/restorefile.php', array('contextid'=>$modcontext->id));
|
||||
break;
|
||||
case 'course':
|
||||
default:
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $courseid);
|
||||
$coursecontext = context_course::instance($courseid);
|
||||
$restorerul = new moodle_url('/backup/restorefile.php', array('contextid'=>$coursecontext->id));
|
||||
}
|
||||
|
||||
|
||||
@@ -535,8 +535,8 @@ class core_backup_renderer extends plugin_renderer_base {
|
||||
}
|
||||
$row->cells = array(
|
||||
html_writer::empty_tag('input', array('type'=>'radio', 'name'=>'targetid', 'value'=>$course->id)),
|
||||
format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id))),
|
||||
format_string($course->fullname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id)))
|
||||
format_string($course->shortname, true, array('context' => context_course::instance($course->id))),
|
||||
format_string($course->fullname, true, array('context' => context_course::instance($course->id)))
|
||||
);
|
||||
$table->data[] = $row;
|
||||
}
|
||||
@@ -605,8 +605,8 @@ class core_backup_renderer extends plugin_renderer_base {
|
||||
}
|
||||
$row->cells = array(
|
||||
html_writer::empty_tag('input', array('type'=>'radio', 'name'=>'importid', 'value'=>$course->id)),
|
||||
format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id))),
|
||||
format_string($course->fullname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id)))
|
||||
format_string($course->shortname, true, array('context' => context_course::instance($course->id))),
|
||||
format_string($course->fullname, true, array('context' => context_course::instance($course->id)))
|
||||
);
|
||||
$table->data[] = $row;
|
||||
}
|
||||
@@ -647,7 +647,7 @@ class core_backup_renderer extends plugin_renderer_base {
|
||||
}
|
||||
$row->cells = array(
|
||||
html_writer::empty_tag('input', array('type'=>'radio', 'name'=>'targetid', 'value'=>$category->id)),
|
||||
format_string($category->name, true, array('context' => get_context_instance(CONTEXT_COURSECAT, $category->id))),
|
||||
format_string($category->name, true, array('context' => context_coursecat::instance($category->id))),
|
||||
format_text($category->description, $category->descriptionformat, array('overflowdiv'=>true))
|
||||
);
|
||||
$table->data[] = $row;
|
||||
|
||||
@@ -182,7 +182,8 @@ abstract class restore_search_base implements renderable {
|
||||
$resultset = $DB->get_records_sql($sql, $params, $offs, $blocksz);
|
||||
foreach ($resultset as $result) {
|
||||
context_instance_preload($result);
|
||||
$context = get_context_instance($contextlevel, $result->id);
|
||||
$classname = context_helper::get_class_for_level($contextlevel);
|
||||
$context = $classname::instance($result->id);
|
||||
if (count($requiredcaps) > 0) {
|
||||
if (!has_all_capabilities($requiredcaps, $context, $userid)) {
|
||||
continue;
|
||||
|
||||
@@ -231,7 +231,7 @@ class restore_ui_stage_destination extends restore_ui_independent_stage {
|
||||
'filepath'=>$this->filepath,
|
||||
'contextid'=>$this->contextid,
|
||||
'stage'=>restore_ui::STAGE_DESTINATION));
|
||||
$this->coursesearch = new restore_course_search(array('url'=>$url), get_context_instance_by_id($contextid)->instanceid);
|
||||
$this->coursesearch = new restore_course_search(array('url'=>$url), context::instance_by_id($contextid)->instanceid);
|
||||
$this->categorysearch = new restore_category_search(array('url'=>$url));
|
||||
}
|
||||
public function process() {
|
||||
@@ -286,7 +286,7 @@ class restore_ui_stage_destination extends restore_ui_independent_stage {
|
||||
'contextid' => $this->contextid,
|
||||
'filepath' => $this->filepath,
|
||||
'stage' => restore_ui::STAGE_SETTINGS));
|
||||
$context = get_context_instance_by_id($this->contextid);
|
||||
$context = context::instance_by_id($this->contextid);
|
||||
|
||||
if ($context->contextlevel == CONTEXT_COURSE and has_capability('moodle/restore:restorecourse', $context)) {
|
||||
$currentcourse = $context->instanceid;
|
||||
@@ -703,7 +703,7 @@ class restore_ui_stage_process extends restore_ui_stage {
|
||||
$haserrors = (!empty($results['errors']));
|
||||
$html .= $renderer->precheck_notices($results);
|
||||
if (!empty($info->role_mappings->mappings)) {
|
||||
$context = get_context_instance(CONTEXT_COURSE, $this->ui->get_controller()->get_courseid());
|
||||
$context = context_course::instance($this->ui->get_controller()->get_courseid());
|
||||
$assignableroles = get_assignable_roles($context, ROLENAME_ALIAS, false);
|
||||
$html .= $renderer->role_mappings($info->role_mappings->mappings, $assignableroles);
|
||||
}
|
||||
|
||||
+1
-1
@@ -27,4 +27,4 @@ M.core_backup.watch_cancel_buttons = function(config) {
|
||||
});
|
||||
}
|
||||
|
||||
}, '@VERSION@', {'requires':['base','node','node-event-simulate','moodle-enrol-notification']});
|
||||
}, '@VERSION@', {'requires':['base','node','node-event-simulate','moodle-core-notification']});
|
||||
|
||||
+2
-2
@@ -85,5 +85,5 @@ YUI.add('moodle-block_community-comments', function(Y) {
|
||||
}
|
||||
|
||||
}, '@VERSION@', {
|
||||
requires:['base','overlay', 'moodle-enrol-notification']
|
||||
});
|
||||
requires:['base','overlay', 'moodle-core-notification']
|
||||
});
|
||||
|
||||
+1
-1
@@ -195,5 +195,5 @@ YUI.add('moodle-block_community-imagegallery', function(Y) {
|
||||
}
|
||||
|
||||
}, '@VERSION@', {
|
||||
requires:['base','node','overlay', 'moodle-enrol-notification']
|
||||
requires:['base','node','overlay', 'moodle-core-notification']
|
||||
});
|
||||
|
||||
@@ -66,7 +66,7 @@ for($i = 1; $i < 3; $i++){
|
||||
?>
|
||||
<tr valign="top">
|
||||
<td align="right">
|
||||
<?php print_string('numsections'.$i, 'block_section_links'); ?>:
|
||||
<label for="menunumsections<?php echo $i; ?>"><?php print_string('numsections'.$i, 'block_section_links'); ?>:</label>
|
||||
</td>
|
||||
<td>
|
||||
<?php choose_from_menu($numberofsections, 'numsections'.$i, $selected[$i][0]); ?>
|
||||
@@ -77,7 +77,7 @@ for($i = 1; $i < 3; $i++){
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right">
|
||||
<?php print_string('incby'.$i, 'block_section_links'); ?>:
|
||||
<label for="menuincby<?php echo $i;?>"><?php print_string('incby'.$i, 'block_section_links'); ?>:</label>
|
||||
</td>
|
||||
<td>
|
||||
<?php choose_from_menu($increments, 'incby'.$i, $selected[$i][1]); ?>
|
||||
|
||||
@@ -224,7 +224,6 @@ class block_tags extends block_base {
|
||||
if ($officialtags) { $this->content->text .= $officialtagscontent; }
|
||||
if ($coursetags) { $this->content->text .= $coursetagscontent; }
|
||||
if ($commtags) { $this->content->text .= $commtagscontent; }
|
||||
|
||||
// add the input form section (allowing a user to tag the current course) and navigation, or loggin message
|
||||
if ($loggedin) {
|
||||
// only show the input form on course pages for those allowed (or not barred)
|
||||
@@ -249,7 +248,8 @@ class block_tags extends block_base {
|
||||
<div class="coursetag_form_wrapper">
|
||||
<div class="coursetag_form_positioner">
|
||||
<div class="coursetag_form_input1">
|
||||
<input type="text" name="coursetag_sug_keyword" class="coursetag_form_input1a" disabled="disabled" />
|
||||
<label class="accesshide" for="coursetag_sug_keyword">$tagthisunit</label>
|
||||
<input type="text" name="coursetag_sug_keyword" id="coursetag_sug_keyword" class="coursetag_form_input1a" disabled="disabled" />
|
||||
</div>
|
||||
<div class="coursetag_form_input2">
|
||||
<input type="text" name="coursetag_new_tag" id="coursetag_new_tag" class="coursetag_form_input2a"
|
||||
|
||||
@@ -101,6 +101,7 @@ class blog_edit_form extends moodleform {
|
||||
$a = new stdClass();
|
||||
$a->modtype = $DB->get_field('modules', 'name', array('id' => $cm->module));
|
||||
$a->modname = $DB->get_field($a->modtype, 'name', array('id' => $cm->instance));
|
||||
$modid = $context->instanceid;
|
||||
}
|
||||
|
||||
$mform->addElement('header', 'assochdr', get_string('associations', 'blog'));
|
||||
|
||||
+1
-1
@@ -123,10 +123,10 @@ if ($eventid !== 0) {
|
||||
$event = new stdClass();
|
||||
$event->action = $action;
|
||||
$event->course = $courseid;
|
||||
$event->courseid = $courseid;
|
||||
$event->timeduration = 0;
|
||||
if ($formoptions->eventtypes->courses) {
|
||||
if (!$issite) {
|
||||
$event->courseid = $courseid;
|
||||
$event->eventtype = 'course';
|
||||
} else {
|
||||
unset($formoptions->eventtypes->courses);
|
||||
|
||||
@@ -1619,6 +1619,7 @@ function calendar_print_month_selector($name, $selected) {
|
||||
for ($i=1; $i<=12; $i++) {
|
||||
$months[$i] = userdate(gmmktime(12, 0, 0, $i, 15, 2000), '%B');
|
||||
}
|
||||
echo html_writer::label(get_string('months'), 'menu'. $name, false, array('class' => 'accesshide'));
|
||||
echo html_writer::select($months, $name, $selected, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -710,7 +710,9 @@ class core_calendar_renderer extends plugin_renderer_base {
|
||||
$select = new single_select(new moodle_url(CALENDAR_URL.'set.php', array('return' => base64_encode($returnurl->out(false)), 'var' => 'setcourse', 'sesskey'=>sesskey())), 'id', $courseoptions, $selected, null);
|
||||
$select->class = 'cal_courses_flt';
|
||||
if ($label !== null) {
|
||||
$select->label = $label;
|
||||
$select->set_label($label);
|
||||
} else {
|
||||
$select->set_label(get_string('listofcourses'), array('class' => 'accesshide'));
|
||||
}
|
||||
return $this->output->render($select);
|
||||
}
|
||||
|
||||
@@ -422,6 +422,7 @@ if (!$courses) {
|
||||
make_categories_list($movetocategories, $notused, 'moodle/category:manage');
|
||||
$movetocategories[$category->id] = get_string('moveselectedcoursesto');
|
||||
echo '<tr><td colspan="3" align="right">';
|
||||
echo html_writer::label(get_string('moveselectedcoursesto'), 'movetoid', false, array('class' => 'accesshide'));
|
||||
echo html_writer::select($movetocategories, 'moveto', $category->id, null, array('id'=>'movetoid'));
|
||||
$PAGE->requires->js_init_call('M.util.init_select_autosubmit', array('movecourses', 'movetoid', false));
|
||||
echo '<input type="hidden" name="id" value="'.$category->id.'" />';
|
||||
|
||||
@@ -369,6 +369,7 @@ function print_category_edit($category, $displaylist, $parentslist, $depth=-1, $
|
||||
}
|
||||
$popupurl = new moodle_url("index.php?move=$category->id&sesskey=".sesskey());
|
||||
$select = new single_select($popupurl, 'moveto', $tempdisplaylist, $category->parent, null, "moveform$category->id");
|
||||
$select->set_label(get_string('frontpagecategorynames'), array('class' => 'accesshide'));
|
||||
echo $OUTPUT->render($select);
|
||||
}
|
||||
echo '</td>';
|
||||
|
||||
+2
-2
@@ -4038,7 +4038,7 @@ function average_number_of_participants() {
|
||||
WHERE ue.enrolid = e.id
|
||||
AND e.courseid <> :siteid
|
||||
AND c.id = e.courseid
|
||||
AND c.visible = 1)';
|
||||
AND c.visible = 1) total';
|
||||
$params = array('siteid' => $SITE->id);
|
||||
$enrolmenttotal = $DB->count_records_sql($sql, $params);
|
||||
|
||||
@@ -4071,7 +4071,7 @@ function average_number_of_courses_modules() {
|
||||
WHERE c.id = cm.course
|
||||
AND c.id <> :siteid
|
||||
AND cm.visible = 1
|
||||
AND c.visible = 1)';
|
||||
AND c.visible = 1) total';
|
||||
$params = array('siteid' => $SITE->id);
|
||||
$moduletotal = $DB->count_records_sql($sql, $params);
|
||||
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ if (!$course = $DB->get_record('course', array('id'=>$id))) {
|
||||
$PAGE->set_url('/course/reset.php', array('id'=>$id));
|
||||
|
||||
require_login($course);
|
||||
require_capability('moodle/course:update', context_course::instance($course->id));
|
||||
require_capability('moodle/course:reset', context_course::instance($course->id));
|
||||
|
||||
$strreset = get_string('reset');
|
||||
$strresetcourse = get_string('resetcourse');
|
||||
|
||||
+6
-3
@@ -70,7 +70,8 @@ if ($scaleid) {
|
||||
echo $OUTPUT->box_start();
|
||||
echo $OUTPUT->heading($scale->name);
|
||||
echo "<center>";
|
||||
echo html_writer::select($scalemenu, 'unused');
|
||||
echo html_writer::label(get_string('scales'), 'scaleunused'. $scaleid, false, array('class' => 'accesshide'));
|
||||
echo html_writer::select($scalemenu, 'unused', '', array('' => 'choosedots'), array('id' => 'scaleunused'.$scaleid));
|
||||
echo "</center>";
|
||||
echo text_to_html($scale->description);
|
||||
echo $OUTPUT->box_end();
|
||||
@@ -101,7 +102,8 @@ if ($scales = $DB->get_records("scale", array("courseid"=>$course->id), "name AS
|
||||
echo $OUTPUT->box_start();
|
||||
echo $OUTPUT->heading($scale->name);
|
||||
echo "<center>";
|
||||
echo html_writer::select($scalemenu, 'unused');
|
||||
echo html_writer::label(get_string('scales'), 'courseunused' . $scale->id, false, array('class' => 'accesshide'));
|
||||
echo html_writer::select($scalemenu, 'unused', '', array('' => 'choosedots'), array('id' => 'courseunused' . $scale->id));
|
||||
echo "</center>";
|
||||
echo text_to_html($scale->description);
|
||||
echo $OUTPUT->box_end();
|
||||
@@ -127,7 +129,8 @@ if ($scales = $DB->get_records("scale", array("courseid"=>0), "name ASC")) {
|
||||
echo $OUTPUT->box_start();
|
||||
echo $OUTPUT->heading($scale->name);
|
||||
echo "<center>";
|
||||
echo html_writer::select($scalemenu, 'unused');
|
||||
echo html_writer::label(get_string('scales'), 'sitescale' . $scale->id, false, array('class' => 'accesshide'));
|
||||
echo html_writer::select($scalemenu, 'unused', '', array('' => 'choosedots'), array('id' => 'sitescale' . $scale->id));
|
||||
echo "</center>";
|
||||
echo text_to_html($scale->description);
|
||||
echo $OUTPUT->box_end();
|
||||
|
||||
@@ -377,6 +377,7 @@ if ($courses) {
|
||||
echo "<input type=\"button\" onclick=\"checkall()\" value=\"$strselectall\" />\n";
|
||||
echo "<input type=\"button\" onclick=\"checknone()\" value=\"$strdeselectall\" />\n";
|
||||
// Select box should only show categories in which user has min capability to move course.
|
||||
echo html_writer::label(get_string('moveselectedcoursesto'), 'movetoid', false, array('class' => 'accesshide'));
|
||||
echo html_writer::select($usercatlist, 'moveto', '', array(''=>get_string('moveselectedcoursesto')), array('id'=>'movetoid'));
|
||||
$PAGE->requires->js_init_call('M.util.init_select_autosubmit', array('movecourses', 'movetoid', false));
|
||||
echo "</td>\n</tr>\n";
|
||||
|
||||
Vendored
+1
-1
@@ -411,4 +411,4 @@ YUI.add('moodle-course-dragdrop', function(Y) {
|
||||
M.course.init_section_dragdrop = function(params) {
|
||||
new DRAGSECTION(params);
|
||||
}
|
||||
}, '@VERSION@', {requires:['base', 'node', 'io', 'dom', 'dd', 'dd-scroll', 'moodle-core-dragdrop', 'moodle-enrol-notification', 'moodle-course-coursebase']});
|
||||
}, '@VERSION@', {requires:['base', 'node', 'io', 'dom', 'dd', 'dd-scroll', 'moodle-core-dragdrop', 'moodle-core-notification', 'moodle-course-coursebase']});
|
||||
|
||||
+1
-1
@@ -381,4 +381,4 @@ YUI.add('moodle-enrol_cohort-quickenrolment', function(Y) {
|
||||
}
|
||||
}
|
||||
|
||||
}, '@VERSION@', {requires:['base','node', 'overlay', 'io-base', 'test', 'json-parse', 'event-delegate', 'dd-plugin', 'event-key', 'moodle-enrol-notification']});
|
||||
}, '@VERSION@', {requires:['base','node', 'overlay', 'io-base', 'test', 'json-parse', 'event-delegate', 'dd-plugin', 'event-key', 'moodle-core-notification']});
|
||||
|
||||
@@ -273,6 +273,7 @@ class core_enrol_external extends external_api {
|
||||
'msn' => new external_value(PARAM_NOTAGS, 'msn number', VALUE_OPTIONAL),
|
||||
'department' => new external_value(PARAM_TEXT, 'department', VALUE_OPTIONAL),
|
||||
'institution' => new external_value(PARAM_TEXT, 'institution', VALUE_OPTIONAL),
|
||||
'idnumber' => new external_value(PARAM_RAW, 'An arbitrary ID code number perhaps from the institution', VALUE_OPTIONAL),
|
||||
'interests' => new external_value(PARAM_TEXT, 'user interests (separated by commas)', VALUE_OPTIONAL),
|
||||
'firstaccess' => new external_value(PARAM_INT, 'first access to the site (0 if never)', VALUE_OPTIONAL),
|
||||
'lastaccess' => new external_value(PARAM_INT, 'last access to the site (0 if never)', VALUE_OPTIONAL),
|
||||
|
||||
+1
-1
@@ -524,4 +524,4 @@ YUI.add('moodle-enrol_manual-quickenrolment', function(Y) {
|
||||
}
|
||||
}
|
||||
|
||||
}, '@VERSION@', {requires:['base','node', 'overlay', 'io-base', 'test', 'json-parse', 'event-delegate', 'dd-plugin', 'event-key', 'moodle-enrol-notification']});
|
||||
}, '@VERSION@', {requires:['base','node', 'overlay', 'io-base', 'test', 'json-parse', 'event-delegate', 'dd-plugin', 'event-key', 'moodle-core-notification']});
|
||||
|
||||
+6
-384
@@ -1,385 +1,7 @@
|
||||
/**
|
||||
* This module provides backwards compatability and should be removed
|
||||
* entirely in Moodle 2.5
|
||||
*/
|
||||
YUI.add('moodle-enrol-notification', function(Y) {
|
||||
|
||||
var DIALOGUE_NAME = 'Moodle dialogue',
|
||||
DIALOGUE_PREFIX = 'moodle-dialogue',
|
||||
CONFIRM_NAME = 'Moodle confirmation dialogue',
|
||||
EXCEPTION_NAME = 'Moodle exception',
|
||||
AJAXEXCEPTION_NAME = 'Moodle AJAX exception',
|
||||
ALERT_NAME = 'Moodle alert',
|
||||
C = Y.Node.create,
|
||||
BASE = 'notificationBase',
|
||||
LIGHTBOX = 'lightbox',
|
||||
NODELIGHTBOX = 'nodeLightbox',
|
||||
COUNT = 0,
|
||||
CONFIRMYES = 'yesLabel',
|
||||
CONFIRMNO = 'noLabel',
|
||||
TITLE = 'title',
|
||||
QUESTION = 'question',
|
||||
CSS = {
|
||||
BASE : 'moodle-dialogue-base',
|
||||
WRAP : 'moodle-dialogue-wrap',
|
||||
HEADER : 'moodle-dialogue-hd',
|
||||
BODY : 'moodle-dialogue-bd',
|
||||
CONTENT : 'moodle-dialogue-content',
|
||||
FOOTER : 'moodle-dialogue-fd',
|
||||
HIDDEN : 'hidden',
|
||||
LIGHTBOX : 'moodle-dialogue-lightbox'
|
||||
};
|
||||
|
||||
var DIALOGUE = function(config) {
|
||||
COUNT++;
|
||||
var id = 'moodle-dialogue-'+COUNT;
|
||||
config.notificationBase =
|
||||
C('<div class="'+CSS.BASE+'">')
|
||||
.append(C('<div class="'+CSS.LIGHTBOX+' '+CSS.HIDDEN+'"></div>'))
|
||||
.append(C('<div id="'+id+'" class="'+CSS.WRAP+'"></div>')
|
||||
.append(C('<div class="'+CSS.HEADER+' yui3-widget-hd"></div>'))
|
||||
.append(C('<div class="'+CSS.BODY+' yui3-widget-bd"></div>'))
|
||||
.append(C('<div class="'+CSS.CONTENT+' yui3-widget-ft"></div>')));
|
||||
Y.one(document.body).append(config.notificationBase);
|
||||
config.srcNode = '#'+id;
|
||||
config.width = config.width || '400px';
|
||||
config.visible = config.visible || false;
|
||||
config.center = config.centered || true;
|
||||
config.centered = false;
|
||||
DIALOGUE.superclass.constructor.apply(this, [config]);
|
||||
};
|
||||
Y.extend(DIALOGUE, Y.Overlay, {
|
||||
initializer : function(config) {
|
||||
this.set(NODELIGHTBOX, this.get(BASE).one('.'+CSS.LIGHTBOX).setStyle('opacity', 0.5));
|
||||
this.after('visibleChange', this.visibilityChanged, this);
|
||||
this.after('headerContentChange', function(e){
|
||||
var h = (this.get('closeButton'))?this.get(BASE).one('.'+CSS.HEADER):false;
|
||||
if (h && !h.one('.closebutton')) {
|
||||
var c = C('<div class="closebutton"></div>');
|
||||
c.on('click', this.hide, this);
|
||||
h.append(c);
|
||||
}
|
||||
}, this);
|
||||
this.render();
|
||||
this.show();
|
||||
},
|
||||
visibilityChanged : function(e) {
|
||||
switch (e.attrName) {
|
||||
case 'visible':
|
||||
if (this.get(LIGHTBOX)) {
|
||||
var l = this.get(NODELIGHTBOX);
|
||||
if (!e.prevVal && e.newVal) {
|
||||
l.setStyle('height',l.get('docHeight')+'px').removeClass(CSS.HIDDEN);
|
||||
} else if (e.prevVal && !e.newVal) {
|
||||
l.addClass(CSS.HIDDEN);
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
},
|
||||
centerDialogue : function() {
|
||||
var bb = this.get('boundingBox'), hidden = bb.hasClass(DIALOGUE_PREFIX+'-hidden');
|
||||
if (hidden) {
|
||||
bb.setStyle('top', '-1000px').removeClass(DIALOGUE_PREFIX+'-hidden');
|
||||
}
|
||||
var x = Math.max(Math.round((bb.get('winWidth') - bb.get('offsetWidth'))/2), 15);
|
||||
var y = Math.max(Math.round((bb.get('winHeight') - bb.get('offsetHeight'))/2), 15) + Y.one(window).get('scrollTop');
|
||||
|
||||
if (hidden) {
|
||||
bb.addClass(DIALOGUE_PREFIX+'-hidden');
|
||||
}
|
||||
bb.setStyle('left', x).setStyle('top', y);
|
||||
}
|
||||
}, {
|
||||
NAME : DIALOGUE_NAME,
|
||||
CSS_PREFIX : DIALOGUE_PREFIX,
|
||||
ATTRS : {
|
||||
notificationBase : {
|
||||
|
||||
},
|
||||
nodeLightbox : {
|
||||
value : null
|
||||
},
|
||||
lightbox : {
|
||||
validator : Y.Lang.isBoolean,
|
||||
value : true
|
||||
},
|
||||
closeButton : {
|
||||
validator : Y.Lang.isBoolean,
|
||||
value : true
|
||||
},
|
||||
center : {
|
||||
validator : Y.Lang.isBoolean,
|
||||
value : true
|
||||
},
|
||||
draggable : {
|
||||
validator : Y.Lang.isBoolean,
|
||||
value : false
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var ALERT = function(config) {
|
||||
config.closeButton = false;
|
||||
ALERT.superclass.constructor.apply(this, [config]);
|
||||
};
|
||||
Y.extend(ALERT, DIALOGUE, {
|
||||
_enterKeypress : null,
|
||||
initializer : function(config) {
|
||||
this.publish('complete');
|
||||
var yes = C('<input type="button" value="'+this.get(CONFIRMYES)+'" />'),
|
||||
content = C('<div class="confirmation-dialogue"></div>')
|
||||
.append(C('<div class="confirmation-message">'+this.get('message')+'</div>'))
|
||||
.append(C('<div class="confirmation-buttons"></div>')
|
||||
.append(yes));
|
||||
this.get(BASE).addClass('moodle-dialogue-confirm');
|
||||
this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
|
||||
this.setStdModContent(Y.WidgetStdMod.HEADER, this.get(TITLE), Y.WidgetStdMod.REPLACE);
|
||||
this.after('destroyedChange', function(){this.get(BASE).remove();}, this);
|
||||
this._enterKeypress = Y.on('key', this.submit, window, 'down:13', this);
|
||||
yes.on('click', this.submit, this);
|
||||
},
|
||||
submit : function(e, outcome) {
|
||||
this._enterKeypress.detach();
|
||||
this.fire('complete');
|
||||
this.hide();
|
||||
this.destroy();
|
||||
}
|
||||
}, {
|
||||
NAME : ALERT_NAME,
|
||||
CSS_PREFIX : DIALOGUE_PREFIX,
|
||||
ATTRS : {
|
||||
title : {
|
||||
validator : Y.Lang.isString,
|
||||
value : 'Alert'
|
||||
},
|
||||
message : {
|
||||
validator : Y.Lang.isString,
|
||||
value : 'Confirm'
|
||||
},
|
||||
yesLabel : {
|
||||
validator : Y.Lang.isString,
|
||||
setter : function(txt) {
|
||||
if (!txt) {
|
||||
txt = 'Ok';
|
||||
}
|
||||
return txt;
|
||||
},
|
||||
value : 'Ok'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var CONFIRM = function(config) {
|
||||
CONFIRM.superclass.constructor.apply(this, [config]);
|
||||
};
|
||||
Y.extend(CONFIRM, DIALOGUE, {
|
||||
_enterKeypress : null,
|
||||
_escKeypress : null,
|
||||
initializer : function(config) {
|
||||
this.publish('complete');
|
||||
this.publish('complete-yes');
|
||||
this.publish('complete-no');
|
||||
var yes = C('<input type="button" value="'+this.get(CONFIRMYES)+'" />'),
|
||||
no = C('<input type="button" value="'+this.get(CONFIRMNO)+'" />'),
|
||||
content = C('<div class="confirmation-dialogue"></div>')
|
||||
.append(C('<div class="confirmation-message">'+this.get(QUESTION)+'</div>'))
|
||||
.append(C('<div class="confirmation-buttons"></div>')
|
||||
.append(yes)
|
||||
.append(no));
|
||||
this.get(BASE).addClass('moodle-dialogue-confirm');
|
||||
this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
|
||||
this.setStdModContent(Y.WidgetStdMod.HEADER, this.get(TITLE), Y.WidgetStdMod.REPLACE);
|
||||
this.after('destroyedChange', function(){this.get(BASE).remove();}, this);
|
||||
this._enterKeypress = Y.on('key', this.submit, window, 'down:13', this, true);
|
||||
this._escKeypress = Y.on('key', this.submit, window, 'down:27', this, false);
|
||||
yes.on('click', this.submit, this, true);
|
||||
no.on('click', this.submit, this, false);
|
||||
},
|
||||
submit : function(e, outcome) {
|
||||
this._enterKeypress.detach();
|
||||
this._escKeypress.detach();
|
||||
this.fire('complete', outcome);
|
||||
if (outcome) {
|
||||
this.fire('complete-yes');
|
||||
} else {
|
||||
this.fire('complete-no');
|
||||
}
|
||||
this.hide();
|
||||
this.destroy();
|
||||
}
|
||||
}, {
|
||||
NAME : CONFIRM_NAME,
|
||||
CSS_PREFIX : DIALOGUE_PREFIX,
|
||||
ATTRS : {
|
||||
yesLabel : {
|
||||
validator : Y.Lang.isString,
|
||||
value : 'Yes'
|
||||
},
|
||||
noLabel : {
|
||||
validator : Y.Lang.isString,
|
||||
value : 'No'
|
||||
},
|
||||
title : {
|
||||
validator : Y.Lang.isString,
|
||||
value : 'Confirm'
|
||||
},
|
||||
question : {
|
||||
validator : Y.Lang.isString,
|
||||
value : 'Are you sure?'
|
||||
}
|
||||
}
|
||||
});
|
||||
Y.augment(CONFIRM, Y.EventTarget);
|
||||
|
||||
var EXCEPTION = function(config) {
|
||||
config.width = config.width || (M.cfg.developerdebug)?Math.floor(Y.one(document.body).get('winWidth')/3)+'px':null;
|
||||
config.closeButton = true;
|
||||
EXCEPTION.superclass.constructor.apply(this, [config]);
|
||||
};
|
||||
Y.extend(EXCEPTION, DIALOGUE, {
|
||||
_hideTimeout : null,
|
||||
_keypress : null,
|
||||
initializer : function(config) {
|
||||
this.get(BASE).addClass('moodle-dialogue-exception');
|
||||
this.setStdModContent(Y.WidgetStdMod.HEADER, config.name, Y.WidgetStdMod.REPLACE);
|
||||
var content = C('<div class="moodle-exception"></div>')
|
||||
.append(C('<div class="moodle-exception-message">'+this.get('message')+'</div>'))
|
||||
.append(C('<div class="moodle-exception-param hidden param-filename"><label>File:</label> '+this.get('fileName')+'</div>'))
|
||||
.append(C('<div class="moodle-exception-param hidden param-linenumber"><label>Line:</label> '+this.get('lineNumber')+'</div>'))
|
||||
.append(C('<div class="moodle-exception-param hidden param-stacktrace"><label>Stack trace:</label> <pre>'+this.get('stack')+'</pre></div>'));
|
||||
if (M.cfg.developerdebug) {
|
||||
content.all('.moodle-exception-param').removeClass('hidden');
|
||||
}
|
||||
this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
|
||||
|
||||
var self = this;
|
||||
var delay = this.get('hideTimeoutDelay');
|
||||
if (delay) {
|
||||
this._hideTimeout = setTimeout(function(){self.hide();}, delay);
|
||||
}
|
||||
this.after('visibleChange', this.visibilityChanged, this);
|
||||
this.after('destroyedChange', function(){this.get(BASE).remove();}, this);
|
||||
this._keypress = Y.on('key', this.hide, window, 'down:13,27', this);
|
||||
this.centerDialogue();
|
||||
},
|
||||
visibilityChanged : function(e) {
|
||||
if (e.attrName == 'visible' && e.prevVal && !e.newVal) {
|
||||
if (this._keypress) this._keypress.detach();
|
||||
var self = this;
|
||||
setTimeout(function(){self.destroy();}, 1000);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
NAME : EXCEPTION_NAME,
|
||||
CSS_PREFIX : DIALOGUE_PREFIX,
|
||||
ATTRS : {
|
||||
message : {
|
||||
value : ''
|
||||
},
|
||||
name : {
|
||||
value : ''
|
||||
},
|
||||
fileName : {
|
||||
value : ''
|
||||
},
|
||||
lineNumber : {
|
||||
value : ''
|
||||
},
|
||||
stack : {
|
||||
setter : function(str) {
|
||||
var lines = str.split("\n");
|
||||
var pattern = new RegExp('^(.+)@('+M.cfg.wwwroot+')?(.{0,75}).*:(\\d+)$');
|
||||
for (var i in lines) {
|
||||
lines[i] = lines[i].replace(pattern, "<div class='stacktrace-line'>ln: $4</div><div class='stacktrace-file'>$3</div><div class='stacktrace-call'>$1</div>");
|
||||
}
|
||||
return lines.join('');
|
||||
},
|
||||
value : ''
|
||||
},
|
||||
hideTimeoutDelay : {
|
||||
validator : Y.Lang.isNumber,
|
||||
value : null
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var AJAXEXCEPTION = function(config) {
|
||||
config.name = config.name || 'Error';
|
||||
config.closeButton = true;
|
||||
AJAXEXCEPTION.superclass.constructor.apply(this, [config]);
|
||||
};
|
||||
Y.extend(AJAXEXCEPTION, DIALOGUE, {
|
||||
_keypress : null,
|
||||
initializer : function(config) {
|
||||
this.get(BASE).addClass('moodle-dialogue-exception');
|
||||
this.setStdModContent(Y.WidgetStdMod.HEADER, config.name, Y.WidgetStdMod.REPLACE);
|
||||
var content = C('<div class="moodle-ajaxexception"></div>')
|
||||
.append(C('<div class="moodle-exception-message">'+this.get('error')+'</div>'))
|
||||
.append(C('<div class="moodle-exception-param hidden param-debuginfo"><label>URL:</label> '+this.get('reproductionlink')+'</div>'))
|
||||
.append(C('<div class="moodle-exception-param hidden param-debuginfo"><label>Debug info:</label> '+this.get('debuginfo')+'</div>'))
|
||||
.append(C('<div class="moodle-exception-param hidden param-stacktrace"><label>Stack trace:</label> <pre>'+this.get('stacktrace')+'</pre></div>'));
|
||||
if (M.cfg.developerdebug) {
|
||||
content.all('.moodle-exception-param').removeClass('hidden');
|
||||
}
|
||||
this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
|
||||
|
||||
var self = this;
|
||||
var delay = this.get('hideTimeoutDelay');
|
||||
if (delay) {
|
||||
this._hideTimeout = setTimeout(function(){self.hide();}, delay);
|
||||
}
|
||||
this.after('visibleChange', this.visibilityChanged, this);
|
||||
this._keypress = Y.on('key', this.hide, window, 'down:13, 27', this);
|
||||
this.centerDialogue();
|
||||
},
|
||||
visibilityChanged : function(e) {
|
||||
if (e.attrName == 'visible' && e.prevVal && !e.newVal) {
|
||||
var self = this;
|
||||
this._keypress.detach();
|
||||
setTimeout(function(){self.destroy();}, 1000);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
NAME : AJAXEXCEPTION_NAME,
|
||||
CSS_PREFIX : DIALOGUE_PREFIX,
|
||||
ATTRS : {
|
||||
error : {
|
||||
validator : Y.Lang.isString,
|
||||
value : 'Unknown error'
|
||||
},
|
||||
debuginfo : {
|
||||
value : null
|
||||
},
|
||||
stacktrace : {
|
||||
value : null
|
||||
},
|
||||
reproductionlink : {
|
||||
setter : function(link) {
|
||||
if (link !== null) {
|
||||
link = '<a href="'+link+'">'+link.replace(M.cfg.wwwroot, '')+'</a>';
|
||||
}
|
||||
return link;
|
||||
},
|
||||
value : null
|
||||
},
|
||||
hideTimeoutDelay : {
|
||||
validator : Y.Lang.isNumber,
|
||||
value : null
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
M.core = M.core || {};
|
||||
M.core.dialogue = DIALOGUE;
|
||||
M.core.alert = ALERT;
|
||||
M.core.confirm = CONFIRM;
|
||||
M.core.exception = EXCEPTION;
|
||||
M.core.ajaxException = AJAXEXCEPTION;
|
||||
|
||||
}, '@VERSION@', {requires:['base','node','overlay','event-key', 'moodle-enrol-notification-skin', 'dd-plugin']});
|
||||
console.log("You are using a deprecated name. Please update your YUI module to use moodle-core-notification instead of moodle-enrol-notification");
|
||||
}, '@VERSION@', {requires:['base','node','overlay','event-key', 'moodle-core-notification']});
|
||||
|
||||
+1
-1
@@ -391,4 +391,4 @@ YUI.add('moodle-enrol-otherusersmanager', function(Y) {
|
||||
}
|
||||
}
|
||||
|
||||
}, '@VERSION@', {requires:['base','node', 'overlay', 'io-base', 'test', 'json-parse', 'event-delegate', 'dd-plugin', 'event-key', 'moodle-enrol-notification']});
|
||||
}, '@VERSION@', {requires:['base','node', 'overlay', 'io-base', 'test', 'json-parse', 'event-delegate', 'dd-plugin', 'event-key', 'moodle-core-notification']});
|
||||
|
||||
Vendored
+1
-1
@@ -416,4 +416,4 @@ YUI.add('moodle-enrol-rolemanager', function(Y) {
|
||||
}
|
||||
}
|
||||
|
||||
}, '@VERSION@', {requires:['base','node','io-base','json-parse','test','moodle-enrol-notification']});
|
||||
}, '@VERSION@', {requires:['base','node','io-base','json-parse','test','moodle-core-notification']});
|
||||
|
||||
+1
-1
@@ -130,4 +130,4 @@ YUI.add('moodle-filter_glossary-autolinker', function(Y) {
|
||||
return new AUTOLINKER(config);
|
||||
}
|
||||
|
||||
}, '@VERSION@', {requires:['base','node','io-base','json-parse','event-delegate','overlay','moodle-enrol-notification']});
|
||||
}, '@VERSION@', {requires:['base','node','io-base','json-parse','event-delegate','overlay','moodle-core-notification']});
|
||||
|
||||
@@ -106,8 +106,13 @@ class backup_gradingform_rubric_plugin extends backup_gradingform_plugin {
|
||||
|
||||
// Set sources to populate the data
|
||||
|
||||
$filling->set_source_table('gradingform_rubric_fillings',
|
||||
array('instanceid' => backup::VAR_PARENTID));
|
||||
// Binding criterionid to ensure it's existence
|
||||
$filling->set_source_sql('SELECT rf.*
|
||||
FROM {gradingform_rubric_fillings} rf
|
||||
JOIN {grading_instances} gi ON gi.id = rf.instanceid
|
||||
JOIN {gradingform_rubric_criteria} rc ON rc.id = rf.criterionid AND gi.definitionid = rc.definitionid
|
||||
WHERE rf.instanceid = :instanceid',
|
||||
array('instanceid' => backup::VAR_PARENTID));
|
||||
|
||||
// no need to annotate ids or files yet (one day when remark field supports
|
||||
// embedded fileds, they must be annotated here)
|
||||
|
||||
+4
-1
@@ -109,6 +109,9 @@ class restore_gradingform_rubric_plugin extends restore_gradingform_plugin {
|
||||
$data->criterionid = $this->get_mappingid('gradingform_rubric_criterion', $data->criterionid);
|
||||
$data->levelid = $this->get_mappingid('gradingform_rubric_level', $data->levelid);
|
||||
|
||||
$DB->insert_record('gradingform_rubric_fillings', $data);
|
||||
if (!empty($data->criterionid)) {
|
||||
$DB->insert_record('gradingform_rubric_fillings', $data);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -556,7 +556,8 @@ class gradingform_rubric_controller extends gradingform_controller {
|
||||
return $this->get_instance($instance);
|
||||
}
|
||||
if ($itemid && $raterid) {
|
||||
if ($rs = $DB->get_records('grading_instances', array('raterid' => $raterid, 'itemid' => $itemid), 'timemodified DESC', '*', 0, 1)) {
|
||||
$params = array('definitionid' => $this->definition->id, 'raterid' => $raterid, 'itemid' => $itemid);
|
||||
if ($rs = $DB->get_records('grading_instances', $params, 'timemodified DESC', '*', 0, 1)) {
|
||||
$record = reset($rs);
|
||||
$currentinstance = $this->get_current_instance($raterid, $itemid);
|
||||
if ($record->status == gradingform_rubric_instance::INSTANCE_STATUS_INCOMPLETE &&
|
||||
|
||||
+2
-1
@@ -82,6 +82,7 @@ $string['messagehistory'] = 'Message history';
|
||||
$string['messagehistoryfull'] = 'All messages';
|
||||
$string['messages'] = 'Messages';
|
||||
$string['messaging'] = 'Messaging';
|
||||
$string['messagingblockednoncontact'] = '{$a} will not be able to reply as you have blocked non-contacts';
|
||||
$string['messagingdisabled'] = 'Messaging is disabled on this site, emails will be sent instead';
|
||||
$string['mycontacts'] = 'My contacts';
|
||||
$string['newonlymsg'] = 'Show only new';
|
||||
@@ -140,5 +141,5 @@ $string['unreadnewmessage'] = 'New message from {$a}';
|
||||
$string['unreadnewnotification'] = 'New notification';
|
||||
$string['unreadnewnotifications'] = 'New notifications ({$a})';
|
||||
$string['userisblockingyou'] = 'This user has blocked you from sending messages to them';
|
||||
$string['userisblockingyounoncontact'] = 'This user is only accepting messages from people listed as contacts, and you are not currently on the list.';
|
||||
$string['userisblockingyounoncontact'] = '{$a} only accepts messages from their contacts.';
|
||||
$string['userssearchresults'] = 'Users found: {$a}';
|
||||
|
||||
+13
-2
@@ -937,6 +937,7 @@ $string['liketologin'] = 'Would you like to log in now with a full user account?
|
||||
$string['list'] = 'List';
|
||||
$string['listfiles'] = 'List of files in {$a}';
|
||||
$string['listofallpeople'] = 'List of all people';
|
||||
$string['listofcourses'] = 'List of courses';
|
||||
$string['local'] = 'Local';
|
||||
$string['localplugindeleteconfirm'] = 'You are about to completely delete the local plugin \'{$a}\'. This will completely delete everything in the database associated with this plugin. Are you SURE you want to continue?';
|
||||
$string['localplugins'] = 'Local plugins';
|
||||
@@ -1032,6 +1033,7 @@ $string['messageselectadd'] = 'Send a message';
|
||||
$string['migratinggrades'] = 'Migrating grades';
|
||||
$string['min'] = 'min';
|
||||
$string['mins'] = 'mins';
|
||||
$string['minute'] = 'minute';
|
||||
$string['minutes'] = 'minutes';
|
||||
$string['miscellaneous'] = 'Miscellaneous';
|
||||
$string['missingcategory'] = 'You need to choose a category';
|
||||
@@ -1059,6 +1061,8 @@ $string['missingteacher'] = 'Must choose something';
|
||||
$string['missingurl'] = 'Missing URL';
|
||||
$string['missingusername'] = 'Missing username';
|
||||
$string['moddoesnotsupporttype'] = 'Module {$a->modname} does not support uploads of type {$a->type}';
|
||||
$string['month'] = 'Month';
|
||||
$string['months'] = 'Months';
|
||||
$string['modified'] = 'Modified';
|
||||
$string['modchooserenable'] = 'Activity chooser on';
|
||||
$string['modchooserdisable'] = 'Activity chooser off';
|
||||
@@ -1247,6 +1251,7 @@ $string['oldpassword'] = 'Current password';
|
||||
$string['olduserdirectory'] = 'This is the OLD users directory, and is no longer needed. You may safely delete it. The files it contains have been copied to the NEW user directory.';
|
||||
$string['opentoguests'] = 'Guest access';
|
||||
$string['optional'] = 'optional';
|
||||
$string['options'] = 'options';
|
||||
$string['order'] = 'Order';
|
||||
$string['originalpath'] = 'Original path';
|
||||
$string['orphanedactivities'] = 'Orphaned activities';
|
||||
@@ -1464,7 +1469,7 @@ $string['screenreaderuse'] = 'Screen reader';
|
||||
$string['screenreaderyes'] = 'Yes';
|
||||
$string['screenreaderuse_help'] = 'If set to yes, a more accessible interface is provided in various places such as chat.';
|
||||
$string['screenshot'] = 'Screenshot';
|
||||
$string['search'] = 'Search'; // TODO rename to searchforums and move to mod_forum
|
||||
$string['search'] = 'Search'; // TODO MDL-34652 rename to searchforums and move to mod_forum
|
||||
$string['search_help'] = 'For basic searching of one or more words anywhere in the text, just type them separated by spaces. All words longer than two characters are used.
|
||||
|
||||
For advanced searching, press the search button without typing anything in the search box to access the advanced search form.';
|
||||
@@ -1493,9 +1498,15 @@ $string['sectionusedefaultname'] = 'Use default section name';
|
||||
$string['seealsostats'] = 'See also: stats';
|
||||
$string['select'] = 'Select';
|
||||
$string['selectacountry'] = 'Select a country';
|
||||
$string['selectacourse'] = 'Select a course';
|
||||
$string['selectacoursesite'] = 'Select a course or site';
|
||||
$string['selectanaction'] = 'Select an action';
|
||||
$string['selectagroup'] = 'Select a group';
|
||||
$string['selectaregion'] = 'Select a region';
|
||||
$string['selctauser'] = 'Select a user';
|
||||
$string['selectall'] = 'Select all';
|
||||
$string['selectamodule'] = 'Please select an activity module';
|
||||
$string['selectanoptions'] = 'Select an options';
|
||||
$string['selectdefault'] = 'Select default';
|
||||
$string['selectedfile'] = 'Selected file';
|
||||
$string['selectednowmove'] = '{$a} files selected for moving. Now go into the destination folder and press \'Move files to here\'';
|
||||
@@ -1511,7 +1522,7 @@ $string['servererror'] = 'An error occurred whilst communicating with the server
|
||||
$string['serverlocaltime'] = 'Server\'s local time';
|
||||
$string['setcategorytheme'] = 'Set category theme';
|
||||
$string['settings'] = 'Settings';
|
||||
$string['shortname'] = 'Short name'; // @deprecated - use shortnamecourse or shortnameuser or some own context specific string
|
||||
$string['shortname'] = 'Short name'; // @deprecated MDL-34652 - use shortnamecourse or shortnameuser or some own context specific string
|
||||
$string['shortnamecollisionwarning'] = '[*] = This shortname is already in use by a course and will need to be changed upon approval';
|
||||
$string['shortnamecourse'] = 'Course short name';
|
||||
$string['shortnamecourse_help'] = 'The short name of the course is displayed in the navigation and is used in the subject line of course email messages.';
|
||||
|
||||
@@ -27,5 +27,6 @@ $string['downloadas'] = 'Download table data as';
|
||||
$string['downloadcsv'] = 'a comma separated values text file';
|
||||
$string['downloadexcel'] = 'a Microsoft Excel spreadsheet';
|
||||
$string['downloadods'] = 'an OpenDocument Spreadsheet (ODS)';
|
||||
$string['downloadoptions'] = 'Select download options';
|
||||
$string['downloadtsv'] = 'a tab separated values text file';
|
||||
$string['downloadxhtml'] = 'an unpaged XHTML document';
|
||||
|
||||
+4
-4
@@ -526,7 +526,7 @@ function set_cron_lock($name, $until, $ignorecurrent=false) {
|
||||
function admin_critical_warnings_present() {
|
||||
global $SESSION;
|
||||
|
||||
if (!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
if (!has_capability('moodle/site:config', context_system::instance())) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1164,7 +1164,7 @@ class admin_externalpage implements part_of_admin_tree {
|
||||
*/
|
||||
public function check_access() {
|
||||
global $CFG;
|
||||
$context = empty($this->context) ? get_context_instance(CONTEXT_SYSTEM) : $this->context;
|
||||
$context = empty($this->context) ? context_system::instance() : $this->context;
|
||||
foreach($this->req_capability as $cap) {
|
||||
if (has_capability($cap, $context)) {
|
||||
return true;
|
||||
@@ -1340,7 +1340,7 @@ class admin_settingpage implements part_of_admin_tree {
|
||||
*/
|
||||
public function check_access() {
|
||||
global $CFG;
|
||||
$context = empty($this->context) ? get_context_instance(CONTEXT_SYSTEM) : $this->context;
|
||||
$context = empty($this->context) ? context_system::instance() : $this->context;
|
||||
foreach($this->req_capability as $cap) {
|
||||
if (has_capability($cap, $context)) {
|
||||
return true;
|
||||
@@ -2854,7 +2854,7 @@ class admin_setting_users_with_capability extends admin_setting_configmultiselec
|
||||
if (is_array($this->choices)) {
|
||||
return true;
|
||||
}
|
||||
$users = get_users_by_capability(get_context_instance(CONTEXT_SYSTEM),
|
||||
$users = get_users_by_capability(context_system::instance(),
|
||||
$this->capability, 'u.id,u.username,u.firstname,u.lastname', 'u.lastname,u.firstname');
|
||||
$this->choices = array(
|
||||
'$@NONE@$' => get_string('nobody'),
|
||||
|
||||
@@ -42,7 +42,7 @@ try {
|
||||
// This identifies the block instance requesting AJAX extension
|
||||
$instanceid = optional_param('instance', null, PARAM_INT);
|
||||
|
||||
$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
|
||||
$PAGE->set_context(context_system::instance());
|
||||
|
||||
// Create a global nav object
|
||||
$navigation = new global_navigation_for_ajax($PAGE, $branchtype, $branchid);
|
||||
|
||||
+4
-4
@@ -657,7 +657,7 @@ class block_manager {
|
||||
$blockinstance->id = $DB->insert_record('block_instances', $blockinstance);
|
||||
|
||||
// Ensure the block context is created.
|
||||
get_context_instance(CONTEXT_BLOCK, $blockinstance->id);
|
||||
context_block::instance($blockinstance->id);
|
||||
|
||||
// If the new instance was created, allow it to do additional setup
|
||||
if ($block = block_instance($blockname, $blockinstance)) {
|
||||
@@ -1230,8 +1230,8 @@ class block_manager {
|
||||
$bi->subpagepattern = $data->bui_subpagepattern;
|
||||
}
|
||||
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$frontpagecontext = get_context_instance(CONTEXT_COURSE, SITEID);
|
||||
$systemcontext = context_system::instance();
|
||||
$frontpagecontext = context_course::instance(SITEID);
|
||||
$parentcontext = get_context_instance_by_id($data->bui_parentcontextid);
|
||||
|
||||
// Updating stickiness and contexts. See MDL-21375 for details.
|
||||
@@ -2102,7 +2102,7 @@ function blocks_add_default_system_blocks() {
|
||||
global $DB;
|
||||
|
||||
$page = new moodle_page();
|
||||
$page->set_context(get_context_instance(CONTEXT_SYSTEM));
|
||||
$page->set_context(context_system::instance());
|
||||
$page->blocks->add_blocks(array(BLOCK_POS_LEFT => array('navigation', 'settings')), '*', null, true);
|
||||
$page->blocks->add_blocks(array(BLOCK_POS_LEFT => array('admin_bookmarks')), 'admin-*', null, null, 2);
|
||||
|
||||
|
||||
+13
-13
@@ -158,7 +158,7 @@ function search_users($courseid, $groupid, $searchtext, $sort='', array $excepti
|
||||
return $DB->get_records_sql($sql, $params);
|
||||
|
||||
} else {
|
||||
$context = get_context_instance(CONTEXT_COURSE, $courseid);
|
||||
$context = context_course::instance($courseid);
|
||||
$contextlists = get_related_contexts_string($context);
|
||||
|
||||
$sql = "SELECT u.id, u.firstname, u.lastname, u.email
|
||||
@@ -412,7 +412,7 @@ function get_courses($categoryid="all", $sort="c.sortorder ASC", $fields="c.*")
|
||||
context_instance_preload($course);
|
||||
if (isset($course->visible) && $course->visible <= 0) {
|
||||
// for hidden courses, require visibility check
|
||||
if (has_capability('moodle/course:viewhiddencourses', get_context_instance(CONTEXT_COURSE, $course->id))) {
|
||||
if (has_capability('moodle/course:viewhiddencourses', context_course::instance($course->id))) {
|
||||
$visiblecourses [$course->id] = $course;
|
||||
}
|
||||
} else {
|
||||
@@ -479,7 +479,7 @@ function get_courses_page($categoryid="all", $sort="c.sortorder ASC", $fields="c
|
||||
context_instance_preload($course);
|
||||
if ($course->visible <= 0) {
|
||||
// for hidden courses, require visibility check
|
||||
if (has_capability('moodle/course:viewhiddencourses', get_context_instance(CONTEXT_COURSE, $course->id))) {
|
||||
if (has_capability('moodle/course:viewhiddencourses', context_course::instance($course->id))) {
|
||||
$totalcount++;
|
||||
if ($totalcount > $limitfrom && (!$limitnum or count($visiblecourses) < $limitnum)) {
|
||||
$visiblecourses [$course->id] = $course;
|
||||
@@ -596,7 +596,7 @@ function get_courses_wmanagers($categoryid=0, $sort="c.sortorder ASC", $fields=a
|
||||
// managers efficiently later...
|
||||
foreach ($courses as $k => $course) {
|
||||
context_instance_preload($course);
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$coursecontext = context_course::instance($course->id);
|
||||
$courses[$k] = $course;
|
||||
$courses[$k]->managers = array();
|
||||
if ($allcats === false) {
|
||||
@@ -694,7 +694,7 @@ function get_courses_wmanagers($categoryid=0, $sort="c.sortorder ASC", $fields=a
|
||||
}
|
||||
} else {
|
||||
foreach ($courses as $k => $course) {
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$coursecontext = context_course::instance($course->id);
|
||||
// Note that strpos() returns 0 as "matched at pos 0"
|
||||
if (strpos($coursecontext->path, $ra->path.'/') === 0) {
|
||||
// Only add it to subpaths
|
||||
@@ -806,7 +806,7 @@ function get_courses_search($searchterms, $sort='fullname ASC', $page=0, $record
|
||||
$rs = $DB->get_recordset_sql($sql, $params);
|
||||
foreach($rs as $course) {
|
||||
context_instance_preload($course);
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$coursecontext = context_course::instance($course->id);
|
||||
if ($course->visible || has_capability('moodle/course:viewhiddencourses', $coursecontext)) {
|
||||
// Don't exit this loop till the end
|
||||
// we need to count all the visible courses
|
||||
@@ -885,7 +885,7 @@ function get_categories($parent='none', $sort=NULL, $shallow=true) {
|
||||
$rs = $DB->get_recordset_sql($sql, $params);
|
||||
foreach($rs as $cat) {
|
||||
context_instance_preload($cat);
|
||||
$catcontext = get_context_instance(CONTEXT_COURSECAT, $cat->id);
|
||||
$catcontext = context_coursecat::instance($cat->id);
|
||||
if ($cat->visible || has_capability('moodle/category:viewhiddencategories', $catcontext)) {
|
||||
$categories[$cat->id] = $cat;
|
||||
}
|
||||
@@ -949,7 +949,7 @@ function get_course_category($catid=0) {
|
||||
$cat->timemodified = time();
|
||||
$catid = $DB->insert_record('course_categories', $cat);
|
||||
// make sure category context exists
|
||||
get_context_instance(CONTEXT_COURSECAT, $catid);
|
||||
context_coursecat::instance($catid);
|
||||
mark_context_dirty('/'.SYSCONTEXTID);
|
||||
fix_course_sortorder(); // Required to build course_categories.depth and .path.
|
||||
$category = $DB->get_record('course_categories', array('id'=>$catid));
|
||||
@@ -1032,7 +1032,7 @@ function fix_course_sortorder() {
|
||||
$defaultcat = reset($topcats);
|
||||
foreach ($frontcourses as $course) {
|
||||
$DB->set_field('course', 'category', $defaultcat->id, array('id'=>$course->id));
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$context = context_course::instance($course->id);
|
||||
$fixcontexts[$context->id] = $context;
|
||||
}
|
||||
unset($frontcourses);
|
||||
@@ -1178,7 +1178,7 @@ function _fix_course_cats($children, &$sortorder, $parent, $depth, $path, &$fixc
|
||||
$update = true;
|
||||
|
||||
// make sure context caches are rebuild and dirty contexts marked
|
||||
$context = get_context_instance(CONTEXT_COURSECAT, $cat->id);
|
||||
$context = context_coursecat::instance($cat->id);
|
||||
$fixcontexts[$context->id] = $context;
|
||||
}
|
||||
if ($cat->sortorder != $sortorder) {
|
||||
@@ -1620,7 +1620,7 @@ function coursemodule_visible_for_user($cm, $userid=0) {
|
||||
if (empty($userid)) {
|
||||
$userid = $USER->id;
|
||||
}
|
||||
if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', get_context_instance(CONTEXT_MODULE, $cm->id), $userid)) {
|
||||
if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', context_module::instance($cm->id), $userid)) {
|
||||
return false;
|
||||
}
|
||||
if ($CFG->enableavailability) {
|
||||
@@ -1628,7 +1628,7 @@ function coursemodule_visible_for_user($cm, $userid=0) {
|
||||
$ci=new condition_info($cm,CONDITION_MISSING_EXTRATABLE);
|
||||
if(!$ci->is_available($cm->availableinfo,false,$userid) and
|
||||
!has_capability('moodle/course:viewhiddenactivities',
|
||||
get_context_instance(CONTEXT_MODULE, $cm->id), $userid)) {
|
||||
context_module::instance($cm->id), $userid)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -2010,7 +2010,7 @@ function user_can_create_courses() {
|
||||
global $DB;
|
||||
$catsrs = $DB->get_recordset('course_categories');
|
||||
foreach ($catsrs as $cat) {
|
||||
if (has_capability('moodle/course:create', get_context_instance(CONTEXT_COURSECAT, $cat->id))) {
|
||||
if (has_capability('moodle/course:create', context_coursecat::instance($cat->id))) {
|
||||
$catsrs->close();
|
||||
return true;
|
||||
}
|
||||
|
||||
+13
-1
@@ -85,7 +85,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool always true
|
||||
*/
|
||||
function xmldb_main_upgrade($oldversion) {
|
||||
global $CFG, $USER, $DB, $OUTPUT;
|
||||
global $CFG, $USER, $DB, $OUTPUT, $SITE;
|
||||
|
||||
require_once($CFG->libdir.'/db/upgradelib.php'); // Core Upgrade-related functions
|
||||
|
||||
@@ -1069,5 +1069,17 @@ function xmldb_main_upgrade($oldversion) {
|
||||
upgrade_main_savepoint(true, 2012072401.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2012072600.01) {
|
||||
// Handle events with empty eventtype //MDL-32827
|
||||
|
||||
$DB->set_field('event', 'eventtype', 'site', array('eventtype' => '', 'courseid' => $SITE->id));
|
||||
$DB->set_field_select('event', 'eventtype', 'due', "eventtype = '' AND courseid != 0 AND groupid = 0 AND (modulename = 'assignment' OR modulename = 'assign')");
|
||||
$DB->set_field_select('event', 'eventtype', 'course', "eventtype = '' AND courseid != 0 AND groupid = 0");
|
||||
$DB->set_field_select('event', 'eventtype', 'group', "eventtype = '' AND groupid != 0");
|
||||
$DB->set_field_select('event', 'eventtype', 'user', "eventtype = '' AND userid != 0");
|
||||
|
||||
// Main savepoint reached
|
||||
upgrade_main_savepoint(true, 2012072600.01);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ function filter_text($text, $courseid = NULL) {
|
||||
$courseid = $COURSE->id;
|
||||
}
|
||||
|
||||
if (!$context = get_context_instance(CONTEXT_COURSE, $courseid)) {
|
||||
if (!$context = context_course::instance($courseid, IGNORE_MISSING)) {
|
||||
return $text;
|
||||
}
|
||||
|
||||
@@ -312,7 +312,7 @@ function get_teacher() {
|
||||
* @return array of user
|
||||
*/
|
||||
function get_course_participants($courseid) {
|
||||
return get_enrolled_users(get_context_instance(CONTEXT_COURSE, $courseid));
|
||||
return get_enrolled_users(context_course::instance($courseid));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -324,7 +324,7 @@ function get_course_participants($courseid) {
|
||||
* @return boolean
|
||||
*/
|
||||
function is_course_participant($userid, $courseid) {
|
||||
return is_enrolled(get_context_instance(CONTEXT_COURSE, $courseid), $userid);
|
||||
return is_enrolled(context_course::instance($courseid), $userid);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -341,7 +341,7 @@ function is_course_participant($userid, $courseid) {
|
||||
function get_recent_enrolments($courseid, $timestart) {
|
||||
global $DB;
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $courseid);
|
||||
$context = context_course::instance($courseid);
|
||||
|
||||
$sql = "SELECT u.id, u.firstname, u.lastname, MAX(l.time)
|
||||
FROM {user} u, {role_assignments} ra, {log} l
|
||||
@@ -2601,7 +2601,7 @@ function update_module_button($cmid, $ignored, $string) {
|
||||
|
||||
//NOTE: DO NOT call new output method because it needs the module name we do not have here!
|
||||
|
||||
if (has_capability('moodle/course:manageactivities', get_context_instance(CONTEXT_MODULE, $cmid))) {
|
||||
if (has_capability('moodle/course:manageactivities', context_module::instance($cmid))) {
|
||||
$string = get_string('updatethis', '', $string);
|
||||
|
||||
$url = new moodle_url("$CFG->wwwroot/course/mod.php", array('update' => $cmid, 'return' => true, 'sesskey' => sesskey()));
|
||||
|
||||
@@ -92,7 +92,7 @@ class tinymce_texteditor extends texteditor {
|
||||
$lang = current_language();
|
||||
$contentcss = $PAGE->theme->editor_css_url()->out(false);
|
||||
|
||||
$context = empty($options['context']) ? get_context_instance(CONTEXT_SYSTEM) : $options['context'];
|
||||
$context = empty($options['context']) ? context_system::instance() : $options['context'];
|
||||
|
||||
$config = get_config('editor_tinymce');
|
||||
|
||||
@@ -152,6 +152,7 @@ class tinymce_texteditor extends texteditor {
|
||||
'theme_advanced_fonts' => $fontselectlist,
|
||||
'theme_advanced_resize_horizontal' => true,
|
||||
'theme_advanced_resizing' => true,
|
||||
'theme_advanced_resizing_min_height' => 30,
|
||||
'min_height' => 30,
|
||||
'theme_advanced_toolbar_location' => "top",
|
||||
'theme_advanced_statusbar_location' => "bottom",
|
||||
|
||||
+6
-6
@@ -389,7 +389,7 @@ function enrol_course_updated($inserted, $course, $data) {
|
||||
function enrol_add_course_navigation(navigation_node $coursenode, $course) {
|
||||
global $CFG;
|
||||
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$coursecontext = context_course::instance($course->id);
|
||||
|
||||
$instances = enrol_get_instances($course->id, true);
|
||||
$plugins = enrol_get_plugins(true);
|
||||
@@ -604,7 +604,7 @@ function enrol_get_my_courses($fields = NULL, $sort = 'visible DESC,sortorder AS
|
||||
foreach ($courses as $id=>$course) {
|
||||
context_instance_preload($course);
|
||||
if (!$course->visible) {
|
||||
if (!$context = get_context_instance(CONTEXT_COURSE, $id)) {
|
||||
if (!$context = context_course::instance($id, IGNORE_MISSING)) {
|
||||
unset($courses[$id]);
|
||||
continue;
|
||||
}
|
||||
@@ -1018,7 +1018,7 @@ abstract class enrol_plugin {
|
||||
$enrol = $this->get_name();
|
||||
return get_string('pluginname', 'enrol_'.$enrol);
|
||||
} else {
|
||||
$context = get_context_instance(CONTEXT_COURSE, $instance->courseid);
|
||||
$context = context_course::instance($instance->courseid);
|
||||
return format_string($instance->name, true, array('context'=>$context));
|
||||
}
|
||||
}
|
||||
@@ -1215,7 +1215,7 @@ abstract class enrol_plugin {
|
||||
if ($instance->enrol !== $name) {
|
||||
throw new coding_exception('invalid enrol instance!');
|
||||
}
|
||||
$context = get_context_instance(CONTEXT_COURSE, $instance->courseid, MUST_EXIST);
|
||||
$context = context_course::instance($instance->courseid, MUST_EXIST);
|
||||
|
||||
$inserted = false;
|
||||
$updated = false;
|
||||
@@ -1352,7 +1352,7 @@ abstract class enrol_plugin {
|
||||
if ($instance->enrol !== $name) {
|
||||
throw new coding_exception('invalid enrol instance!');
|
||||
}
|
||||
$context = get_context_instance(CONTEXT_COURSE, $instance->courseid, MUST_EXIST);
|
||||
$context = context_course::instance($instance->courseid, MUST_EXIST);
|
||||
|
||||
if (!$ue = $DB->get_record('user_enrolments', array('enrolid'=>$instance->id, 'userid'=>$userid))) {
|
||||
// weird, user not enrolled
|
||||
@@ -1484,7 +1484,7 @@ abstract class enrol_plugin {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $instance->courseid, MUST_EXIST);
|
||||
$context = context_course::instance($instance->courseid, MUST_EXIST);
|
||||
|
||||
if (!has_capability("enrol/$name:unenrolself", $context)) {
|
||||
return NULL;
|
||||
|
||||
+1
-1
@@ -328,7 +328,7 @@ class external_api {
|
||||
throw new invalid_parameter_exception('Context does not exist');
|
||||
}
|
||||
if (empty(self::$contextrestriction)) {
|
||||
self::$contextrestriction = get_context_instance(CONTEXT_SYSTEM);
|
||||
self::$contextrestriction = context_system::instance();
|
||||
}
|
||||
$rcontext = self::$contextrestriction;
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ class file_browser {
|
||||
*/
|
||||
public function get_file_info($context = NULL, $component = NULL, $filearea = NULL, $itemid = NULL, $filepath = NULL, $filename = NULL) {
|
||||
if (!$context) {
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
$context = context_system::instance();
|
||||
}
|
||||
switch ($context->contextlevel) {
|
||||
case CONTEXT_SYSTEM:
|
||||
|
||||
@@ -383,7 +383,7 @@ class file_info_context_course extends file_info {
|
||||
if (empty($cminfo->uservisible)) {
|
||||
continue;
|
||||
}
|
||||
$modcontext = get_context_instance(CONTEXT_MODULE, $cminfo->id);
|
||||
$modcontext = context_module::instance($cminfo->id, IGNORE_MISSING);
|
||||
if ($child = $this->browser->get_file_info($modcontext)) {
|
||||
$children[] = $child;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ class file_info_context_coursecat extends file_info {
|
||||
if (empty($component)) {
|
||||
// we can not list the category contents, so try parent, or top system
|
||||
if ($this->category->parent and $pc = $DB->get_record('course_categories', array('id'=>$this->category->parent))) {
|
||||
$parent = get_context_instance(CONTEXT_COURSECAT, $pc->id);
|
||||
$parent = context_coursecat::instance($pc->id, IGNORE_MISSING);
|
||||
return $this->browser->get_file_info($parent);
|
||||
} else {
|
||||
return $this->browser->get_file_info();
|
||||
@@ -165,7 +165,7 @@ class file_info_context_coursecat extends file_info {
|
||||
|
||||
$course_cats = $DB->get_records('course_categories', array('parent'=>$this->category->id), 'sortorder', 'id,visible');
|
||||
foreach ($course_cats as $category) {
|
||||
$context = get_context_instance(CONTEXT_COURSECAT, $category->id);
|
||||
$context = context_coursecat::instance($category->id);
|
||||
if (!$category->visible and !has_capability('moodle/category:viewhiddencategories', $context)) {
|
||||
continue;
|
||||
}
|
||||
@@ -176,7 +176,7 @@ class file_info_context_coursecat extends file_info {
|
||||
|
||||
$courses = $DB->get_records('course', array('category'=>$this->category->id), 'sortorder', 'id,visible');
|
||||
foreach ($courses as $course) {
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$context = context_course::instance($course->id);
|
||||
if (!$course->visible and !has_capability('moodle/course:viewhiddencourses', $context)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ class file_info_context_system extends file_info {
|
||||
|
||||
$course_cats = $DB->get_records('course_categories', array('parent'=>0), 'sortorder', 'id,visible');
|
||||
foreach ($course_cats as $category) {
|
||||
$context = get_context_instance(CONTEXT_COURSECAT, $category->id);
|
||||
$context = context_coursecat::instance($category->id);
|
||||
if (!$category->visible and !has_capability('moodle/category:viewhiddencategories', $context)) {
|
||||
continue;
|
||||
}
|
||||
@@ -115,7 +115,7 @@ class file_info_context_system extends file_info {
|
||||
if (!$course->visible and !has_capability('moodle/course:viewhiddencourses', $context)) {
|
||||
continue;
|
||||
}
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$context = context_course::instance($course->id);
|
||||
if ($child = $this->browser->get_file_info($context)) {
|
||||
$children[] = $child;
|
||||
}
|
||||
|
||||
+10
-10
@@ -318,7 +318,7 @@ function file_get_unused_draft_itemid() {
|
||||
print_error('noguest');
|
||||
}
|
||||
|
||||
$contextid = get_context_instance(CONTEXT_USER, $USER->id)->id;
|
||||
$contextid = context_user::instance($USER->id)->id;
|
||||
|
||||
$fs = get_file_storage();
|
||||
$draftitemid = rand(1, 999999999);
|
||||
@@ -357,7 +357,7 @@ function file_prepare_draft_area(&$draftitemid, $contextid, $component, $fileare
|
||||
$options['forcehttps'] = false;
|
||||
}
|
||||
|
||||
$usercontext = get_context_instance(CONTEXT_USER, $USER->id);
|
||||
$usercontext = context_user::instance($USER->id);
|
||||
$fs = get_file_storage();
|
||||
|
||||
if (empty($draftitemid)) {
|
||||
@@ -465,7 +465,7 @@ function file_rewrite_pluginfile_urls($text, $file, $contextid, $component, $fil
|
||||
function file_get_draft_area_info($draftitemid) {
|
||||
global $CFG, $USER;
|
||||
|
||||
$usercontext = get_context_instance(CONTEXT_USER, $USER->id);
|
||||
$usercontext = context_user::instance($USER->id);
|
||||
$fs = get_file_storage();
|
||||
|
||||
$results = array();
|
||||
@@ -490,7 +490,7 @@ function file_get_draft_area_info($draftitemid) {
|
||||
function file_get_user_used_space() {
|
||||
global $DB, $USER;
|
||||
|
||||
$usercontext = get_context_instance(CONTEXT_USER, $USER->id);
|
||||
$usercontext = context_user::instance($USER->id);
|
||||
$sql = "SELECT SUM(files1.filesize) AS totalbytes FROM {files} files1
|
||||
JOIN (SELECT contenthash, filename, MAX(id) AS id
|
||||
FROM {files}
|
||||
@@ -526,7 +526,7 @@ function file_correct_filepath($str) { //TODO: what is this? (skodak)
|
||||
function file_get_drafarea_folders($draftitemid, $filepath, &$data) {
|
||||
global $USER, $OUTPUT, $CFG;
|
||||
$data->children = array();
|
||||
$context = get_context_instance(CONTEXT_USER, $USER->id);
|
||||
$context = context_user::instance($USER->id);
|
||||
$fs = get_file_storage();
|
||||
if ($files = $fs->get_directory_files($context->id, 'user', 'draft', $draftitemid, $filepath, false)) {
|
||||
foreach ($files as $file) {
|
||||
@@ -558,7 +558,7 @@ function file_get_drafarea_folders($draftitemid, $filepath, &$data) {
|
||||
function file_get_drafarea_files($draftitemid, $filepath = '/') {
|
||||
global $USER, $OUTPUT, $CFG;
|
||||
|
||||
$context = get_context_instance(CONTEXT_USER, $USER->id);
|
||||
$context = context_user::instance($USER->id);
|
||||
$fs = get_file_storage();
|
||||
|
||||
$data = new stdClass();
|
||||
@@ -711,7 +711,7 @@ function file_restore_source_field_from_draft_file($storedfile) {
|
||||
function file_save_draft_area_files($draftitemid, $contextid, $component, $filearea, $itemid, array $options=null, $text=null, $forcehttps=false) {
|
||||
global $USER;
|
||||
|
||||
$usercontext = get_context_instance(CONTEXT_USER, $USER->id);
|
||||
$usercontext = context_user::instance($USER->id);
|
||||
$fs = get_file_storage();
|
||||
|
||||
$options = (array)$options;
|
||||
@@ -905,7 +905,7 @@ function file_save_draft_area_files($draftitemid, $contextid, $component, $filea
|
||||
function file_rewrite_urls_to_pluginfile($text, $draftitemid, $forcehttps = false) {
|
||||
global $CFG, $USER;
|
||||
|
||||
$usercontext = get_context_instance(CONTEXT_USER, $USER->id);
|
||||
$usercontext = context_user::instance($USER->id);
|
||||
|
||||
$wwwroot = $CFG->wwwroot;
|
||||
if ($forcehttps) {
|
||||
@@ -3763,7 +3763,7 @@ function file_pluginfile($relativepath, $forcedownload, $preview = null) {
|
||||
|
||||
while (!$canview && count($courses) > 0) {
|
||||
$course = array_shift($courses);
|
||||
if (has_capability('moodle/user:viewdetails', get_context_instance(CONTEXT_COURSE, $course->id))) {
|
||||
if (has_capability('moodle/user:viewdetails', context_course::instance($course->id))) {
|
||||
$canview = true;
|
||||
}
|
||||
}
|
||||
@@ -3780,7 +3780,7 @@ function file_pluginfile($relativepath, $forcedownload, $preview = null) {
|
||||
|
||||
} else if ($filearea === 'profile' and $context->contextlevel == CONTEXT_COURSE) {
|
||||
$userid = (int)array_shift($args);
|
||||
$usercontext = get_context_instance(CONTEXT_USER, $userid);
|
||||
$usercontext = context_user::instance($userid);
|
||||
|
||||
if ($CFG->forcelogin) {
|
||||
require_login();
|
||||
|
||||
@@ -140,6 +140,30 @@ class zip_packer_testcase extends advanced_testcase {
|
||||
foreach($archivefiles as $file) {
|
||||
$this->assertArrayHasKey($file->pathname, $this->files);
|
||||
}
|
||||
|
||||
// Test invalid files parameter.
|
||||
$archive = "$CFG->tempdir/archive2.zip";
|
||||
$this->assertFalse(file_exists($archive));
|
||||
|
||||
$this->assertFalse(file_exists(__DIR__.'/xx/yy/ee.txt'));
|
||||
$files = array('xtest.txt'=>__DIR__.'/xx/yy/ee.txt');
|
||||
ob_start();
|
||||
$result = $packer->archive_to_pathname($files, $archive);
|
||||
$d = ob_end_clean();
|
||||
$this->assertTrue($d !== '');
|
||||
$this->assertFalse($result);
|
||||
|
||||
$this->assertTrue(file_exists(__DIR__.'/fixtures/test.txt'));
|
||||
$files = array();
|
||||
$files['""""'] = null; // Invalid directory name.
|
||||
$files['test.txt'] = __DIR__.'/fixtures/test.txt';
|
||||
ob_start();
|
||||
$result = $packer->archive_to_pathname($files, $archive);
|
||||
$d = ob_end_clean();
|
||||
$this->assertTrue($d !== '');
|
||||
$this->assertTrue($result);
|
||||
|
||||
@unlink($archive);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -100,26 +100,44 @@ class zip_packer extends file_packer {
|
||||
return false;
|
||||
}
|
||||
|
||||
$result = false; // One processed file or dir means success here.
|
||||
|
||||
foreach ($files as $archivepath => $file) {
|
||||
$archivepath = trim($archivepath, '/');
|
||||
|
||||
if (is_null($file)) {
|
||||
// empty directories have null as content
|
||||
$ziparch->add_directory($archivepath.'/');
|
||||
if ($ziparch->add_directory($archivepath.'/')) {
|
||||
$result = true;
|
||||
} else {
|
||||
debugging("Can not zip '$archivepath' directory", DEBUG_DEVELOPER);
|
||||
}
|
||||
|
||||
} else if (is_string($file)) {
|
||||
$this->archive_pathname($ziparch, $archivepath, $file);
|
||||
if ($this->archive_pathname($ziparch, $archivepath, $file)) {
|
||||
$result = true;
|
||||
} else {
|
||||
debugging("Can not zip '$archivepath' file", DEBUG_DEVELOPER);
|
||||
}
|
||||
|
||||
} else if (is_array($file)) {
|
||||
$content = reset($file);
|
||||
$ziparch->add_file_from_string($archivepath, $content);
|
||||
if ($ziparch->add_file_from_string($archivepath, $content)) {
|
||||
$result = true;
|
||||
} else {
|
||||
debugging("Can not zip '$archivepath' file", DEBUG_DEVELOPER);
|
||||
}
|
||||
|
||||
} else {
|
||||
$this->archive_stored($ziparch, $archivepath, $file);
|
||||
if ($this->archive_stored($ziparch, $archivepath, $file)) {
|
||||
$result = true;
|
||||
} else {
|
||||
debugging("Can not zip '$archivepath' file", DEBUG_DEVELOPER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $ziparch->close();
|
||||
return ($ziparch->close() && $result);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -128,12 +146,16 @@ class zip_packer extends file_packer {
|
||||
* @param zip_archive $ziparch zip archive instance
|
||||
* @param string $archivepath file path to archive
|
||||
* @param stored_file $file stored_file object
|
||||
* @return bool success
|
||||
*/
|
||||
private function archive_stored($ziparch, $archivepath, $file) {
|
||||
$file->archive_file($ziparch, $archivepath);
|
||||
$result = $file->archive_file($ziparch, $archivepath);
|
||||
if (!$result) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$file->is_directory()) {
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
$baselength = strlen($file->get_filepath());
|
||||
@@ -147,8 +169,11 @@ class zip_packer extends file_packer {
|
||||
if (!$file->is_directory()) {
|
||||
$path = $path.$file->get_filename();
|
||||
}
|
||||
// Ignore result here, partial zipping is ok for now.
|
||||
$file->archive_file($ziparch, $path);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -157,18 +182,18 @@ class zip_packer extends file_packer {
|
||||
* @param zip_archive $ziparch zip archive instance
|
||||
* @param string $archivepath file path to archive
|
||||
* @param string $file path name of the file
|
||||
* @return bool success
|
||||
*/
|
||||
private function archive_pathname($ziparch, $archivepath, $file) {
|
||||
if (!file_exists($file)) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is_file($file)) {
|
||||
if (!is_readable($file)) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
$ziparch->add_file_from_pathname($archivepath, $file);
|
||||
return;
|
||||
return $ziparch->add_file_from_pathname($archivepath, $file);
|
||||
}
|
||||
if (is_dir($file)) {
|
||||
if ($archivepath !== '') {
|
||||
@@ -183,7 +208,7 @@ class zip_packer extends file_packer {
|
||||
$this->archive_pathname($ziparch, $newpath, $file->getPathname());
|
||||
}
|
||||
unset($files); //release file handles
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-6
@@ -605,7 +605,7 @@ function filter_set_global_state($filter, $state, $sortorder = false) {
|
||||
}
|
||||
|
||||
// See if there is an existing record.
|
||||
$syscontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$syscontext = context_system::instance();
|
||||
$rec = $DB->get_record('filter_active', array('filter' => $filter, 'contextid' => $syscontext->id));
|
||||
if (empty($rec)) {
|
||||
$insert = true;
|
||||
@@ -747,7 +747,7 @@ function filter_set_local_state($filter, $contextid, $state) {
|
||||
"Must be one of TEXTFILTER_ON, TEXTFILTER_OFF or TEXTFILTER_INHERIT.");
|
||||
}
|
||||
|
||||
if ($contextid == get_context_instance(CONTEXT_SYSTEM)->id) {
|
||||
if ($contextid == context_system::instance()->id) {
|
||||
throw new coding_exception('You cannot use filter_set_local_state ' .
|
||||
'with $contextid equal to the system context id.');
|
||||
}
|
||||
@@ -847,7 +847,7 @@ function filter_get_local_config($filter, $contextid) {
|
||||
*/
|
||||
function filter_get_all_local_settings($contextid) {
|
||||
global $DB;
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
$context = context_system::instance();
|
||||
return array(
|
||||
$DB->get_records('filter_active', array('contextid' => $contextid), 'filter', 'filter,active'),
|
||||
$DB->get_records('filter_config', array('contextid' => $contextid), 'filter,name', 'filter,name,value'),
|
||||
@@ -940,13 +940,13 @@ function filter_preload_activities(course_modinfo $modinfo) {
|
||||
$cmcontexts = array();
|
||||
$cmcontextids = array();
|
||||
foreach ($modinfo->get_cms() as $cm) {
|
||||
$modulecontext = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
$modulecontext = context_module::instance($cm->id);
|
||||
$cmcontextids[] = $modulecontext->id;
|
||||
$cmcontexts[] = $modulecontext;
|
||||
}
|
||||
|
||||
// Get course context and all other parents...
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $modinfo->get_course_id());
|
||||
$coursecontext = context_course::instance($modinfo->get_course_id());
|
||||
$parentcontextids = explode('/', substr($coursecontext->path, 1));
|
||||
$allcontextids = array_merge($cmcontextids, $parentcontextids);
|
||||
|
||||
@@ -1094,7 +1094,7 @@ function filter_get_available_in_context($context) {
|
||||
*/
|
||||
function filter_get_global_states() {
|
||||
global $DB;
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
$context = context_system::instance();
|
||||
return $DB->get_records('filter_active', array('contextid' => $context->id), 'sortorder', 'filter,active,sortorder');
|
||||
}
|
||||
|
||||
|
||||
+4
-3
@@ -80,7 +80,7 @@ class MoodleQuickForm_editor extends HTML_QuickForm_element {
|
||||
$this->_options['maxbytes'] = get_max_upload_file_size($CFG->maxbytes, $options['maxbytes']);
|
||||
}
|
||||
if (!$this->_options['context']) {
|
||||
$this->_options['context'] = get_context_instance(CONTEXT_SYSTEM);
|
||||
$this->_options['context'] = context_system::instance();
|
||||
}
|
||||
$this->_options['trusted'] = trusttext_trusted($this->_options['context']);
|
||||
parent::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
|
||||
@@ -361,10 +361,11 @@ class MoodleQuickForm_editor extends HTML_QuickForm_element {
|
||||
|
||||
$str .= '<div>';
|
||||
if (count($formats)>1) {
|
||||
$str.= html_writer::select($formats, $elname.'[format]', $format, false);
|
||||
$str .= html_writer::label(get_string('format'), 'menu'. $elname. 'format', false, array('class' => 'accesshide'));
|
||||
$str .= html_writer::select($formats, $elname.'[format]', $format, false, array('id' => 'menu'. $elname. 'format'));
|
||||
} else {
|
||||
$keys = array_keys($formats);
|
||||
$str.= html_writer::empty_tag('input',
|
||||
$str .= html_writer::empty_tag('input',
|
||||
array('name'=>$elname.'[format]', 'type'=> 'hidden', 'value' => array_pop($keys)));
|
||||
}
|
||||
$str .= '</div>';
|
||||
|
||||
@@ -321,7 +321,7 @@ class form_filemanager implements renderable {
|
||||
$this->options = file_get_drafarea_files($options->itemid, '/');
|
||||
|
||||
// calculate file count
|
||||
$usercontext = get_context_instance(CONTEXT_USER, $USER->id);
|
||||
$usercontext = context_user::instance($USER->id);
|
||||
$files = $fs->get_area_files($usercontext->id, 'user', 'draft', $options->itemid, 'id', false);
|
||||
$filecount = count($files);
|
||||
$this->options->filecount = $filecount;
|
||||
|
||||
@@ -126,9 +126,9 @@ class MoodleQuickForm_filepicker extends HTML_QuickForm_input {
|
||||
}
|
||||
|
||||
if ($COURSE->id == SITEID) {
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
$context = context_system::instance();
|
||||
} else {
|
||||
$context = get_context_instance(CONTEXT_COURSE, $COURSE->id);
|
||||
$context = context_course::instance($COURSE->id);
|
||||
}
|
||||
|
||||
$client_id = uniqid();
|
||||
@@ -191,7 +191,7 @@ class MoodleQuickForm_filepicker extends HTML_QuickForm_input {
|
||||
// make sure max one file is present and it is not too big
|
||||
if (!is_null($draftitemid)) {
|
||||
$fs = get_file_storage();
|
||||
$usercontext = get_context_instance(CONTEXT_USER, $USER->id);
|
||||
$usercontext = context_user::instance($USER->id);
|
||||
if ($files = $fs->get_area_files($usercontext->id, 'user', 'draft', $draftitemid, 'id DESC', false)) {
|
||||
$file = array_shift($files);
|
||||
if ($this->_options['maxbytes']
|
||||
|
||||
+1
-1
@@ -130,7 +130,7 @@ class MoodleQuickForm_tags extends MoodleQuickForm_group {
|
||||
|
||||
// If the user can manage official tags, give them a link to manage them.
|
||||
$label = get_string('otags', 'tag');
|
||||
if (has_capability('moodle/tag:manage', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
if (has_capability('moodle/tag:manage', context_system::instance())) {
|
||||
$url = $CFG->wwwroot .'/tag/manage.php';
|
||||
$label .= ' (' . $OUTPUT->action_link(
|
||||
$url,
|
||||
|
||||
+2
-2
@@ -97,9 +97,9 @@ class MoodleQuickForm_url extends HTML_QuickForm_text{
|
||||
$strsaved = get_string('filesaved', 'repository');
|
||||
$straddlink = get_string('choosealink', 'repository');
|
||||
if ($COURSE->id == SITEID) {
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
$context = context_system::instance();
|
||||
} else {
|
||||
$context = get_context_instance(CONTEXT_COURSE, $COURSE->id);
|
||||
$context = context_course::instance($COURSE->id);
|
||||
}
|
||||
$client_id = uniqid();
|
||||
|
||||
|
||||
+6
-6
@@ -395,7 +395,7 @@ abstract class moodleform {
|
||||
if ($rule['type'] == 'required') {
|
||||
$draftid = (int)$mform->getSubmitValue($elementname);
|
||||
$fs = get_file_storage();
|
||||
$context = get_context_instance(CONTEXT_USER, $USER->id);
|
||||
$context = context_user::instance($USER->id);
|
||||
if (!$files = $fs->get_area_files($context->id, 'user', 'draft', $draftid, 'id DESC', false)) {
|
||||
$errors[$elementname] = $rule['message'];
|
||||
}
|
||||
@@ -673,7 +673,7 @@ abstract class moodleform {
|
||||
}
|
||||
$draftid = $values[$elname];
|
||||
$fs = get_file_storage();
|
||||
$context = get_context_instance(CONTEXT_USER, $USER->id);
|
||||
$context = context_user::instance($USER->id);
|
||||
if (!$files = $fs->get_area_files($context->id, 'user', 'draft', $draftid, 'id DESC', false)) {
|
||||
return false;
|
||||
}
|
||||
@@ -721,7 +721,7 @@ abstract class moodleform {
|
||||
}
|
||||
$draftid = $values[$elname];
|
||||
$fs = get_file_storage();
|
||||
$context = get_context_instance(CONTEXT_USER, $USER->id);
|
||||
$context = context_user::instance($USER->id);
|
||||
if (!$files = $fs->get_area_files($context->id, 'user', 'draft', $draftid, 'id DESC', false)) {
|
||||
return false;
|
||||
}
|
||||
@@ -784,7 +784,7 @@ abstract class moodleform {
|
||||
}
|
||||
$draftid = $values[$elname];
|
||||
$fs = get_file_storage();
|
||||
$context = get_context_instance(CONTEXT_USER, $USER->id);
|
||||
$context = context_user::instance($USER->id);
|
||||
if (!$files = $fs->get_area_files($context->id, 'user', 'draft', $draftid, 'id DESC', false)) {
|
||||
return null;
|
||||
}
|
||||
@@ -828,7 +828,7 @@ abstract class moodleform {
|
||||
return false;
|
||||
}
|
||||
$draftid = $values[$elname];
|
||||
$context = get_context_instance(CONTEXT_USER, $USER->id);
|
||||
$context = context_user::instance($USER->id);
|
||||
if (!$files = $fs->get_area_files($context->id, 'user' ,'draft', $draftid, 'id DESC', false)) {
|
||||
return false;
|
||||
}
|
||||
@@ -890,7 +890,7 @@ abstract class moodleform {
|
||||
}
|
||||
$draftid = $values[$elname];
|
||||
$fs = get_file_storage();
|
||||
$context = get_context_instance(CONTEXT_USER, $USER->id);
|
||||
$context = context_user::instance($USER->id);
|
||||
if (!$files = $fs->get_area_files($context->id, 'user', 'draft', $draftid, 'id DESC', false)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user