function print_header($title, $morenavlinks = NULL, $bodytags = '', $meta = '', $extrabuttons = '') { global $USER, $CFG; $this->init_full(); $replacements = array('%fullname%' => format_string($this->activityrecord->name)); foreach ($replacements as $search => $replace) { $title = str_replace($search, $replace, $title); } if (empty($morenavlinks) && $this->user_allowed_editing()) { // mmmm, tables $buttons = '<table><tr>'; $buttons .= '<td>' . $extrabuttons . '</td>'; $buttons .= '<td>' . update_module_button(optional_param('clone', $this->modulerecord->id, PARAM_INT), $this->courserecord->id, get_string('modulename', $this->activityname)) . '</td>'; if (!empty($CFG->showblocksonmodpages)) { $clonething = optional_param('clone', 0, PARAM_INT); $clonething = $clonething ? '<input type="hidden" name="clone" value="' . $clonething . '" />' : ''; $buttons .= '<td><form ' . $CFG->frametarget . ' method="get" action="view.php"><div>' . '<input type="hidden" name="id" value="' . $this->modulerecord->id . '" />' . $clonething . '<input type="hidden" name="edit" value="' . ($this->user_is_editing() ? 'off' : 'on') . '" />' . '<input type="submit" value="' . get_string($this->user_is_editing() ? 'blockseditoff' : 'blocksediton') . '" /></div></form></td>'; } $buttons .= '</tr></table>'; } else { $buttons = $extrabuttons ? $extrabuttons : ' '; } if (empty($morenavlinks)) { $morenavlinks = array(); } $navigation = build_navigation($morenavlinks, $this->modulerecord); print_header($title, $this->courserecord->fullname, $navigation, '', $meta, true, $buttons, navmenu($this->courserecord, $this->modulerecord), false, $bodytags); }
public function print_header($title, $morebreadcrumbs = null, $navigation = '') { global $USER, $CFG; $this->init_full(); $replacements = array('%fullname%' => format_string($this->activityrecord->name)); foreach ($replacements as $search => $replace) { $title = str_replace($search, $replace, $title); } if ($this->courserecord->id == SITEID) { $breadcrumbs = array(); } else { $breadcrumbs = array($this->courserecord->shortname => $CFG->wwwroot . '/course/view.php?id=' . $this->courserecord->id); } $breadcrumbs[get_string('modulenameplural', 'game')] = $CFG->wwwroot . '/mod/game/index.php?id=' . $this->courserecord->id; $breadcrumbs[format_string($this->activityrecord->name)] = $CFG->wwwroot . '/mod/game/view.php?id=' . $this->modulerecord->id; if (!empty($morebreadcrumbs)) { $breadcrumbs = array_merge($breadcrumbs, $morebreadcrumbs); } if (empty($morebreadcrumbs) && $this->user_allowed_editing()) { $buttons = '<table><tr><td>' . update_module_button($this->modulerecord->id, $this->courserecord->id, get_string('modulename', 'game')) . '</td>'; if (!empty($CFG->showblocksonmodpages)) { $buttons .= '<td><form ' . $CFG->frametarget . ' method="get" action="view.php">' . '<div>' . '<input type="hidden" name="id" value="' . $this->modulerecord->id . '" />' . '<input type="hidden" name="edit" value="' . ($this->user_is_editing() ? 'off' : 'on') . '" />' . '<input type="submit" value="' . get_string($this->user_is_editing() ? 'blockseditoff' : 'blocksediton') . '" />' . '</div></form></td>'; } $buttons .= '</tr></table>'; } else { $buttons = ' '; } print_header($title, $this->courserecord->fullname, $navigation); }
/** * Print a standard lesson heading. * * This will also print up to three * buttons in the breadcrumb, lesson heading * lesson tabs, lesson notifications and perhaps * a popup with a media file. * * @return void **/ function print_header($title = '', $morenavlinks = array()) { global $CFG; $this->init_full(); /// Variable setup/check $context = get_context_instance(CONTEXT_MODULE, $this->modulerecord->id); $activityname = format_string($this->activityrecord->name); if ($this->lessonpageid === NULL) { error('Programmer error: must set the lesson page ID'); } if (empty($title)) { $title = "{$this->courserecord->shortname}: {$activityname}"; } /// Build the buttons if (has_capability('mod/lesson:edit', $context)) { $buttons = '<span class="edit_buttons">' . update_module_button($this->modulerecord->id, $this->courserecord->id, get_string('modulename', 'lesson')); if (!empty($this->lessonpageid) and $this->lessonpageid != LESSON_EOL) { $buttons .= '<form ' . $CFG->frametarget . ' method="get" action="' . $CFG->wwwroot . '/mod/lesson/lesson.php">' . '<input type="hidden" name="id" value="' . $this->modulerecord->id . '" />' . '<input type="hidden" name="action" value="editpage" />' . '<input type="hidden" name="redirect" value="navigation" />' . '<input type="hidden" name="pageid" value="' . $this->lessonpageid . '" />' . '<input type="submit" value="' . get_string('editpagecontent', 'lesson') . '" />' . '</form>'; if (!empty($CFG->showblocksonmodpages) and $this->user_allowed_editing()) { if ($this->user_is_editing()) { $onoff = 'off'; } else { $onoff = 'on'; } $buttons .= '<form ' . $CFG->frametarget . ' method="get" action="' . $CFG->wwwroot . '/mod/lesson/view.php">' . '<input type="hidden" name="id" value="' . $this->modulerecord->id . '" />' . '<input type="hidden" name="pageid" value="' . $this->lessonpageid . '" />' . '<input type="hidden" name="edit" value="' . $onoff . '" />' . '<input type="submit" value="' . get_string("blocksedit{$onoff}") . '" /> </form>'; } } $buttons .= '</span>'; } else { $buttons = ' '; } /// Build the meta /// Currently broken because the $meta is printed before the JavaScript is printed // if (!optional_param('pageid', 0, PARAM_INT) and !empty($this->activityrecord->mediafile)) { // // open our pop-up // $url = '/mod/lesson/mediafile.php?id='.$this->modulerecord->id; // $name = 'lessonmediafile'; // $options = 'menubar=0,location=0,left=5,top=5,scrollbars,resizable,width='. $this->activityrecord->mediawidth .',height='. $this->activityrecord->mediaheight; // $meta = "\n<script type=\"text/javascript\">"; // $meta .= "\n<!--\n"; // $meta .= " openpopup('$url', '$name', '$options', 0);"; // $meta .= "\n// -->\n"; // $meta .= '</script>'; // } else { $meta = ''; // } $navigation = build_navigation($morenavlinks, $this->modulerecord); print_header($title, $this->courserecord->fullname, $navigation, '', $meta, true, $buttons, user_login_string($this->courserecord) . '<hr style="width:95%">' . navmenu($this->courserecord, $this->modulerecord)); if (has_capability('mod/lesson:manage', $context)) { print_heading_with_help($activityname, 'overview', 'lesson'); // Rename our objects for the sake of the tab code list($cm, $course, $lesson, $currenttab) = array(&$this->modulerecord, &$this->courserecord, &$this->activityrecord, 'view'); include $CFG->dirroot . '/mod/lesson/tabs.php'; } else { print_heading($activityname); } lesson_print_messages(); }
/** * Print url header. * @param object $url * @param object $cm * @param object $course * @return void */ function url_print_header($url, $cm, $course) { global $PAGE, $OUTPUT; $PAGE->set_title($course->shortname . ': ' . $url->name); $PAGE->set_heading($course->fullname); $PAGE->set_activity_record($url); $PAGE->set_button(update_module_button($cm->id, '', get_string('modulename', 'url'))); echo $OUTPUT->header(build_navigation('', $cm), navmenu($course, $cm)); }
/** * Display the resource with the course blocks. */ function display_course_blocks_start() { global $CFG; global $USER; global $THEME; require_once $CFG->libdir . '/blocklib.php'; require_once $CFG->libdir . '/pagelib.php'; require_once $CFG->dirroot . '/course/lib.php'; //required by some blocks $PAGE = page_create_object(PAGE_COURSE_VIEW, $this->course->id); $this->PAGE = $PAGE; $pageblocks = blocks_setup($PAGE); $blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), 210); /// Print the page header $edit = optional_param('edit', -1, PARAM_BOOL); if ($edit != -1 and $PAGE->user_allowed_editing()) { $USER->editing = $edit; } $morenavlinks = array($this->strresources => 'index.php?id=' . $this->course->id, $this->resource->name => ''); $PAGE->print_header($this->course->shortname . ': %fullname%', $morenavlinks, "", "", update_module_button($this->cm->id, $this->course->id, $this->strresource)); echo '<table id="layout-table"><tr>'; $lt = empty($THEME->layouttable) ? array('left', 'middle', 'right') : $THEME->layouttable; foreach ($lt as $column) { $lt1[] = $column; if ($column == 'middle') { break; } } foreach ($lt1 as $column) { switch ($column) { case 'left': if (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $PAGE->user_is_editing()) { echo '<td style="width: ' . $blocks_preferred_width . 'px;" id="left-column">'; print_container_start(); blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT); print_container_end(); echo '</td>'; } break; case 'middle': echo '<td id="middle-column">'; print_container_start(false, 'middle-column-wrap'); echo '<div id="resource">'; break; case 'right': if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $PAGE->user_is_editing()) { echo '<td style="width: ' . $blocks_preferred_width . 'px;" id="right-column">'; print_container_start(); blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT); print_container_end(); echo '</td>'; } break; } } }
function display() { global $CFG; $formatoptions = new object(); $formatoptions->noclean = true; /// Are we displaying the course blocks? if ($this->resource->options == 'showblocks') { parent::display_course_blocks_start(); $entry = get_record('kaltura_entries', 'context', "R_" . "{$this->resource}->id"); if (trim(strip_tags($this->resource->alltext))) { echo $entry->title; $context = get_context_instance(CONTEXT_COURSE, $this->course->id); $formatoptions = new object(); $formatoptions->noclean = true; print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $this->course->id), "center"); if (has_capability('moodle/course:manageactivities', $context)) { echo embed_kaltura($resource->alltext, get_width($entry), get_height($entry), $entry->entry_type, $entry->design, true); } else { echo embed_kaltura($resource->alltext, get_width($entry), get_height($entry), KalturaEntryType::MEDIA_CLIP, $entry->design, true); } } parent::display_course_blocks_end(); } else { /// Set up generic stuff first, including checking for access parent::display(); /// Set up some shorthand variables $cm = $this->cm; $course = $this->course; $resource = $this->resource; $entry = get_record('kaltura_entries', 'context', "R_" . "{$resource->id}"); $pagetitle = strip_tags($course->shortname . ': ' . format_string($resource->name)); $inpopup = optional_param('inpopup', '', PARAM_BOOL); add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id); $navigation = build_navigation($this->navlinks, $cm); print_header($pagetitle, $course->fullname, $navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm)); if (trim(strip_tags($this->resource->alltext))) { echo $entry->title; $context = get_context_instance(CONTEXT_COURSE, $this->course->id); $formatoptions = new object(); $formatoptions->noclean = true; print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $this->course->id), "center"); if (has_capability('moodle/course:manageactivities', $context)) { echo embed_kaltura($resource->alltext, get_width($entry), get_height($entry), $entry->entry_type, $entry->design, true); } else { echo embed_kaltura($resource->alltext, get_width($entry), get_height($entry), KalturaEntryType::MEDIA_CLIP, $entry->design, true); } } /* print_simple_box(format_text($resource->alltext, $resource->reference, $formatoptions, $course->id), "center", "", "", "20"); */ $strlastmodified = get_string("lastmodified"); echo "<div class=\"modified\">{$strlastmodified}: " . userdate($resource->timemodified) . "</div>"; print_footer($course); } }
function display() { global $CFG; $formatoptions = new object(); $formatoptions->noclean = true; /// Are we displaying the course blocks? if ($this->resource->options == 'showblocks') { parent::display_course_blocks_start(); $entry = get_record('kaltura_entries', 'context', "R_" . "{$this->resource}->id"); if (trim(strip_tags($this->resource->alltext))) { echo $entry->title; $player_url = $CFG->wwwroot . '/mod/kaltura/kswfdoc.php?context=' . $this->course->id . '&entry_id=' . $resource->alltext; $formatoptions = new object(); $formatoptions->noclean = true; print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $this->course->id), "center"); if ($resource->alltext) { echo '<input style="margin-top:20px;" type="button" value="View video presentation" onclick="kalturaInitModalBox(\'' . $player_url . '\', {width:780, height:400});">'; } // echo embed_kaltura($resource->alltext,get_width($entry),get_height($entry),$entry->entry_type); } parent::display_course_blocks_end(); } else { /// Set up generic stuff first, including checking for access parent::display(); /// Set up some shorthand variables $cm = $this->cm; $course = $this->course; $resource = $this->resource; $entry = get_record('kaltura_entries', 'context', "R_" . "{$resource->id}"); $pagetitle = strip_tags($course->shortname . ': ' . format_string($resource->name)); $inpopup = optional_param('inpopup', '', PARAM_BOOL); add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id); $navigation = build_navigation($this->navlinks, $cm); print_header($pagetitle, $course->fullname, $navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm)); if (trim(strip_tags($this->resource->alltext))) { echo $entry->title; } $formatoptions = new object(); $formatoptions->noclean = true; print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $this->course->id), "center"); if (trim(strip_tags($this->resource->alltext))) { $player_url = $CFG->wwwroot . '/mod/kaltura/kswfdoc.php?context=' . $this->course->id . '&entry_id=' . $resource->alltext; if ($resource->alltext) { echo '<input type="button" style="margin-top:20px;" value="View video presentation" onclick="kalturaInitModalBox(\'' . $player_url . '\', {width:780, height:400});">'; } // echo embed_kaltura($resource->alltext,get_width($entry),get_height($entry),$entry->entry_type); } /* print_simple_box(format_text($resource->alltext, $resource->reference, $formatoptions, $course->id), "center", "", "", "20"); */ $strlastmodified = get_string("lastmodified"); echo "<div class=\"modified\">{$strlastmodified}: " . userdate($resource->timemodified) . "</div>"; print_footer($course); } }
function print_header_and_tabs($cm, $course, $quiz, $reportmode = "overview", $meta = "") { global $CFG; /// Define some strings $strquizzes = get_string("modulenameplural", "quiz"); $strquiz = get_string("modulename", "quiz"); /// Print the page header print_header_simple(format_string($quiz->name), "", "<a href=\"index.php?id={$course->id}\">{$strquizzes}</a>\n -> " . format_string($quiz->name), '', $meta, true, update_module_button($cm->id, $course->id, $strquiz), navmenu($course, $cm)); /// Print the tabs $currenttab = 'reports'; $mode = $reportmode; require $CFG->dirroot . '/mod/quiz/tabs.php'; }
function print_header_and_tabs($cm, $course, $quiz, $reportmode = "overview", $meta = "") { global $CFG; /// Define some strings $strquizzes = get_string("modulenameplural", "quiz"); $strquiz = get_string("modulename", "quiz"); /// Print the page header $navigation = build_navigation('', $cm); print_header_simple(format_string($quiz->name), "", $navigation, '', $meta, true, update_module_button($cm->id, $course->id, $strquiz), user_login_string($course) . '<hr style="width:95%">' . navmenu($course, $cm)); /// Print the tabs $currenttab = 'reports'; $mode = $reportmode; require $CFG->dirroot . '/mod/quiz/tabs.php'; }
function print_header_and_tabs($cm, $course, $quiz, $reportmode = "overview", $meta = "") { global $CFG; /// Define some strings $strquizzes = get_string("modulenameplural", "quiz"); $strquiz = get_string("modulename", "quiz"); /// Print the page header $navlinks = array(); $navlinks[] = array('name' => $strquizzes, 'link' => "index.php?id={$course->id}", 'type' => 'activity'); $navlinks[] = array('name' => format_string($quiz->name), 'link' => '', 'type' => 'activityinstance'); $navigation = build_navigation($navlinks); print_header_simple(format_string($quiz->name), "", $navigation, '', $meta, true, update_module_button($cm->id, $course->id, $strquiz), navmenu($course, $cm)); /// Print the tabs $currenttab = 'reports'; $mode = $reportmode; require $CFG->dirroot . '/mod/quiz/tabs.php'; }
function webquestscorm_print_header($name, $currenttab = '', $course = NULL, $cm = NULL, $cmid = 0) { global $CFG; if ($cmid) { if (!isset($cm)) { if (!($cm = get_coursemodule_from_id('webquestscorm', $cmid))) { error('Course Module ID was incorrect'); } } if (!isset($course)) { if (!($course = get_record('course', 'id', $this->cm->course))) { error('Course is misconfigured'); } } if (!isset($name)) { if (!($webquestscorm = get_record('webquestscorm', 'id', $this->cm->instance))) { error('webquestscorm ID was incorrect'); } $name = $webquestscorm->name; } } else { if (!isset($cm)) { error('Course Module ID was incorrect'); } if (!isset($course)) { error('Course is misconfigured'); } if (!isset($name)) { error('webquestscorm name was incorrect'); } } $strwebquestscorms = get_string('modulenameplural', 'webquestscorm'); $strwebquestscorm = get_string('modulename', 'webquestscorm'); $strname = format_string($name); $button = update_module_button($cm->id, $course->id, $strwebquestscorm); $meta = ''; if ($CFG->version < 2007101500) { print_header_simple(format_string($strname), "", "<a href=\"index.php?id={$course->id}\">{$strwebquestscorms}</a> -> " . format_string($name), "", "", true, update_module_button($cm->id, $course->id, $strwebquestscorm), navmenu($course, $cm)); } else { $navigation = build_navigation('', $cm); print_header($course->shortname . ':' . $strname, $course->fullname, $navigation, '', $meta, true, $button, navmenu($course, $cm)); } print_heading(format_string($name, true)); require_once "tabs.php"; }
function print_header_and_tabs($cm, $course, $game, $reportmode = "overview", $meta = "") { global $CFG; /// Define some strings $strgames = get_string("modulenameplural", "game"); $strgame = get_string("modulename", "game"); /// Print the page header if (function_exists('build_navigation')) { $navigation = build_navigation('', $cm); print_header($course->shortname, $course->shortname, $navigation); } else { print_header_simple(format_string($game->name), "", "<a href=\"index.php?id={$course->id}\">{$strgames}</a>\n -> " . format_string($game->name), '', $meta, true, update_module_button($cm->id, $course->id, $strgame), navmenu($course, $cm)); } /// Print the tabs $currenttab = 'reports'; $mode = $reportmode; include 'tabs.php'; }
function print_header_and_tabs($cm, $course, $quiz, $reportmode = "overview") { global $CFG; /// Define some strings $strquizzes = get_string("modulenameplural", "quiz"); $strquiz = get_string("modulename", "quiz"); /// Print the page header $navigation = build_navigation('', $cm); print_header_simple(format_string($quiz->name), "", $navigation, '', '', true, update_module_button($cm->id, $course->id, $strquiz), navmenu($course, $cm)); /// Print the tabs $currenttab = 'reports'; $mode = $reportmode; require $CFG->dirroot . '/mod/quiz/tabs.php'; $course_context = get_context_instance(CONTEXT_COURSE, $course->id); if (has_capability('gradereport/grader:view', $course_context) && has_capability('moodle/grade:viewall', $course_context)) { echo '<div class="allcoursegrades"><a href="' . $CFG->wwwroot . '/grade/report/grader/index.php?id=' . $course->id . '">' . get_string('seeallcoursegrades', 'grades') . '</a></div>'; } }
function print_header($title, $morebreadcrumbs = NULL) { global $USER, $CFG, $WS; $this->init_full(); if ($this->user_allowed_editing()) { $buttons = wiki_table_start('', true); $buttons .= update_module_button($this->modulerecord->id, $this->courserecord->id, get_string('modulename', 'wiki')); if (!empty($CFG->showblocksonmodpages)) { $buttons .= wiki_change_column('', true); $prop = null; $prop->method = "get"; $prop->action = "view.php"; $prop->events = 'onsubmit="this.target=\'_top\'; return true"'; $buttons .= wiki_form_start($prop, true); $buttons .= wiki_div_start('', true); $prop = null; $prop->name = "id"; $prop->value = $this->modulerecord->id; $buttons .= wiki_input_hidden($prop, true); $prop = null; $prop->name = "edit"; $prop->value = $this->user_is_editing() ? 'off' : 'on'; $buttons .= wiki_input_hidden($prop, true); $prop = null; $prop->value = get_string($this->user_is_editing() ? 'blockseditoff' : 'blocksediton'); $buttons .= wiki_input_submit($prop, true); $buttons .= wiki_div_end(true); $buttons .= wiki_form_end(true); } $buttons .= wiki_table_end('', true); } else { $buttons = ' '; } // print_header($title, $this->courserecord->fullname, $crumbtext, '', '', true, $buttons, navmenu($this->courserecord, $this->modulerecord)); /// Print header. $navlinks = array(); $navlinks[] = array('name' => get_string('modulenameplural', 'wiki'), 'link' => $CFG->wwwroot . '/mod/wiki/index.php?id=' . $this->courserecord->id, 'type' => 'activity'); $navlinks[] = array('name' => format_string($this->activityrecord->name), 'link' => "view.php", 'type' => 'activityinstance'); $navigation = build_navigation($navlinks); print_header_simple(format_string($this->activityrecord->name), "", $navigation, "", "", true, $buttons, navmenu($this->courserecord, $WS->cm)); }
function print_header($title, $morebreadcrumbs = NULL) { global $USER, $CFG; $this->init_full(); $replacements = array('%fullname%' => format_string($this->activityrecord->name)); foreach ($replacements as $search => $replace) { $title = str_replace($search, $replace, $title); } if ($this->courserecord->id == SITEID) { $breadcrumbs = array(); } else { $breadcrumbs = array($this->courserecord->shortname => $CFG->wwwroot . '/course/view.php?id=' . $this->courserecord->id); } $breadcrumbs[get_string('modulenameplural', "bigbluebutton")] = $CFG->wwwroot . '/mod/bigbluebutton/index.php?id=' . $this->courserecord->id; $breadcrumbs[format_string($this->activityrecord->name)] = $CFG->wwwroot . '/mod/bigbluebutton/view.php?id=' . $this->modulerecord->id; if (!empty($morebreadcrumbs)) { $breadcrumbs = array_merge($breadcrumbs, $morebreadcrumbs); } $total = count($breadcrumbs); $current = 1; $crumbtext = ''; foreach ($breadcrumbs as $text => $href) { if ($current++ == $total) { $crumbtext .= ' ' . $text; } else { $crumbtext .= ' <a href="' . $href . '">' . $text . '</a> ->'; } } if (empty($morebreadcrumbs) && $this->user_allowed_editing()) { $buttons = '<table><tr><td>' . update_module_button($this->modulerecord->id, $this->courserecord->id, get_string('modulename', 'bigbluebutton')) . '</td>'; if (!empty($CFG->showblocksonmodpages)) { $buttons .= '<td><form target="' . $CFG->framename . '" method="get" action="view.php">' . '<input type="hidden" name="id" value="' . $this->modulerecord->id . '" />' . '<input type="hidden" name="edit" value="' . ($this->user_is_editing() ? 'off' : 'on') . '" />' . '<input type="submit" value="' . get_string($this->user_is_editing() ? 'blockseditoff' : 'blocksediton') . '" /></form></td>'; } $buttons .= '</tr></table>'; } else { $buttons = ' '; } print_header($title, $this->courserecord->fullname, $crumbtext, '', '', true, $buttons, navmenu($this->courserecord, $this->modulerecord)); }
/// Check to see if groups are being used here $groupmode = groups_get_activity_groupmode($cm); $currentgroup = groups_get_activity_group($cm, true); if (empty($currentgroup)) { $currentgroup = 0; } if (empty($elluminate->meetingid) && $elluminate->groupmode != 0) { elluminate_group_instance_check($elluminate, $cm->id); } $baseurl = $CFG->wwwroot . '/mod/elluminate/preload.php?id=' . $elluminate->id; /// Print the page header $strelluminates = get_string('modulenameplural', 'elluminate'); $strelluminate = get_string('modulename', 'elluminate'); $straddpreload = get_string('addpreload', 'elluminate'); $strdelpreload = get_string('deletewhiteboardpreload', 'elluminate'); $buttontext = update_module_button($cm->id, $course->id, $strelluminate); $navigation = build_navigation(empty($delete) ? $straddpreload : $strdelpreload, $cm); print_header_simple(format_string($elluminate->name), '', $navigation, '', '', true, $buttontext, navmenu($course, $cm)); /// Delete a preload file for this meeting. if (!empty($delete)) { if (!empty($elluminate->meetingid)) { if ($preload = elluminate_list_meeting_preloads($elluminate->meetingid)) { if ($preload->presentationid == $delete) { /// Delete the preload from the meeting. if (!elluminate_delete_preload($preload->presentationid, $elluminate->meetingid)) { error(get_string('preloaddeleteerror', 'elluminate')); } redirect($CFG->wwwroot . '/mod/elluminate/view.php?id=' . $cm->id, get_string('preloaddeletesuccess', 'elluminate'), 5); } } }
//delete responses. redirect("view.php?id={$cm->id}"); } } $answer = optional_param('answer', '', PARAM_INT); if (empty($answer)) { redirect("view.php?id={$cm->id}", get_string('mustchooseone', 'choice')); } else { choice_user_submit_response($answer, $choice, $USER->id, $course->id, $cm); } redirect("view.php?id={$cm->id}"); exit; } /// Display the choice and possibly results $navigation = build_navigation('', $cm); print_header_simple(format_string($choice->name), "", $navigation, "", "", true, update_module_button($cm->id, $course->id, $strchoice), navmenu($course, $cm)); add_to_log($course->id, "choice", "view", "view.php?id={$cm->id}", $choice->id, $cm->id); /// Check to see if groups are being used in this choice $groupmode = groups_get_activity_groupmode($cm); groups_get_activity_group($cm, true); groups_print_activity_menu($cm, 'view.php?id=' . $id); if (has_capability('mod/choice:readresponses', $context)) { choice_show_reportlink($choice, $course->id, $cm, $groupmode); } echo '<div class="clearer"></div>'; if ($choice->text) { print_box(format_text($choice->text, $choice->format), 'generalbox', 'intro'); } //if user has already made a selection, and they are not allowed to update it, show their selected answer. if (!empty($USER->id) && ($current = get_record('choice_answers', 'choiceid', $choice->id, 'userid', $USER->id)) && empty($choice->allowupdate)) { print_simple_box(get_string("yourselection", "choice", userdate($choice->timeopen)) . ": " . format_string(choice_get_option_text($choice, $current->optionid)), "center");
if ($course2 = get_record('course', 'id', $courseid)) { require_course_login($course2); //this overwrites the object $course :-( $course = get_record("course", "id", $cm->course); // the workaround } else { error("courseid is not correct"); } } if (!$capabilities->complete) { error(get_string('error')); } /// Print the page header $strfeedbacks = get_string("modulenameplural", "feedback"); $strfeedback = get_string("modulename", "feedback"); $buttontext = update_module_button($cm->id, $course->id, $strfeedback); $navlinks = array(); $navlinks[] = array('name' => $strfeedbacks, 'link' => "index.php?id={$course->id}", 'type' => 'activity'); $navlinks[] = array('name' => format_string($feedback->name), 'link' => "", 'type' => 'activityinstance'); $navigation = build_navigation($navlinks); print_header_simple(format_string($feedback->name), "", $navigation, "", "", true, $buttontext, navmenu($course, $cm)); //ishidden check. //feedback in courses if (empty($cm->visible) and !$capabilities->viewhiddenactivities and $course->id != SITEID) { notice(get_string("activityiscurrentlyhidden")); } //ishidden check. //feedback on mainsite if (empty($cm->visible) and !$capabilities->viewhiddenactivities and $courseid == SITEID) { notice(get_string("activityiscurrentlyhidden")); }
$orgstr = '¤torg=' . $currentorg; $SESSION->scorm_scoid = $sco->id; $SESSION->scorm_status = 'Not Initialized'; $SESSION->scorm_mode = $mode; $SESSION->scorm_attempt = $attempt; // // Print the page header // $bodyscript = ''; if ($scorm->popup == 1) { $bodyscript = 'onunload="main.close();"'; } $navlinks[] = array('name' => format_string($scorm->name, true), 'link' => "view.php?id={$cm->id}", 'type' => 'activityinstance'); $navigation = build_navigation($navlinks); $exitlink = '<a href="' . $CFG->wwwroot . '/course/view.php?id=' . $scorm->course . '" title="' . $strexit . '">' . $strexit . '</a> '; print_header($pagetitle, $course->fullname, $navigation, '', '', true, $exitlink . update_module_button($cm->id, $course->id, $strscorm), '', false, $bodyscript); echo $PAGE->requires->data_for_js('scormplayerdata', array('cwidth' => $scorm->width, 'cheight' => $scorm->height))->asap(); echo $PAGE->requires->js('mod/scorm/request.js')->asap(); echo $PAGE->requires->js('mod/scorm/loaddatamodel.php?id=' . $cm->id . $scoidstr . $modestr . $attemptstr)->asap(); echo $PAGE->requires->js('mod/scorm/rd.js')->asap(); $PAGE->requires->js_function_call('attach_resize_event'); if ($sco->previd != 0 && (!isset($sco->previous) || $sco->previous == 0)) { $scostr = '&scoid=' . $sco->previd; $PAGE->requires->js_function_call('scorm_set_prev', array($CFG->wwwroot . '/mod/scorm/player.php?id=' . $cm->id . $orgstr . $modepop . $scostr)); } else { $PAGE->requires->js_function_call('scorm_set_prev', array($CFG->wwwroot . '/mod/scorm/view.php?id=' . $cm->id)); } if ($sco->nextid != 0 && (!isset($sco->next) || $sco->next == 0)) { $scostr = '&scoid=' . $sco->nextid; $PAGE->requires->js_function_call('scorm_set_next', array($CFG->wwwroot . '/mod/scorm/player.php?id=' . $cm->id . $orgstr . $modepop . $scostr)); } else {
/** * Display all the submissions ready for grading */ function display_submissions($message = '') { global $CFG, $db, $USER; require_once $CFG->libdir . '/gradelib.php'; /* first we check to see if the form has just been submitted * to request user_preference updates */ if (isset($_POST['updatepref'])) { $perpage = optional_param('perpage', 10, PARAM_INT); $perpage = $perpage <= 0 ? 10 : $perpage; set_user_preference('assignment_perpage', $perpage); set_user_preference('assignment_quickgrade', optional_param('quickgrade', 0, PARAM_BOOL)); } /* next we get perpage and quickgrade (allow quick grade) params * from database */ $perpage = get_user_preferences('assignment_perpage', 10); $quickgrade = get_user_preferences('assignment_quickgrade', 0); $grading_info = grade_get_grades($this->course->id, 'mod', 'assignment', $this->assignment->id); if (!empty($CFG->enableoutcomes) and !empty($grading_info->outcomes)) { $uses_outcomes = true; } else { $uses_outcomes = false; } $teacherattempts = true; /// Temporary measure $page = optional_param('page', 0, PARAM_INT); $strsaveallfeedback = get_string('saveallfeedback', 'assignment'); /// Some shortcuts to make the code read better $course = $this->course; $assignment = $this->assignment; $cm = $this->cm; $tabindex = 1; //tabindex for quick grading tabbing; Not working for dropdowns yet add_to_log($course->id, 'assignment', 'view submission', 'submissions.php?id=' . $this->assignment->id, $this->assignment->id, $this->cm->id); $navlinks = array(); $navlinks[] = array('name' => $this->strassignments, 'link' => "index.php?id={$course->id}", 'type' => 'activity'); $navlinks[] = array('name' => format_string($this->assignment->name, true), 'link' => "view.php?a={$this->assignment->id}", 'type' => 'activityinstance'); $navlinks[] = array('name' => $this->strsubmissions, 'link' => '', 'type' => 'title'); $navigation = build_navigation($navlinks); print_header_simple(format_string($this->assignment->name, true), "", $navigation, '', '', true, update_module_button($cm->id, $course->id, $this->strassignment), navmenu($course, $cm)); if (!empty($message)) { echo $message; // display messages here if any } $context = get_context_instance(CONTEXT_MODULE, $cm->id); /// find out current groups mode $groupmode = groups_get_activity_groupmode($cm); $currentgroup = groups_get_activity_group($cm, true); groups_print_activity_menu($cm, 'submissions.php?id=' . $this->cm->id); /// Get all ppl that are allowed to submit assignments $users = get_users_by_capability($context, 'mod/assignment:submit', '', '', '', '', $currentgroup, '', false); $users = array_keys($users); if (!empty($CFG->enablegroupings) && !empty($cm->groupingid)) { $groupingusers = groups_get_grouping_members($cm->groupingid, 'u.id', 'u.id'); $users = array_intersect($users, array_keys($groupingusers)); } $tablecolumns = array('picture', 'fullname', 'grade', 'submissioncomment', 'timemodified', 'timemarked', 'status', 'finalgrade'); if ($uses_outcomes) { $tablecolumns[] = 'outcome'; // no sorting based on outcomes column } $tableheaders = array('', get_string('fullname'), get_string('grade'), get_string('comment', 'assignment'), get_string('lastmodified') . ' (' . $course->student . ')', get_string('lastmodified') . ' (' . $course->teacher . ')', get_string('status'), get_string('finalgrade', 'grades')); if ($uses_outcomes) { $tableheaders[] = get_string('outcome', 'grades'); } require_once $CFG->libdir . '/tablelib.php'; $table = new flexible_table('mod-assignment-submissions'); $table->define_columns($tablecolumns); $table->define_headers($tableheaders); $table->define_baseurl($CFG->wwwroot . '/mod/assignment/submissions.php?id=' . $this->cm->id . '&currentgroup=' . $currentgroup); $table->sortable(true, 'lastname'); //sorted by lastname by default $table->collapsible(true); $table->initialbars(true); $table->column_suppress('picture'); $table->column_suppress('fullname'); $table->column_class('picture', 'picture'); $table->column_class('fullname', 'fullname'); $table->column_class('grade', 'grade'); $table->column_class('submissioncomment', 'comment'); $table->column_class('timemodified', 'timemodified'); $table->column_class('timemarked', 'timemarked'); $table->column_class('status', 'status'); $table->column_class('finalgrade', 'finalgrade'); if ($uses_outcomes) { $table->column_class('outcome', 'outcome'); } $table->set_attribute('cellspacing', '0'); $table->set_attribute('id', 'attempts'); $table->set_attribute('class', 'submissions'); $table->set_attribute('width', '90%'); //$table->set_attribute('align', 'center'); $table->no_sorting('finalgrade'); $table->no_sorting('outcome'); // Start working -- this is necessary as soon as the niceties are over $table->setup(); /// Check to see if groups are being used in this assignment if (!$teacherattempts) { $teachers = get_course_teachers($course->id); if (!empty($teachers)) { $keys = array_keys($teachers); } foreach ($keys as $key) { unset($users[$key]); } } if (empty($users)) { print_heading(get_string('noattempts', 'assignment')); return true; } /// Construct the SQL if ($where = $table->get_sql_where()) { $where .= ' AND '; } if ($sort = $table->get_sql_sort()) { $sort = ' ORDER BY ' . $sort; } $select = 'SELECT u.id, u.firstname, u.lastname, u.picture, s.id AS submissionid, s.grade, s.submissioncomment, s.timemodified, s.timemarked, COALESCE(SIGN(SIGN(s.timemarked) + SIGN(s.timemarked - s.timemodified)), 0) AS status '; $sql = 'FROM ' . $CFG->prefix . 'user u ' . 'LEFT JOIN ' . $CFG->prefix . 'assignment_submissions s ON u.id = s.userid AND s.assignment = ' . $this->assignment->id . ' ' . 'WHERE ' . $where . 'u.id IN (' . implode(',', $users) . ') '; $table->pagesize($perpage, count($users)); ///offset used to calculate index of student in that particular query, needed for the pop up to know who's next $offset = $page * $perpage; $strupdate = get_string('update'); $strgrade = get_string('grade'); $grademenu = make_grades_menu($this->assignment->grade); if (($ausers = get_records_sql($select . $sql . $sort, $table->get_page_start(), $table->get_page_size())) !== false) { $grading_info = grade_get_grades($this->course->id, 'mod', 'assignment', $this->assignment->id, array_keys($ausers)); foreach ($ausers as $auser) { $final_grade = $grading_info->items[0]->grades[$auser->id]; /// Calculate user status $auser->status = $auser->timemarked > 0 && $auser->timemarked >= $auser->timemodified; $picture = print_user_picture($auser->id, $course->id, $auser->picture, false, true); if (empty($auser->submissionid)) { $auser->grade = -1; //no submission yet } if (!empty($auser->submissionid)) { ///Prints student answer and student modified date ///attach file or print link to student answer, depending on the type of the assignment. ///Refer to print_student_answer in inherited classes. if ($auser->timemodified > 0) { $studentmodified = '<div id="ts' . $auser->id . '">' . $this->print_student_answer($auser->id) . userdate($auser->timemodified) . '</div>'; } else { $studentmodified = '<div id="ts' . $auser->id . '"> </div>'; } ///Print grade, dropdown or text if ($auser->timemarked > 0) { $teachermodified = '<div id="tt' . $auser->id . '">' . userdate($auser->timemarked) . '</div>'; if ($final_grade->locked or $final_grade->overridden) { $grade = '<div id="g' . $auser->id . '">' . $final_grade->str_grade . '</div>'; } else { if ($quickgrade) { $menu = choose_from_menu(make_grades_menu($this->assignment->grade), 'menu[' . $auser->id . ']', $auser->grade, get_string('nograde'), '', -1, true, false, $tabindex++); $grade = '<div id="g' . $auser->id . '">' . $menu . '</div>'; } else { $grade = '<div id="g' . $auser->id . '">' . $this->display_grade($auser->grade) . '</div>'; } } } else { $teachermodified = '<div id="tt' . $auser->id . '"> </div>'; if ($final_grade->locked or $final_grade->overridden) { $grade = '<div id="g' . $auser->id . '">' . $final_grade->str_grade . '</div>'; } else { if ($quickgrade) { $menu = choose_from_menu(make_grades_menu($this->assignment->grade), 'menu[' . $auser->id . ']', $auser->grade, get_string('nograde'), '', -1, true, false, $tabindex++); $grade = '<div id="g' . $auser->id . '">' . $menu . '</div>'; } else { $grade = '<div id="g' . $auser->id . '">' . $this->display_grade($auser->grade) . '</div>'; } } } ///Print Comment if ($final_grade->locked or $final_grade->overridden) { $comment = '<div id="com' . $auser->id . '">' . shorten_text(strip_tags($final_grade->str_feedback), 15) . '</div>'; } else { if ($quickgrade) { $comment = '<div id="com' . $auser->id . '">' . '<textarea tabindex="' . $tabindex++ . '" name="submissioncomment[' . $auser->id . ']" id="submissioncomment' . $auser->id . '" rows="2" cols="20">' . $auser->submissioncomment . '</textarea></div>'; } else { $comment = '<div id="com' . $auser->id . '">' . shorten_text(strip_tags($auser->submissioncomment), 15) . '</div>'; } } } else { $studentmodified = '<div id="ts' . $auser->id . '"> </div>'; $teachermodified = '<div id="tt' . $auser->id . '"> </div>'; $status = '<div id="st' . $auser->id . '"> </div>'; if ($final_grade->locked or $final_grade->overridden) { $grade = '<div id="g' . $auser->id . '">' . $final_grade->str_grade . '</div>'; } else { if ($quickgrade) { // allow editing $menu = choose_from_menu(make_grades_menu($this->assignment->grade), 'menu[' . $auser->id . ']', $auser->grade, get_string('nograde'), '', -1, true, false, $tabindex++); $grade = '<div id="g' . $auser->id . '">' . $menu . '</div>'; } else { $grade = '<div id="g' . $auser->id . '">-</div>'; } } if ($final_grade->locked or $final_grade->overridden) { $comment = '<div id="com' . $auser->id . '">' . $final_grade->str_feedback . '</div>'; } else { if ($quickgrade) { $comment = '<div id="com' . $auser->id . '">' . '<textarea tabindex="' . $tabindex++ . '" name="submissioncomment[' . $auser->id . ']" id="submissioncomment' . $auser->id . '" rows="2" cols="20">' . $auser->submissioncomment . '</textarea></div>'; } else { $comment = '<div id="com' . $auser->id . '"> </div>'; } } } if (empty($auser->status)) { /// Confirm we have exclusively 0 or 1 $auser->status = 0; } else { $auser->status = 1; } $buttontext = $auser->status == 1 ? $strupdate : $strgrade; ///No more buttons, we use popups ;-). $popup_url = '/mod/assignment/submissions.php?id=' . $this->cm->id . '&userid=' . $auser->id . '&mode=single' . '&offset=' . $offset++; $button = link_to_popup_window($popup_url, 'grade' . $auser->id, $buttontext, 600, 780, $buttontext, 'none', true, 'button' . $auser->id); $status = '<div id="up' . $auser->id . '" class="s' . $auser->status . '">' . $button . '</div>'; $finalgrade = '<span id="finalgrade_' . $auser->id . '">' . $final_grade->str_grade . '</span>'; $outcomes = ''; if ($uses_outcomes) { foreach ($grading_info->outcomes as $n => $outcome) { $outcomes .= '<div class="outcome"><label>' . $outcome->name . '</label>'; $options = make_grades_menu(-$outcome->scaleid); if ($outcome->grades[$auser->id]->locked or !$quickgrade) { $options[0] = get_string('nooutcome', 'grades'); $outcomes .= ': <span id="outcome_' . $n . '_' . $auser->id . '">' . $options[$outcome->grades[$auser->id]->grade] . '</span>'; } else { $outcomes .= ' '; $outcomes .= choose_from_menu($options, 'outcome_' . $n . '[' . $auser->id . ']', $outcome->grades[$auser->id]->grade, get_string('nooutcome', 'grades'), '', 0, true, false, 0, 'outcome_' . $n . '_' . $auser->id); } $outcomes .= '</div>'; } } $row = array($picture, fullname($auser), $grade, $comment, $studentmodified, $teachermodified, $status, $finalgrade); if ($uses_outcomes) { $row[] = $outcomes; } $table->add_data($row); } } /// Print quickgrade form around the table if ($quickgrade) { echo '<form action="submissions.php" id="fastg" method="post">'; echo '<div>'; echo '<input type="hidden" name="id" value="' . $this->cm->id . '" />'; echo '<input type="hidden" name="mode" value="fastgrade" />'; echo '<input type="hidden" name="page" value="' . $page . '" />'; echo '</div>'; //echo '<div style="text-align:center"><input type="submit" name="fastg" value="'.get_string('saveallfeedback', 'assignment').'" /></div>'; } $table->print_html(); /// Print the whole table if ($quickgrade) { echo '<div style="text-align:center"><input type="submit" name="fastg" value="' . get_string('saveallfeedback', 'assignment') . '" /></div>'; echo '</form>'; } /// End of fast grading form /// Mini form for setting user preference echo '<br />'; echo '<form id="options" action="submissions.php?id=' . $this->cm->id . '" method="post">'; echo '<div>'; echo '<input type="hidden" id="updatepref" name="updatepref" value="1" />'; echo '<table id="optiontable" align="right">'; echo '<tr align="right"><td>'; echo '<label for="perpage">' . get_string('pagesize', 'assignment') . '</label>'; echo ':</td>'; echo '<td>'; echo '<input type="text" id="perpage" name="perpage" size="1" value="' . $perpage . '" />'; helpbutton('pagesize', get_string('pagesize', 'assignment'), 'assignment'); echo '</td></tr>'; echo '<tr align="right">'; echo '<td>'; print_string('quickgrade', 'assignment'); echo ':</td>'; echo '<td>'; if ($quickgrade) { echo '<input type="checkbox" name="quickgrade" value="1" checked="checked" />'; } else { echo '<input type="checkbox" name="quickgrade" value="1" />'; } helpbutton('quickgrade', get_string('quickgrade', 'assignment'), 'assignment') . '</p></div>'; echo '</td></tr>'; echo '<tr>'; echo '<td colspan="2" align="right">'; echo '<input type="submit" value="' . get_string('savepreferences') . '" />'; echo '</td></tr></table>'; echo '</div>'; echo '</form>'; ///End of mini form print_footer($this->course); }
/** * Display the file resource * * Displays a file resource embedded, in a frame, or in a popup. * Output depends on type of file resource. * * @param CFG global object */ function display() { global $CFG, $THEME, $USER; /// Set up generic stuff first, including checking for access parent::display(); /// Set up some shorthand variables $cm = $this->cm; $course = $this->course; $resource = $this->resource; $this->set_parameters(); // set the parameters array /////////////////////////////////////////////// /// Possible display modes are: /// File displayed in a frame in a normal window /// File displayed embedded in a normal page /// File displayed in a popup window /// File displayed emebedded in a popup window /// First, find out what sort of file we are dealing with. require_once $CFG->libdir . '/filelib.php'; $querystring = ''; $resourcetype = ''; $embedded = false; $mimetype = mimeinfo("type", $resource->reference); $pagetitle = strip_tags($course->shortname . ': ' . format_string($resource->name)); $formatoptions = new object(); $formatoptions->noclean = true; if ($resource->options != "bogusoption_usedtobe_frame") { // TODO nicolasconnault 14-03-07: This option should be renamed "embed" if (in_array($mimetype, array('image/gif', 'image/jpeg', 'image/png'))) { // It's an image $resourcetype = "image"; $embedded = true; } else { if ($mimetype == "audio/mp3") { // It's an MP3 audio file $resourcetype = "mp3"; $embedded = true; } else { if ($mimetype == "video/x-flv") { // It's a Flash video file $resourcetype = "flv"; $embedded = true; } else { if (substr($mimetype, 0, 10) == "video/x-ms") { // It's a Media Player file $resourcetype = "mediaplayer"; $embedded = true; } else { if ($mimetype == "video/quicktime") { // It's a Quicktime file $resourcetype = "quicktime"; $embedded = true; } else { if ($mimetype == "application/x-shockwave-flash") { // It's a Flash file $resourcetype = "flash"; $embedded = true; } else { if ($mimetype == "video/mpeg") { // It's a Mpeg file $resourcetype = "mpeg"; $embedded = true; } else { if ($mimetype == "text/html") { // It's a web page $resourcetype = "html"; } else { if ($mimetype == "application/zip") { // It's a zip archive $resourcetype = "zip"; $embedded = true; } else { if ($mimetype == 'application/pdf' || $mimetype == 'application/x-pdf') { $resourcetype = "pdf"; $embedded = true; } } } } } } } } } } } $isteamspeak = stripos($resource->reference, 'teamspeak://') === 0; /// Form the parse string if (!empty($resource->alltext)) { $querys = array(); $parray = explode(',', $resource->alltext); foreach ($parray as $fieldstring) { $field = explode('=', $fieldstring); $querys[] = urlencode($field[1]) . '=' . urlencode($this->parameters[$field[0]]['value']); } if ($isteamspeak) { $querystring = implode('?', $querys); } else { $querystring = implode('&', $querys); } } /// Set up some variables $inpopup = optional_param('inpopup', 0, PARAM_BOOL); if (resource_is_url($resource->reference)) { $fullurl = $resource->reference; if (!empty($querystring)) { $urlpieces = parse_url($resource->reference); if (empty($urlpieces['query']) or $isteamspeak) { $fullurl .= '?' . $querystring; } else { $fullurl .= '&' . $querystring; } } } else { if ($CFG->resource_allowlocalfiles and strpos($resource->reference, RESOURCE_LOCALPATH) === 0) { // Localpath $localpath = get_user_preferences('resource_localpath', 'D:'); $relativeurl = str_replace(RESOURCE_LOCALPATH, $localpath, $resource->reference); if ($querystring) { $relativeurl .= '?' . $querystring; } $relativeurl = str_replace('\\', '/', $relativeurl); $relativeurl = str_replace(' ', '%20', $relativeurl); $fullurl = 'file:///' . htmlentities($relativeurl); $localpath = true; } else { // Normal uploaded file if ($CFG->slasharguments) { $relativeurl = "/file.php/{$course->id}/{$resource->reference}"; if ($querystring) { $relativeurl .= '?' . $querystring; } } else { $relativeurl = "/file.php?file=/{$course->id}/{$resource->reference}"; if ($querystring) { $relativeurl .= '&' . $querystring; } } $fullurl = "{$CFG->wwwroot}{$relativeurl}"; } } /// Print a notice and redirect if we are trying to access a file on a local file system /// and the config setting has been disabled if (!$CFG->resource_allowlocalfiles and strpos($resource->reference, RESOURCE_LOCALPATH) === 0) { if ($inpopup) { print_header($pagetitle, $course->fullname); } else { $this->navlinks[] = array('name' => format_string($resource->name), 'link' => null, 'type' => 'misc'); $this->navigation = build_navigation($this->navlinks); print_header($pagetitle, $course->fullname, $this->navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm)); } notify(get_string('notallowedlocalfileaccess', 'resource', '')); if ($inpopup) { close_window_button(); } print_footer('none'); die; } /// Check whether this is supposed to be a popup, but was called directly if ($resource->popup and !$inpopup) { /// Make a page and a pop-up window $this->navlinks[] = array('name' => format_string($resource->name), 'link' => null, 'type' => 'misc'); $this->navigation = build_navigation($this->navlinks); print_header($pagetitle, $course->fullname, $this->navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm)); echo "\n<script type=\"text/javascript\">"; echo "\n<!--\n"; echo "openpopup('/mod/resource/view.php?inpopup=true&id={$cm->id}','resource{$resource->id}','{$resource->popup}');\n"; echo "\n-->\n"; echo '</script>'; if (trim(strip_tags($resource->summary))) { print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions), "center"); } $link = "<a href=\"{$CFG->wwwroot}/mod/resource/view.php?inpopup=true&id={$cm->id}\" " . "onclick=\"this.target='resource{$resource->id}'; return openpopup('/mod/resource/view.php?inpopup=true&id={$cm->id}', " . "'resource{$resource->id}','{$resource->popup}');\">" . format_string($resource->name, true) . "</a>"; echo '<div class="popupnotice">'; print_string('popupresource', 'resource'); echo '<br />'; print_string('popupresourcelink', 'resource', $link); echo '</div>'; print_footer($course); exit; } /// Now check whether we need to display a frameset $frameset = optional_param('frameset', '', PARAM_ALPHA); if (empty($frameset) and !$embedded and !$inpopup and $resource->options == "frame" and empty($USER->screenreader)) { @header('Content-Type: text/html; charset=utf-8'); echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">\n"; echo "<html dir=\"ltr\">\n"; echo '<head>'; echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />'; echo "<title>" . format_string($course->shortname) . ": " . strip_tags(format_string($resource->name, true)) . "</title></head>\n"; echo "<frameset rows=\"{$CFG->resource_framesize},*\">"; echo "<frame src=\"view.php?id={$cm->id}&type={$resource->type}&frameset=top\" title=\"" . get_string('modulename', 'resource') . "\"/>"; if (!empty($localpath)) { // Show it like this so we interpose some HTML echo "<frame src=\"view.php?id={$cm->id}&type={$resource->type}&inpopup=true\" title=\"" . get_string('modulename', 'resource') . "\"/>"; } else { echo "<frame src=\"{$fullurl}\" title=\"" . get_string('modulename', 'resource') . "\"/>"; } echo "</frameset>"; echo "</html>"; exit; } /// We can only get here once per resource, so add an entry to the log add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id); /// If we are in a frameset, just print the top of it if (!empty($frameset) and $frameset == "top") { $this->navlinks[] = array('name' => format_string($resource->name), 'link' => null, 'type' => 'misc'); $this->navigation = build_navigation($this->navlinks); print_header($pagetitle, $course->fullname, $this->navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm, "parent")); $options = new object(); $options->para = false; echo '<div class="summary">' . format_text($resource->summary, FORMAT_HTML, $options) . '</div>'; if (!empty($localpath)) { // Show some help echo '<div align="right" class="helplink">'; link_to_popup_window('/mod/resource/type/file/localpath.php', get_string('localfile', 'resource'), get_string('localfilehelp', 'resource'), 400, 500, get_string('localfilehelp', 'resource')); echo '</div>'; } echo '</div></div></body></html>'; exit; } /// Display the actual resource if ($embedded) { // Display resource embedded in page $strdirectlink = get_string("directlink", "resource"); if ($inpopup) { print_header($pagetitle); } else { $this->navlinks[] = array('name' => format_string($resource->name, true), 'link' => $fullurl, 'type' => 'misc'); $this->navigation = build_navigation($this->navlinks); print_header_simple($pagetitle, '', $this->navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm, "self")); } if ($resourcetype == "image") { echo '<div class="resourcecontent resourceimg">'; echo "<img title=\"" . strip_tags(format_string($resource->name, true)) . "\" class=\"resourceimage\" src=\"{$fullurl}\" alt=\"\" />"; echo '</div>'; } else { if ($resourcetype == "mp3") { if (!empty($THEME->resource_mp3player_colors)) { $c = $THEME->resource_mp3player_colors; // You can set this up in your theme/xxx/config.php } else { $c = 'bgColour=000000&btnColour=ffffff&btnBorderColour=cccccc&iconColour=000000&' . 'iconOverColour=00cc00&trackColour=cccccc&handleColour=ffffff&loaderColour=ffffff&' . 'font=Arial&fontColour=FF33FF&buffer=10&waitForPlay=no&autoPlay=yes'; } $c .= '&volText=' . get_string('vol', 'resource') . '&panText=' . get_string('pan', 'resource'); $c = htmlentities($c); $id = 'filter_mp3_' . time(); //we need something unique because it might be stored in text cache $cleanurl = addslashes_js($fullurl); // If we have Javascript, use UFO to embed the MP3 player, otherwise depend on plugins echo '<div class="resourcecontent resourcemp3">'; echo '<span class="mediaplugin mediaplugin_mp3" id="' . $id . '"></span>' . '<script type="text/javascript">' . "\n" . '//<![CDATA[' . "\n" . 'var FO = { movie:"' . $CFG->wwwroot . '/lib/mp3player/mp3player.swf?src=' . $cleanurl . '",' . "\n" . 'width:"600", height:"70", majorversion:"6", build:"40", flashvars:"' . $c . '", quality: "high" };' . "\n" . 'UFO.create(FO, "' . $id . '");' . "\n" . '//]]>' . "\n" . '</script>' . "\n"; echo '<noscript>'; echo "<object type=\"audio/mpeg\" data=\"{$fullurl}\" width=\"600\" height=\"70\">"; echo "<param name=\"src\" value=\"{$fullurl}\" />"; echo '<param name="quality" value="high" />'; echo '<param name="autoplay" value="true" />'; echo '<param name="autostart" value="true" />'; echo '</object>'; echo '<p><a href="' . $fullurl . '">' . $fullurl . '</a></p>'; echo '</noscript>'; echo '</div>'; } else { if ($resourcetype == "flv") { $id = 'filter_flv_' . time(); //we need something unique because it might be stored in text cache $cleanurl = addslashes_js($fullurl); // If we have Javascript, use UFO to embed the FLV player, otherwise depend on plugins echo '<div class="resourcecontent resourceflv">'; echo '<span class="mediaplugin mediaplugin_flv" id="' . $id . '"></span>' . '<script type="text/javascript">' . "\n" . '//<![CDATA[' . "\n" . 'var FO = { movie:"' . $CFG->wwwroot . '/filter/mediaplugin/flvplayer.swf?file=' . $cleanurl . '",' . "\n" . 'width:"600", height:"400", majorversion:"6", build:"40", allowscriptaccess:"never", quality: "high" };' . "\n" . 'UFO.create(FO, "' . $id . '");' . "\n" . '//]]>' . "\n" . '</script>' . "\n"; echo '<noscript>'; echo "<object type=\"video/x-flv\" data=\"{$fullurl}\" width=\"600\" height=\"400\">"; echo "<param name=\"src\" value=\"{$fullurl}\" />"; echo '<param name="quality" value="high" />'; echo '<param name="autoplay" value="true" />'; echo '<param name="autostart" value="true" />'; echo '</object>'; echo '<p><a href="' . $fullurl . '">' . $fullurl . '</a></p>'; echo '</noscript>'; echo '</div>'; } else { if ($resourcetype == "mediaplayer") { echo '<div class="resourcecontent resourcewmv">'; echo '<object type="video/x-ms-wmv" data="' . $fullurl . '">'; echo '<param name="controller" value="true" />'; echo '<param name="autostart" value="true" />'; echo "<param name=\"src\" value=\"{$fullurl}\" />"; echo '<param name="scale" value="noScale" />'; echo "<a href=\"{$fullurl}\">{$fullurl}</a>"; echo '</object>'; echo '</div>'; } else { if ($resourcetype == "mpeg") { echo '<div class="resourcecontent resourcempeg">'; echo '<object classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsm p2inf.cab#Version=5,1,52,701" type="application/x-oleobject">'; echo "<param name=\"fileName\" value=\"{$fullurl}\" />"; echo '<param name="autoStart" value="true" />'; echo '<param name="animationatStart" value="true" />'; echo '<param name="transparentatStart" value="true" />'; echo '<param name="showControls" value="true" />'; echo '<param name="Volume" value="-450" />'; echo '<!--[if !IE]>-->'; echo '<object type="video/mpeg" data="' . $fullurl . '">'; echo '<param name="controller" value="true" />'; echo '<param name="autostart" value="true" />'; echo "<param name=\"src\" value=\"{$fullurl}\" />"; echo "<a href=\"{$fullurl}\">{$fullurl}</a>"; echo '<!--<![endif]-->'; echo '<a href="' . $fullurl . '">' . $fullurl . '</a>'; echo '<!--[if !IE]>-->'; echo '</object>'; echo '<!--<![endif]-->'; echo '</object>'; echo '</div>'; } else { if ($resourcetype == "quicktime") { echo '<style type="text/css">'; echo '/* class to hide nested objects in IE */'; echo '/* hides the second object from all versions of IE */'; echo '* html object.hiddenObjectForIE { display: none; }'; echo '/* display the second object only for IE5 Mac */'; echo '/* IE Mac \\*//*/'; echo '* html object.hiddenObjectForIE { display: inline; }'; echo '/**/'; echo '</style>'; echo '<div class="resourcecontent resourceqt">'; echo '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"'; echo ' codebase="http://www.apple.com/qtactivex/qtplugin.cab">'; echo "<param name=\"src\" value=\"{$fullurl}\" />"; echo '<param name="autoplay" value="true" />'; echo '<param name="loop" value="true" />'; echo '<param name="controller" value="true" />'; echo '<param name="scale" value="aspect" />'; echo "<object class=\"hiddenObjectForIE\" type=\"video/quicktime\" data=\"{$fullurl}\">"; echo '<param name="controller" value="true" />'; echo '<param name="autoplay" value="true" />'; echo '<param name="loop" value="true" />'; echo '<param name="scale" value="aspect" />'; echo '</object>'; echo '<a href="' . $fullurl . '">' . $fullurl . '</a>'; echo '</object>'; echo '</div>'; } else { if ($resourcetype == "flash") { echo '<div class="resourcecontent resourceswf">'; echo '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">'; echo "<param name=\"movie\" value=\"{$fullurl}\" />"; echo '<param name="autoplay" value="true" />'; echo '<param name="loop" value="true" />'; echo '<param name="controller" value="true" />'; echo '<param name="scale" value="aspect" />'; echo '<!--[if !IE]>-->'; echo "<object type=\"application/x-shockwave-flash\" data=\"{$fullurl}\">"; echo '<param name="controller" value="true" />'; echo '<param name="autoplay" value="true" />'; echo '<param name="loop" value="true" />'; echo '<param name="scale" value="aspect" />'; echo '<!--<![endif]-->'; echo '<a href="' . $fullurl . '">' . $fullurl . '</a>'; echo '<!--[if !IE]>-->'; echo '</object>'; echo '<!--<![endif]-->'; echo '</object>'; echo '</div>'; } elseif ($resourcetype == 'zip') { echo '<div class="resourcepdf">'; echo get_string('clicktoopen', 'resource') . '<a href="' . $fullurl . '">' . format_string($resource->name) . '</a>'; echo '</div>'; } elseif ($resourcetype == 'pdf') { echo '<div class="resourcepdf">'; echo '<object data="' . $fullurl . '" type="application/pdf">'; echo get_string('clicktoopen', 'resource') . '<a href="' . $fullurl . '">' . format_string($resource->name) . '</a>'; echo '</object>'; echo '</div>'; } } } } } } } if (trim($resource->summary)) { print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $course->id), "center"); } if ($inpopup) { echo "<div class=\"popupnotice\">(<a href=\"{$fullurl}\">{$strdirectlink}</a>)</div>"; } else { print_spacer(20, 20); print_footer($course); } } else { // Display the resource on it's own if (!empty($localpath)) { // Show a link to help work around browser security echo '<div align="right" class="helplink">'; link_to_popup_window('/mod/resource/type/file/localpath.php', get_string('localfile', 'resource'), get_string('localfilehelp', 'resource'), 400, 500, get_string('localfilehelp', 'resource')); echo '</div>'; echo "<div class=\"popupnotice\">(<a href=\"{$fullurl}\">{$fullurl}</a>)</div>"; } redirect($fullurl); } }
/** * Display all the submissions ready for grading * * @global object * @global object * @global object * @global object * @param string $message * @return bool|void */ function display_submissions($message = '') { global $CFG, $DB, $USER, $DB, $OUTPUT; require_once $CFG->libdir . '/gradelib.php'; /* first we check to see if the form has just been submitted * to request user_preference updates */ if (isset($_POST['updatepref'])) { $perpage = optional_param('perpage', 10, PARAM_INT); $perpage = $perpage <= 0 ? 10 : $perpage; set_user_preference('assignment_perpage', $perpage); set_user_preference('assignment_quickgrade', optional_param('quickgrade', 0, PARAM_BOOL)); } /* next we get perpage and quickgrade (allow quick grade) params * from database */ $perpage = get_user_preferences('assignment_perpage', 10); $quickgrade = get_user_preferences('assignment_quickgrade', 0); $grading_info = grade_get_grades($this->course->id, 'mod', 'assignment', $this->assignment->id); if (!empty($CFG->enableoutcomes) and !empty($grading_info->outcomes)) { $uses_outcomes = true; } else { $uses_outcomes = false; } $page = optional_param('page', 0, PARAM_INT); $strsaveallfeedback = get_string('saveallfeedback', 'assignment'); /// Some shortcuts to make the code read better $course = $this->course; $assignment = $this->assignment; $cm = $this->cm; $tabindex = 1; //tabindex for quick grading tabbing; Not working for dropdowns yet add_to_log($course->id, 'assignment', 'view submission', 'submissions.php?id=' . $this->cm->id, $this->assignment->id, $this->cm->id); $navigation = build_navigation($this->strsubmissions, $this->cm); print_header_simple(format_string($this->assignment->name, true), "", $navigation, '', '', true, update_module_button($cm->id, $course->id, $this->strassignment), navmenu($course, $cm)); $course_context = get_context_instance(CONTEXT_COURSE, $course->id); if (has_capability('gradereport/grader:view', $course_context) && has_capability('moodle/grade:viewall', $course_context)) { echo '<div class="allcoursegrades"><a href="' . $CFG->wwwroot . '/grade/report/grader/index.php?id=' . $course->id . '">' . get_string('seeallcoursegrades', 'grades') . '</a></div>'; } if (!empty($message)) { echo $message; // display messages here if any } $context = get_context_instance(CONTEXT_MODULE, $cm->id); /// Check to see if groups are being used in this assignment /// find out current groups mode $groupmode = groups_get_activity_groupmode($cm); $currentgroup = groups_get_activity_group($cm, true); groups_print_activity_menu($cm, 'submissions.php?id=' . $this->cm->id); /// Get all ppl that are allowed to submit assignments if ($users = get_users_by_capability($context, 'mod/assignment:submit', 'u.id', '', '', '', $currentgroup, '', false)) { $users = array_keys($users); } // if groupmembersonly used, remove users who are not in any group if ($users and !empty($CFG->enablegroupings) and $cm->groupmembersonly) { if ($groupingusers = groups_get_grouping_members($cm->groupingid, 'u.id', 'u.id')) { $users = array_intersect($users, array_keys($groupingusers)); } } $tablecolumns = array('picture', 'fullname', 'grade', 'submissioncomment', 'timemodified', 'timemarked', 'status', 'finalgrade'); if ($uses_outcomes) { $tablecolumns[] = 'outcome'; // no sorting based on outcomes column } $tableheaders = array('', get_string('fullname'), get_string('grade'), get_string('comment', 'assignment'), get_string('lastmodified') . ' (' . get_string('submission', 'assignment') . ')', get_string('lastmodified') . ' (' . get_string('grade') . ')', get_string('status'), get_string('finalgrade', 'grades')); if ($uses_outcomes) { $tableheaders[] = get_string('outcome', 'grades'); } require_once $CFG->libdir . '/tablelib.php'; $table = new flexible_table('mod-assignment-submissions'); $table->define_columns($tablecolumns); $table->define_headers($tableheaders); $table->define_baseurl($CFG->wwwroot . '/mod/assignment/submissions.php?id=' . $this->cm->id . '&currentgroup=' . $currentgroup); $table->sortable(true, 'lastname'); //sorted by lastname by default $table->collapsible(true); $table->initialbars(true); $table->column_suppress('picture'); $table->column_suppress('fullname'); $table->column_class('picture', 'picture'); $table->column_class('fullname', 'fullname'); $table->column_class('grade', 'grade'); $table->column_class('submissioncomment', 'comment'); $table->column_class('timemodified', 'timemodified'); $table->column_class('timemarked', 'timemarked'); $table->column_class('status', 'status'); $table->column_class('finalgrade', 'finalgrade'); if ($uses_outcomes) { $table->column_class('outcome', 'outcome'); } $table->set_attribute('cellspacing', '0'); $table->set_attribute('id', 'attempts'); $table->set_attribute('class', 'submissions'); $table->set_attribute('width', '100%'); //$table->set_attribute('align', 'center'); $table->no_sorting('finalgrade'); $table->no_sorting('outcome'); // Start working -- this is necessary as soon as the niceties are over $table->setup(); if (empty($users)) { echo $OUTPUT->heading(get_string('nosubmitusers', 'assignment')); return true; } /// Construct the SQL if ($where = $table->get_sql_where()) { $where .= ' AND '; } if ($sort = $table->get_sql_sort()) { $sort = ' ORDER BY ' . $sort; } $select = 'SELECT u.id, u.firstname, u.lastname, u.picture, u.imagealt, s.id AS submissionid, s.grade, s.submissioncomment, s.timemodified, s.timemarked, COALESCE(SIGN(SIGN(s.timemarked) + SIGN(s.timemarked - s.timemodified)), 0) AS status '; $sql = 'FROM {user} u ' . 'LEFT JOIN {assignment_submissions} s ON u.id = s.userid AND s.assignment = ' . $this->assignment->id . ' ' . 'WHERE ' . $where . 'u.id IN (' . implode(',', $users) . ') '; $table->pagesize($perpage, count($users)); ///offset used to calculate index of student in that particular query, needed for the pop up to know who's next $offset = $page * $perpage; $strupdate = get_string('update'); $strgrade = get_string('grade'); $grademenu = make_grades_menu($this->assignment->grade); if (($ausers = $DB->get_records_sql($select . $sql . $sort, null, $table->get_page_start(), $table->get_page_size())) !== false) { $grading_info = grade_get_grades($this->course->id, 'mod', 'assignment', $this->assignment->id, array_keys($ausers)); foreach ($ausers as $auser) { $final_grade = $grading_info->items[0]->grades[$auser->id]; $grademax = $grading_info->items[0]->grademax; $final_grade->formatted_grade = round($final_grade->grade, 2) . ' / ' . round($grademax, 2); $locked_overridden = 'locked'; if ($final_grade->overridden) { $locked_overridden = 'overridden'; } /// Calculate user status $auser->status = $auser->timemarked > 0 && $auser->timemarked >= $auser->timemodified; $picture = $OUTPUT->user_picture(moodle_user_picture::make($auser, $course->id)); if (empty($auser->submissionid)) { $auser->grade = -1; //no submission yet } if (!empty($auser->submissionid)) { ///Prints student answer and student modified date ///attach file or print link to student answer, depending on the type of the assignment. ///Refer to print_student_answer in inherited classes. if ($auser->timemodified > 0) { $studentmodified = '<div id="ts' . $auser->id . '">' . $this->print_student_answer($auser->id) . userdate($auser->timemodified) . '</div>'; } else { $studentmodified = '<div id="ts' . $auser->id . '"> </div>'; } ///Print grade, dropdown or text if ($auser->timemarked > 0) { $teachermodified = '<div id="tt' . $auser->id . '">' . userdate($auser->timemarked) . '</div>'; if ($final_grade->locked or $final_grade->overridden) { $grade = '<div id="g' . $auser->id . '" class="' . $locked_overridden . '">' . $final_grade->formatted_grade . '</div>'; } else { if ($quickgrade) { $select = html_select::make(make_grades_menu($this->assignment->grade), 'menu[' . $auser->id . ']', $auser->grade, get_string('nograde')); $select->nothingvalue = '-1'; $select->tabindex = $tabindex++; $menu = $OUTPUT->select($select); $grade = '<div id="g' . $auser->id . '">' . $menu . '</div>'; } else { $grade = '<div id="g' . $auser->id . '">' . $this->display_grade($auser->grade) . '</div>'; } } } else { $teachermodified = '<div id="tt' . $auser->id . '"> </div>'; if ($final_grade->locked or $final_grade->overridden) { $grade = '<div id="g' . $auser->id . '" class="' . $locked_overridden . '">' . $final_grade->formatted_grade . '</div>'; } else { if ($quickgrade) { $select = html_select::make(make_grades_menu($this->assignment->grade), 'menu[' . $auser->id . ']', $auser->grade, get_string('nograde')); $select->nothingvalue = '-1'; $select->tabindex = $tabindex++; $menu = $OUTPUT->select($select); $grade = '<div id="g' . $auser->id . '">' . $menu . '</div>'; } else { $grade = '<div id="g' . $auser->id . '">' . $this->display_grade($auser->grade) . '</div>'; } } } ///Print Comment if ($final_grade->locked or $final_grade->overridden) { $comment = '<div id="com' . $auser->id . '">' . shorten_text(strip_tags($final_grade->str_feedback), 15) . '</div>'; } else { if ($quickgrade) { $comment = '<div id="com' . $auser->id . '">' . '<textarea tabindex="' . $tabindex++ . '" name="submissioncomment[' . $auser->id . ']" id="submissioncomment' . $auser->id . '" rows="2" cols="20">' . $auser->submissioncomment . '</textarea></div>'; } else { $comment = '<div id="com' . $auser->id . '">' . shorten_text(strip_tags($auser->submissioncomment), 15) . '</div>'; } } } else { $studentmodified = '<div id="ts' . $auser->id . '"> </div>'; $teachermodified = '<div id="tt' . $auser->id . '"> </div>'; $status = '<div id="st' . $auser->id . '"> </div>'; if ($final_grade->locked or $final_grade->overridden) { $grade = '<div id="g' . $auser->id . '">' . $final_grade->formatted_grade . '</div>'; } else { if ($quickgrade) { // allow editing $select = html_select::make(make_grades_menu($this->assignment->grade), 'menu[' . $auser->id . ']', $auser->grade, get_string('nograde')); $select->nothingvalue = '-1'; $select->tabindex = $tabindex++; $menu = $OUTPUT->select($select); $grade = '<div id="g' . $auser->id . '">' . $menu . '</div>'; } else { $grade = '<div id="g' . $auser->id . '">-</div>'; } } if ($final_grade->locked or $final_grade->overridden) { $comment = '<div id="com' . $auser->id . '">' . $final_grade->str_feedback . '</div>'; } else { if ($quickgrade) { $comment = '<div id="com' . $auser->id . '">' . '<textarea tabindex="' . $tabindex++ . '" name="submissioncomment[' . $auser->id . ']" id="submissioncomment' . $auser->id . '" rows="2" cols="20">' . $auser->submissioncomment . '</textarea></div>'; } else { $comment = '<div id="com' . $auser->id . '"> </div>'; } } } if (empty($auser->status)) { /// Confirm we have exclusively 0 or 1 $auser->status = 0; } else { $auser->status = 1; } $buttontext = $auser->status == 1 ? $strupdate : $strgrade; ///No more buttons, we use popups ;-). $popup_url = '/mod/assignment/submissions.php?id=' . $this->cm->id . '&userid=' . $auser->id . '&mode=single' . '&offset=' . $offset++; $link = html_link::make($popup_url, $buttontext); $link->add_action(new popup_action('click', $link->url, 'grade' . $auser->id, array('height' => 600, 'width' => 700))); $link->title = $buttontext; $button = $OUTPUT->link($link); $status = '<div id="up' . $auser->id . '" class="s' . $auser->status . '">' . $button . '</div>'; $finalgrade = '<span id="finalgrade_' . $auser->id . '">' . $final_grade->str_grade . '</span>'; $outcomes = ''; if ($uses_outcomes) { foreach ($grading_info->outcomes as $n => $outcome) { $outcomes .= '<div class="outcome"><label>' . $outcome->name . '</label>'; $options = make_grades_menu(-$outcome->scaleid); if ($outcome->grades[$auser->id]->locked or !$quickgrade) { $options[0] = get_string('nooutcome', 'grades'); $outcomes .= ': <span id="outcome_' . $n . '_' . $auser->id . '">' . $options[$outcome->grades[$auser->id]->grade] . '</span>'; } else { $outcomes .= ' '; $select = html_select::make($options, 'outcome_' . $n . '[' . $auser->id . ']', $outcome->grades[$auser->id]->grade, get_string('nooutcome', 'grades')); $select->nothingvalue = '0'; $select->tabindex = $tabindex++; $select->id = 'outcome_' . $n . '_' . $auser->id; $outcomes .= $OUTPUT->select($select); } $outcomes .= '</div>'; } } $userlink = '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $auser->id . '&course=' . $course->id . '">' . fullname($auser) . '</a>'; $row = array($picture, $userlink, $grade, $comment, $studentmodified, $teachermodified, $status, $finalgrade); if ($uses_outcomes) { $row[] = $outcomes; } $table->add_data($row); } } /// Print quickgrade form around the table if ($quickgrade) { echo '<form action="submissions.php" id="fastg" method="post">'; echo '<div>'; echo '<input type="hidden" name="id" value="' . $this->cm->id . '" />'; echo '<input type="hidden" name="mode" value="fastgrade" />'; echo '<input type="hidden" name="page" value="' . $page . '" />'; echo '</div>'; } $table->print_html(); /// Print the whole table if ($quickgrade) { $lastmailinfo = get_user_preferences('assignment_mailinfo', 1) ? 'checked="checked"' : ''; echo '<div class="fgcontrols">'; echo '<div class="emailnotification">'; echo '<label for="mailinfo">' . get_string('enableemailnotification', 'assignment') . '</label>'; echo '<input type="hidden" name="mailinfo" value="0" />'; echo '<input type="checkbox" id="mailinfo" name="mailinfo" value="1" ' . $lastmailinfo . ' />'; echo $OUTPUT->help_icon(moodle_help_icon::make('emailnotification', get_string('enableemailnotification', 'assignment'), 'assignment')) . '</p></div>'; echo '</div>'; echo '<div class="fastgbutton"><input type="submit" name="fastg" value="' . get_string('saveallfeedback', 'assignment') . '" /></div>'; echo '</div>'; echo '</form>'; } /// End of fast grading form /// Mini form for setting user preference echo '<div class="qgprefs">'; echo '<form id="options" action="submissions.php?id=' . $this->cm->id . '" method="post"><div>'; echo '<input type="hidden" name="updatepref" value="1" />'; echo '<table id="optiontable">'; echo '<tr><td>'; echo '<label for="perpage">' . get_string('pagesize', 'assignment') . '</label>'; echo '</td>'; echo '<td>'; echo '<input type="text" id="perpage" name="perpage" size="1" value="' . $perpage . '" />'; echo $OUTPUT->help_icon(moodle_help_icon::make('pagesize', get_string('pagesize', 'assignment'), 'assignment')); echo '</td></tr>'; echo '<tr><td>'; echo '<label for="quickgrade">' . get_string('quickgrade', 'assignment') . '</label>'; echo '</td>'; echo '<td>'; $checked = $quickgrade ? 'checked="checked"' : ''; echo '<input type="checkbox" id="quickgrade" name="quickgrade" value="1" ' . $checked . ' />'; echo $OUTPUT->help_icon(moodle_help_icon::make('quickgrade', get_string('quickgrade', 'assignment'), 'assignment')) . '</p></div>'; echo '</td></tr>'; echo '<tr><td colspan="2">'; echo '<input type="submit" value="' . get_string('savepreferences') . '" />'; echo '</td></tr></table>'; echo '</div></form></div>'; ///End of mini form echo $OUTPUT->footer(); }
print_error('invalidlightboxgalleryid', 'lightboxgallery'); } if (!($course = $DB->get_record('course', array('id' => $gallery->course)))) { print_error('invalidcourseid'); } if (!($cm = get_coursemodule_from_instance('lightboxgallery', $gallery->id, $course->id))) { print_error('invalidcoursemodule'); } if ($delete && !($comment = $DB->get_record('lightboxgallery_comments', array('gallery' => $gallery->id, 'id' => $delete)))) { print_error('Invalid comment ID'); } require_login($course->id); $PAGE->set_url('/mod/lightboxgallery/view.php', array('id' => $id)); $PAGE->set_title($gallery->name); $PAGE->set_heading($course->shortname); $PAGE->set_button(update_module_button($cm->id, $course->id, get_string('modulename', 'lightboxgallery'))); $context = get_context_instance(CONTEXT_MODULE, $cm->id); $galleryurl = $CFG->wwwroot . '/mod/lightboxgallery/view.php?id=' . $cm->id; if ($delete && has_capability('mod/lightboxgallery:edit', $context)) { if ($confirm && confirm_sesskey()) { $DB->delete_records('lightboxgallery_comments', array('id' => $comment->id)); redirect($galleryurl); } else { echo $OUTPUT->header(); lightboxgallery_print_comment($comment, $context); echo '<br />'; $paramsyes = array('id' => $gallery->id, 'delete' => $comment->id, 'sesskey' => sesskey(), 'confirm' => 1); $paramsno = array('id' => $cm->id); echo $OUTPUT->confirm(get_string('commentdelete', 'lightboxgallery'), new moodle_url('/mod/lightboxgallery/comment.php', $paramsyes), new moodle_url('/mod/lightboxgallery/view.php', $paramsno)); echo $OUTPUT->footer(); die;
error("No such user in this course"); } } // Log -------------------------------------------------------------- add_to_log($course->id, "blended", "generateQuizPDF", "generateQuizesPDF.php?id={$blended->id}", "{$blended->id}"); // Capabilities ----------------------------------------------------- require_login($cm->course, false, $cm); $context_course = context_course::instance($cm->course); $context = context_module::instance($cm->id); require_capability('mod/blended:printquizes', $context); // Get the strings -------------------------------------------------- $strlabelspage = get_string("labelspage", "blended"); $strpaperquiz = get_string("paperquiz", "blended"); // Print the page header -------------------------------------------- $navigation = build_navigation(array(array('name' => $blended->name, 'link' => "../../mod/blended/view.php?a={$blended->id}", 'type' => 'misc'), array('name' => $strpaperquiz, 'link' => null, 'type' => 'misc'))); print_header("{$course->shortname}: {$blended->name}: {$strpaperquiz}", "{$course->shortname}", $navigation, "", "", true, update_module_button($cm->id, $course->id, $blended->name, $strpaperquiz), navmenu($course, $cm)); /** * Launch pending job?? TODO aparently this do nothing */ if ($timestamp_launch && $timestamp_launch != 0) { error("operation unsuported. Please contact Admin."); $timestamp = time(); //TODO cambiar por question_create_uniqueid_attempt if (!($unique_attempts = get_records_sql('SELECT * FROM ' . "{$CFG->prefix}blended_attempts WHERE timestamp= '{$timestamp_launch}'"))) { error("Encountered a problem trying to get attempt."); } $i = 0; foreach ($unique_attempts as $attempt) { $attempts[$i] = $attempt; $attempts[$i]->status = JOB_STATE_WAITING; $attempts[$i]->timestamp = $timestamp;
$firstscorm = current($scorms); if (!($course->format == 'scorm' && $firstscorm->id == $scorm->id)) { $navlinks[] = array('name' => $strscorms, 'link' => "index.php?id={$course->id}", 'type' => 'activity'); } } } $pagetitle = strip_tags($course->shortname . ': ' . format_string($scorm->name)); add_to_log($course->id, 'scorm', 'pre-view', 'view.php?id=' . $cm->id, "{$scorm->id}"); if (has_capability('mod/scorm:skipview', get_context_instance(CONTEXT_MODULE, $cm->id)) && scorm_simple_play($scorm, $USER)) { exit; } // // Print the page header // $navlinks = array(); $navlinks[] = array('name' => format_string($scorm->name, true), 'link' => "view.php?id={$cm->id}", 'type' => 'activityinstance'); $navigation = build_navigation($navlinks); print_header($pagetitle, $course->fullname, $navigation, '', '', true, update_module_button($cm->id, $course->id, $strscorm), navmenu($course, $cm)); if (has_capability('mod/scorm:viewreport', $context)) { $trackedusers = scorm_get_count_users($scorm->id, $cm->groupingid); if ($trackedusers > 0) { echo "<div class=\"reportlink\"><a {$CFG->frametarget} href=\"report.php?id={$cm->id}\"> " . get_string('viewalluserreports', 'scorm', $trackedusers) . '</a></div>'; } else { echo '<div class="reportlink">' . get_string('noreports', 'scorm') . '</div>'; } } // Print the main part of the page print_heading(format_string($scorm->name)); print_box(format_text($scorm->summary), 'generalbox', 'intro'); scorm_view_display($USER, $scorm, 'view.php?id=' . $cm->id, $cm); print_footer($course);
/** * Print the standard header for pagemenu module * * @uses $CFG * @uses $USER tabs.php requires it * @param object $cm Course module record object * @param object $course Couse record object * @param object $pagemenu pagemenu module record object * @param string $currenttab File location and tab to be selected * @param string $focus Focus * @param boolean $showtabs Display tabs yes/no * @return void **/ function pagemenu_print_header($cm, $course, $pagemenu, $currenttab = 'view', $focus = '', $showtabs = true) { global $CFG, $USER; $strpagemenus = get_string('modulenameplural', 'pagemenu'); $strpagemenu = get_string('modulename', 'pagemenu'); $strname = format_string($pagemenu->name); /// Log it! add_to_log($course->id, 'pagemenu', $currenttab, "{$currenttab}.php?id={$cm->id}", $strname, $cm->id); /// Print header, heading, tabs and messages print_header_simple($strname, $strname, build_navigation('', $cm), $focus, '', true, update_module_button($cm->id, $course->id, $strpagemenu), navmenu($course, $cm)); print_heading($strname); if ($showtabs) { pagemenu_print_tabs($cm, $currenttab); } pagemenu_print_messages(); }
} else { print_error('nofieldindatabase', 'data'); } } // populate objets for this databases fields $fields = array(); foreach ($fieldrecords as $fieldrecord) { $fields[] = data_get_field($fieldrecord, $data); } $mform = new mod_data_export_form('export.php?d=' . $data->id, $fields, $cm); if ($mform->is_cancelled()) { redirect('view.php?d=' . $data->id); } elseif (!($formdata = (array) $mform->get_data())) { // build header to match the rest of the UI $nav = build_navigation('', $cm); print_header_simple($data->name, '', $nav, '', '', true, update_module_button($cm->id, $course->id, get_string('modulename', 'data')), navmenu($course, $cm), '', ''); echo $OUTPUT->heading(format_string($data->name)); // these are for the tab display $currentgroup = groups_get_activity_group($cm); $groupmode = groups_get_activity_groupmode($cm); $currenttab = 'export'; include 'tabs.php'; $mform->display(); echo $OUTPUT->footer(); die; } if (array_key_exists('portfolio', $formdata) && !empty($formdata['portfolio'])) { // fake portfolio callback stuff and redirect $formdata['id'] = $cm->id; $formdata['exporttype'] = 'csv'; // force for now
error('Course Module ID was incorrect'); } } else { error('You must specify a course_module ID or an instance ID'); } } require_login($course, true, $cm); add_to_log($course->id, "shoppingcart", "view", "view.php?id={$cm->id}", "{$shoppingcart->id}"); /// Print the page header $strshoppingcarts = get_string('modulenameplural', 'shoppingcart'); $strshoppingcart = get_string('modulename', 'shoppingcart'); $navlinks = array(); $navlinks[] = array('name' => $strshoppingcarts, 'link' => "index.php?id={$course->id}", 'type' => 'activity'); $navlinks[] = array('name' => format_string($shoppingcart->name), 'link' => '', 'type' => 'activityinstance'); $navigation = build_navigation($navlinks); print_header_simple(format_string($shoppingcart->name), '', $navigation, '', '', true, update_module_button($cm->id, $course->id, $strshoppingcart), navmenu($course, $cm)); /// Print the main part of the page //********************************************************************************************** // Shopping Cart session_start(); $_SESSION['userid'] = $USER->id; //Role $sql = "SELECT * FROM {$CFG->prefix}role_assignments WHERE userid =" . $USER->id; $role_assignment = get_record_sql($sql); $sql2 = "SELECT * FROM {$CFG->prefix}role WHERE id = " . $role_assignment->roleid; $role_obj = get_record_sql($sql2); $role = $role_obj->shortname; function curPageURL() { $pageURL = 'http'; if ($_SERVER["HTTPS"] == "on") {
} $strforums = get_string("modulenameplural", "forum"); $strforum = get_string("modulename", "forum"); $buttontext = update_module_button($cm->id, $course->id, $strforum); } else { if ($f) { if (!($forum = get_record("forum", "id", $f))) { error("Forum ID was incorrect or no longer exists"); } if (!($course = get_record("course", "id", $forum->course))) { error("Forum is misconfigured - don't know what course it's from"); } $strforums = get_string("modulenameplural", "forum"); $strforum = get_string("modulename", "forum"); if ($cm = get_coursemodule_from_instance("forum", $forum->id, $course->id)) { $buttontext = update_module_button($cm->id, $course->id, $strforum); } else { $cm->id = 0; $cm->visible = 1; $cm->course = $course->id; $buttontext = ""; } } else { error('Must specify a course module or a forum ID'); } } if (!$buttontext) { $buttontext = forum_search_form($course, $search); } require_course_login($course, true, $cm); $context = get_context_instance(CONTEXT_MODULE, $cm->id);
error('Course module is incorrect'); } if (!($course = get_record('course', 'id', $vimoodle->course))) { error('Course is misconfigured'); } if (!($cm = get_coursemodule_from_instance('vimoodle', $vimoodle->id, $course->id))) { error('Course Module ID was incorrect'); } } else { error('You must specify a course_module ID or an instance ID'); } } require_login($course, true, $cm); add_to_log($course->id, "vimoodle", "view", "view.php?id={$cm->id}", "{$vimoodle->id}"); /// Print the page header $strvimoodles = get_string('modulenameplural', 'vimoodle'); $strvimoodle = get_string('modulename', 'vimoodle'); $navlinks = array(); $navlinks[] = array('name' => $strvimoodles, 'link' => "index.php?id={$course->id}", 'type' => 'activity'); $navlinks[] = array('name' => format_string($vimoodle->name), 'link' => '', 'type' => 'activityinstance'); $navigation = build_navigation($navlinks); print_header_simple(format_string($vimoodle->name), '', $navigation, '', '', true, update_module_button($cm->id, $course->id, $strvimoodle), navmenu($course, $cm)); /// Print the main part of the page $user = $vimoodle->caseid; $video = $vimoodle->videoid; $pin = $vimoodle->pin; $album = $vimoodle->albumid; $client = new jsonRPCClient(); require_once "layout.php"; /// Finish the page print_footer($course);