/** * Get the user dashboard report view. * * @uses $CFG, $CURMAN * @param none * @return string The HTML for the dashboard report. */ function get_dashboard() { global $CFG, $CURMAN; require_once CURMAN_DIRLOCATION . '/lib/curriculumstudent.class.php'; //needed for AJAX calls require_js(array('yui_yahoo', 'yui_dom', 'yui_event', 'yui_connection', "{$CFG->wwwroot}/curriculum/js/util.js", "{$CFG->wwwroot}/curriculum/js/dashboard.js"), true); if (optional_param('tab', '', PARAM_CLEAN) == 'archivedlp') { $tab = 'archivedlp'; $show_archived = 1; } else { $tab = 'currentlp'; $show_archived = 0; } $content = ''; $archive_var = '_elis_curriculum_archive'; $totalcourses = 0; $totalcurricula = 0; $completecourses = 0; $curriculas = array(); $classids = array(); $sql = 'SELECT curstu.id, curstu.curriculumid as curid, cur.name as name FROM ' . $CURMAN->db->prefix_table(CURASSTABLE) . ' curstu JOIN ' . $CURMAN->db->prefix_table(CURTABLE) . ' cur ON cur.id = curstu.curriculumid WHERE curstu.userid = \'' . $this->id . '\' ORDER BY cur.priority ASC, cur.name ASC'; if ($usercurs = get_records_sql($sql)) { foreach ($usercurs as $usercur) { // Check if this curricula is set as archived and whether we want to display it $crlm_context = get_context_instance(context_level_base::get_custom_context_level('curriculum', 'block_curr_admin'), $usercur->curid); $data_array = field_data::get_for_context_and_field($crlm_context, $archive_var); $crlm_archived = 0; if (is_array($data_array) && !empty($data_array)) { foreach ($data_array as $data_key => $data_obj) { $crlm_archived = !empty($data_obj->data) ? 1 : 0; } } if ($show_archived == $crlm_archived) { $totalcurricula++; $curriculas[$usercur->curid]['id'] = $usercur->curid; $curriculas[$usercur->curid]['name'] = $usercur->name; $data = array(); if ($courses = curriculumcourse_get_listing($usercur->curid, 'curcrs.position, crs.name', 'ASC')) { foreach ($courses as $course) { $totalcourses++; $course_obj = new course($course->courseid); $coursedesc = $course_obj->syllabus; if ($cdata = student_get_class_from_course($course->courseid, $this->id)) { foreach ($cdata as $classdata) { if (!in_array($classdata->id, $classids)) { $classids[] = $classdata->id; } if ($classdata->completestatusid == STUSTATUS_PASSED) { $completecourses++; } if ($mdlcrs = moodle_get_course($classdata->id)) { $coursename = '<a href="' . $CFG->wwwroot . '/course/view.php?id=' . $mdlcrs . '">' . $course->coursename . '</a>'; } else { $coursename = $course->coursename; } $data[] = array($coursename, $coursedesc, $classdata->grade, $classdata->completestatusid == STUSTATUS_PASSED ? get_string('yes') : get_string('no'), $classdata->completestatusid == STUSTATUS_PASSED && !empty($classdata->completetime) ? date('M j, Y', $classdata->completetime) : get_string('na', 'block_curr_admin')); } } else { $data[] = array($course->coursename, $coursedesc, 0, get_string('no'), get_string('na', 'block_curr_admin')); } } } $curriculas[$usercur->curid]['data'] = $data; } else { // Keep note of the classid's regardless if set archived or not for later use in determining non-curricula courses if ($courses = curriculumcourse_get_listing($usercur->curid, 'curcrs.position, crs.name', 'ASC')) { foreach ($courses as $course) { if ($cdata = student_get_class_from_course($course->courseid, $this->id)) { foreach ($cdata as $classdata) { if (!in_array($classdata->id, $classids)) { $classids[] = $classdata->id; } } } } } } } } // Show different css for IE below version 8 if (check_browser_version('MSIE', 7.0) && !check_browser_version('MSIE', 8.0)) { // IEs that are lower than version 8 do not get the float because it messes up the tabs at the top of the page for some reason $float_style = 'text-align:right;'; } else { // Sane browsers get the float tag $float_style = 'text-align:right; float:right;'; } // Tab header $field_exists = field::get_for_context_level_with_name('curriculum', $archive_var); if (!empty($field_exists)) { $tabrow = array(); $tabrow[] = new tabobject('currentlp', $CFG->wwwroot . '/curriculum/index.php?tab=currentlp', get_string('tab_current_learning_plans', 'block_curr_admin')); $tabrow[] = new tabobject('archivedlp', $CFG->wwwroot . '/curriculum/index.php?tab=archivedlp', get_string('tab_archived_learning_plans', 'block_curr_admin')); $tabrows = array($tabrow); print_tabs($tabrows, $tab); } $content .= print_heading_block(get_string('learningplanwelcome', 'block_curr_admin', fullname($this)), '', true); if ($totalcurricula === 0) { $blank_lang = $tab == 'archivedlp' ? 'noarchivedplan' : 'nolearningplan'; $content .= '<br /><center>' . get_string($blank_lang, 'block_curr_admin') . '</center>'; } // Load the user preferences for hide/show button states if ($collapsed = get_user_preferences('crlm_learningplan_collapsed_curricula')) { $collapsed_array = explode(',', $collapsed); } else { $collapsed = ''; $collapsed_array = array(); } $content .= '<input type="hidden" name="collapsed" id="collapsed" value="' . $collapsed . '">'; if (!empty($usercurs)) { foreach ($usercurs as $usercur) { if (!isset($curriculas[$usercur->curid])) { continue; } $curricula = $curriculas[$usercur->curid]; $table = new stdClass(); $table->head = array(get_string('class', 'block_curr_admin'), get_string('description', 'block_curr_admin'), get_string('score', 'block_curr_admin'), get_string('completed_label', 'block_curr_admin'), get_string('date', 'block_curr_admin')); $table->data = $curricula['data']; $curricula_name = empty($CURMAN->config->disablecoursecatalog) ? '<a href="index.php?s=crscat§ion=curr&showcurid=' . $curricula['id'] . '">' . $curricula['name'] . '</a>' : $curricula['name']; $header_curr_name = get_string('learningplanname', 'block_curr_admin', $curricula_name); if (in_array($curricula['id'], $collapsed_array)) { $button_label = get_string('showcourses', 'block_curr_admin'); $extra_class = ' hide'; } else { $button_label = get_string('hidecourses', 'block_curr_admin'); $extra_class = ''; } $heading = '<div class="clearfix"></div>' . '<div style="' . $float_style . '">' . '<script id="curriculum' . $curricula['id'] . 'script" type="text/javascript">toggleVisibleInitWithState("curriculum' . $curricula['id'] . 'script", "curriculum' . $curricula['id'] . 'button", "' . $button_label . '", "' . get_string('hidecourses', 'block_curr_admin') . '", "' . get_string('showcourses', 'block_curr_admin') . '", "curriculum-' . $curricula['id'] . '");</script></div>' . $header_curr_name; $content .= '<div class="dashboard_curricula_block">'; $content .= print_heading($heading, 'left', 2, 'main', true); $content .= '<div id="curriculum-' . $curricula['id'] . '" class="yui-skin-sam ' . $extra_class . '">'; if (empty($curricula['data'])) { $content .= get_string('nocourseassoc', 'block_curr_admin'); } else { $content .= print_table($table, true); } $content .= '</div>'; $content .= '</div>'; } } /// Completed non-curricula course data if ($tab != 'archivedlp') { if (!empty($classids)) { $sql = "SELECT stu.id, stu.classid, crs.name as coursename, stu.completetime, stu.grade, stu.completestatusid\n FROM " . $CURMAN->db->prefix_table(STUTABLE) . " stu\n INNER JOIN " . $CURMAN->db->prefix_table(CLSTABLE) . " cls ON cls.id = stu.classid\n INNER JOIN " . $CURMAN->db->prefix_table(CRSTABLE) . " crs ON crs.id = cls.courseid\n WHERE userid = {$this->id}\n AND classid " . (count($classids) == 1 ? "!= " . current($classids) : "NOT IN (" . implode(", ", $classids) . ")") . "\n ORDER BY crs.name ASC, stu.completetime ASC"; } else { $sql = "SELECT stu.id, stu.classid, crs.name as coursename, stu.completetime, stu.grade, stu.completestatusid\n FROM " . $CURMAN->db->prefix_table(STUTABLE) . " stu\n INNER JOIN " . $CURMAN->db->prefix_table(CLSTABLE) . " cls ON cls.id = stu.classid\n INNER JOIN " . $CURMAN->db->prefix_table(CRSTABLE) . " crs ON crs.id = cls.courseid\n WHERE userid = {$this->id}\n ORDER BY crs.name ASC, stu.completetime ASC"; } if ($classes = get_records_sql($sql)) { $table = new stdClass(); $table->head = array(get_string('class', 'block_curr_admin'), get_string('score', 'block_curr_admin'), get_string('completed_label', 'block_curr_admin'), get_string('date', 'block_curr_admin')); $table->data = array(); foreach ($classes as $class) { if ($mdlcrs = moodle_get_course($class->classid)) { $coursename = '<a href="' . $CFG->wwwroot . '/course/view.php?id=' . $mdlcrs . '">' . $class->coursename . '</a>'; } else { $coursename = $class->coursename; } $table->data[] = array($coursename, $class->grade, $class->completestatusid == STUSTATUS_PASSED ? get_string('yes') : get_string('no'), $class->completestatusid == STUSTATUS_PASSED && !empty($class->completetime) ? date('M j, Y', $class->completetime) : get_string('na', 'block_curr_admin')); } $header_curr_name = get_string('noncurriculacourses', 'block_curr_admin'); if (in_array('na', $collapsed_array)) { $button_label = get_string('showcourses', 'block_curr_admin'); $extra_class = ' hide'; } else { $button_label = get_string('hidecourses', 'block_curr_admin'); $extra_class = ''; } $heading = '<div class="clearfix"></div>' . '<div style="' . $float_style . '">' . '<script id="noncurriculascript" type="text/javascript">toggleVisibleInitWithState("noncurriculascript", "noncurriculabutton", "' . $button_label . '", "' . get_string('hidecourses', 'block_curr_admin') . '", "' . get_string('showcourses', 'block_curr_admin') . '", "curriculum-na");</script></div>' . $header_curr_name; $content .= '<div class="dashboard_curricula_block">'; $content .= print_heading($heading, 'left', 2, 'main', true); $content .= '<div id="curriculum-na" class="yui-skin-sam ' . $extra_class . '">'; $content .= print_table($table, true); $content .= '</div>'; $content .= '</div>'; } } return $content; }
$options->id = $courseid; $options->folderid = $folderid; $options->filterid = $filterid; /// Print the main part of the page // Print principal table. This have 2 columns . . . and possibility to add right column. echo '<table id="layout-table"> <tr>'; // Print "blocks" of this account echo '<td style="width: 180px;" id="left-column">'; email_printblocks($USER->id, $courseid, ($search == get_string('searchtext', 'block_email_list') or $search == '') ? true : false); // Close left column echo '</td>'; // Print principal column echo '<td id="middle-column">'; // Print middle table print_heading_block($strsearch); echo '<div> </div>'; // Create advanced search form $advancedsearch = new advanced_search_form(); if (($search == get_string('searchtext', 'block_email_list') or $search == '') and !$advancedsearch->is_submitted()) { if (!$action) { echo $OUTPUT->notification(get_string('emptysearch', 'block_email_list'), ''); echo $OUTPUT->notification(get_string('wantadvancedsearch', 'block_email_list'), 'notifysuccess'); } // Print advanced search form $advancedsearch->display(); } else { if ($advancedsearch->is_cancelled()) { // Cancelled form redirect($CFG->wwwroot . '/blocks/email_list/email/index.php?id=' . $courseid, '', 1); } else {
if (!empty($clear) && $clear == 1) { echo "DELETED"; //clearExamTables($cid); //redirect("$CFG->wwwroot/schedule.php"); } } else { print_heading_block("Clear Exam Records"); print_simple_box_start('center', '60%', '#FFFFFF', 20, 'noticebox'); echo "There are no record(s) to be deleted.<br/><br/>"; print_single_button($mainurl, null); print_simple_box_end(); } } } else { // Course Creator/Teacher Role print_heading_block("Clear Exam Records"); print_simple_box_start('center', '60%', '#FFFFFF', 20, 'noticebox'); if ($userRole->roleid == 2 || $userRole->roleid == 3) { echo "Only an Administrator can delete records.<br/><br/>"; } else { redirect($mainurl); } print_single_button($mainurl, null); print_simple_box_end(); } } print_container_end(); // End - Middle Container Content echo '</td>'; break; case 'right':
} $preview .= "</ul>\n</li>\n"; } $preview .= '</ul>'; } else { /// Save the groups data foreach ($groups as $group) { $newgroup->timecreated = time(); $newgroup->timemodified = $newgroup->timecreated; $newgroup->courseid = $data->courseid; $newgroup->name = $group['name']; $groupid = insert_record('groups', $newgroup); foreach ($group['members'] as $user) { $member->groupid = $groupid; $member->userid = $user->id; $member->timeadded = time(); insert_record('groups_members', $member); } } redirect($returnurl); } } /// Print header print_header_simple($strgroups, ': ' . $strgroups, $navigation, '', '', true, '', navmenu($course)); /// Display the form $editform->display(); if (isset($preview)) { print_heading_block(get_string('groupspreview', 'group')); print_box($preview); } print_footer($course);
$strgroupmy = get_string('groupmy'); $editing = $PAGE->user_is_editing(); echo '<table id="layout-table" cellspacing="0" summary="' . get_string('layouttable') . '">'; echo '<tr>'; if (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $editing) { echo '<td style="width:' . $preferred_width_left . 'px" id="left-column">'; print_container_start(); blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT); print_container_end(); echo '</td>'; } echo '<td id="middle-column">'; print_container_start(); echo skip_main_destination(); if ($forum = forum_get_course_forum($course->id, 'social')) { print_heading_block(get_string('socialheadline')); $cm = get_coursemodule_from_instance('forum', $forum->id); $context = get_context_instance(CONTEXT_MODULE, $cm->id); echo '<div class="subscribelink">', forum_get_subscribe_link($forum, $context), '</div>'; forum_print_latest_discussions($course, $forum, 10, 'plain', '', false); } else { notify('Could not find or create a social forum here'); } print_container_end(); echo '</td>'; // The right column if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $editing) { echo '<td style="width:' . $preferred_width_right . 'px" id="right-column">'; print_container_start(); blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT); print_container_end();
// Print "blocks" of this account echo '<td style="width: 180px;" id="left-column">'; email_printblocks($USER->id, $courseid); // Close left column echo '</td>'; // Print principal column echo '<td id="middle-column">'; // Get actual folder, for show if (!($folder = email_get_folder($folderoldid))) { if (!($folder = email_get_folder($folderid))) { // Default, is inbox $folder = email_get_root_folder($USER->id, EMAIL_INBOX); } } // Print middle table print_heading_block(get_string('mailbox', 'block_email_list') . ': ' . $folder->name); echo '<div> </div>'; // Print tabs options email_print_tabs_options($courseid, $folderid); /// Prepare action if (!empty($action) and $mailid > 0) { // When remove an mail, this functions only accept array in param, overthere converting this param ... if (!is_array($mailid)) { $mailids = array($mailid); } else { $mailids = $mailid; } // Print action in case . . . switch ($action) { case 'removemail': // Fix bug
function action_default() { global $CFG, $CURMAN, $USER; $context = get_context_instance(CONTEXT_SYSTEM); if (has_capability('block/curr_admin:managecurricula', $context)) { echo print_heading_block('Administrator Dashboard', '', true); echo '<p>'; echo get_string('elis_doc_class_link', 'block_curr_admin'); echo '</p><p>'; echo $this->last_cron_runtimes(); echo '</p>'; $healthpg = new healthpage(); if ($healthpg->can_do_default()) { echo '<p>', get_string('health_check_link', 'block_curr_admin', $CFG->wwwroot), '</p>'; } echo print_heading(get_string('elisversion', 'block_curr_admin') . ': ' . $CURMAN->release, 'right', '4', 'main', true); } if ($cmuid = cm_get_crlmuserid($USER->id)) { $user = new user($cmuid); echo $user->get_dashboard(); } }
$strmarkthistopic = get_string('markthistopic'); $strmarkedthistopic = get_string('markedthistopic'); $strmoveup = get_string('moveup'); $strmovedown = get_string('movedown'); } /// Layout the whole page as three big columns. echo '<table id="layout-table" cellspacing="0" summary="' . get_string('layouttable') . '"><tr>'; /// The left column ... if (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $editing) { echo '<td style="width:' . $preferred_width_left . 'px" id="left-column">'; blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT); echo '</td>'; } /// Start main column echo '<td id="middle-column">' . skip_main_destination(); print_heading_block(get_string('lamsoutline', 'lams'), 'outline'); echo '<table class="topics" width="100%" height="100%" summary="' . get_string('layouttable') . '">'; /// If currently moving a file then show the current clipboard if (ismoving($course->id)) { $stractivityclipboard = strip_tags(get_string('activityclipboard', '', addslashes($USER->activitycopyname))); $strcancel = get_string('cancel'); echo '<tr class="clipboard">'; echo '<td colspan="3">'; echo $stractivityclipboard . ' (<a href="mod.php?cancelcopy=true&sesskey=' . $USER->sesskey . '">' . $strcancel . '</a>)'; echo '</td>'; echo '</tr>'; } /// Print Section 0 $section = 0; $thissection = $sections[$section]; if ($thissection->summary or $thissection->sequence or isediting($course->id)) {
echo '</td></tr>'; echo '<tr class="section separator"><td colspan="3" class="spacer"></td></tr>'; } // $section++; // } echo '</table>'; if (!empty($sectionmenu)) { echo '<div align="center" class="jumpmenu">'; echo popup_form($CFG->wwwroot . '/course/view.php?id=' . $course->id . '&', $sectionmenu, 'sectionmenu', '', get_string('jumpto'), '', '', true); echo '</div>'; } print_container_end(); if (right_to_left()) { print_heading_block($imgright . ' (Previous page) ' . get_string('chapter', 'format_ebook') . " {$ebook->chapter} " . get_string('page', 'format_ebook') . " {$ebook->page} (Next page) {$imgleft}", 'outline'); } else { print_heading_block("{$imgleft} " . get_string('page', 'format_ebook') . " {$ebook->page} {$imgright}", 'outline'); } echo '</td>'; break; case 'right': // The right column if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $editing) { echo '<td style="width:' . $preferred_width_right . 'px" id="right-column">'; print_container_start(); blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT); print_container_end(); echo '</td>'; } break; } }
notice(get_string("activityiscurrentlyhidden")); } add_to_log($course->id, "mail", "view", "view.php?id={$cm->id}", $mail->id, $cm->id); /// Printing the heading $strmails = get_string("modulenameplural", "mail"); $strmail = get_string("modulename", "mail"); $navigation = "<a href=\"index.php?id={$course->id}\">{$strmails}</a> ->"; print_header_simple(format_string($mail->name), "", "{$navigation} " . format_string($mail->name), "", "", true, update_module_button($cm->id, $course->id, $strmail), navmenu($course, $cm)); /// If no search results then get potential students for this course excluding users already in course if (count($SESSION->selectedto) > 0) { $existinguserlist = implode(',', $SESSION->selectedto); } else { $existinguserlist = ""; } if (!($students = get_course_students($course->id, "u.firstname ASC, u.lastname ASC, u.username ASC", "", 0, 99999, '', '', NULL, '', 'u.id,u.username,u.firstname,u.lastname', $existinguserlist))) { $students = array(); } if (!($teachers = get_course_teachers($course->id, '', $existinguserlist))) { $teachers = array(); } $numusers = count($students) + count($teachers); mail_start_print_table_main($mail, $cm, $course); print_heading_block("<center>" . get_string("groups", "mail") . "</center>"); echo "<br>"; include 'groups.html'; mail_end_print_table_main($mail); /// Finish the page print_footer($course); ?>
/** * Called from {@link page_print_position()} and it is * supposed to print the front page settings in the * center column for the site course and only for * the default page (EG: the landing page). * * @return boolean **/ function page_frontpage_settings() { global $CFG, $SESSION, $SITE, $PAGE, $COURSE; // Cheap check first - course ID if ($COURSE->id != SITEID) { return false; } // More expensive check - make sure we are viewing default page $default = page_get_default_page(); $current = $PAGE->get_formatpage(); if (empty($default->id) or empty($current->id) or $default->id != $current->id) { return false; } $editing = $PAGE->user_is_editing(); /// START COPY/PASTE FROM INDEX.PHP print_container_start(); /// Print Section if ($SITE->numsections > 0) { if (!($section = get_record('course_sections', 'course', $SITE->id, 'section', 1))) { delete_records('course_sections', 'course', $SITE->id, 'section', 1); // Just in case $section->course = $SITE->id; $section->section = 1; $section->summary = ''; $section->sequence = ''; $section->visible = 1; $section->id = insert_record('course_sections', $section); } if (!empty($section->sequence) or !empty($section->summary) or $editing) { print_box_start('generalbox sitetopic'); /// If currently moving a file then show the current clipboard if (ismoving($SITE->id)) { $stractivityclipboard = strip_tags(get_string('activityclipboard', '', addslashes($USER->activitycopyname))); echo '<p><font size="2">'; echo "{$stractivityclipboard} (<a href=\"course/mod.php?cancelcopy=true&sesskey={$USER->sesskey}\">" . get_string('cancel') . '</a>)'; echo '</font></p>'; } $options = NULL; $options->noclean = true; echo format_text($section->summary, FORMAT_HTML, $options); if ($editing) { $streditsummary = get_string('editsummary'); echo "<a title=\"{$streditsummary}\" " . " href=\"course/editsection.php?id={$section->id}\"><img src=\"{$CFG->pixpath}/t/edit.gif\" " . " class=\"iconsmall\" alt=\"{$streditsummary}\" /></a><br /><br />"; } get_all_mods($SITE->id, $mods, $modnames, $modnamesplural, $modnamesused); print_section($SITE, $section, $mods, $modnamesused, true); if ($editing) { print_section_add_menus($SITE, $section->section, $modnames); } print_box_end(); } } if (isloggedin() and !isguest() and isset($CFG->frontpageloggedin)) { $frontpagelayout = $CFG->frontpageloggedin; } else { $frontpagelayout = $CFG->frontpage; } foreach (explode(',', $frontpagelayout) as $v) { switch ($v) { /// Display the main part of the front page. case FRONTPAGENEWS: if ($SITE->newsitems) { // Print forums only when needed require_once $CFG->dirroot . '/mod/forum/lib.php'; if (!($newsforum = forum_get_course_forum($SITE->id, 'news'))) { error('Could not find or create a main news forum for the site'); } if (!empty($USER->id)) { $SESSION->fromdiscussion = $CFG->wwwroot; if (forum_is_subscribed($USER->id, $newsforum)) { $subtext = get_string('unsubscribe', 'forum'); } else { $subtext = get_string('subscribe', 'forum'); } print_heading_block($newsforum->name); echo '<div class="subscribelink"><a href="mod/forum/subscribe.php?id=' . $newsforum->id . '">' . $subtext . '</a></div>'; } else { print_heading_block($newsforum->name); } forum_print_latest_discussions($SITE, $newsforum, $SITE->newsitems, 'plain', 'p.modified DESC'); } break; case FRONTPAGECOURSELIST: if (isloggedin() and !has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)) and !isguest() and empty($CFG->disablemycourses)) { print_heading_block(get_string('mycourses')); print_my_moodle(); } else { if (!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)) and !isguest() or count_records('course') <= FRONTPAGECOURSELIMIT) { // admin should not see list of courses when there are too many of them print_heading_block(get_string('availablecourses')); print_courses(0); } } break; case FRONTPAGECATEGORYNAMES: print_heading_block(get_string('categories')); print_box_start('generalbox categorybox'); print_whole_category_list(NULL, NULL, NULL, -1, false); print_box_end(); print_course_search('', false, 'short'); break; case FRONTPAGECATEGORYCOMBO: print_heading_block(get_string('categories')); print_box_start('generalbox categorybox'); print_whole_category_list(NULL, NULL, NULL, -1, true); print_box_end(); print_course_search('', false, 'short'); break; case FRONTPAGETOPICONLY: // Do nothing!! :-) break; } // echo '<br />'; REMOVED FOR THE FORMAT } print_container_end(); /// END COPY/PASTE FROM INDEX.PHP return true; }
} blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT); if (!empty($THEME->customcorners)) { print_custom_corners_end(); } echo '</td>'; } break; case 'middle': /// Start main column echo '<td id="middle-column">'; if (!empty($THEME->customcorners)) { print_custom_corners_start(); } echo '<a name="startofcontent"></a>'; print_heading_block(get_string('layout.synchronous', 'samouk'), 'outline'); echo '<table class="weeks" width="100%" summary="' . get_string('layouttable') . '">'; /// If user is teacher, print publication status and control panel if (isediting($course->id) && has_capability('moodle/course:update', $context)) { echo '<tr id="section-viewcontrol" class="section main">'; echo '<td class="left side"> </td>'; echo '<td class="content">'; echo '<div class="summary" style="float:left; width:90%;">'; $summaryformatoptions->noclean = true; if ($course->visible) { echo format_text(get_string('layout.showusers.yes', 'samouk'), FORMAT_HTML, $summaryformatoptions); } else { echo format_text(get_string('layout.showusers.no', 'samouk'), FORMAT_HTML, $summaryformatoptions); } echo "</div>"; echo "<div style='float:right; width:60px; text-align:right;'>";
if (!empty($THEME->roundcorners)) { echo '</div></div></div>'; echo '<div class="bb"><div></div></div>'; } echo '</td>'; } break; case 'middle': /// Start main column echo '<td id="middle-column">'; if (!empty($THEME->roundcorners)) { echo '<div class="bt"><div></div></div>'; echo '<div class="i1"><div class="i2"><div class="i3">'; } echo '<a name="startofcontent"></a>'; print_heading_block(get_string('projectoutline', 'format_project'), 'outline'); echo '<table class="topics" width="100%" summary="' . get_string('layouttable') . '">'; /// If currently moving a file then show the current clipboard if (ismoving($course->id)) { $stractivityclipboard = strip_tags(get_string('activityclipboard', '', addslashes($USER->activitycopyname))); $strcancel = get_string('cancel'); echo '<tr class="clipboard">'; echo '<td colspan="3">'; echo $stractivityclipboard . ' (<a href="mod.php?cancelcopy=true&sesskey=' . $USER->sesskey . '">' . $strcancel . '</a>)'; echo '</td>'; echo '</tr>'; } /// Print Section 0 $section = 0; $thissection = $sections[$section]; if ($thissection->summary or $thissection->sequence or isediting($course->id)) {
// Required $PAGE->set_title("{$course->shortname}: {$stremail}"); echo $OUTPUT->header("{$navigation} <a href=index.php?id={$course->id}>{$stremails}</a> -> {$strsearch}"); } // Print principal table. This have 2 columns . . . and possibility to add right column. echo '<table id="layout-table"> <tr>'; // Print "blocks" of this account echo '<td style="width: 180px;" id="left-column">'; email_printblocks($USER->id, $courseid); // Close left column echo '</td>'; // Print principal column echo '<td id="middle-column">'; // Print block print_heading_block(''); echo '<div> </div>'; if (isset($folderid)) { $folder = $DB->get_record('block_email_list_folder', array('id' => $folderid)); } require_login($course->id, false); if ($course->id == SITEID) { $context = get_context_instance(CONTEXT_SYSTEM, SITEID); // SYSTEM context } else { $context = get_context_instance(CONTEXT_COURSE, $course->id); // Course context } switch ($action) { case md5('admin'): $hassubfolders = email_print_administration_folders($options);
print_header(); notice(get_string("activityiscurrentlyhidden")); } add_to_log($course->id, "portafolio", "view", "view.php?id={$cm->id}", $portafolio->id, $cm->id); /// Processing standard security processes $navigation = ""; if ($course->category) { $navigation = "<a href=\"../../course/view.php?id={$course->id}\">{$course->shortname}</a> ->"; require_login($course->id); } if (!$cm->visible and !isteacher($course->id)) { print_header(); notice(get_string("activityiscurrentlyhidden")); } add_to_log($course->id, "mail", "view", "view.php?id={$cm->id}", $mail->id, $cm->id); /// Printing the heading $strmails = get_string("modulenameplural", "mail"); $strmail = get_string("modulename", "mail"); $navigation = "<a href=\"index.php?id={$course->id}\">{$strmails}</a> ->"; print_header_simple(format_string($mail->name), "", "{$navigation} " . format_string($mail->name), "", "", true, update_module_button($cm->id, $course->id, $strmail), navmenu($course, $cm)); /// If no search results then get potential students for this course excluding users already in course mail_start_print_table_main($mail, $cm, $course); print_heading_block("<center>" . get_string("folders", "mail") . "</center>"); echo "<br>"; include 'folders.html'; mail_end_print_table_main($mail); /// Finish the page print_footer($course); ?>
switch ($column) { case 'left': if (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $editing) { echo '<td style="width:' . $preferred_width_left . 'px" id="left-column">'; print_container_start(); blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT); print_container_end(); echo '</td>'; } break; case 'middle': /// Start main column echo '<td id="middle-column">'; print_container_start(); echo skip_main_destination(); print_heading_block(get_string('topicoutline'), 'outline'); echo '<table class="topics" width="100%" summary="' . get_string('layouttable') . '">'; /// If currently moving a file then show the current clipboard if (ismoving($course->id)) { $stractivityclipboard = strip_tags(get_string('activityclipboard', '', addslashes($USER->activitycopyname))); $strcancel = get_string('cancel'); echo '<tr class="clipboard">'; echo '<td colspan="3">'; echo $stractivityclipboard . ' (<a href="mod.php?cancelcopy=true&sesskey=' . $USER->sesskey . '">' . $strcancel . '</a>)'; echo '</td>'; echo '</tr>'; } /// Print Section 0 $section = 0; $thissection = $sections[$section]; if ($thissection->summary or $thissection->sequence or isediting($course->id)) {
/** * Function used by the site index page to display category specific information. */ function fn_display_category_content($course, $catid) { global $USER, $CFG; $totcount = 99; $isteacher = isteacher($course->id); $isediting = isediting($course->id); $ismoving = ismoving($course->id); if (!($category = get_record('course_categories', 'id', $catid))) { error('Invalid category requested.'); } $courses = get_courses_page($catid, 'c.sortorder ASC', 'c.id,c.sortorder,c.shortname,c.fullname,c.summary,c.visible,c.teacher,c.guest,c.password', $totcount); /// Store a course section per category id. Code it by using the 'catid' plus 10 as the section number. $sectnum = $catid + 10; if (!($section = get_record('course_sections', 'course', $course->id, 'section', $sectnum))) { $section = new stdClass(); $section->course = $course->id; $section->section = $sectnum; $section->summary = $category->name; $section->sequence = ''; $section->visible = 1; if (!($section->id = insert_record('course_sections', $section))) { error('Could not create section for category ' . $category->name); } } if (!empty($section) || $isediting) { get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused); } $groupbuttons = $course->groupmode; $groupbuttonslink = !$course->groupmodeforce; if ($ismoving) { $strmovehere = get_string('movehere'); $strmovefull = strip_tags(get_string('movefull', '', "'{$USER->activitycopyname}'")); $strcancel = get_string('cancel'); $stractivityclipboard = $USER->activitycopyname; } $modinfo = unserialize($course->modinfo); $editbuttons = ''; print_simple_box_start("center", "100%", '', 5, "coursebox"); echo '<table class="topics" width="100%">'; echo '<tr id="section-' . $section . '" class="section main">'; echo '<td class="content">'; print_heading_block('<div align="center">' . $category->name . '</div>'); echo '<table class="section" width="100%">'; if (!empty($section) && !empty($section->sequence)) { $sectionmods = explode(',', $section->sequence); foreach ($sectionmods as $modnumber) { if (empty($mods[$modnumber])) { continue; } $mod = $mods[$modnumber]; if ($isediting && !$ismoving) { if ($groupbuttons) { if (!($mod->groupmodelink = $groupbuttonslink)) { $mod->groupmode = $course->groupmode; } } else { $mod->groupmode = false; } $editbuttons = '<br />' . make_editing_buttons($mod, true, true); } else { $editbuttons = ''; } if ($mod->visible || $isteacher) { echo '<tr><td class="activity ' . $mod->modname . '">'; if ($ismoving) { if ($mod->id == $USER->activitycopy) { continue; } echo '<a title="' . $strmovefull . '" href="' . $CFG->wwwroot . '/course/mod.php?moveto=' . $mod->id . '&sesskey=' . $USER->sesskey . '">' . '<img height="16" width="80" src="' . $CFG->pixpath . '/movehere.gif" alt="' . $strmovehere . '" border="0" /></a>'; } $instancename = urldecode($modinfo[$modnumber]->name); $instancename = format_string($instancename, true, $course->id); $linkcss = $mod->visible ? '' : ' class="dimmed" '; if (!empty($modinfo[$modnumber]->extra)) { $extra = urldecode($modinfo[$modnumber]->extra); } else { $extra = ''; } if (!empty($modinfo[$modnumber]->icon)) { $icon = $CFG->pixpath . '/' . urldecode($modinfo[$modnumber]->icon); } else { $icon = $CFG->modpixpath . '/' . $mod->modname . '/icon.gif'; } if ($mod->modname == 'label') { echo format_text($extra, FORMAT_HTML) . $editbuttons; } else { echo '<img src="' . $icon . '" height="16" width="16" alt="' . $mod->modfullname . '" /> ' . '<a title="' . $mod->modfullname . '" ' . $linkcss . ' ' . $extra . ' href="' . $CFG->wwwroot . '/mod/' . $mod->modname . '/view.php?id=' . $mod->id . '">' . $instancename . '</a>' . $editbuttons; } echo "</td>"; echo "</tr>"; } } } else { echo "<tr><td></td></tr>"; // needed for XHTML compatibility } if ($ismoving) { echo '<tr><td><a title="' . $strmovefull . '" href="' . $CFG->wwwroot . '/course/mod.php?movetosection=' . $section->id . '&sesskey=' . $USER->sesskey . '">' . '<img height="16" width="80" src="' . $CFG->pixpath . '/movehere.gif" alt="' . $strmovehere . '" border="0" /></a></td></tr>'; } if ($isediting && $modnames) { echo '<tr><td>'; print_section_add_menus($course, $section->section, $modnames, true); echo '</td></tr>'; } echo "</table>\n\n"; echo '</td></tr></table>'; print_simple_box_end(); if (empty($courses)) { print_heading(FN_translate_course_string(get_string("nocoursesyet"))); } else { foreach ($courses as $course) { print_course($course); } } }
print_container_end(); echo '</td>'; } // The right column if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $editing) { echo '<td style="width: ' . $preferred_width_right . 'px;" id="right-column">'; print_container_start(); blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT); print_container_end(); echo '</td>'; } echo '</tr></table></div></div>'; // Start main column print_container_start(); echo skip_main_destination(); print_heading_block($course->fullname, 'outline'); echo '<div class="panel" title="' . get_string('summary') . '"><div class="wrapper"><h3>' . get_string('summary') . '</h3>'; echo '<table class="weeks" width="100%" summary="' . get_string('layouttable') . '">'; /// If currently moving a file then show the current clipboard if (ismoving($course->id)) { $stractivityclipboard = strip_tags(get_string('activityclipboard', '', addslashes($USER->activitycopyname))); $strcancel = get_string('cancel'); echo '<tr class="clipboard">'; echo '<td colspan="3">'; echo $stractivityclipboard . ' (<a href="mod.php?cancelcopy=true&sesskey=' . $USER->sesskey . '">' . $strcancel . '</a>)'; echo '</td>'; echo '</tr>'; } /// Print Section 0 with general activities $section = 0; $thissection = $sections[$section];
function cms_render_news($course) { global $CFG; if ($course->newsitems) { // Print forums only when needed require_once $CFG->dirroot . '/mod/forum/lib.php'; if (!($newsforum = forum_get_course_forum($course->id, 'news'))) { error('Could not find or create a main news forum for the course'); } if (isset($USER->id)) { $SESSION->fromdiscussion = $CFG->wwwroot; if (forum_is_subscribed($USER->id, $newsforum->id)) { $subtext = get_string('unsubscribe', 'forum'); } else { $subtext = get_string('subscribe', 'forum'); } $headertext = '<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>' . '<td><div class="title">' . $newsforum->name . '</div></td>' . '<td><div class="link"><a href="mod/forum/subscribe.php?id=' . $newsforum->id . '">' . $subtext . '</a></div></td>' . '</tr></table>'; } else { $headertext = $newsforum->name; } ob_start(); print_heading_block($headertext); forum_print_latest_discussions($course, $newsforum, $course->newsitems, 'plain', 'p.modified DESC'); $return = ob_get_contents(); ob_end_clean(); return $return; } return ''; }
case 'left': /// The left column ... if (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $editing) { echo '<td style="width:' . $preferred_width_left . 'px" id="left-column">'; print_container_start(); blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT); print_container_end(); echo '</td>'; } break; case 'middle': /// Start main column echo '<td id="middle-column">'; print_container_start(); echo skip_main_destination(); print_heading_block(get_string('weeklyoutline'), 'outline'); echo '<table class="weeks" width="100%" summary="' . get_string('layouttable') . '">'; /// If currently moving a file then show the current clipboard if (ismoving($course->id)) { $stractivityclipboard = strip_tags(get_string('activityclipboard', '', addslashes($USER->activitycopyname))); $strcancel = get_string('cancel'); echo '<tr class="clipboard">'; echo '<td colspan="3">'; echo $stractivityclipboard . ' (<a href="mod.php?cancelcopy=true&sesskey=' . $USER->sesskey . '">' . $strcancel . '</a>)'; echo '</td>'; echo '</tr>'; } /// Print Section 0 with general activities $section = 0; $thissection = $sections[$section]; if ($thissection->summary or $thissection->sequence or isediting($course->id)) {
function editSPCourse($catid, $cid, $adding, $link, $options) { global $DB; $output = ''; $cat = get_record('question_categories', 'id', $catid); if ($adding) { // Create new Object $new_spc_qc->name = 'spc_' . $cat->name; $new_spc_qc->categoryid = $cat->id; $record = insert_record('spc_question_categories', $new_spc_qc); $r = get_record('spc_question_categories', 'id', $record); // Create new Object $new_spc_course->courseid = $cid; $new_spc_course->categoryid = $cat->id; $new_spc_course->name = $r->name; $record = insert_record('spc_courses', $new_spc_course); $r = get_record('spc_courses', 'id', $record); //echo "Record".$record." ID:".$r->id." Name:".$r->name." courseid:".$r->courseid." categoryid:".$r->categoryid."<br/>"; $output .= "Special Course '" . $r->name . "' was added. <br/>"; } else { delete_records('spc_courses', 'categoryid', $catid); delete_records('spc_question_categories', 'categoryid', $catid); if (record_exists('spc_question_categories', 'categoryid', $catid)) { $output .= "Special Course '" . $cat->name . "' could not be deleted. <br/>"; } else { $output .= "Special Course '" . $cat->name . "' was deleted. <br/>"; } } print_heading_block($cat->name); print_box_start('boxwidthwide boxaligncenter generalbox questioncategories contextlevel' . $list->context->contextlevel); echo $output . "<br/>"; print_single_button($link, $options); print_box_end(); }
if (!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)) and !isguest() or count_records('course') <= FRONTPAGECOURSELIMIT) { // admin should not see list of courses when there are too many of them print_heading_block(get_string('availablecourses')); print_courses(0); } } break; case FRONTPAGECATEGORYNAMES: print_heading_block(get_string('categories')); print_box_start('generalbox categorybox'); print_whole_category_list(NULL, NULL, NULL, -1, false); print_box_end(); print_course_search('', false, 'short'); break; case FRONTPAGECATEGORYCOMBO: print_heading_block(get_string('categories')); print_box_start('generalbox categorybox'); print_whole_category_list(NULL, NULL, NULL, -1, true); print_box_end(); print_course_search('', false, 'short'); break; case FRONTPAGETOPICONLY: // Do nothing!! :-) break; } echo '<br />'; } print_container_end(); echo '</td>'; break; case 'right':
$messagestemp = mail_sort_array_messages($messagestemp, $sort, $dir); $limitmessage = ($page + 1) * $perpage; for ($i = $page * $perpage; $i < $limitmessage; $i++) { if ($messagestemp[$i]) { $messages[] = $messagestemp[$i]; } } } } } /// If no search results then get potential students for this course excluding users already in course mail_start_print_table_main($mail, $cm, $course); if ($folder) { print_heading_block("<center>" . get_string("folder", "mail") . " " . $folder->name . "</center>"); } else { if ($id) { print_heading_block("<center>" . get_string("folder", "mail") . " " . get_string("folderdelete", "mail") . "</center>"); } else { if ($message) { print_heading_block("<center>" . get_string("message", "mail") . "</center>"); } } } echo "<br>"; include 'messages.html'; mail_end_print_table_main($mail); /// Finish the page print_footer($course); ?>