MDL-19794 Converting calls to popup_form()
This commit is contained in:
+8
-1
@@ -171,7 +171,14 @@
|
||||
make_categories_list($displaylist, $notused);
|
||||
|
||||
echo '<div class="categorypicker">';
|
||||
popup_form('category.php?id=', $displaylist, 'switchcategory', $category->id, '', '', '', false, 'self', $strcategories.':');
|
||||
$popupurl = 'category.php?id=';
|
||||
foreach ($displaylist as $key => $val) {
|
||||
$displaylist[$popupurl.$key] = $val;
|
||||
unset($displaylist[$key]);
|
||||
}
|
||||
$select = moodle_select::make_popup_form($displaylist, 'switchcategory', $popupurl.$category->id);
|
||||
$select->set_label($strcategories.':');
|
||||
echo $OUTPUT->select($select);
|
||||
echo '</div>';
|
||||
|
||||
/// Print current category description
|
||||
|
||||
@@ -130,6 +130,8 @@
|
||||
$timenow = time();
|
||||
$section = 1;
|
||||
$sectionmenu = array();
|
||||
|
||||
$popupurl = $CFG->wwwroot.'/course/view.php?id='.$course->id.'&topic=';
|
||||
|
||||
while ($section <= $course->numsections) {
|
||||
|
||||
@@ -155,7 +157,7 @@
|
||||
} else {
|
||||
$strsummary = ' - '.substr($strsummary, 0, 60).'...';
|
||||
}
|
||||
$sectionmenu[$section] = s($section.$strsummary);
|
||||
$sectionmenu[$popupurl.$section] = s($section.$strsummary);
|
||||
}
|
||||
$section++;
|
||||
continue;
|
||||
@@ -252,7 +254,8 @@
|
||||
|
||||
if (!empty($sectionmenu)) {
|
||||
echo '<div class="jumpmenu">';
|
||||
echo popup_form($CFG->wwwroot.'/course/view.php?id='.$course->id.'&topic=', $sectionmenu,
|
||||
'sectionmenu', '', get_string('jumpto'), '', '', true);
|
||||
$select = moodle_select::make_popup_form($sectionmenu, 'sectionmenu');
|
||||
$select->set_label(get_string('jumpto'));
|
||||
echo $OUTPUT->select($select);
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
@@ -126,6 +126,8 @@
|
||||
$weekofseconds = 604800;
|
||||
$course->enddate = $course->startdate + ($weekofseconds * $course->numsections);
|
||||
|
||||
$popupurl = $CFG->wwwroot.'/course/view.php?id='.$course->id.'&week=';
|
||||
|
||||
$strftimedateshort = ' '.get_string('strftimedateshort');
|
||||
|
||||
while ($weekdate < $course->enddate) {
|
||||
@@ -150,7 +152,7 @@
|
||||
|
||||
if (!empty($displaysection) and $displaysection != $section) { // Check this week is visible
|
||||
if ($showsection) {
|
||||
$sectionmenu[$section] = s("$strweek $section | $weekday - $endweekday");
|
||||
$sectionmenu[$popupurl.$section] = s("$strweek $section | $weekday - $endweekday");
|
||||
}
|
||||
$section++;
|
||||
$weekdate = $nextweekdate;
|
||||
@@ -244,7 +246,8 @@
|
||||
|
||||
if (!empty($sectionmenu)) {
|
||||
echo '<div class="jumpmenu">';
|
||||
echo popup_form($CFG->wwwroot.'/course/view.php?id='.$course->id.'&week=', $sectionmenu,
|
||||
'sectionmenu', '', get_string('jumpto'), '', '', true);
|
||||
$select = moodle_select::make_popup_form($sectionmenu, 'sectionmenu');
|
||||
$select->set_label(get_string('jumpto'));
|
||||
echo $OUTPUT->select($select);
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
+6
-1
@@ -330,13 +330,18 @@ function print_category_edit($category, $displaylist, $parentslist, $depth=-1, $
|
||||
echo '<td align="left">';
|
||||
if (has_capability('moodle/category:manage', $category->context)) {
|
||||
$tempdisplaylist = $displaylist;
|
||||
$popupurl = "index.php?move=$category->id&sesskey=".sesskey()."&moveto=";
|
||||
unset($tempdisplaylist[$category->id]);
|
||||
foreach ($parentslist as $key => $parents) {
|
||||
if (in_array($category->id, $parents)) {
|
||||
unset($tempdisplaylist[$key]);
|
||||
}
|
||||
}
|
||||
popup_form ("index.php?move=$category->id&sesskey=".sesskey()."&moveto=", $tempdisplaylist, "moveform$category->id", $category->parent, '', '', '', false);
|
||||
foreach ($tempdisplaylist as $key => $val) {
|
||||
$tempdisplaylist[$popupurl.$key] = $val;
|
||||
unset($tempdisplaylist[$key]);
|
||||
}
|
||||
echo $OUTPUT->select(moodle_select::make_popup_form($tempdisplaylist, "moveform$category->id", $popupurl.$category->parent));
|
||||
}
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
|
||||
+17
-10
@@ -1546,7 +1546,7 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
|
||||
* Prints the menus to add activities and resources.
|
||||
*/
|
||||
function print_section_add_menus($course, $section, $modnames, $vertical=false, $return=false) {
|
||||
global $CFG;
|
||||
global $CFG, $OUTPUT;
|
||||
|
||||
// check to see if user can add menus
|
||||
if (!has_capability('moodle/course:manageactivities', get_context_instance(CONTEXT_COURSE, $course->id))) {
|
||||
@@ -1556,6 +1556,8 @@ function print_section_add_menus($course, $section, $modnames, $vertical=false,
|
||||
static $resources = false;
|
||||
static $activities = false;
|
||||
|
||||
$popupurl = "$CFG->wwwroot/course/mod.php?id=$course->id§ion=$section&sesskey=".sesskey()."&add=";
|
||||
|
||||
if ($resources === false) {
|
||||
$resources = array();
|
||||
$activities = array();
|
||||
@@ -1573,20 +1575,22 @@ function print_section_add_menus($course, $section, $modnames, $vertical=false,
|
||||
$gettypesfunc = $modname.'_get_types';
|
||||
if (function_exists($gettypesfunc)) {
|
||||
$types = $gettypesfunc();
|
||||
|
||||
foreach($types as $type) {
|
||||
$type->type = str_replace('&', '&', $type->type);
|
||||
if (!isset($type->modclass) or !isset($type->typestr)) {
|
||||
debugging('Incorrect activity type in '.$modname);
|
||||
continue;
|
||||
}
|
||||
if ($type->modclass == MOD_CLASS_RESOURCE) {
|
||||
$resources[$type->type] = $type->typestr;
|
||||
$resources[$popupurl.$type->type] = $type->typestr;
|
||||
} else {
|
||||
$activities[$type->type] = $type->typestr;
|
||||
$activities[$popupurl.$type->type] = $type->typestr;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// all mods without type are considered activity
|
||||
$activities[$modname] = $modnamestr;
|
||||
$activities[$popupurl.$modname] = $modnamestr;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1599,16 +1603,19 @@ function print_section_add_menus($course, $section, $modnames, $vertical=false,
|
||||
if (!$vertical) {
|
||||
$output .= '<div class="horizontal">';
|
||||
}
|
||||
|
||||
|
||||
if (!empty($resources)) {
|
||||
$output .= popup_form("$CFG->wwwroot/course/mod.php?id=$course->id§ion=$section&sesskey=".sesskey()."&add=",
|
||||
$resources, "ressection$section", "", $straddresource, 'resource/types', $straddresource, true);
|
||||
$select = moodle_select::make_popup_form($resources, "ressection$section", null);
|
||||
$select->nothinglabel = $straddresource;
|
||||
$select->set_help_icon('resource/types', $straddresource);
|
||||
$output .= $OUTPUT->select($select);
|
||||
}
|
||||
|
||||
if (!empty($activities)) {
|
||||
$output .= ' ';
|
||||
$output .= popup_form("$CFG->wwwroot/course/mod.php?id=$course->id§ion=$section&sesskey=".sesskey()."&add=",
|
||||
$activities, "section$section", "", $straddactivity, 'mods', $straddactivity, true);
|
||||
$select = moodle_select::make_popup_form($activities, "section$section", null);
|
||||
$select->nothinglabel = $straddactivity;
|
||||
$select->set_help_icon('mods', $straddactivity);
|
||||
$output .= $OUTPUT->select($select);
|
||||
}
|
||||
|
||||
if (!$vertical) {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
|
||||
function report_stats_mode_menu($course, $mode, $time, $url) {
|
||||
global $CFG;
|
||||
global $CFG, $OUTPUT;
|
||||
/*
|
||||
$reportoptions = stats_get_report_options($course->id, $mode);
|
||||
$timeoptions = report_stats_timeoptions($mode);
|
||||
@@ -18,13 +18,13 @@
|
||||
*/
|
||||
|
||||
$options = array();
|
||||
$options[STATS_MODE_GENERAL] = get_string('statsmodegeneral');
|
||||
$options[STATS_MODE_DETAILED] = get_string('statsmodedetailed');
|
||||
$popupurl = $url."?course=$course->id&time=$time&mode=";
|
||||
$options[$popupurl.STATS_MODE_GENERAL] = get_string('statsmodegeneral');
|
||||
$options[$popupurl.STATS_MODE_DETAILED] = get_string('statsmodedetailed');
|
||||
if (has_capability('coursereport/stats:view', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
$options[STATS_MODE_RANKED] = get_string('reports');
|
||||
$options[$popupurl.STATS_MODE_RANKED] = get_string('reports');
|
||||
}
|
||||
|
||||
return popup_form($url."?course=$course->id&time=$time&mode=", $options, 'switchmode', $mode, '', '', '', true);
|
||||
return $OUTPUT->select(moodle_select::make_popup_form($options, 'switchmode', $popupurl.$mode));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user