MDL-19794 Converting calls to popup_form()

This commit is contained in:
nicolasconnault
2009-08-08 09:31:01 +00:00
parent 43a228b363
commit 64e12bb710
6 changed files with 49 additions and 24 deletions
+8 -1
View File
@@ -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
+6 -3
View File
@@ -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.'&amp;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>';
}
+6 -3
View File
@@ -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.'&amp;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
View File
@@ -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&amp;sesskey=".sesskey()."&amp;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
View File
@@ -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&section=$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('&amp;', '&', $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&section=$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&section=$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) {
+6 -6
View File
@@ -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&amp;time=$time&amp;mode=", $options, 'switchmode', $mode, '', '', '', true);
return $OUTPUT->select(moodle_select::make_popup_form($options, 'switchmode', $popupurl.$mode));
}