MDL-21217, MDL-21198 simplified/improved outputlib help icon related apis + several fixed regresions

This commit is contained in:
Petr Skoda 2009-12-30 15:19:55 +00:00
parent 48a67d9f01
commit 4bcc51185c
113 changed files with 442 additions and 970 deletions

View File

@ -380,7 +380,7 @@ if (defined('WARN_DISPLAY_ERRORS_ENABLED')) {
$lastcron = $DB->get_field_sql('SELECT MAX(lastcron) FROM {modules}');
if (time() - $lastcron > 3600 * 24) {
$strinstallation = get_string('installation', 'install');
$helpbutton = $OUTPUT->help_icon(moodle_help_icon::make('install', $strinstallation));
$helpbutton = $OUTPUT->help_icon('install', $strinstallation);
echo $OUTPUT->box(get_string('cronwarning', 'admin').' '.$helpbutton, 'generalbox adminwarning');
}

View File

@ -496,7 +496,7 @@
$select->nothinglabel = $strchoosefiletoedit;
$select->set_label($selectionlabel);
echo $OUTPUT->select($select);
echo $OUTPUT->help_icon(moodle_help_icon::make('langswitchstorage', $strfilestoredinhelp));
echo $OUTPUT->help_icon('langswitchstorage', $strfilestoredinhelp);
echo $OUTPUT->box_end();
if ($currentfile <> '') {
@ -763,7 +763,7 @@
$select->nothinglabel = $strchoosefiletoedit;
$select->set_label($selectionlabel);
echo $OUTPUT->select($select);
echo $OUTPUT->help_icon(moodle_help_icon::make('langswitchstorage', $strfilestoredinhelp));
echo $OUTPUT->help_icon('langswitchstorage', $strfilestoredinhelp);
echo $OUTPUT->box_end();
if (!empty($currentfile)) {
@ -812,11 +812,11 @@
echo '<div>';
if ($uselocal) {
$strsavetotitle = $strlanglocalpackage . $OUTPUT->help_icon(moodle_help_icon::make('langpackages', $strlanglocalpackage));
$straltdirtitle = $strlangmasterpackage . $OUTPUT->help_icon(moodle_help_icon::make('langpackages', $strlangmasterpackage));
$strsavetotitle = $strlanglocalpackage . $OUTPUT->help_icon('langpackages', $strlanglocalpackage);
$straltdirtitle = $strlangmasterpackage . $OUTPUT->help_icon('langpackages', $strlangmasterpackage);
} else {
$straltdirtitle = $strlanglocalpackage . $OUTPUT->help_icon(moodle_help_icon::make('langpackages', $strlanglocalpackage));
$strsavetotitle = $strlangmasterpackage . $OUTPUT->help_icon(moodle_help_icon::make('langpackages', $strlangmasterpackage));
$straltdirtitle = $strlanglocalpackage . $OUTPUT->help_icon('langpackages', $strlanglocalpackage);
$strsavetotitle = $strlangmasterpackage . $OUTPUT->help_icon('langpackages', $strlangmasterpackage);
}
@ -876,7 +876,7 @@
}
if (is_readable($ensrc)) {
echo '<fieldset><legend>'.$strlangmasterenglish;
echo $OUTPUT->help_icon(moodle_help_icon::make('langpackages', $strlangmasterenglish));
echo $OUTPUT->help_icon('langpackages', $strlangmasterenglish);
echo '</legend>';
echo "<div class='mdl-align'>\n<textarea rows=\"$fileeditorrows\" cols=\"$fileeditorcols\" name=\"\">";
echo htmlspecialchars(file_get_contents($ensrc));

View File

@ -32,7 +32,7 @@ if (empty($mnet_peer->public_key)) $mnet_peer->public_key = '';
<td align="right" valign="top"><?php
print_string('publickey', 'mnet');
echo ': <br />';
echo $OUTPUT->help_icon(moodle_help_icon::make("publickey", get_string('publickey', 'mnet'), "mnet", true));
echo $OUTPUT->help_icon("publickey", get_string('publickey', 'mnet'), "mnet", true);
?></td>
<?php
@ -105,7 +105,7 @@ if (isset($mnet_peer->ip_address) && '' != $mnet_peer->ip_address){
<tr>
<td align="right" valign="top"><?php print_string('ipaddress', 'mnet');
echo ': <br />';
echo $OUTPUT->help_icon(moodle_help_icon::make("ipaddress", get_string('ipaddress', 'mnet'), "mnet", true));
echo $OUTPUT->help_icon("ipaddress", get_string('ipaddress', 'mnet'), "mnet", true);
?>:</td>
<td valign="top"><?php echo $mnet_peer->ip_address; ?></td>
</tr>

View File

@ -296,10 +296,7 @@
}
/// Print heading.
$helpicon = new moodle_help_icon();
$helpicon->text = $title;
$helpicon->page = 'assignroles';
echo $OUTPUT->heading_with_help($helpicon);
echo $OUTPUT->heading_with_help($title, 'assignroles');
if ($roleid) {
/// Show UI for assigning a particular role to users.
@ -330,7 +327,7 @@
if ($hidden) { echo 'checked="checked" '; } ?>/>
<label for="hidden" title="<?php print_string('createhiddenassign', 'role'); ?>">
<?php print_string('hidden', 'role'); ?>
<?php echo $OUTPUT->help_icon(moodle_help_icon::make('hiddenassign', get_string('createhiddenassign', 'role'))); ?>
<?php echo $OUTPUT->help_icon('hiddenassign', get_string('createhiddenassign', 'role')); ?>
</label></p>
<p><label for="extendperiod"><?php print_string('enrolperiod') ?></label><br />

View File

@ -138,10 +138,7 @@
}
/// Print heading.
$helpicon = new moodle_help_icon();
$helpicon->text = $title;
$helpicon->page = 'checkpermissions';
echo $OUTPUT->heading_with_help($helpicon);
echo $OUTPUT->heading_with_help($title, 'checkpermissions');
/// If a user has been chosen, show all the permissions for this user.
$reportuser = $userselector->get_selected_user();

View File

@ -120,10 +120,7 @@
} else if ($action == 'edit') {
$title = get_string('editingrolex', 'role', $rolenames[$roleid]->localname);
}
$helpicon = new moodle_help_icon();
$helpicon->text = $title;
$helpicon->page = 'roles';
echo $OUTPUT->heading_with_help($helpicon);
echo $OUTPUT->heading_with_help($title, 'roles');
/// Work out some button labels.
if ($action == 'add' || $action == 'duplicate') {

View File

@ -380,7 +380,7 @@ abstract class capability_table_with_risks extends capability_table_base {
protected function add_header_cells() {
global $OUTPUT;
echo '<th colspan="' . count($this->displaypermissions) . '" scope="col">' .
get_string('permission', 'role') . ' ' . $OUTPUT->help_icon(moodle_help_icon::make('permissions', get_string('permissions', 'role'))) . '</th>';
get_string('permission', 'role') . ' ' . $OUTPUT->help_icon('permissions', get_string('permissions', 'role')) . '</th>';
echo '<th class="risk" colspan="' . count($this->allrisks) . '" scope="col">' . get_string('risks','role') . '</th>';
}

View File

@ -206,7 +206,7 @@
$table->wrap = array('nowrap', '', 'nowrap','nowrap');
$table->width = '90%';
$table->head = array(
get_string('role') . ' ' . $OUTPUT->help_icon(moodle_help_icon::make('roles', get_string('roles'))),
get_string('role') . ' ' . $OUTPUT->help_icon('roles', get_string('roles')),
get_string('description'),
get_string('shortname'),
get_string('edit')

View File

@ -175,10 +175,7 @@
include_once('tabs.php');
}
$helpicon = new moodle_help_icon();
$helpicon->text = $title;
$helpicon->page = 'overrides';
echo $OUTPUT->heading_with_help($helpicon);
echo $OUTPUT->heading_with_help($title, 'overrides');
if ($roleid) {
/// Show UI for overriding roles.

View File

@ -58,10 +58,7 @@ $overwritepicture = optional_param('overwritepicture', 0, PARAM_BOOL);
/// Print the header
admin_externalpage_print_header();
$helpicon = new moodle_help_icon();
$helpicon->text = $struploadpictures;
$helpicon->page = 'uploadpictures';
echo $OUTPUT->heading_with_help($helpicon);
echo $OUTPUT->heading_with_help($struploadpictures, 'uploadpictures');
$mform = new admin_uploadpicture_form(null, $userfields);
if ($formdata = $mform->get_data()) {

View File

@ -107,10 +107,7 @@ if (empty($iid)) {
} else {
admin_externalpage_print_header();
$helpicon = new moodle_help_icon();
$helpicon->text = get_string('uploadusers');
$helpicon->page = 'uploadusers3';
echo $OUTPUT->heading_with_help($helpicon);
echo $OUTPUT->heading_with_help(get_string('uploadusers'), 'uploadusers3');
$mform->display();
echo $OUTPUT->footer();
@ -749,10 +746,7 @@ admin_externalpage_print_header();
/// Print the form
$helpicon = new moodle_help_icon();
$helpicon->text = get_string('uploaduserspreview', 'admin');
$helpicon->page = 'uploadusers2';
echo $OUTPUT->heading_with_help($helpicon);
echo $OUTPUT->heading_with_help(get_string('uploaduserspreview', 'admin'), 'uploadusers2');
$ci = 0;
$ri = 0;

View File

@ -94,7 +94,7 @@ class user_bulk_form extends moodleform {
$grp =& $mform->addElement('group', 'usersgrp', get_string('users'), $objs, ' ', false);
$grp->setHelpButton(array('lists', get_string('users'), 'bulkusers'));
$mform->setHelpButton('usersgrp', array('lists', get_string('users'), 'bulkusers'));
$mform->addElement('static', 'comment');
@ -104,7 +104,7 @@ class user_bulk_form extends moodleform {
$objs[] =& $mform->createElement('submit', 'addall', get_string('addall', 'bulkusers'));
$objs[] =& $mform->createElement('submit', 'removeall', get_string('removeall', 'bulkusers'));
$grp =& $mform->addElement('group', 'buttonsgrp', get_string('selectedlist', 'bulkusers'), $objs, array(' ', '<br />'), false);
$grp->setHelpButton(array('selectedlist', get_string('selectedlist', 'bulkusers'), 'bulkusers'));
$mform->setHelpButton('buttonsgrp', array('selectedlist', get_string('selectedlist', 'bulkusers'), 'bulkusers'));
$renderer =& $mform->defaultRenderer();
$template = '<label class="qflabel" style="vertical-align:top">{label}</label> {element}';

View File

@ -281,7 +281,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
echo "<tr>";
echo "<td align=\"right\" colspan=\"2\"><b>";
echo '<label for="menubackup_site_files">'.get_string ("sitefilesused").'</label>';
echo $OUTPUT->help_icon(moodle_help_icon::make('sitefilesused', get_string('sitefilesused')));
echo $OUTPUT->help_icon('sitefilesused', get_string('sitefilesused'));
echo "</b></td><td colspan=\"2\">";
$course_file_options[0] = get_string("no");
$course_file_options[1] = get_string("yes");

View File

@ -269,7 +269,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
echo '<label for="shortnamefield">'.get_string ('shortname').'</label>';
echo "</td>";
echo "<td><input type=\"text\" id=\"shortnamefield\" name=\"shortname\" maxlength=\"100\" size=\"20\" value=\"".s($form1->shortname)."\" alt=\"".get_string("shortname")."\" />" ;
echo $OUTPUT->help_icon(moodle_help_icon::make("courseshortname", get_string("shortname"))) ;
echo $OUTPUT->help_icon("courseshortname", get_string("shortname"));
if (isset($err["shortname"])) echo $OUTPUT->error_text($err["shortname"]);
echo "</td>";
echo "</tr>";
@ -278,7 +278,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
echo '<label for="fullnamefield">'.get_string ('fullname').'</label>';
echo "</td>";
echo "<td><input type=\"text\" id=\"fullnamefield\" name=\"fullname\" maxlength=\"254\" size=\"50\" value=\"".s($form1->fullname)."\" alt=\" ".get_string("fullname")."\" />" ;
echo $OUTPUT->help_icon(moodle_help_icon::make("coursefullname", get_string("fullname"))) ;
echo $OUTPUT->help_icon("coursefullname", get_string("fullname"));
if (isset($err["fullname"])) echo $OUTPUT->error_text($err["fullname"]);
echo"</td></tr>";
} else {
@ -303,7 +303,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
$yearselector = html_select::make_time_selector('years', "startyear", $form1->startdate);
echo $OUTPUT->select($dayselector) . $OUTPUT->select($monthselector) . $OUTPUT->select($yearselector);
echo $OUTPUT->help_icon(moodle_help_icon::make("coursestartdate", get_string("startdate")));
echo $OUTPUT->help_icon("coursestartdate", get_string("startdate"));
} else {
print_string('notavailable');
echo '<input type="hidden" name="startyear" value="0" />';
@ -463,7 +463,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
//Now print the Groups tr (assume there is no $info->backup_groups)
echo "<tr>";
echo "<td align=\"right\" colspan=\"2\"><b>";
$helplink = $OUTPUT->help_icon(moodle_help_icon::make('grouprestore', get_string('groups')));
$helplink = $OUTPUT->help_icon('grouprestore', get_string('groups'));
echo '<label for="menurestore_groups">'.get_string ("groups").'</label>'.$helplink;
echo "</b></td><td colspan=\"2\">";
if (empty($CFG->enablegroupings)) {

View File

@ -36,7 +36,7 @@ class block_search_forums extends block_base {
'<input id="searchform_search" name="search" type="text" size="16" />';
$this->content->text .= '<button id="searchform_button" type="submit" title="'.$search.'">'.$button.'</button><br />';
$this->content->text .= '<a href="'.$CFG->wwwroot.'/mod/forum/search.php?id='.$this->page->course->id.'">'.$advancedsearch.'</a>';
$this->content->text .= $OUTPUT->help_icon(moodle_help_icon::make('search', $advancedsearch));
$this->content->text .= $OUTPUT->help_icon('search', $advancedsearch);
$this->content->text .= '</fieldset></form></div>';
return $this->content;

View File

@ -232,7 +232,7 @@ class block_tags extends block_base {
$tagthisunit = get_string('tagthisunit', $tagslang);
$buttonadd = get_string('add', $tagslang);
$arrowtitle = get_string('arrowtitle', $tagslang);
$coursetaghelpbutton = $OUTPUT->help_icon(moodle_help_icon::make('addtags', 'adding tags', $tagslang));
$coursetaghelpbutton = $OUTPUT->help_icon('addtags', 'adding tags', $tagslang);
$sesskey = sesskey();
$arrowright = $OUTPUT->pix_url('t/arrow_left');
$this->content->footer .= <<<EOT

View File

@ -79,10 +79,7 @@ $PAGE->navbar->add($stredit);
$PAGE->set_focuscontrol('theform.summary');
echo $OUTPUT->header();
$helpicon = new moodle_help_icon();
$helpicon->text = $strsummaryof;
$helpicon->page = 'summaries';
echo $OUTPUT->heading_with_help($helpicon);
echo $OUTPUT->heading_with_help($strsummaryof, 'summaries');
$mform->display();
echo $OUTPUT->footer();

View File

@ -35,10 +35,7 @@ $strusers = get_string("users");
$strusersnew = get_string("usersnew");
$strimportgroups = get_string("importgroups");
$helpicon = new moodle_help_icon();
$helpicon->text = $strimportgroups;
$helpicon->page = 'uploadgroups';
echo $OUTPUT->heading_with_help($helpicon);
echo $OUTPUT->heading_with_help($strimportgroups, 'uploadgroups');
$maxuploadsize = get_max_upload_file_size();
echo '<p align="center">';

View File

@ -3026,7 +3026,7 @@ function print_groupmode_setting($form, $course=NULL) {
$select = html_select::make($choices, 'groupmode', $groupmode, false);
$select->disabled = $course->groupmodeforce;
echo $OUTPUT->select($select);
echo $OUTPUT->help_icon(moodle_help_icon::make('groupmode', get_string('groupmode')));
echo $OUTPUT->help_icon('groupmode', get_string('groupmode'));
echo '</td></tr>';
}
}

View File

@ -616,11 +616,7 @@
require($CFG->dirroot.'/'.$CFG->admin.'/roles/tabs.php');
}
$helpicon = new moodle_help_icon();
$helpicon->page = 'mods';
$helpicon->text = $pageheading;
$helpicon->module = $module->name;
echo $OUTPUT->heading_with_help($helpicon, $OUTPUT->pix_url('icon', $module->name));
echo $OUTPUT->heading_with_help($pageheading, 'mods', $module->name, 'icon');
$mform->display();

View File

@ -126,7 +126,7 @@
echo $OUTPUT->select(html_select::make($roleoptions,'roleid',$roleid,false));
echo '<label for="menuaction">'.get_string('showactions').'</label>'."\n";
echo $OUTPUT->select(html_select::make($actionoptions,'action',$action,false));
echo $OUTPUT->help_icon(moodle_help_icon::make('participationreport',get_string('participationreport')));
echo $OUTPUT->help_icon('participationreport', get_string('participationreport'));
echo '<input type="submit" value="'.get_string('go').'" />'."\n</div></form>\n";
$baseurl = $CFG->wwwroot.'/course/report/participation/index.php?id='.$course->id.'&amp;roleid='
@ -281,7 +281,7 @@
$select->label = get_string("withselectedusers");
$select->add_action('change', 'conditionalsubmit', array('formid' => 'studentsform'));
echo $OUTPUT->select($select);
echo $OUTPUT->help_icon(moodle_help_icon::make("participantswithselectedusers", get_string("withselectedusers")));
echo $OUTPUT->help_icon("participantswithselectedusers", get_string("withselectedusers"));
echo '<input type="submit" value="' . get_string('ok') . '" />'."\n";
echo '</div>'."\n";
echo '</form>'."\n";

View File

@ -131,7 +131,7 @@ if (!isset($frm->acceptechecktypes)) {
<tr valign="top">
<td align="right">an_authcode:</td>
<td><?php echo $OUTPUT->checkbox(html_select_option::make_checkbox('1', !empty($frm->an_authcode), get_string("adminauthcode", "enrol_authorize")), 'an_authcode'); ?>
<?php echo $OUTPUT->help_icon(moodle_help_icon::make('authorize/authcode', 'authcode', 'enrol')); ?><br />
<?php echo $OUTPUT->help_icon('authorize/authcode', 'authcode', 'enrol'); ?><br />
</td>
</tr>
@ -177,20 +177,20 @@ if (!isset($frm->acceptechecktypes)) {
</tr>
<tr valign="top"><td colspan="2"><h4><?php print_string("adminauthorizeccapture", "enrol_authorize") ?>
<?php echo $OUTPUT->help_icon(moodle_help_icon::make('authorize/orderreview', 'orderreview', 'enrol')); ?>
<?php echo $OUTPUT->help_icon('authorize/orderreview', 'orderreview', 'enrol'); ?>
</h4></td></tr>
<tr valign="top">
<td align="right">an_review:</td>
<td><?php echo $OUTPUT->checkbox(html_select_option::make_checkbox('1', !empty($frm->an_review), get_string("adminreview", "enrol_authorize")), 'an_review'); ?>
<?php echo $OUTPUT->help_icon(moodle_help_icon::make('authorize/review', get_string('adminhelpreviewtitle', 'enrol_authorize'), 'enrol')); ?><br />
<?php echo $OUTPUT->help_icon('authorize/review', get_string('adminhelpreviewtitle', 'enrol_authorize'), 'enrol'); ?><br />
</td>
</tr>
<tr valign="top">
<td align="right">an_capture_day:</td>
<td><input type="text" name="an_capture_day" size="2" maxlength="2" value="<?php p($frm->an_capture_day) ?>" />
<?php echo $OUTPUT->help_icon(moodle_help_icon::make('authorize/captureday', get_string('adminhelpcapturetitle', 'enrol_authorize'), 'enrol')); ?><br />
<?php echo $OUTPUT->help_icon('authorize/captureday', get_string('adminhelpcapturetitle', 'enrol_authorize'), 'enrol'); ?><br />
<?php print_string("reviewday", "enrol_authorize", $frm->an_capture_day) ?></td>
</tr>

View File

@ -23,11 +23,7 @@
$PAGE->set_button($managebutton);
echo $OUTPUT->header();
$helpicon = new moodle_help_icon();
$helpicon->text = $struploadcsv;
$helpicon->page = 'authorize/uploadcsv';
$helpicon->module = 'enrol';
echo $OUTPUT->heading_with_help($helpicon);
echo $OUTPUT->heading_with_help($struploadcsv, 'authorize/uploadcsv', 'enrol');
/// Handle CSV file
if (($form = data_submitted()) && confirm_sesskey()) {

View File

@ -38,7 +38,7 @@
<input type="checkbox" value="1" name="enrol_createnewusers" <?php if ($frm->enrol_createnewusers) echo "checked=\"checked\"" ?> />
</td>
<td>
<?php echo $OUTPUT->help_icon(moodle_help_icon::make('createnewusers', 'More detail about this option', 'enrol/imsenterprise')); ?>
<?php echo $OUTPUT->help_icon('createnewusers', 'More detail about this option', 'enrol/imsenterprise'); ?>
</td>
</tr>
@ -48,7 +48,7 @@
<input type="checkbox" value="1" name="enrol_imsdeleteusers" <?php if ($frm->enrol_imsdeleteusers) echo "checked=\"checked\"" ?> />
</td>
<td>
<?php echo $OUTPUT->help_icon(moodle_help_icon::make('deleteusers', 'More detail about this option', 'enrol/imsenterprise')); ?>
<?php echo $OUTPUT->help_icon('deleteusers', 'More detail about this option', 'enrol/imsenterprise'); ?>
</td>
</tr>
@ -78,7 +78,7 @@
<input type="checkbox" value="1" name="enrol_imssourcedidfallback" <?php if ($frm->enrol_imssourcedidfallback) echo "checked=\"checked\"" ?> />
</td>
<td>
<?php echo $OUTPUT->help_icon(moodle_help_icon::make('sourceddidfallback', 'More detail about this option', 'enrol/imsenterprise')); ?>
<?php echo $OUTPUT->help_icon('sourceddidfallback', 'More detail about this option', 'enrol/imsenterprise'); ?>
</td>
</tr>
<!--
@ -138,7 +138,7 @@ foreach($this->imsroles as $imsrolenum=>$imsrolename){
<input type="text" <?php echo 'value="'.intval($frm->enrol_truncatecoursecodes).'"' ?> name="enrol_truncatecoursecodes" size="3" maxlength="3" />
</td>
<td>
<?php echo $OUTPUT->help_icon(moodle_help_icon::make('truncatecoursecodes', 'More detail about this option', 'enrol/imsenterprise')); ?>
<?php echo $OUTPUT->help_icon('truncatecoursecodes', 'More detail about this option', 'enrol/imsenterprise'); ?>
</td>
</tr>
@ -148,7 +148,7 @@ foreach($this->imsroles as $imsrolenum=>$imsrolename){
<input type="checkbox" value="1" name="enrol_createnewcourses" <?php if ($frm->enrol_createnewcourses) echo "checked=\"checked\"" ?> />
</td>
<td>
<?php echo $OUTPUT->help_icon(moodle_help_icon::make('createnewcourses', 'More detail about this option', 'enrol/imsenterprise')); ?>
<?php echo $OUTPUT->help_icon('createnewcourses', 'More detail about this option', 'enrol/imsenterprise'); ?>
</td>
</tr>
@ -158,7 +158,7 @@ foreach($this->imsroles as $imsrolenum=>$imsrolename){
<input type="checkbox" value="1" name="enrol_createnewcategories" <?php if ($frm->enrol_createnewcategories) echo "checked=\"checked\"" ?> />
</td>
<td>
<?php echo $OUTPUT->help_icon(moodle_help_icon::make('categorisation', 'More detail about this option', 'enrol/imsenterprise')); ?>
<?php echo $OUTPUT->help_icon('categorisation', 'More detail about this option', 'enrol/imsenterprise'); ?>
</td>
</tr>
@ -168,7 +168,7 @@ foreach($this->imsroles as $imsrolenum=>$imsrolename){
<input type="checkbox" value="1" name="enrol_imsunenrol" <?php if ($frm->enrol_imsunenrol) echo "checked=\"checked\"" ?> />
</td>
<td>
<?php echo $OUTPUT->help_icon(moodle_help_icon::make('unenrol', 'More detail about this option', 'enrol/imsenterprise')); ?>
<?php echo $OUTPUT->help_icon('unenrol', 'More detail about this option', 'enrol/imsenterprise'); ?>
</td>
</tr>
@ -180,7 +180,7 @@ foreach($this->imsroles as $imsrolenum=>$imsrolename){
<td align="right"><?php print_string('restricttarget', 'enrol_imsenterprise') ?>:</td>
<td colspan="2">
<input type="text" <?php echo 'value="'.htmlspecialchars($frm->enrol_imsrestricttarget).'"' ?> name="enrol_imsrestricttarget" size="20" maxlength="32" />
<?php echo $OUTPUT->help_icon(moodle_help_icon::make('target', 'More detail about this option', 'enrol/imsenterprise')); ?>
<?php echo $OUTPUT->help_icon('target', 'More detail about this option', 'enrol/imsenterprise'); ?>
</td>
</tr>
@ -190,7 +190,7 @@ foreach($this->imsroles as $imsrolenum=>$imsrolename){
<input type="checkbox" value="1" name="enrol_imscapitafix" <?php if ($frm->enrol_imscapitafix) echo "checked=\"checked\"" ?> />
</td>
<td>
<?php echo $OUTPUT->help_icon(moodle_help_icon::make('capita', 'More detail about this option', 'enrol/imsenterprise')); ?>
<?php echo $OUTPUT->help_icon('capita', 'More detail about this option', 'enrol/imsenterprise'); ?>
</td>
</tr>

View File

@ -125,10 +125,7 @@ if ($context->contextlevel == CONTEXT_COURSE and $context->instanceid == SITEID)
}
/// Print heading.
$helpicon = new moodle_help_icon();
$helpicon->text = $title;
$helpicon->page = 'localfiltersettings';
echo $OUTPUT->heading_with_help($helpicon);
echo $OUTPUT->heading_with_help($title, 'localfiltersettings');
if (empty($availablefilters)) {
echo '<p class="centerpara">' . get_string('nofiltersenabled', 'filters') . "</p>\n";

View File

@ -649,7 +649,7 @@ class grade_edit_tree_column_aggregation extends grade_edit_tree_column_category
public function get_header_cell() {
global $OUTPUT;
$headercell = clone($this->headercell);
$headercell->text = get_string('aggregation', 'grades').$OUTPUT->help_icon(moodle_help_icon::make('aggregation', 'aggregation', 'grade'));
$headercell->text = get_string('aggregation', 'grades').$OUTPUT->help_icon('aggregation', 'aggregation', 'grade');
return $headercell;
}
@ -706,7 +706,7 @@ class grade_edit_tree_column_extracredit extends grade_edit_tree_column {
public function get_header_cell() {
global $OUTPUT;
$headercell = clone($this->headercell);
$headercell->text = get_string('extracredit', 'grades').$OUTPUT->help_icon(moodle_help_icon::make('aggregationcoefcombo', 'aggregationcoefcombo', 'grade'));
$headercell->text = get_string('extracredit', 'grades').$OUTPUT->help_icon('aggregationcoefcombo', 'aggregationcoefcombo', 'grade');
return $headercell;
}
@ -748,7 +748,7 @@ class grade_edit_tree_column_weight extends grade_edit_tree_column {
public function get_header_cell() {
global $OUTPUT;
$headercell = clone($this->headercell);
$headercell->text = get_string('weightuc', 'grades').$OUTPUT->help_icon(moodle_help_icon::make('aggregationcoefweight', 'aggregationcoefweight', 'grade'));
$headercell->text = get_string('weightuc', 'grades').$OUTPUT->help_icon('aggregationcoefweight', 'aggregationcoefweight', 'grade');
return $headercell;
}
@ -846,7 +846,7 @@ class grade_edit_tree_column_aggregateonlygraded extends grade_edit_tree_column_
$headercell = clone($this->headercell);
$headercell->style .= 'width: 40px;';
$headercell->text = get_string('aggregateonlygraded', 'grades')
. $OUTPUT->help_icon(moodle_help_icon::make('aggregateonlygraded', 'aggregateonlygraded', 'grade'));
. $OUTPUT->help_icon('aggregateonlygraded', 'aggregateonlygraded', 'grade');
return $headercell;
}
@ -892,7 +892,7 @@ class grade_edit_tree_column_aggregatesubcats extends grade_edit_tree_column_cat
$headercell = clone($this->headercell);
$headercell->style .= 'width: 40px;';
$headercell->text = get_string('aggregatesubcats', 'grades')
.$OUTPUT->help_icon(moodle_help_icon::make('aggregatesubcats', 'aggregatesubcats', 'grade'));
.$OUTPUT->help_icon('aggregatesubcats', 'aggregatesubcats', 'grade');
return $headercell;
}
@ -938,7 +938,7 @@ class grade_edit_tree_column_aggregateoutcomes extends grade_edit_tree_column_ca
$headercell = clone($this->headercell);
$headercell->style .= 'width: 40px;';
$headercell->text = get_string('aggregateoutcomes', 'grades')
.$OUTPUT->help_icon(moodle_help_icon::make('aggregateoutcomes', 'aggregateoutcomes', 'grade'));
.$OUTPUT->help_icon('aggregateoutcomes', 'aggregateoutcomes', 'grade');
return $headercell;
}
@ -990,7 +990,7 @@ class grade_edit_tree_column_droplow extends grade_edit_tree_column_category {
public function get_header_cell() {
global $OUTPUT;
$headercell = clone($this->headercell);
$headercell->text = get_string('droplow', 'grades').$OUTPUT->help_icon(moodle_help_icon::make('droplow', 'droplow', 'grade'));
$headercell->text = get_string('droplow', 'grades').$OUTPUT->help_icon('droplow', 'droplow', 'grade');
return $headercell;
}
@ -1026,7 +1026,7 @@ class grade_edit_tree_column_keephigh extends grade_edit_tree_column_category {
public function get_header_cell() {
global $OUTPUT;
$headercell = clone($this->headercell);
$headercell->text = get_string('keephigh', 'grades').$OUTPUT->help_icon(moodle_help_icon::make('keephigh', 'keephigh', 'grade'));
$headercell->text = get_string('keephigh', 'grades').$OUTPUT->help_icon('keephigh', 'keephigh', 'grade');
return $headercell;
}
@ -1062,7 +1062,7 @@ class grade_edit_tree_column_multfactor extends grade_edit_tree_column {
public function get_header_cell() {
global $OUTPUT;
$headercell = clone($this->headercell);
$headercell->text = get_string('multfactor', 'grades').$OUTPUT->help_icon(moodle_help_icon::make('multfactor', 'multfactor', 'grade'));
$headercell->text = get_string('multfactor', 'grades').$OUTPUT->help_icon('multfactor', 'multfactor', 'grade');
return $headercell;
}
@ -1104,7 +1104,7 @@ class grade_edit_tree_column_plusfactor extends grade_edit_tree_column {
public function get_header_cell() {
global $OUTPUT;
$headercell = clone($this->headercell);
$headercell->text = get_string('plusfactor', 'grades').$OUTPUT->help_icon(moodle_help_icon::make('plusfactor', 'plusfactor', 'grade'));
$headercell->text = get_string('plusfactor', 'grades').$OUTPUT->help_icon('plusfactor', 'plusfactor', 'grade');
return $headercell;
}

View File

@ -169,7 +169,7 @@ class completion_info {
global $PAGE, $OUTPUT;
if ($this->is_enabled() && !$PAGE->user_is_editing() && isloggedin() && !isguestuser()) {
echo '<span id = "completionprogressid" class="completionprogress">'.get_string('yourprogress','completion').' ';
echo $OUTPUT->help_icon(moodle_help_icon::make('completionicons',get_string('completionicons','completion'),'completion'));
echo $OUTPUT->help_icon('completionicons',get_string('completionicons','completion'),'completion');
echo '</span>';
}
}

View File

@ -2443,54 +2443,10 @@ function print_table($table, $return=false) {
* @param string $class class added to the element
* @return string html code to display a link to a popup window.
*/
function link_to_popup_window ($url, $name=null, $linkname=null,
$height=400, $width=500, $title=null,
$options=null, $return=false) {
global $OUTPUT;
function link_to_popup_window ($url, $name=null, $linkname=null, $height=400, $width=500, $title=null, $options=null, $return=false) {
debugging('link_to_popup_window() has been removed. Please change your code to use $OUTPUT->link(). Please note popups are discouraged for accessibility reasons');
debugging('link_to_popup_window() has been deprecated. Please change your code to use $OUTPUT->link().');
if ($options == 'none') {
$options = null;
}
if (empty($linkname)) {
throw new coding_exception('A link must have a descriptive text value! See $OUTPUT->link_to_popup() for usage.');
}
// Create a html_link object
$link = html_link::make($url, $linkname);
$link->title = $title;
// Parse the $options string
$popupparams = array();
if (!empty($options)) {
$optionsarray = explode(',', $options);
foreach ($optionsarray as $option) {
if (strstr($option, '=')) {
$parts = explode('=', $option);
if ($parts[1] == '0') {
$popupparams[$parts[0]] = false;
} else {
$popupparams[$parts[0]] = $parts[1];
}
} else {
$popupparams[$option] = true;
}
}
}
$popupaction = new popup_action('click', $url, $name, $popupparams);
$link->add_action($popupaction);
// Call the output method
$output = $OUTPUT->link($link);
if ($return) {
return $output;
} else {
echo $output;
}
return $OUTPUT->link($url, $name);
}
/**
@ -2523,7 +2479,7 @@ function button_to_popup_window ($url, $name=null, $linkname=null,
}
if (empty($linkname)) {
throw new coding_exception('A link must have a descriptive text value! See $OUTPUT->link_to_popup() for usage.');
throw new coding_exception('A link must have a descriptive text value! See $OUTPUT->link() for usage.');
}
// Create a html_button object
@ -2796,36 +2752,132 @@ function helpbutton($page, $title, $module='moodle', $image=true, $linktext=fals
global $OUTPUT;
if (!empty($text)) {
throw new coding_exception('The $text parameter has been deprecated. Please update your code and use $OUTPUT->help_icon() instead. <br />' .
"You will also need to copy the following text into a proper html help file if not already done so: <p>$text</p>");
}
$output = $OUTPUT->help_icon($page, $title, $module, $linktext);
if (!empty($imagetext)) {
throw new coding_exception('The $imagetext parameter has been deprecated. Please update your code and use $OUTPUT->help_icon() instead.');
}
$helpicon = new moodle_help_icon();
$helpicon->page = $page;
$helpicon->text = $title;
$helpicon->module = $module;
$helpicon->linktext = $linktext;
// If image is true, the defaults are handled by the helpicon's prepare method
if (!$image) {
$helpicon->image = false;
}
$output = $OUTPUT->help_icon($helpicon);
// hide image with CSS if needed
if ($return) {
return $output;
} else {
echo $output;
}
}
/**
* Print a help button.
*
* Prints a special help button that is a link to the "live" emoticon popup
*
* @todo Finish documenting this function
*
* @global object
* @global object
* @param string $form ?
* @param string $field ?
* @param boolean $return If true then the output is returned as a string, if false it is printed to the current page.
* @return string|void Depending on value of $return
*/
function emoticonhelpbutton($form, $field, $return = false) {
/// TODO: MDL-21215
debugging('emoticonhelpbutton() was removed, new text editors will implement this feature');
}
/**
* Returns a string of html with an image of a help icon linked to a help page on a number of help topics.
* Should be used only with htmleditor or textarea.
*
* @global object
* @global object
* @param mixed $helptopics variable amount of params accepted. Each param may be a string or an array of arguments for
* helpbutton.
* @return string Link to help button
*/
function editorhelpbutton(){
return '';
/// TODO: MDL-21215
global $CFG, $SESSION, $OUTPUT;
$items = func_get_args();
$i = 1;
$urlparams = array();
$titles = array();
foreach ($items as $item){
if (is_array($item)){
$urlparams[] = "keyword$i=".urlencode($item[0]);
$urlparams[] = "title$i=".urlencode($item[1]);
if (isset($item[2])){
$urlparams[] = "module$i=".urlencode($item[2]);
}
$titles[] = trim($item[1], ". \t");
} else if (is_string($item)) {
$urlparams[] = "button$i=".urlencode($item);
switch ($item) {
case 'reading' :
$titles[] = get_string("helpreading");
break;
case 'writing' :
$titles[] = get_string("helpwriting");
break;
case 'questions' :
$titles[] = get_string("helpquestions");
break;
case 'emoticons2' :
$titles[] = get_string("helpemoticons");
break;
case 'richtext2' :
$titles[] = get_string('helprichtext');
break;
case 'text2' :
$titles[] = get_string('helptext');
break;
default :
print_error('unknownhelp', '', '', $item);
}
}
$i++;
}
if (count($titles)>1){
//join last two items with an 'and'
$a = new object();
$a->one = $titles[count($titles) - 2];
$a->two = $titles[count($titles) - 1];
$titles[count($titles) - 2] = get_string('and', '', $a);
unset($titles[count($titles) - 1]);
}
$alttag = join (', ', $titles);
$paramstring = join('&', $urlparams);
$linkobject = '<img alt="'.$alttag.'" class="iconhelp" src="'.$OUTPUT->pix_url('help') . '" />';
$link = html_link::make(s('/lib/form/editorhelp.php?'.$paramstring), $linkobject);
$link->add_action(new popup_action('click', $link->url, 'popup', array('height' => 400, 'width' => 500)));
$link->title = $alttag;
return $OUTPUT->link($link);
}
/**
* Print a help button.
*
* Prints a special help button for html editors (htmlarea in this case)
*
* @todo Write code into this function! detect current editor and print correct info
* @global object
* @return string Only returns an empty string at the moment
*/
function editorshortcutshelpbutton() {
/// TODO: MDL-21215
global $CFG;
//TODO: detect current editor and print correct info
/* $imagetext = '<img src="' . $CFG->httpswwwroot . '/lib/editor/htmlarea/images/kbhelp.gif" alt="'.
get_string('editorshortcutkeys').'" class="iconkbhelp" />';
return helpbutton('editorshortcuts', get_string('editorshortcutkeys'), 'moodle', true, false, '', true, $imagetext);*/
return '';
}
/**
* Returns an image of an up or down arrow, used for column sorting. To avoid unnecessary DB accesses, please
* provide this function with the language strings for sortasc and sortdesc.
@ -3143,10 +3195,10 @@ function choose_from_menu_nested($options,$name,$selected='',$nothing='choose',$
* @return string|bool Depending on value of $return
*/
function print_scale_menu_helpbutton($courseid, $scale, $return=false) {
// debugging('print_scale_menu_helpbutton() has been deprecated. Please change your code to use $OUTPUT->help_button($scaleselect).');
// debugging('print_scale_menu_helpbutton() has been deprecated. Please change your code to use $OUTPUT->help_scale($courseid, $scale).');
global $OUTPUT;
$output = $OUTPUT->help_button(help_button::make_scale_menu($courseid, $scale));
$output = $OUTPUT->help_icon_scale($courseid, $scale);
if ($return) {
return $output;
@ -3451,17 +3503,15 @@ function print_heading_with_help($text, $helppage, $module='moodle', $icon=false
global $OUTPUT;
$helpicon = new moodle_help_icon();
$helpicon->page = $helppage;
$helpicon->text = $text;
$helpicon->module = $module;
// Extract the src from $icon if it exists
if (preg_match('/src="([^"]*)"/', $icon, $matches)) {
$icon = $matches[1];
$icon = moodle_url($icon);
} else {
$icon = '';
}
$output = $OUTPUT->heading_with_help($helpicon, $icon);
$output = $OUTPUT->heading_with_help($text, $helppage, $module, $icon);
if ($return) {
return $output;

View File

@ -76,18 +76,7 @@ class MoodleQuickForm_advcheckbox extends HTML_QuickForm_advcheckbox{
* @param string $function function name to call to get html
*/
function setHelpButton($helpbuttonargs, $function='helpbutton'){
if (!is_array($helpbuttonargs)){
$helpbuttonargs=array($helpbuttonargs);
}else{
$helpbuttonargs=$helpbuttonargs;
}
//we do this to to return html instead of printing it
//without having to specify it in every call to make a button.
if ('helpbutton' == $function){
$defaultargs=array('', '', 'moodle', true, false, '', true);
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
}
$this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
debugging('component setHelpButton() is not used any more, please use $mform->setHelpButton() instead');
}
/**
* get html for help button

View File

@ -47,18 +47,7 @@ class MoodleQuickForm_button extends HTML_QuickForm_button
* @param string $function function name to call to get html
*/
function setHelpButton($helpbuttonargs, $function='helpbutton'){
if (!is_array($helpbuttonargs)){
$helpbuttonargs=array($helpbuttonargs);
}else{
$helpbuttonargs=$helpbuttonargs;
}
//we do this to to return html instead of printing it
//without having to specify it in every call to make a button.
if ('helpbutton' == $function){
$defaultargs=array('', '', 'moodle', true, false, '', true);
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
}
$this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
debugging('component setHelpButton() is not used any more, please use $mform->setHelpButton() instead');
}
/**
* get html for help button

View File

@ -25,18 +25,7 @@ class MoodleQuickForm_checkbox extends HTML_QuickForm_checkbox{
* @param string $function function name to call to get html
*/
function setHelpButton($helpbuttonargs, $function='helpbutton'){
if (!is_array($helpbuttonargs)){
$helpbuttonargs=array($helpbuttonargs);
}else{
$helpbuttonargs=$helpbuttonargs;
}
//we do this to to return html instead of printing it
//without having to specify it in every call to make a button.
if ('helpbutton' == $function){
$defaultargs=array('', '', 'moodle', true, false, '', true);
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
}
$this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
debugging('component setHelpButton() is not used any more, please use $mform->setHelpButton() instead');
}
/**
* get html for help button

View File

@ -25,18 +25,7 @@ class MoodleQuickForm_file extends HTML_QuickForm_file{
* @param string $function function name to call to get html
*/
function setHelpButton($helpbuttonargs, $function='helpbutton'){
if (!is_array($helpbuttonargs)){
$helpbuttonargs=array($helpbuttonargs);
}else{
$helpbuttonargs=$helpbuttonargs;
}
//we do this to to return html instead of printing it
//without having to specify it in every call to make a button.
if ('helpbutton' == $function){
$defaultargs=array('', '', 'moodle', true, false, '', true);
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
}
$this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
debugging('component setHelpButton() is not used any more, please use $mform->setHelpButton() instead');
}
/**
* set html for help button

View File

@ -97,18 +97,7 @@ class MoodleQuickForm_filemanager extends HTML_QuickForm_element {
}
function setHelpButton($helpbuttonargs, $function='helpbutton'){
if (!is_array($helpbuttonargs)){
$helpbuttonargs=array($helpbuttonargs);
}else{
$helpbuttonargs=$helpbuttonargs;
}
//we do this to to return html instead of printing it
//without having to specify it in every call to make a button.
if ('helpbutton' == $function){
$defaultargs=array('', '', 'moodle', true, false, '', true);
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
}
$this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
debugging('component setHelpButton() is not used any more, please use $mform->setHelpButton() instead');
}
function getHelpButton() {

View File

@ -36,18 +36,7 @@ class MoodleQuickForm_filepicker extends HTML_QuickForm_input {
}
function setHelpButton($helpbuttonargs, $function='helpbutton') {
if (!is_array($helpbuttonargs)) {
$helpbuttonargs = array($helpbuttonargs);
} else {
$helpbuttonargs = $helpbuttonargs;
}
//we do this to to return html instead of printing it
//without having to specify it in every call to make a button.
if ('helpbutton' == $function){
$defaultargs = array('', '', 'moodle', true, false, '', true);
$helpbuttonargs = $helpbuttonargs + $defaultargs ;
}
$this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
debugging('component setHelpButton() is not used any more, please use $mform->setHelpButton() instead');
}
function getHelpButton() {

View File

@ -51,34 +51,6 @@ class MoodleQuickForm_format extends MoodleQuickForm_select{
}
} //end constructor
/**
* Add a single button.
*
* @param string $elementname name of the element to add the item to
* @param array $button arguments to pass to function $function
* @param boolean $suppresscheck whether to throw an error if the element
* doesn't exist.
* @param string $function - function to generate html from the arguments in $button
* @param string $function
*/
function setHelpButton($button, $function='helpbutton'){
global $OUTPUT;
//_elements has a numeric index, this code accesses the elements by name
$buttonparams = array('page', 'text', 'module', 'image', 'linktext', 'text', 'return', 'imagetext');
$helpiconoptions = array('page' => null, 'text' => null, 'module' => 'moodle', 'image' => null, 'linktext' => false);
foreach ($button as $key => $val) {
if (isset($button[$key])) {
$helpiconoptions[$buttonparams[$key]] = $val;
}
}
$helpicon = moodle_help_icon::make($helpiconoptions['page'], $helpiconoptions['text'], $helpiconoptions['module'], $helpiconoptions['linktext']);
if (!$helpiconoptions['image']) {
$helpicon->image = false;
}
$this->_helpbutton = $OUTPUT->help_icon($helpicon);
}
/**
* Called by HTML_QuickForm whenever form event is made on this element
*
@ -95,7 +67,7 @@ class MoodleQuickForm_format extends MoodleQuickForm_select{
case 'createElement':
$menu = format_text_menu();
$this->load($menu);
$this->setHelpButton(array('textformat', get_string('helpformatting')));
//$this->setHelpButton(array('textformat', get_string('helpformatting')));
break;
case 'updateValue' :
$value = $this->_findValue($caller->_constantValues);

View File

@ -30,21 +30,7 @@ class MoodleQuickForm_group extends HTML_QuickForm_group{
* @param string $function function name to call to get html
*/
function setHelpButton($helpbuttonargs, $function='helpbutton'){
global $OUTPUT;
if (!is_array($helpbuttonargs)){
$helpbuttonargs=array($helpbuttonargs);
}else{
$helpbuttonargs=$helpbuttonargs;
}
//we do this to to return html instead of printing it
//without having to specify it in every call to make a button.
if ($function == 'helpbutton') {
$defaultargs=array('', '', 'moodle', true, false, '', true);
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
$this->_helpbutton=$OUTPUT->help_icon(call_user_func_array('moodle_help_icon::make', $helpbuttonargs));
} else {
$this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
}
debugging('component setHelpButton() is not used any more, please use $mform->setHelpButton() instead');
}
/**
* set html for help button

View File

@ -43,18 +43,7 @@ class MoodleQuickForm_header extends HTML_QuickForm_header
* @param string $function function name to call to get html
*/
function setHelpButton($helpbuttonargs, $function='helpbutton'){
if (!is_array($helpbuttonargs)){
$helpbuttonargs=array($helpbuttonargs);
}else{
$helpbuttonargs=$helpbuttonargs;
}
//we do this to to return html instead of printing it
//without having to specify it in every call to make a button.
if ('helpbutton' == $function){
$defaultargs=array('', '', 'moodle', true, false, '', true);
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
}
$this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
debugging('component setHelpButton() is not used any more, please use $mform->setHelpButton() instead');
}
/**
* get html for help button

View File

@ -47,18 +47,7 @@ class MoodleQuickForm_htmleditor extends MoodleQuickForm_textarea{
* @param string $function function name to call to get html
*/
function setHelpButton($helpbuttonargs, $function='helpbutton'){
if (!$this->_canUseHtmlEditor){
if ('editorhelpbutton' == $function){
$key = array_search('richtext2', $helpbuttonargs);
if ($key !== FALSE){
array_splice($helpbuttonargs, $key, 1, array('text2', 'emoticons2'));
}
} elseif ('helpbutton' == $function && $helpbuttonargs[0] == 'richtext2' && ((!isset($helpbuttonargs[2])) || $helpbuttonargs[2] == 'moodle')){
//replace single 'richtext' help button with text and emoticon button when htmleditor off.
return $this->setHelpButton(array('text2', 'emoticons2'), 'editorhelpbutton');
}
}
return parent::setHelpButton($helpbuttonargs, $function);
debugging('component setHelpButton() is not used any more, please use $mform->setHelpButton() instead');
}
function toHtml(){

View File

@ -62,7 +62,8 @@ class MoodleQuickForm_modgrade extends MoodleQuickForm_select{
$grades[$i] = $i;
}
$this->load($grades);
$this->setHelpButton(array($COURSE->id), 'modgradehelpbutton');
//TODO: rewrite mod grading support in modforms
// $this->setHelpButton(array($COURSE->id), 'modgradehelpbutton');
return $result;
}
return parent::onQuickFormEvent($event, $arg, $caller);

View File

@ -25,18 +25,7 @@ class MoodleQuickForm_password extends HTML_QuickForm_password{
* @param string $function function name to call to get html
*/
function setHelpButton($helpbuttonargs, $function='helpbutton'){
if (!is_array($helpbuttonargs)){
$helpbuttonargs=array($helpbuttonargs);
}else{
$helpbuttonargs=$helpbuttonargs;
}
//we do this to to return html instead of printing it
//without having to specify it in every call to make a button.
if ('helpbutton' == $function){
$defaultargs=array('', '', 'moodle', true, false, '', true);
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
}
$this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
debugging('component setHelpButton() is not used any more, please use $mform->setHelpButton() instead');
}
/**
* get html for help button

View File

@ -25,18 +25,7 @@ class MoodleQuickForm_radio extends HTML_QuickForm_radio{
* @param string $function function name to call to get html
*/
function setHelpButton($helpbuttonargs, $function='helpbutton'){
if (!is_array($helpbuttonargs)){
$helpbuttonargs=array($helpbuttonargs);
}else{
$helpbuttonargs=$helpbuttonargs;
}
//we do this to to return html instead of printing it
//without having to specify it in every call to make a button.
if ('helpbutton' == $function){
$defaultargs=array('', '', 'moodle', true, false, '', true);
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
}
$this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
debugging('component setHelpButton() is not used any more, please use $mform->setHelpButton() instead');
}
/**
* get html for help button

View File

@ -7,7 +7,6 @@
* @category Admin
* @package admin
* @author Nicolas Connault <nicolasconnault@gmail.com>
* @version $Id$
*/
@ -96,18 +95,7 @@ class MoodleQuickForm_recaptcha extends HTML_QuickForm_input {
* @param string $function function name to call to get html
*/
function setHelpButton($helpbuttonargs, $function='helpbutton'){
if (!is_array($helpbuttonargs)){
$helpbuttonargs=array($helpbuttonargs);
}else{
$helpbuttonargs=$helpbuttonargs;
}
//we do this to to return html instead of printing it
//without having to specify it in every call to make a button.
if ('helpbutton' == $function){
$defaultargs=array('', '', 'moodle', true, false, '', true);
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
}
$this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
debugging('component setHelpButton() is not used any more, please use $mform->setHelpButton() instead');
}
/**

View File

@ -57,21 +57,7 @@ class MoodleQuickForm_select extends HTML_QuickForm_select{
* @param string $function function name to call to get html
*/
function setHelpButton($helpbuttonargs, $function='helpbutton'){
global $OUTPUT;
if (!is_array($helpbuttonargs)){
$helpbuttonargs=array($helpbuttonargs);
}else{
$helpbuttonargs=$helpbuttonargs;
}
//we do this to to return html instead of printing it
//without having to specify it in every call to make a button.
if ('helpbutton' == $function){
$defaultargs=array('', '', 'moodle', true, false, '', true);
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
$this->_helpbutton=$OUTPUT->help_icon(call_user_func_array('moodle_help_icon::make', $helpbuttonargs));
} else {
$this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
}
debugging('component setHelpButton() is not used any more, please use $mform->setHelpButton() instead');
}
/**
* get html for help button

View File

@ -570,18 +570,7 @@ class MoodleQuickForm_selectgroups extends HTML_QuickForm_element {
* @param string $function function name to call to get html
*/
function setHelpButton($helpbuttonargs, $function='helpbutton'){
if (!is_array($helpbuttonargs)){
$helpbuttonargs=array($helpbuttonargs);
}else{
$helpbuttonargs=$helpbuttonargs;
}
//we do this to to return html instead of printing it
//without having to specify it in every call to make a button.
if ('helpbutton' == $function){
$defaultargs=array('', '', 'moodle', true, false, '', true);
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
}
$this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
debugging('component setHelpButton() is not used any more, please use $mform->setHelpButton() instead');
}
/**
* get html for help button

View File

@ -90,18 +90,7 @@ class MoodleQuickForm_selectwithlink extends HTML_QuickForm_select{
* @param string $function function name to call to get html
*/
function setHelpButton($helpbuttonargs, $function='helpbutton'){
if (!is_array($helpbuttonargs)){
$helpbuttonargs=array($helpbuttonargs);
}else{
$helpbuttonargs=$helpbuttonargs;
}
//we do this to to return html instead of printing it
//without having to specify it in every call to make a button.
if ('helpbutton' == $function){
$defaultargs=array('', '', 'moodle', true, false, '', true);
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
}
$this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
debugging('component setHelpButton() is not used any more, please use $mform->setHelpButton() instead');
}
/**
* get html for help button

View File

@ -26,18 +26,7 @@ class MoodleQuickForm_static extends HTML_QuickForm_static{
* @param string $function function name to call to get html
*/
function setHelpButton($helpbuttonargs, $function='helpbutton'){
if (!is_array($helpbuttonargs)){
$helpbuttonargs=array($helpbuttonargs);
}else{
$helpbuttonargs=$helpbuttonargs;
}
//we do this to to return html instead of printing it
//without having to specify it in every call to make a button.
if ('helpbutton' == $function){
$defaultargs=array('', '', 'moodle', true, false, '', true);
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
}
$this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
debugging('component setHelpButton() is not used any more, please use $mform->setHelpButton() instead');
}
/**
* get html for help button

View File

@ -58,18 +58,7 @@ class MoodleQuickForm_text extends HTML_QuickForm_text{
* @param string $function function name to call to get html
*/
function setHelpButton($helpbuttonargs, $function='helpbutton'){
if (!is_array($helpbuttonargs)){
$helpbuttonargs=array($helpbuttonargs);
}else{
$helpbuttonargs=$helpbuttonargs;
}
//we do this to to return html instead of printing it
//without having to specify it in every call to make a button.
if ('helpbutton' == $function){
$defaultargs=array('', '', 'moodle', true, false, '', true);
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
}
$this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
debugging('component setHelpButton() is not used any more, please use $mform->setHelpButton() instead');
}
/**
* get html for help button

View File

@ -34,29 +34,7 @@ class MoodleQuickForm_textarea extends HTML_QuickForm_textarea{
* @param string $function function name to call to get html
*/
function setHelpButton($helpbuttonargs, $function='helpbutton'){
global $SESSION;
if (!is_array($helpbuttonargs)) {
$helpbuttonargs = array($helpbuttonargs);
} else {
$helpbuttonargs = $helpbuttonargs;
}
//we do this to to return html instead of printing it
//without having to specify it in every call to make a button.
if ('helpbutton' == $function){
$defaultargs = array('', '', 'moodle', true, false, '', true);
$helpbuttonargs = $helpbuttonargs + $defaultargs ;
if (in_array($helpbuttonargs[0], array('emoticons2', 'text2', 'richtext2'))) {
$SESSION->inserttextform = $this->_formid;
$SESSION->inserttextfield = $this->getAttribute('name');
}
} else if ('editorhelpbutton' == $function) {
$specialhelp = array_intersect($helpbuttonargs, array('emoticons2', 'text2', 'richtext2'));
if (!empty($specialhelp)) {
$SESSION->inserttextform = $this->_formid;
$SESSION->inserttextfield = $this->getAttribute('name');
}
}
$this->_helpbutton = call_user_func_array($function, $helpbuttonargs);
debugging('component setHelpButton() is not used any more, please use $mform->setHelpButton() instead');
}
/**
* get html for help button

View File

@ -95,18 +95,7 @@ EOD;
* @param string $function function name to call to get html
*/
function setHelpButton($helpbuttonargs, $function='helpbutton'){
if (!is_array($helpbuttonargs)){
$helpbuttonargs=array($helpbuttonargs);
}else{
$helpbuttonargs=$helpbuttonargs;
}
//we do this to to return html instead of printing it
//without having to specify it in every call to make a button.
if ('helpbutton' == $function){
$defaultargs=array('', '', 'moodle', true, false, '', true);
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
}
$this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
debugging('component setHelpButton() is not used any more, please use $mform->setHelpButton() instead');
}
/**
* get html for help button

View File

@ -34,18 +34,7 @@ class MoodleQuickForm_warning extends HTML_QuickForm_static{
* @param string $function function name to call to get html
*/
function setHelpButton($helpbuttonargs, $function='helpbutton'){
if (!is_array($helpbuttonargs)){
$helpbuttonargs=array($helpbuttonargs);
}else{
$helpbuttonargs=$helpbuttonargs;
}
//we do this to to return html instead of printing it
//without having to specify it in every call to make a button.
if ('helpbutton' == $function){
$defaultargs=array('', '', 'moodle', true, false, '', true);
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
}
$this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
debugging('component setHelpButton() is not used any more, please use $mform->setHelpButton() instead');
}
function toHtml() {

View File

@ -1334,26 +1334,26 @@ class MoodleQuickForm extends HTML_QuickForm_DHTMLRulesTableless {
* @param string $function - function to generate html from the arguments in $button
* @param string $function
*/
function setHelpButton($elementname, $button, $suppresscheck=false, $function='helpbutton'){
function setHelpButton($elementname, $buttonargs, $suppresscheck=false, $function='helpbutton'){
global $OUTPUT;
if (array_key_exists($elementname, $this->_elementIndex)){
if ($function !== 'helpbutton') {
debugging('parameter $function in moodle_form::setHelpButton() is not supported any more');
}
$buttonargs = (array)$buttonargs;
if (array_key_exists($elementname, $this->_elementIndex)) {
//_elements has a numeric index, this code accesses the elements by name
$element=&$this->_elements[$this->_elementIndex[$elementname]];
$buttonparams = array('page', 'text', 'module', 'image', 'linktext', 'text', 'return', 'imagetext');
$helpiconoptions = array('page' => null, 'text' => null, 'module' => 'moodle', 'image' => null, 'linktext' => false);
$element = $this->_elements[$this->_elementIndex[$elementname]];
foreach ($button as $key => $val) {
if (isset($button[$key])) {
$helpiconoptions[$buttonparams[$key]] = $val;
}
}
$helpicon = moodle_help_icon::make($helpiconoptions['page'], $helpiconoptions['text'], $helpiconoptions['module'], $helpiconoptions['linktext']);
if (!$helpiconoptions['image']) {
$helpicon->image = false;
}
$page = isset($buttonargs[0]) ? $buttonargs[0] : null;
$text = isset($buttonargs[1]) ? $buttonargs[1] : null;
$module = isset($buttonargs[2]) ? $buttonargs[2] : 'moodle';
$linktext = isset($buttonargs[3]) ? $buttonargs[3] : false;
$element->_helpbutton = $OUTPUT->help_icon($helpicon);
}elseif (!$suppresscheck){
$element->_helpbutton = $OUTPUT->help_icon($page, $text, $module, $linktext);
} else if (!$suppresscheck) {
print_error('nonexistentformelements', 'form', '', $elementname);
}
}

View File

@ -385,7 +385,7 @@ class html_select extends labelled_html_component {
*/
public $form;
/**
* @var moodle_help_icon $form An optional moodle_help_icon component
* @var help_icon $array help icon params
*/
public $helpicon;
/**
@ -621,34 +621,21 @@ class html_select extends labelled_html_component {
/**
* Adds a help icon next to the select menu.
*
* This can be used in two ways:
*
* <pre>
* $select->set_help_icon($page, $text, $linktext);
* // OR
* $helpicon = new moodle_help_icon();
* $helpicon->page = $page;
* $helpicon->text = $text;
* $helpicon->linktext = $linktext;
* $select->set_help_icon($helpicon);
* $select->set_help_icon($page, $text, $component);
* </pre>
*
* Use the second form when you need to add additional HTML attributes
* to the label and/or JS actions.
*
* @param mixed $page Either the keyword that defines a help page or a moodle_help_icon object
* @param string $helppage Either the keyword that defines a help page or a help_icon object
* @param text $text The text of the help icon
* @param component $component
* @param boolean $linktext Whether or not to show text next to the icon
* @return void
*/
public function set_help_icon($page, $text, $linktext=false) {
if ($page instanceof moodle_help_icon) {
$this->helpicon = $page;
} else if (!empty($page)) {
$this->helpicon = new moodle_help_icon();
$this->helpicon->page = $page;
$this->helpicon->text = $text;
$this->helpicon->linktext = $linktext;
public function set_help_icon($helppage='', $text='', $component='moodle') {
if ($helppage) {
$this->helpicon = array('helppage'=>$helppage, 'text'=>$text, 'component'=>$component);
} else {
$this->helpicon = null;
}
}
@ -1292,10 +1279,10 @@ class html_link extends html_component {
// to be filled later
} else if ($url instanceof moodle_url) {
$this->src = clone($url);
$this->url = clone($url);
} else if (is_string($url)) {
$this->src = new moodle_url($url);
$this->url = new moodle_url($url);
} else {
throw new coding_style_exception('Image can be constructed only from moodle_url or string url.');
@ -1403,17 +1390,17 @@ class html_image extends labelled_html_component {
* @param moodle_url|string $url url of the image
* @param array $options image attributes such as title, id, alt, widht, height
*/
public function __construct($url = null, array $options = null) {
public function __construct($src = null, array $options = null) {
parent::__construct($options);
if (is_null($url)) {
if (is_null($src)) {
// to be filled later
} else if ($url instanceof moodle_url) {
$this->src = clone($url);
} else if ($src instanceof moodle_url) {
$this->src = clone($src);
} else if (is_string($url)) {
$this->src = new moodle_url($url);
} else if (is_string($src)) {
$this->src = new moodle_url($src);
} else {
throw new coding_style_exception('Image can be constructed only from moodle_url or string url.');
@ -1443,8 +1430,8 @@ class html_image extends labelled_html_component {
*
* @param mixed $url The URL to the image (string or moodle_url)
*/
public static function make($url) {
return new html_image($url);
public static function make($src) {
return new html_image($src);
}
}
@ -2027,11 +2014,11 @@ class user_picture extends html_image {
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @since Moodle 2.0
*/
class moodle_help_icon extends labelled_html_component {
class help_icon extends html_image {
public $page;
/**
* @var html_link $link A html_link object that will hold the URL info
* @var string $module Which module is the page defined in
*/
public $link;
/**
* @var string $text A descriptive text
*/
@ -2039,29 +2026,46 @@ class moodle_help_icon extends labelled_html_component {
/**
* @var string $page The keyword that defines a help page
*/
public $page;
/**
* @var string $module Which module is the page defined in
*/
public $module = 'moodle';
public $component = 'moodle';
/**
* @var boolean $linktext Whether or not to show text next to the icon
*/
public $linktext = false;
/**
* @var mixed $image The help icon. Can be set to true (will use default help icon),
* false (will not use any icon), the URL to an image, or a full
* html_image object.
* @var html_link $link A html_link object that will hold the URL info
*/
public $image;
public $link;
/**
* Constructor: sets up the other components in case they are needed
* @param string $page The keyword that defines a help page
* @param string $text A descriptive text
* @param string $component
* @param bool $linktext add extra text to icon
* @return void
*/
public function __construct() {
public function __construct($helppage, $text, $component='moodle', $linktext=false) {
global $CFG;
if (empty($helppage)) {
throw new coding_exception('A help_icon object requires a $helppage parameter');
}
if (empty($text)) {
throw new coding_exception('A help_icon object requires a $text parameter');
}
parent::__construct(null, array('class'=>'iconhelp'));
$this->helppage = $helppage;
$this->text = $text;
$this->component = $component;
$this->linktext = $linktext;
$this->link = new html_link();
$this->image = new html_image();
$this->link->url = new moodle_url($CFG->wwwroot.'/help.php', array('module' => $this->component, 'file' => $this->helppage .'.html'));
// Warn users about new window for Accessibility
}
/**
@ -2071,98 +2075,25 @@ class moodle_help_icon extends labelled_html_component {
public function prepare(renderer_base $output, moodle_page $page, $target) {
global $CFG;
if (empty($this->page)) {
throw new coding_exception('A moodle_help_icon object requires a $page parameter');
if (empty($this->link->title)) {
$this->link->title = get_string('helpprefix2', '', trim($this->text, ". \t")) .' ('.get_string('newwindow').')';
}
if (empty($this->text) && empty($this->link->text)) {
throw new coding_exception('A moodle_help_icon object (or its $link attribute) requires a $text parameter');
} else if (!empty($this->text) && empty($this->link->text)) {
$this->link->text = $this->text;
if (empty($this->src)) {
$this->src = $output->pix_url('help');
}
// fix for MDL-7734
$this->link->url = new moodle_url($CFG->wwwroot.'/help.php', array('module' => $this->module, 'file' => $this->page .'.html'));
// fix for MDL-7734
if (!empty($page->course->lang)) {
$this->link->url->param('forcelang', $page->course->lang);
}
// Catch references to the old text.html and emoticons.html help files that
// were renamed in MDL-13233.
if (in_array($this->page, array('text', 'emoticons', 'richtext'))) {
$oldname = $this->page;
$this->page .= '2';
debugging("You are referring to the old help file '$oldname'. " .
"This was renamed to '$this->page' because of MDL-13233. " .
"Please update your code.", DEBUG_DEVELOPER);
}
if ($this->module == '') {
$this->module = 'moodle';
}
// Warn users about new window for Accessibility
$this->title = get_string('helpprefix2', '', trim($this->text, ". \t")) .' ('.get_string('newwindow').')';
// Prepare image and linktext
if ($this->image && !($this->image instanceof html_image)) {
$image = fullclone($this->image);
$this->image = new html_image();
if ($image instanceof moodle_url) {
$this->image->src = $image->out();
} else if ($image === true) {
$this->image->src = $output->pix_url('help');
} else if (is_string($image)) {
$this->image->src = $image;
}
if ($this->linktext) {
$this->image->alt = get_string('helpwiththis');
} else {
$this->image->alt = $this->text;
if ($this->linktext) {
$this->image->alt = get_string('helpwiththis');
} else {
$this->image->alt = $this->title;
}
$this->image->add_class('iconhelp');
} else if (empty($this->image->src)) {
if (!($this->image instanceof html_image)) {
$this->image = new html_image();
}
$this->image->src = $output->pix_url('help');
}
$popup = new popup_action('click', $this->link->url);
$this->link->add_action($popup);
parent::prepare($output, $page, $target);
}
/**
* This is a shortcut for creating a help_icon with only the 2 required params
* @param string $page The keyword that defines a help page
* @param string $text A descriptive text
* @return moodle_help_icon A moodle_help_icon object with the two common fields initialised.
*/
public static function make($page, $text, $module='moodle', $linktext=false) {
$helpicon = new moodle_help_icon();
$helpicon->page = $page;
$helpicon->text = $text;
$helpicon->module = $module;
$helpicon->linktext = $linktext;
return $helpicon;
}
public static function make_scale_menu($courseid, $scale) {
$helpbutton = new moodle_help_icon();
$strscales = get_string('scales');
$helpbutton->image->alt = $scale->name;
$helpbutton->link->url = new moodle_url('/course/scales.php', array('id' => $courseid, 'list' => true, 'scaleid' => $scale->id));
$popupaction = new popup_action('click', $helpbutton->url, 'ratingscale', $popupparams);
$popupaction->width = 500;
$popupaction->height = 400;
$helpbutton->link->add_action($popupaction);
$helpbutton->link->title = $scale->name;
return $helpbutton;
}
}

View File

@ -459,13 +459,13 @@ class core_renderer extends renderer_base {
*/
public function login_info() {
global $USER, $CFG, $DB;
if (during_initial_install()) {
return '';
}
$course = $this->page->course;
if (session_is_loggedinas()) {
$realuser = session_get_realuser();
$fullname = fullname($realuser, true);
@ -474,15 +474,15 @@ class core_renderer extends renderer_base {
} else {
$realuserinfo = '';
}
$loginurl = get_login_url();
if (empty($course->id)) {
// $course->id is not defined during installation
return '';
} else if (!empty($USER->id)) {
$context = get_context_instance(CONTEXT_COURSE, $course->id);
$fullname = fullname($USER, true);
$username = "<a $CFG->frametarget href=\"$CFG->wwwroot/user/view.php?id=$USER->id&amp;course=$course->id\">$fullname</a>";
if (is_mnet_remote_user($USER) and $idprovider = $DB->get_record('mnet_host', array('id'=>$USER->mnethostid))) {
@ -507,9 +507,9 @@ class core_renderer extends renderer_base {
$loggedinas = get_string('loggedinnot', 'moodle').
" (<a $CFG->frametarget href=\"$loginurl\">".get_string('login').'</a>)';
}
$loggedinas = '<div class="logininfo">'.$loggedinas.'</div>';
if (isset($SESSION->justloggedin)) {
unset($SESSION->justloggedin);
if (!empty($CFG->displayloginfailures)) {
@ -530,7 +530,7 @@ class core_renderer extends renderer_base {
}
}
}
return $loggedinas;
}
@ -758,7 +758,7 @@ class core_renderer extends renderer_base {
$currlang = current_language();
$langs = get_list_of_languages();
if (count($langs) < 2) {
return '';
}
@ -1145,89 +1145,70 @@ class core_renderer extends renderer_base {
/*
* Centered heading with attached help button (same title text)
* and optional icon attached
* @param moodle_help_icon $helpicon A moodle_help_icon object
* @param mixed $image An image URL or a html_image object
* @param string $text A heading text
* @param string $page The keyword that defines a help page
* @param string $component component name
* @param string|moodle_url $icon
* @param string $iconalt icon alt text
* @return string HTML fragment
*/
public function heading_with_help($helpicon, $image=false) {
if (!($image instanceof html_image) && !empty($image)) {
$htmlimage = new html_image();
$htmlimage->src = $image;
$image = $htmlimage;
public function heading_with_help($text, $helppage, $component='moodle', $icon='', $iconalt='') {
$image = '';
if ($icon) {
if ($icon instanceof moodle_url) {
$image = $this->image($icon, array('class'=>'icon', 'alt'=>$iconalt));
} else {
$image = $this->image($this->pix_url($icon, $component), array('class'=>'icon', 'alt'=>$iconalt));
}
}
return $this->container($this->image($image) . $this->heading($helpicon->text, 2, 'main help') . $this->help_icon($helpicon), 'heading-with-help');
$help = $this->help_icon($helppage, $text, $component);
return $this->heading($image.$text.$help, 2, 'main help');
}
/**
* Print a help icon.
*
* @param moodle_help_icon $helpicon A moodle_help_icon object, subclass of html_link
*
* @param string $page The keyword that defines a help page
* @param string $text A descriptive text
* @param string $component component name
* @param bool $linktext show extra descriptive text
* @return string HTML fragment
*/
public function help_icon($icon) {
global $COURSE;
$icon = clone($icon);
public function help_icon($helppage, $text=null, $component='moodle', $linktext=false) {
$icon = new help_icon($helppage, $text, $component, $linktext);
$icon->prepare($this, $this->page, $this->target);
$popup = new popup_action('click', $icon->link->url);
$icon->link->add_action($popup);
$image = null;
if (!empty($icon->image)) {
$image = $icon->image;
$image->add_class('iconhelp');
$icon->link->text = $this->image($icon);
if ($icon->linktext) {
$icon->link->text .= $icon->text;
}
return $this->output_tag('span', array('class' => 'helplink'), $this->link_to_popup($icon->link, $image));
return $this->output_tag('span', array('class' => 'helplink'), $this->link($icon->link));
}
/**
* Creates and returns a button to a popup window
* Print scale help icon.
*
* @param html_link $link Subclass of html_component
* @param moodle_popup $popup A moodle_popup object
* @param html_image $image An optional image replacing the link text
*
* @return string HTML fragment
* @param int $courseid
* @param object $scale instance
* @return string HTML fragment
*/
public function link_to_popup($link, $image=null) {
//TODO: decide if this should be removed completely, because link() already handles this
// we could also add html_link::make_popup() factory method
$link = clone($link);
public function help_icon_scale($courseid, stdClass $scale) {
global $CFG;
// Use image if one is given
if (!empty($image) && $image instanceof html_image) {
$title = get_string('helpprefix2', '', $scale->name) .' ('.get_string('newwindow').')';
if (empty($image->alt) || $image->alt == HTML_ATTR_EMPTY) {
$image->alt = $link->text;
$image->title = $link->text;
}
$icon = $this->image($this->pix_url('help'), array('class'=>'iconhelp', 'alt'=>get_string('scales')));
$link->text = $this->image($image);
$link = new html_link(new moodle_url($CFG->wwwroot.'/course/scales.php', array('id' => $courseid, 'list' => true, 'scaleid' => $scale->id)), $icon);
$popupaction = new popup_action('click', $link->url, 'ratingscale');
$link->add_action($popupaction);
if (!empty($link->linktext)) { // TODO: this is weird!
$link->text = "$link->title &#160; $link->text";
}
}
$link->prepare($this, $this->page, $this->target);
$this->prepare_event_handlers($link);
if (empty($link->url)) {
throw new coding_exception('Called $OUTPUT->link_to_popup($link) method without $link->url set.');
}
$linkurl = prepare_url($link->url);
$tagoptions = array(
'title' => $link->title,
'id' => $link->id,
'href' => ($linkurl) ? $linkurl : prepare_url($popup->url),
'class' => $link->get_classes_string());
return $this->output_tag('a', $tagoptions, $link->text);
return $this->output_tag('span', array('class' => 'helplink'), $this->link($link));
}
/**
@ -1499,7 +1480,7 @@ class core_renderer extends renderer_base {
* html_select::set_label($label) passing a html_label object
*
* To add a help icon, use html_select::set_help($page, $text, $linktext) or
* html_select::set_help($helpicon) passing a moodle_help_icon object
* html_select::set_help($helpicon) passing a help_icon object
*
* If you html_select::$rendertype to "radio", it will render radio buttons
* instead of a <select> menu, unless $multiple is true, in which case it
@ -1558,8 +1539,8 @@ class core_renderer extends renderer_base {
$html .= $this->label($select->label);
}
if (!empty($select->helpicon) && $select->helpicon instanceof moodle_help_icon) {
$html .= $this->help_icon($select->helpicon);
if ($select->helpicon) {
$html .= $this->help_icon($select->helpicon['helppage'], $select->helpicon['text'], $select->helpicon['component']);
}
if ($select->rendertype == 'menu') {

View File

@ -890,7 +890,7 @@ class core_renderer_test extends UnitTestCase {
}
public function test_heading_with_help() {
$originalicon = new moodle_help_icon();
$originalicon = new help_icon();
$originalicon->page = 'myhelppage';
$originalicon->text = 'Cool help text';

View File

@ -920,7 +920,7 @@ class flexible_table {
$select = html_select::make($downloadoptions, 'download', $this->defaultdownloadformat, false);
$select->nothingvalue = '';
$html .= $OUTPUT->select($select);
$html .= $OUTPUT->help_icon(moodle_help_icon::make('tableexportformats', get_string('tableexportformats', 'table')));
$html .= $OUTPUT->help_icon('tableexportformats', get_string('tableexportformats', 'table'));
$html .= '</div></form>';
return $html;

View File

@ -2401,127 +2401,6 @@ function mdie($msg='', $errorcode=1) {
exit($errorcode);
}
/**
* Returns a string of html with an image of a help icon linked to a help page on a number of help topics.
* Should be used only with htmleditor or textarea.
*
* @global object
* @global object
* @param mixed $helptopics variable amount of params accepted. Each param may be a string or an array of arguments for
* helpbutton.
* @return string Link to help button
*/
function editorhelpbutton(){
global $CFG, $SESSION, $OUTPUT;
$items = func_get_args();
$i = 1;
$urlparams = array();
$titles = array();
foreach ($items as $item){
if (is_array($item)){
$urlparams[] = "keyword$i=".urlencode($item[0]);
$urlparams[] = "title$i=".urlencode($item[1]);
if (isset($item[2])){
$urlparams[] = "module$i=".urlencode($item[2]);
}
$titles[] = trim($item[1], ". \t");
} else if (is_string($item)) {
$urlparams[] = "button$i=".urlencode($item);
switch ($item) {
case 'reading' :
$titles[] = get_string("helpreading");
break;
case 'writing' :
$titles[] = get_string("helpwriting");
break;
case 'questions' :
$titles[] = get_string("helpquestions");
break;
case 'emoticons2' :
$titles[] = get_string("helpemoticons");
break;
case 'richtext2' :
$titles[] = get_string('helprichtext');
break;
case 'text2' :
$titles[] = get_string('helptext');
break;
default :
print_error('unknownhelp', '', '', $item);
}
}
$i++;
}
if (count($titles)>1){
//join last two items with an 'and'
$a = new object();
$a->one = $titles[count($titles) - 2];
$a->two = $titles[count($titles) - 1];
$titles[count($titles) - 2] = get_string('and', '', $a);
unset($titles[count($titles) - 1]);
}
$alttag = join (', ', $titles);
$paramstring = join('&', $urlparams);
$linkobject = '<img alt="'.$alttag.'" class="iconhelp" src="'.$OUTPUT->pix_url('help') . '" />';
$link = html_link::make(s('/lib/form/editorhelp.php?'.$paramstring), $linkobject);
$link->add_action(new popup_action('click', $link->url, 'popup', array('height' => 400, 'width' => 500)));
$link->title = $alttag;
return $OUTPUT->link($link);
}
/**
* Print a help button.
*
* Prints a special help button that is a link to the "live" emoticon popup
*
* @todo Finish documenting this function
*
* @global object
* @global object
* @param string $form ?
* @param string $field ?
* @param boolean $return If true then the output is returned as a string, if false it is printed to the current page.
* @return string|void Depending on value of $return
*/
function emoticonhelpbutton($form, $field, $return = false) {
global $SESSION, $OUTPUT;
$SESSION->inserttextform = $form;
$SESSION->inserttextfield = $field;
$helpicon = moodle_help_icon::make('emoticons2', get_string('helpemoticons'), 'moodle', true);
$helpicon->image->src = $OUTPUT->pix_url('s/smiley');
$helpicon->image->add_class('emoticon');
$helpicon->style = "margin-left:3px; padding-right:1px;width:15px;height:15px;";
$help = $OUTPUT->help_icon($helpicon);
if (!$return){
echo $help;
} else {
return $help;
}
}
/**
* Print a help button.
*
* Prints a special help button for html editors (htmlarea in this case)
*
* @todo Write code into this function! detect current editor and print correct info
* @global object
* @return string Only returns an empty string at the moment
*/
function editorshortcutshelpbutton() {
global $CFG;
//TODO: detect current editor and print correct info
/* $imagetext = '<img src="' . $CFG->httpswwwroot . '/lib/editor/htmlarea/images/kbhelp.gif" alt="'.
get_string('editorshortcutkeys').'" class="iconkbhelp" />';
return helpbutton('editorshortcuts', get_string('editorshortcutkeys'), 'moodle', true, false, '', true, $imagetext);*/
return '';
}
/**
* Returns html code to be used as help icon of modgrade form element
*

View File

@ -15,7 +15,7 @@ if ($show_instructions) {
if (empty($CFG->usesid)) {
echo '<br/>';
echo '('.get_string("cookiesenabled").')';
echo $OUTPUT->help_icon(moodle_help_icon::make("cookies", get_string("cookiesenabled")));
echo $OUTPUT->help_icon("cookies", get_string("cookiesenabled"));
}
?>
</div>

View File

@ -210,9 +210,9 @@ foreach ( $providers as $providerid => $provider){
/// TODO XXX: This is only a quick hack ... helpfile locations should be provided as part of the provider definition
if ($provider->component == 'moodle') {
$helpbtn = $OUTPUT->help_icon(moodle_help_icon::make('moodle_'.$provider->name, $providername, 'message'));
$helpbtn = $OUTPUT->help_icon('moodle_'.$provider->name, $providername, 'message');
} else {
$helpbtn = $OUTPUT->help_icon(moodle_help_icon::make('message_'.$provider->name, $providername, basename($provider->component)));
$helpbtn = $OUTPUT->help_icon('message_'.$provider->name, $providername, basename($provider->component));
}
echo '<tr><th align="right">'.$providername.$helpbtn.'</th><td colspan="'.$number_procs.'"></td></tr>'."\n";

View File

@ -1009,7 +1009,7 @@ class assignment_base {
} else {
echo '<div class="format">';
echo $OUTPUT->select(html_select::make(format_text_menu(), "format", $submission->format, false));
echo $OUTPUT->help_icon(moodle_help_icon::make("textformat", get_string("helpformatting")));
echo $OUTPUT->help_icon("textformat", get_string("helpformatting"));
echo '</div>';
}
}
@ -1418,7 +1418,7 @@ class assignment_base {
echo '<label for="mailinfo">'.get_string('enableemailnotification','assignment').'</label>';
echo '<input type="hidden" name="mailinfo" value="0" />';
echo '<input type="checkbox" id="mailinfo" name="mailinfo" value="1" '.$lastmailinfo.' />';
echo $OUTPUT->help_icon(moodle_help_icon::make('emailnotification', get_string('enableemailnotification', 'assignment'), 'assignment')).'</p></div>';
echo $OUTPUT->help_icon('emailnotification', get_string('enableemailnotification', 'assignment'), 'assignment').'</p></div>';
echo '</div>';
echo '<div class="fastgbutton"><input type="submit" name="fastg" value="'.get_string('saveallfeedback', 'assignment').'" /></div>';
echo '</div>';
@ -1436,7 +1436,7 @@ class assignment_base {
echo '</td>';
echo '<td>';
echo '<input type="text" id="perpage" name="perpage" size="1" value="'.$perpage.'" />';
echo $OUTPUT->help_icon(moodle_help_icon::make('pagesize', get_string('pagesize','assignment'), 'assignment'));
echo $OUTPUT->help_icon('pagesize', get_string('pagesize','assignment'), 'assignment');
echo '</td></tr>';
echo '<tr><td>';
echo '<label for="quickgrade">'.get_string('quickgrade','assignment').'</label>';
@ -1444,7 +1444,7 @@ class assignment_base {
echo '<td>';
$checked = $quickgrade ? 'checked="checked"' : '';
echo '<input type="checkbox" id="quickgrade" name="quickgrade" value="1" '.$checked.' />';
echo $OUTPUT->help_icon(moodle_help_icon::make('quickgrade', get_string('quickgrade', 'assignment'), 'assignment')).'</p></div>';
echo $OUTPUT->help_icon('quickgrade', get_string('quickgrade', 'assignment'), 'assignment').'</p></div>';
echo '</td></tr>';
echo '<tr><td colspan="2">';
echo '<input type="submit" value="'.get_string('savepreferences').'" />';

View File

@ -42,8 +42,8 @@ echo $OUTPUT->header();
<form action="../empty.php" method="post" target="empty" id="inputForm"
onsubmit="return empty_field_and_submit()" style="margin:0">
<input type="text" id="input_chat_message" name="chat_message" size="50" value="" />
<?php echo $OUTPUT->help_icon(moodle_help_icon::make('chatting', get_string('helpchatting', 'chat'), 'chat', true)); ?><br />
<input type="checkbox" id="auto" size="50" value="" checked='true' /><label for="auto"><?php echo get_string('autoscroll', 'chat');?></label>
<?php echo $OUTPUT->help_icon('chatting', get_string('helpchatting', 'chat'), 'chat', true); ?><br />
<input type="checkbox" id="auto" size="50" value="" checked="checked" /><label for="auto"><?php echo get_string('autoscroll', 'chat');?></label>
</form>
<form action="insert.php" method="post" target="empty" id="sendForm">

View File

@ -29,7 +29,7 @@ echo $OUTPUT->header();
<form action="../empty.php" method="get" target="empty" id="inputform"
onsubmit="return empty_field_and_submit();">
<input type="text" name="chat_message" id="chat_message" size="60" value="" />
<?php echo $OUTPUT->help_icon(moodle_help_icon::make("chatting", get_string("helpchatting", "chat"), "chat", true)); ?>
<?php echo $OUTPUT->help_icon("chatting", get_string("helpchatting", "chat"), "chat", true); ?>
</form>
<form action="<?php echo "http://$CFG->chat_serverhost:$CFG->chat_serverport/"; ?>" method="get" target="empty" id="sendform">

View File

@ -333,7 +333,7 @@ if (has_capability('mod/data:manageentries',$context)) {
echo '<tr>';
echo '<td align="right">'.get_string('csvfile', 'data').':</td>';
echo '<td><input type="file" name="recordsfile" size="30" />';
echo $OUTPUT->help_icon(moodle_help_icon::make('importcsv', get_string('csvimport', 'data'), 'data'));
echo $OUTPUT->help_icon('importcsv', get_string('csvimport', 'data'), 'data');
echo '</td><tr>';
echo '<td align="right">'.get_string('fielddelimiter', 'data').':</td>';
echo '<td><input type="text" name="fielddelimiter" size="6" />';

View File

@ -306,7 +306,7 @@ if (($mode == 'new') && (!empty($newtype)) && confirm_sesskey()) { ///
echo '<label for="fieldform_jump">'.get_string('newfield','data').'</label>';
$popupurl = $CFG->wwwroot.'/mod/data/field.php?d='.$data->id.'&mode=new&sesskey='. sesskey();
echo $OUTPUT->select(html_select::make_popup_form($popupurl, 'newtype', $menufield, "fieldform"));
echo $OUTPUT->help_icon(moodle_help_icon::make('fields', get_string('addafield','data'), 'data'));
echo $OUTPUT->help_icon('fields', get_string('addafield','data'), 'data');
echo '</div>';
echo '<div class="sortdefault">';

View File

@ -73,7 +73,7 @@ class data_field_textarea extends data_field_base {
$str .= '<option value="'.s($key).'" '.$selected.'>'.$desc.'</option>';
}
$str .= '</select>';
$str .= $OUTPUT->help_icon(moodle_help_icon::make('textformat', get_string('helpformatting'), 'moodle'));
$str .= $OUTPUT->help_icon('textformat', get_string('helpformatting'), 'moodle');
$str .= '</div>';
$str .= '</div>';

View File

@ -1549,7 +1549,7 @@ function data_print_ratings($data, $record) {
if ($data->scale < 0) {
if ($scale = $DB->get_record('scale', array('id'=>abs($data->scale)))) {
echo $OUTPUT->help_button(moodle_help_icon::make_scale_menu($data->course, $scale));
echo $OUTPUT->help_icon_scale($data->course, $scale);
}
}
@ -2214,7 +2214,7 @@ class PresetImporter {
if (!empty($currentfields) && !empty($newfields)) {
echo "<h3>$strfieldmappings ";
echo $OUTPUT->help_icon(moodle_help_icon::make('fieldmappings', $strfieldmappings, 'data'));
echo $OUTPUT->help_icon('fieldmappings', $strfieldmappings, 'data');
echo '</h3><table>';
foreach ($newfields as $nid => $newfield) {

View File

@ -333,7 +333,7 @@ echo '<table class="presets" cellpadding="5">';
echo '<tr><td valign="top" colspan="2" align="center"><h3>'.$strexport.'</h3></td></tr>';
echo '<tr><td><label>'.$strexportaszip.'</label>';
echo $OUTPUT->help_icon(moodle_help_icon::make('exportzip', get_string('help'), 'data', false));
echo $OUTPUT->help_icon('exportzip', get_string('help'), 'data', false);
echo '</td><td>';
$options = array();
$options['sesskey'] = sesskey();
@ -343,7 +343,7 @@ echo $OUTPUT->button(html_form::make_button('preset.php', $options, $strexport))
echo '</td></tr>';
echo '<tr><td><label>'.$strsaveaspreset.'</label>';
echo $OUTPUT->help_icon(moodle_help_icon::make('savepreset', get_string('help'), 'data', false));
echo $OUTPUT->help_icon('savepreset', get_string('help'), 'data', false);
echo '</td><td>';
$options = array();
$options['sesskey'] = sesskey();
@ -353,7 +353,7 @@ echo $OUTPUT->button(html_form::make_button('preset.php', $options, $strsave));
echo '</td></tr>';
echo '<tr><td valign="top" colspan="2" align="center"><h3>'.$strimport.'</h3></td></tr>';
echo '<tr><td><label for="fromfile">'.$strfromfile.'</label>';
echo $OUTPUT->help_icon(moodle_help_icon::make('importfromfile', get_string('help'), 'data', true));
echo $OUTPUT->help_icon('importfromfile', get_string('help'), 'data', true);
echo '</td><td>';
echo '<form id="uploadpreset" method="post" action="preset.php">';
echo '<fieldset class="invisiblefieldset">';
@ -366,7 +366,7 @@ echo '</fieldset></form>';
echo '</td></tr>';
echo '<tr valign="top"><td><label>'.$strusestandard.'</label>';
echo $OUTPUT->help_icon(moodle_help_icon::make('usepreset', get_string('help'), 'data', true));
echo $OUTPUT->help_icon('usepreset', get_string('help'), 'data', true);
echo '</td><td>';
echo '<form id="presets" method="post" action="preset.php" >';

View File

@ -203,7 +203,7 @@ echo '<tr><td valign="top">';
if ($mode != 'csstemplate' and $mode != 'jstemplate') {
// Add all the available fields for this data.
echo '<label for="availabletags">'.get_string('availabletags','data').'</label>';
echo $OUTPUT->help_icon(moodle_help_icon::make('tags', get_string('tags'), 'data'));
echo $OUTPUT->help_icon('tags', get_string('tags'), 'data');
echo '<br />';

View File

@ -142,11 +142,7 @@ if($check_anonymously) {
echo '</table>';
}
}else {
$helpicon = new moodle_help_icon();
$helpicon->text = get_string('insufficient_responses_for_this_group', 'feedback');
$helpicon->page = 'insufficient_responses';
$helpicon->module = 'feedback';
echo $OUTPUT->heading_with_help($helpicon);
echo $OUTPUT->heading_with_help(get_string('insufficient_responses_for_this_group', 'feedback'), 'insufficient_responses', 'feedback');
}
echo '</td></tr></table></div>';
echo $OUTPUT->box_end();

View File

@ -211,7 +211,7 @@ if($do_show == 'edit') {
if(is_array($feedbackitems)){
$itemnr = 0;
$helpbutton = $OUTPUT->help_icon(moodle_help_icon::make('preview', get_string('preview','feedback'), 'feedback',true));
$helpbutton = $OUTPUT->help_icon('preview', get_string('preview','feedback'), 'feedback',true);
echo $OUTPUT->heading($helpbutton . get_string('preview', 'feedback'));
if(isset($SESSION->feedback->moving) AND $SESSION->feedback->moving->shouldmoving == 1) {

View File

@ -97,14 +97,14 @@ if (($courses = $DB->get_records_sql_menu($sql, $params)) && !empty($searchcours
echo ' ' . get_string('courses') . ': ';
echo $OUTPUT->select(html_select::make ($courses, 'coursefilter', $coursefilter));
echo '<input type="submit" value="'.get_string('mapcourse', 'feedback').'"/>';
echo $OUTPUT->help_icon(moodle_help_icon::make('mapcourses', '', 'feedback', true));
echo $OUTPUT->help_icon('mapcourses', '', 'feedback', true);
echo '<input type="button" value="'.get_string('searchagain').'" onclick="document.location=\'mapcourse.php?id='.$id.'\'"/>';
echo '<input type="hidden" name="searchcourse" value="'.$searchcourse.'"/>';
echo '<input type="hidden" name="feedbackid" value="'.$feedback->id.'"/>';
echo $OUTPUT->help_icon(moodle_help_icon::make('searchcourses', '', 'feedback', true));
echo $OUTPUT->help_icon('searchcourses', '', 'feedback', true);
} else {
echo '<input type="text" name="searchcourse" value="'.$searchcourse.'"/> <input type="submit" value="'.get_string('searchcourses').'"/>';
echo $OUTPUT->help_icon(moodle_help_icon::make('searchcourses', '', 'feedback', true));
echo $OUTPUT->help_icon('searchcourses', '', 'feedback', true);
}
echo '</form>';

View File

@ -112,7 +112,7 @@ if($do_show == 'showentries'){
if($feedback->course == SITEID){
echo '<div class="mdl-align"><a href="'.htmlspecialchars('analysis_course.php?id=' . $id . '&courseid='.$courseid).'">';
echo get_string('course') .' '. get_string('analysis', 'feedback') . ' ('.get_string('completed_feedbacks', 'feedback').': '.intval($completedFeedbackCount).')</a>';
echo $OUTPUT->help_icon(moodle_help_icon::make('viewcompleted', '', 'feedback', true));
echo $OUTPUT->help_icon('viewcompleted', '', 'feedback', true);
echo '</div>';
}else {
echo '<div class="mdl-align"><a href="'.htmlspecialchars('analysis.php?id=' . $id . '&courseid='.$courseid).'">';

View File

@ -136,7 +136,7 @@ if($capabilities->mapcourse) {
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
echo '<input type="hidden" name="id" value="'.$id.'" />';
echo '<button type="submit">'.get_string('mapcourses', 'feedback').'</button>';
echo $OUTPUT->help_icon(moodle_help_icon::make('mapcourse', '', 'feedback', true));
echo $OUTPUT->help_icon('mapcourse', '', 'feedback', true);
echo '</form>';
echo '<br />';
echo '</div>';

View File

@ -4212,7 +4212,7 @@ function forum_search_form($course, $search='') {
$output = '<div class="forumsearch">';
$output .= '<form action="'.$CFG->wwwroot.'/mod/forum/search.php" style="display:inline">';
$output .= '<fieldset class="invisiblefieldset">';
$output .= $OUTPUT->help_icon(moodle_help_icon::make('search', get_string('search')));
$output .= $OUTPUT->help_icon('search', get_string('search'));
$output .= '<input name="search" type="text" size="18" value="'.s($search, true).'" alt="search" />';
$output .= '<input value="'.get_string('searchforums', 'forum').'" type="submit" />';
$output .= '<input name="id" type="hidden" value="'.$course->id.'" />';
@ -5890,7 +5890,7 @@ function forum_print_discussion($course, $cm, $forum, $discussion, $post, $mode,
}
if ($forum->scale < 0) {
if ($scale = $DB->get_record("scale", array("id" => abs($forum->scale)))) {
echo $OUTPUT->help_button(help_button::make_scale_menu($course->id, $scale));
echo $OUTPUT->help_icon_scale($course->id, $scale);
}
}
echo '</div>';
@ -8051,10 +8051,7 @@ function forum_extend_settings_navigation($settingsnav, $module=null) {
if (forum_is_forcesubscribed($forumobject)) {
$notekey = $forum->add(get_string("forcessubscribe", 'forum'));
$string = get_string('allowchoice', 'forum');
$helpbutton = new moodle_help_icon();
$helpbutton->page = "subscription";
$helpbutton->text = $string;
$helpbutton->module = "forum";
$helpbutton = $OUTPUT->help_icon("subscription", $string, "forum");
if (has_capability('mod/forum:managesubscriptions', $PAGE->cm->context)) {
$url = new moodle_url($CFG->wwwroot.'/mod/forum/subscribe.php', array('id'=>$forumobject->id, 'force'=>'no'));
$forum->add($string, $url, navigation_node::TYPE_SETTING);
@ -8064,18 +8061,11 @@ function forum_extend_settings_navigation($settingsnav, $module=null) {
} else if ($forumobject->forcesubscribe == FORUM_DISALLOWSUBSCRIBE) {
$string = get_string('disallowsubscribe', 'forum');
$notekey = $forum->add($string);
$helpbutton = new moodle_help_icon();
$helpbutton->page = "subscription";
$helpbutton->text = $string;
$helpbutton->module = "forum";
$helpbutton = $OUTPUT->help_icon("subscription", $string, "forum");
} else {
$string = get_string("forcesubscribe", "forum");
$notekey = $forum->add(get_string("allowsallsubscribe", 'forum'));
$helpbutton = new moodle_help_icon();
$helpbutton->page = "subscription";
$helpbutton->text = $string;
$helpbutton->module = "forum";
$helpbutton = $OUTPUT->help_icon("subscription", $string, "forum");
if (has_capability('mod/forum:managesubscriptions', $PAGE->cm->context)) {
$url = new moodle_url($CFG->wwwroot.'/mod/forum/subscribe.php', array('id'=>$forumobject->id, 'force'=>'yes'));
@ -8113,7 +8103,7 @@ function forum_extend_settings_navigation($settingsnav, $module=null) {
if ($notekey!==false) {
$forum->get($notekey)->add_class('note');
if ($helpbutton!==false) {
$forum->get($notekey)->helpbutton = $OUTPUT->help_icon($helpbutton);
$forum->get($notekey)->helpbutton = $helpbutton;
}
}
if (has_capability('moodle/course:manageactivities', $PAGE->cm->context)) {

View File

@ -175,7 +175,7 @@ class mod_forum_mod_form extends moodleform_mod {
//we want the form to display them if they are set.
if ($typevalue[0]=='news') {
$type->addOption(get_string('namenews', 'forum'), 'news');
$type->setHelpButton(array('forumtypenews', get_string('forumtype', 'forum'), 'forum'));
$mform->setHelpButton('type', array('forumtypenews', get_string('forumtype', 'forum'), 'forum'));
$type->freeze();
$type->setPersistantFreeze(true);
}

View File

@ -27,7 +27,7 @@
}
?>><?php echo get_string("no") ?>
</option>
</select> <?php echo $OUTPUT->help_icon(moodle_help_icon::make("linkcategory", get_string("linkcategory", "glossary"), "glossary")) ?>
</select> <?php echo $OUTPUT->help_icon("linkcategory", get_string("linkcategory", "glossary"), "glossary") ?>
</td>
</tr>
<tr>

View File

@ -6,7 +6,7 @@
echo '(';
print_string("maxsize", "", display_size(get_max_upload_file_size($CFG->maxbytes, $course->maxbytes)));
echo ') ';
echo $OUTPUT->help_icon(moodle_help_icon::make("filetoimport", get_string("filetoimport", "glossary"), "glossary"));
echo $OUTPUT->help_icon("filetoimport", get_string("filetoimport", "glossary"), "glossary");
?>
</b></td>
<td style="width:70%">
@ -24,10 +24,10 @@
<td style="width:25%"><select size="1" name="dest">
<option selected="selected" value="current"><?php print_string("currentglossary","glossary") ?></option>
<option value="new"><?php print_string("newglossary","glossary") ?></option>
</select> <?php echo $OUTPUT->help_icon(moodle_help_icon::make("destination", get_string("destination", "glossary"), "glossary")) ?></td>
</select> <?php echo $OUTPUT->help_icon("destination", get_string("destination", "glossary"), "glossary") ?></td>
<td style="width:25%" align="right"><?php print_string("importcategories","glossary") ?>:</td>
<td style="width:25%"><input type="checkbox" name="catsincl" value="1" alt="<?php print_string("importcategories","glossary") ?>" />
<?php echo $OUTPUT->help_icon(moodle_help_icon::make("importcategories", get_string("importcategories", "glossary"), "glossary")) ?>
<?php echo $OUTPUT->help_icon("importcategories", get_string("importcategories", "glossary"), "glossary") ?>
</td>
</tr>
</table>

View File

@ -500,7 +500,7 @@ if ($ratingsmenuused) {
echo "<div class=\"boxaligncenter\"><input type=\"submit\" value=\"".get_string("sendinratings", "glossary")."\" />";
if ($glossary->scale < 0) {
if ($scale = $DB->get_record("scale", array("id"=>abs($glossary->scale)))) {
echo $OUTPUT->help_button(help_button::make_scale_menu($course->id, $scale));
echo $OUTPUT->help_icon_scale($course->id, $scale);
}
}
echo "</div>";

View File

@ -548,7 +548,7 @@ function hotpot_print_report_selector(&$course, &$hotpot, &$formdata) {
);
print '<tr><td>';
echo $OUTPUT->help_icon(moodle_help_icon::make('reportcontent', get_string('reportcontent', 'hotpot'), 'hotpot'));
echo $OUTPUT->help_icon('reportcontent', get_string('reportcontent', 'hotpot'), 'hotpot');
print '</td><th align="right" scope="col">'.get_string('reportcontent', 'hotpot').':</th><td colspan="7">';
foreach ($menus as $name => $options) {
$value = $formdata[$name];
@ -587,7 +587,7 @@ function hotpot_print_report_selector(&$course, &$hotpot, &$formdata) {
);
print '<tr><td>';
echo $OUTPUT->help_icon(moodle_help_icon::make('reportformat', get_string('reportformat', 'hotpot'), 'hotpot'));
echo $OUTPUT->help_icon('reportformat', get_string('reportformat', 'hotpot'), 'hotpot');
print '</td>';
foreach ($menus as $name => $options) {
$value = $formdata[$name];

View File

@ -136,7 +136,7 @@ class hotpot_report extends hotpot_default_report {
if (empty($table->caption)) {
$table->caption = get_string('indivresp', 'quiz');
if ($is_html) {
$table->caption .= $OUTPUT->help_icon(moodle_help_icon::make('responsestable', $table->caption, 'hotpot'));
$table->caption .= $OUTPUT->help_icon('responsestable', $table->caption, 'hotpot');
}
}
$hints = empty($response->hints) ? 0 : $response->hints;
@ -260,14 +260,14 @@ class hotpot_report extends hotpot_default_report {
$br = $is_html ? '<br />' : "\n";
$space = $is_html ? '&nbsp;' : "";
$no_value = $is_html ? '--' : "";
$help_button = $is_html ? $OUTPUT->help_icon(moodle_help_icon::make("discrimination", get_string('discrimination', 'quiz'), "quiz")) : "";
$help_button = $is_html ? $OUTPUT->help_icon("discrimination", get_string('discrimination', 'quiz'), "quiz") : "";
// table properties
unset($table);
$table->border = 1;
$table->width = '100%';
$table->caption = get_string('itemanal', 'quiz');
if ($is_html) {
$table->caption .= $OUTPUT->help_icon(moodle_help_icon::make('analysistable', $table->caption, 'hotpot'));
$table->caption .= $OUTPUT->help_icon('analysistable', $table->caption, 'hotpot');
}
// initialize legend, if necessary
if (!empty($options['reportshowlegend'])) {

View File

@ -62,11 +62,7 @@ $mform->set_data($data);
$PAGE->set_heading($strimportquestions);
echo $OUTPUT->header();
$helpicon = new moodle_help_icon();
$helpicon->text = $strimportquestions;
$helpicon->page = "import";
$helpicon->module = "lesson";
echo $OUTPUT->heading_with_help($helpicon);
echo $OUTPUT->heading_with_help($strimportquestions, 'import', 'lesson' );
if ($data = $mform->get_data()) {

View File

@ -205,12 +205,7 @@ $PAGE->set_heading($strimportppt);
echo $OUTPUT->header();
/// Print upload form
$helpicon = new moodle_help_icon();
$helpicon->text = $strimportppt;
$helpicon->page = "importppt";
$helpicon->module = "lesson";
echo $OUTPUT->heading_with_help($helpicon);
echo $OUTPUT->heading_with_help($strimportppt, 'importppt', 'lesson');
echo $OUTPUT->box_start('generalbox boxaligncenter');
$mform->display();
echo $OUTPUT->box_end();

View File

@ -455,7 +455,7 @@ function lesson_mediafile_block_contents($cmid, $lesson) {
$link->title = get_string('mediafilepopup', 'lesson');
$content = $OUTPUT->link($link);
$content .= $OUTPUT->help_icon(moodle_help_icon::make("mediafilestudent", get_string("mediafile", "lesson"), "lesson"));
$content .= $OUTPUT->help_icon("mediafilestudent", get_string("mediafile", "lesson"), "lesson");
$bc = new block_contents();
$bc->title = get_string('linkedmedia', 'lesson');

View File

@ -49,13 +49,7 @@ class mod_lesson_renderer extends plugin_renderer_base {
$output = $this->output->header();
if (has_capability('mod/lesson:manage', $context)) {
$helpicon = new moodle_help_icon();
$helpicon->text = $activityname;
$helpicon->page = "overview";
$helpicon->module = "lesson";
$output .= $this->output->heading_with_help($helpicon);
$output .= $this->output->heading_with_help($activityname, 'overview', 'lesson');
if (!empty($currenttab)) {
ob_start();

View File

@ -106,7 +106,7 @@ function module_specific_controls($totalnumber, $recurse, $category, $cmid, $cmo
$out .= '<input type="hidden" name="categoryid" value="' . $category->id . '" />';
$out .= ' <input type="submit" name="addrandom" value="'.
$straddtoquiz.'" '.$disabled.' />';
$out .= $OUTPUT->help_icon(moodle_help_icon::make('random', get_string('random', 'quiz'), 'quiz'));
$out .= $OUTPUT->help_icon('random', get_string('random', 'quiz'), 'quiz');
}
}
return $out;
@ -516,7 +516,7 @@ if ($quiz_reordertool) {
echo '</div>';
}
echo $OUTPUT->heading($pagetitle.": ".$quiz->name, 2);
echo $OUTPUT->help_icon(moodle_help_icon::make('editconcepts', get_string('basicideasofquiz', 'quiz'), 'quiz', get_string('basicideasofquiz', 'quiz')));
echo $OUTPUT->help_icon('editconcepts', get_string('basicideasofquiz', 'quiz'), 'quiz', true);
quiz_print_status_bar($quiz);
$tabindex = 0;

View File

@ -676,7 +676,7 @@ function quiz_print_pagecontrols($quiz, $pageurl, $page, $hasattempts) {
</div>
</form>
</div>
<?php echo $OUTPUT->help_icon(moodle_help_icon::make('random', get_string('random', 'quiz'), 'quiz')); ?>
<?php echo $OUTPUT->help_icon('random', get_string('random', 'quiz'), 'quiz'); ?>
<?php
echo "\n</div>";
}
@ -1144,7 +1144,7 @@ function quiz_print_grading_form($quiz, $pageurl, $tabindex) {
echo '<label for="inputmaxgrade">' . get_string('maximumgradex', '', $a) . "</label>";
echo '<input type="hidden" name="savechanges" value="save" />';
echo '<input type="submit" value="' . $strsave . '" />';
echo $OUTPUT->help_icon(moodle_help_icon::make('maxgrade', get_string('maximumgrade'), 'quiz'));
echo $OUTPUT->help_icon('maxgrade', get_string('maximumgrade'), 'quiz');
echo '</fieldset>';
echo "</div></form>\n";
return $tabindex + 1;

View File

@ -823,16 +823,13 @@ function quiz_question_preview_button($quiz, $question, $label = false) {
}
// Build the icon.
$image = new html_image();
$image->src = $OUTPUT->pix_url('t/preview');
$image->add_class('iconsmall');
$image->alt = $strpreviewquestion;
$image = $OUTPUT->image($OUTPUT->pix_url('t/preview'), array('class'=>'iconsmall', 'alt'=>$strpreviewquestion));
$link = html_link::make("/question/preview.php?id=$question->id&quizid=$quiz->id", $strpreviewlabel);
$link = new html_link($CFG->wwwroot."/question/preview.php?id=$question->id&quizid=$quiz->id", $image, array('title' => $strpreviewquestion));
parse_str(QUESTION_PREVIEW_POPUP_OPTIONS, $options);
$link->add_action(new popup_action('click', $link->url, 'questionpreview', $options));
$link->title = $strpreviewquestion;
return $OUTPUT->link_to_popup($link, $image);
return $OUTPUT->link($link);
}
/**

View File

@ -2,7 +2,6 @@
/**
* This script calculates various statistics about student attempts
*
* @version $Id$
* @author Martin Dougiamas, Jamie Pratt, Tim Hunt and others.
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package quiz
@ -422,7 +421,7 @@ class quiz_statistics_report extends quiz_default_report {
$select = html_select::make($downloadoptions, 'download', $this->table->defaultdownloadformat, false);
$select->nothingvalue = '';
$quizinformationtablehtml .= $OUTPUT->select($select);;
$quizinformationtablehtml .= $OUTPUT->help_icon(moodle_help_icon::make('tableexportformats', get_string('tableexportformats', 'table')));
$quizinformationtablehtml .= $OUTPUT->help_icon('tableexportformats', get_string('tableexportformats', 'table'));
$quizinformationtablehtml .= '</div></form>';
}
$quizinformationtablehtml .= $OUTPUT->table($quizinformationtable);

View File

@ -146,7 +146,7 @@ class quiz_report_statistics_table extends flexible_table {
if ($question->_stats->negcovar){
$negcovar = get_string('negcovar', 'quiz_statistics');
if (!$this->is_downloading()){
$negcovar .= $OUTPUT->help_icon(moodle_help_icon::make('negcovar', $negcovar, 'quiz_statistics'));
$negcovar .= $OUTPUT->help_icon('negcovar', $negcovar, 'quiz_statistics');
return '<div class="negcovar">'.$negcovar.'</div>';
} else {
return $negcovar;

View File

@ -357,11 +357,7 @@
// Do the Action
# "setpageflags", "removepages", "strippages", "checklinks", "revertpages"
$helpicon = new moodle_help_icon();
$helpicon->text = get_string($action,"wiki");
$helpicon->page = $action;
$helpicon->module = "wiki";
echo $OUTPUT->heading_with_help($helpicon);
echo $OUTPUT->heading_with_help(get_string($action,"wiki"), $action, 'wiki');
include $action.".html";
echo $OUTPUT->box_end();

View File

@ -28,7 +28,7 @@ if($err->remark) {
<td>
<input type="text" name="authorfieldpattern" size="30" value="<?php p($form->authorfieldpattern) ?>" />
<?php
echo $OUTPUT->help_icon(moodle_help_icon::make('revertauthorfieldpattern', get_string('authorfieldpattern', 'wiki'), 'wiki'));
echo $OUTPUT->help_icon('revertauthorfieldpattern', get_string('authorfieldpattern', 'wiki'), 'wiki');
if (!empty($err->authorfieldpattern)) { echo $OUTPUT->error_text($err->authorfieldpattern); }
?>
</td>

View File

@ -365,7 +365,7 @@
/// Formatting Rules
echo '<td class="howtowiki">';
echo $OUTPUT->help_icon(moodle_help_icon::make('howtowiki', get_string('howtowiki', 'wiki'), 'wiki'));
echo $OUTPUT->help_icon('howtowiki', get_string('howtowiki', 'wiki'), 'wiki');
echo '</td>';
echo '</tr></table>';

View File

@ -257,11 +257,7 @@ class question_category_object {
public function output_edit_lists() {
global $OUTPUT;
$helpicon = new moodle_help_icon();
$helpicon->text = get_string('editcategories', 'quiz');
$helpicon->page = 'categories';
$helpicon->module = 'question';
echo $OUTPUT->heading_with_help($helpicon);
echo $OUTPUT->heading_with_help(get_string('editcategories', 'quiz'), 'categories', 'question');
foreach ($this->editlists as $context => $list){
$listhtml = $list->to_html(0, array('str'=>$this->str));

View File

@ -625,16 +625,14 @@ class question_bank_preview_action_column extends question_bank_action_column_ba
protected function display_content($question, $rowclasses) {
global $OUTPUT;
if (question_has_capability_on($question, 'use')) {
parse_str(QUESTION_PREVIEW_POPUP_OPTIONS, $options);
$image = new html_image();
$image->src = $OUTPUT->pix_url('t/preview');
$image->add_class('iconsmall');
$image->alt = $this->strpreview;
// Build the icon.
$image = $OUTPUT->image($OUTPUT->pix_url('t/preview'), array('class'=>'iconsmall', 'alt'=>$this->strpreview));
$link = html_link::make($this->qbank->preview_question_url($question->id), $this->strpreview);
$link = new html_link($this->qbank->preview_question_url($question->id), $image, array('title' => $this->strpreview));
parse_str(QUESTION_PREVIEW_POPUP_OPTIONS, $options);
$link->add_action(new popup_action('click', $link->url, 'questionpreview', $options));
$link->title = $this->strpreview;
echo $OUTPUT->link_to_popup($link, $image);
echo $OUTPUT->link($link);
}
}
@ -1934,7 +1932,7 @@ function create_new_question_button($categoryid, $params, $caption, $tooltip = '
$form->button->disabled = $disabled;
echo $OUTPUT->button($form);
echo $OUTPUT->help_icon(moodle_help_icon::make('types', get_string('createnewquestion', 'question'), 'question'));
echo $OUTPUT->help_icon('types', get_string('createnewquestion', 'question'), 'question');
$PAGE->requires->yui2_lib('dragdrop');
$PAGE->requires->yui2_lib('container');
if (!$choiceformprinted) {

View File

@ -119,11 +119,7 @@
}
/// Display export form
$helpicon = new moodle_help_icon();
$helpicon->text = $strexportquestions;
$helpicon->page = 'export';
$helpicon->module = 'quiz';
echo $OUTPUT->heading_with_help($helpicon);
echo $OUTPUT->heading_with_help($strexportquestions, 'export', 'quiz');
$export_form->display();

View File

@ -16,7 +16,7 @@ class question_export_form extends moodleform {
$radioarray = array();
foreach ($fileformatnames as $shortname => $fileformatname) {
$radioelement = &MoodleQuickForm::createElement('radio','format','',$fileformatname,$shortname);
$radioelement->setHelpButton(array("$shortname",$fileformatname,"qformat_$shortname"));
$mform->setHelpButton('format', array("$shortname",$fileformatname,"qformat_$shortname"));
$radioarray[] = $radioelement;
}
$mform->addGroup($radioarray,'format','',array('<br />'),false);

View File

@ -151,11 +151,7 @@
}
}
$helpicon = new moodle_help_icon();
$helpicon->text = $txt->importquestions;
$helpicon->page = 'import';
$helpicon->module = 'quiz';
echo $OUTPUT->heading_with_help($helpicon);
echo $OUTPUT->heading_with_help($txt->importquestions, 'import', 'quiz');
/// Print upload form
$import_form->display();

View File

@ -573,18 +573,10 @@ class question_calculated_qtype extends default_questiontype {
return;
break;
case 'datasetdefinitions':
$helpicon = new moodle_help_icon();
$helpicon->text = get_string("choosedatasetproperties", "quiz");
$helpicon->page = 'questiondatasets';
$helpicon->module = 'quiz';
echo $OUTPUT->heading_with_help($helpicon);
echo $OUTPUT->heading_with_help(get_string("choosedatasetproperties", "quiz"), 'questiondatasets', 'quiz');
break;
case 'datasetitems':
$helpicon = new moodle_help_icon();
$helpicon->text = get_string("editdatasets", "quiz");
$helpicon->page = 'questiondatasets';
$helpicon->module = 'quiz';
echo $OUTPUT->heading_with_help($helpicon);
echo $OUTPUT->heading_with_help(get_string("editdatasets", "quiz"), 'questiondatasets', 'quiz');
break;
}

View File

@ -228,11 +228,7 @@ class default_questiontype {
global $OUTPUT;
$heading = $this->get_heading(empty($question->id));
$helpicon = new moodle_help_icon();
$helpicon->text = $heading;
$helpicon->page = $this->name();
$helpicon->module = $this->plugin_name();
echo $OUTPUT->heading_with_help($helpicon);
echo $OUTPUT->heading_with_help($heading, $this->name(), $this->plugin_name());
$permissionstrs = array();
if (!empty($question->id)){

View File

@ -89,11 +89,7 @@ class random_qtype extends default_questiontype {
function display_question_editing_page(&$mform, $question, $wizardnow){
$heading = $this->get_heading(empty($question->id));
$helpicon = new moodle_help_icon();
$helpicon->text = $heading;
$helpicon->page = $this->name();
$helpicon->module = $this->plugin_name();
echo $OUTPUT->heading_with_help($helpicon);
echo $OUTPUT->heading_with_help($heading, $this->name(), $this->plugin_name());
$mform->display();
}

View File

@ -127,7 +127,7 @@ echo $OUTPUT->header();
// Print the add and delete form
coursetag_get_jscript();
$addtagshelp = $OUTPUT->help_icon(moodle_help_icon::make('addtags', 'adding tags', $tagslang));
$addtagshelp = $OUTPUT->help_icon('addtags', 'adding tags', $tagslang);
$edittagthisunit = get_string('edittagthisunit', $tagslang);
$arrowtitle = get_string('arrowtitle', $tagslang);
$sesskey = sesskey();
@ -160,7 +160,7 @@ echo $OUTPUT->header();
</div>
EOT;
if ($coursetabs) {
$deletetagshelp = $OUTPUT->help_icon(moodle_help_icon::make('deletetags', 'deleting tags', $tagslang));
$deletetagshelp = $OUTPUT->help_icon('deletetags', 'deleting tags', $tagslang);
$editdeletemytag = get_string('editdeletemytag', $tagslang);
$outstr .= <<<EOT1
<div class="coursetag_edit_row">

Some files were not shown because too many files have changed in this diff Show More