From 307955fbc5a198c116851a2a219ff0f8be8e55eb Mon Sep 17 00:00:00 2001 From: Myles Carrick Date: Wed, 27 Apr 2011 16:28:57 +1000 Subject: [PATCH 10/11] index: re-enable so that the link from the Activities block takes us somewhere meaningful --- index.php | 86 ++++++++++++++++++++++--------------------------------------- 1 files changed, 31 insertions(+), 55 deletions(-) diff --git a/index.php b/index.php index 5464734..4f00102 100644 --- a/index.php +++ b/index.php @@ -7,11 +7,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ - -// Not sure if this page is needed anymore - -/** - require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); require_once(dirname(__FILE__).'/lib.php'); @@ -25,25 +20,23 @@ if (! $course = $DB->get_record('course', $params)) { } require_course_login($course); +$PAGE->set_pagelayout('incourse'); add_to_log($course->id, 'adobeconnect', 'view all', "index.php?id=$course->id", ''); - -/// Get all required stringsadobeconnect +/// Get all required strings $stradobeconnects = get_string('modulenameplural', 'adobeconnect'); $stradobeconnect = get_string('modulename', 'adobeconnect'); +$strsectionname = get_string('sectionname', 'format_'.$course->format); +$strname = get_string('name'); +$strintro = get_string('moduleintro'); - -/// Print the header - -$navlinks = array(); -$navlinks[] = array('name' => $stradobeconnects, 'link' => '', 'type' => 'activity'); -$navigation = build_navigation($navlinks); - -print_header_simple($stradobeconnects, '', $navigation, '', '', true, '', navmenu($course)); - -/// Get all the appropriate data +$PAGE->set_url('/mod/adobeconnect/index.php', array('id' => $course->id)); +$PAGE->set_title($course->shortname.': '.$stradobeconnects); +$PAGE->set_heading($course->fullname); +$PAGE->navbar->add($stradobeconnects); +echo $OUTPUT->header(); if (! $adobeconnects = get_all_instances_in_course('adobeconnect', $course)) { notice(get_string('noinstances', 'adobeconnect'), "../../course/view.php?id=$course->id"); @@ -52,58 +45,41 @@ if (! $adobeconnects = get_all_instances_in_course('adobeconnect', $course)) { /// Print the list of instances (your module will probably extend this) -$timenow = time(); -$strname = get_string('name'); -$strweek = get_string('week'); -$strtopic = get_string('topic'); - -if ($course->format == 'weeks') { - $table->head = array ($strweek, $strname); - $table->align = array ('center', 'left'); -} else if ($course->format == 'topics') { - $table->head = array ($strtopic, $strname); - $table->align = array ('center', 'left', 'left', 'left'); -} else { - $table->head = array ($strname); - $table->align = array ('left', 'left', 'left'); +$usesections = course_format_uses_sections($course->format); +if ($usesections) { + $sections = get_all_sections($course->id); } -$groups = groups_get_user_groups($course->id, $USER->id); -$groupid = ''; -$groupmode = ''; +$table = new html_table(); +$table->attributes['class'] = 'generaltable mod_index'; -if (array_key_exists(0, $groups)) { - $groupid = '&group='.current($groups[0]); +if ($usesections) { + $table->head = array ($strsectionname, $strname, $strintro); + $table->align = array ('center', 'left', 'left'); +} else { + $table->head = array ($strlastmodified, $strname, $strintro); + $table->align = array ('left', 'left', 'left'); } foreach ($adobeconnects as $adobeconnect) { - $group = $groupid; + $linkparams = array('id' => $adobeconnect->coursemodule); + $linkoptions = array(); - if (0 == $adobeconnect->groupmode) { - $group = '&group=0'; - } + $modviewurl = new moodle_url('/mod/adobeconnect/view.php', $linkparams); if (!$adobeconnect->visible) { - //Show dimmed if the mod is hidden - $link = ''.format_string($adobeconnect->name).''; - } else { - //Show normal if the mod is visible - $link = ''.format_string($adobeconnect->name).''; + $linkoptions['class'] = "dimmed"; } + $link = html_writer::link($modviewurl, format_string($adobeconnect->name), $linkoptions); + $intro = $adobeconnect->intro; if ($course->format == 'weeks' or $course->format == 'topics') { - $table->data[] = array ($adobeconnect->section, $link); + $table->data[] = array ($adobeconnect->section, $link, $intro); } else { - $table->data[] = array ($link); + $table->data[] = array ($link, $intro); } } -print_heading($stradobeconnects); -print_table($table); - -/// Finish the page - -print_footer($course); +echo html_writer::table($table); -?> -*/ \ No newline at end of file +echo $OUTPUT->footer(); \ No newline at end of file -- 1.7.2.2