Skip to content

Commit

Permalink
Following Eloy's suggestion and Martin's clarification, the wizard is…
Browse files Browse the repository at this point in the history
… going

to demonstrate a feat where 10 lines of code turn into 2, and a global var
dependency vanishes at the same time! ;)
  • Loading branch information
defacer committed Apr 1, 2004
1 parent f30fe8d commit 2b10fcf
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions calendar/view.php
Expand Up @@ -337,7 +337,7 @@ function calendar_show_day($d, $m, $y, $courses, $groups, $users) {

function calendar_show_month_detailed($m, $y, $courses, $groups, $users) {
global $CFG, $SESSION, $USER;
global $day, $mon, $yr, $defaultcourses;
global $day, $mon, $yr;

$getvars = 'from=month&cal_d='.$day.'&cal_m='.$mon.'&cal_y='.$yr; // For filtering

Expand Down Expand Up @@ -549,26 +549,20 @@ function calendar_show_month_detailed($m, $y, $courses, $groups, $users) {
}
echo 'style="width: 8px;"></td><td><strong>'.get_string('courseevents', 'calendar').':</strong> ';

$defaultcourses = array_diff_assoc($defaultcourses, array(1 => 1)); // Filter the site out
$getcourses = array_keys($defaultcourses);

if(!empty($getcourses)) {
$select = 'id IN ('.implode(',', $getcourses).')';
$coursesdata = get_records_select('course', $select, 'fullname');
}
else {
$coursedata = false;
}
$coursesdata = get_my_courses($USER->id);
$coursesdata = array_diff_assoc($coursesdata, array(1 => 1));

echo '<select name="course" onchange="document.location.href=\''.CALENDAR_URL.'set.php?var=setcourse&amp;'.$getvars.'&amp;id=\' + this.value;">';
echo '<option value="0"'.($SESSION->cal_show_course === false?' selected':'').'>'.get_string('hidden', 'calendar')."</option>\n";
echo '<option value="1"'.($SESSION->cal_show_course === true?' selected':'').'>'.get_string('shown', 'calendar')."</option>\n";
if($coursesdata !== false) {
foreach($coursesdata as $coursedata) {
echo "\n<option value='$coursedata->id'";
if(is_int($SESSION->cal_show_course) && $coursedata->id == $SESSION->cal_show_course) echo ' selected';
echo '>'.$coursedata->shortname."</option>\n";
if(is_int($SESSION->cal_show_course) && $coursedata->id == $SESSION->cal_show_course) {
echo ' selected';
}
echo '>'.$coursedata->shortname."</option>\n";
}
}
echo '</select>';
echo '</td>';
Expand Down

0 comments on commit 2b10fcf

Please sign in to comment.