Skip to content

Commit

Permalink
Merge branch 'wip-MDL-35826-master' of git://github.com/phalacee/moodle
Browse files Browse the repository at this point in the history
Conflicts:
	calendar/upgrade.txt
  • Loading branch information
Sam Hemelryk committed Jan 22, 2013
2 parents a659a79 + 512edd6 commit 8af97c2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
6 changes: 2 additions & 4 deletions blocks/calendar_month/block_calendar_month.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,11 @@ function get_content() {
list($courses, $group, $user) = calendar_set_filters($filtercourse);
if ($issite) {
// For the front page
$this->content->text .= calendar_top_controls('frontpage', array('id' => $courseid, 'm' => $cal_m, 'y' => $cal_y));
$this->content->text .= calendar_get_mini($courses, $group, $user, $cal_m, $cal_y);
$this->content->text .= calendar_get_mini($courses, $group, $user, $cal_m, $cal_y, 'frontpage', $courseid);
// No filters for now
} else {
// For any other course
$this->content->text .= calendar_top_controls('course', array('id' => $courseid, 'm' => $cal_m, 'y' => $cal_y));
$this->content->text .= calendar_get_mini($courses, $group, $user, $cal_m, $cal_y);
$this->content->text .= calendar_get_mini($courses, $group, $user, $cal_m, $cal_y, 'course', $courseid);
$this->content->text .= '<h3 class="eventskey">'.get_string('eventskey', 'calendar').'</h3>';
$this->content->text .= '<div class="filters calendar_filters">'.calendar_filter_controls($this->page->url).'</div>';
}
Expand Down
9 changes: 7 additions & 2 deletions calendar/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,16 @@ function calendar_get_starting_weekday() {
/**
* Generates the HTML for a miniature calendar
*
* @param array $courses list of course
* @param array $courses list of course to list events from
* @param array $groups list of group
* @param array $users user's info
* @param int $cal_month calendar month in numeric, default is set to false
* @param int $cal_year calendar month in numeric, default is set to false
* @param string $placement the place/page the calendar is set to appear - passed on the the controls function
* @param int $courseid id of the course the calendar is displayed on - passed on the the controls function
* @return string $content return html table for mini calendar
*/
function calendar_get_mini($courses, $groups, $users, $cal_month = false, $cal_year = false) {
function calendar_get_mini($courses, $groups, $users, $cal_month = false, $cal_year = false, $placement = false, $courseid = false ) {
global $CFG, $USER, $OUTPUT;

$display = new stdClass;
Expand Down Expand Up @@ -280,6 +282,9 @@ function calendar_get_mini($courses, $groups, $users, $cal_month = false, $cal_y

$summary = get_string('calendarheading', 'calendar', userdate(make_timestamp($y, $m), get_string('strftimemonthyear')));
$content .= '<table class="minicalendar calendartable" summary="'.$summary.'">'; // Begin table
if (($placement !== false) && ($courseid !== false)) {
$content .= '<caption>'. calendar_top_controls($placement, array('id' => $courseid, 'm' => $m, 'y' => $y)) .'</caption>';
}
$content .= '<tr class="weekdays">'; // Header row: day names

// Print out the names of the weekdays
Expand Down
9 changes: 3 additions & 6 deletions calendar/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,16 +171,13 @@ public function fake_block_threemonths(calendar_information $calendar) {
list($nextmon, $nextyr) = calendar_add_month($calendar->month, $calendar->year);

$content = html_writer::start_tag('div', array('class'=>'minicalendarblock'));
$content .= calendar_top_controls('display', array('id' => $calendar->courseid, 'm' => $prevmon, 'y' => $prevyr));
$content .= calendar_get_mini($calendar->courses, $calendar->groups, $calendar->users, $prevmon, $prevyr);
$content .= calendar_get_mini( $calendar->courses, $calendar->groups, $calendar->users, $prevmon, $prevyr, 'display', $calendar->courseid);
$content .= html_writer::end_tag('div');
$content .= html_writer::start_tag('div', array('class'=>'minicalendarblock'));
$content .= calendar_top_controls('display', array('id' => $calendar->courseid, 'm' => $calendar->month, 'y' => $calendar->year));
$content .= calendar_get_mini($calendar->courses, $calendar->groups, $calendar->users, $calendar->month, $calendar->year);
$content .= calendar_get_mini($calendar->courses, $calendar->groups, $calendar->users, $calendar->month, $calendar->year, 'display', $calendar->courseid);
$content .= html_writer::end_tag('div');
$content .= html_writer::start_tag('div', array('class'=>'minicalendarblock'));
$content .= calendar_top_controls('display', array('id' => $calendar->courseid, 'm' => $nextmon, 'y' => $nextyr));
$content .= calendar_get_mini($calendar->courses, $calendar->groups, $calendar->users, $nextmon, $nextyr);
$content .= calendar_get_mini($calendar->courses, $calendar->groups, $calendar->users, $nextmon, $nextyr, 'display', $calendar->courseid);
$content .= html_writer::end_tag('div');
return $content;
}
Expand Down
1 change: 1 addition & 0 deletions calendar/upgrade.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ required changes in code:
* calendar_add_icalendar_event() now requires a valid subscriptionid
* calendar_process_subscription_row() throws exception for invalid subscriptionid
* calendar_update_subscription_events() now throws a dml_exception instead of moodle_exception for bad subscriptions
* calendar_get_mini() function now has optional $placement and $courseid paramaters.

=== 2.4 ===

Expand Down

0 comments on commit 8af97c2

Please sign in to comment.