function view() { global $USER, $OUTPUT, $DB, $CFG; require_capability('mod/assignment:view', $this->context); add_to_log($this->course->id, 'assignment', 'view', "view.php?id={$this->cm->id}", $this->assignment->id, $this->cm->id); $this->view_header(); if ($this->assignment->timeavailable > time() and !has_capability('mod/assignment:grade', $this->context) and $this->assignment->var3) { // force hiding before available date echo $OUTPUT->box_start('generalbox boxaligncenter', 'intro'); print_string('notavailableyet', 'assignment'); echo $OUTPUT->box_end(); } else { $this->view_intro(); } $this->view_dates(); $coversheet_filename = false; $coversheet_url = false; $fs = get_file_storage(); $files = $fs->get_area_files($this->context->id, 'mod_assignment', 'coversheet', false, '', false); if (!empty($files)) { $coversheet_filename = array_shift($files); $coversheet_filename = $coversheet_filename->get_filename(); $coversheet_url = file_encode_url($CFG->wwwroot . '/pluginfile.php', '/' . $this->context->id . '/mod_assignment/coversheet/0/' . $coversheet_filename); } if (has_capability('mod/assignment:submit', $this->context)) { $submission = $this->get_submission($USER->id); $filecount = $submission ? $this->count_user_files($submission->id) : 0; $this->view_feedback(); $this->view_final_submission(); if ($this->is_finalized($submission)) { echo $OUTPUT->heading(get_string('submission', 'assignment'), 3); } else { echo $OUTPUT->heading(get_string('submissiondraft', 'assignment'), 3); if ($coversheet_filename) { echo '<p>' . get_string('coversheetnotice', 'assignment_uploadpdf') . ': '; echo '<a href="' . $coversheet_url . '" target="_blank">' . $coversheet_filename . '</a></p>'; } } if ($filecount and $submission) { echo $OUTPUT->box($this->print_user_files($USER->id, true), 'generalbox boxaligncenter', 'userfiles'); } else { if ($this->is_finalized($submission)) { echo $OUTPUT->box(get_string('nofiles', 'assignment'), 'generalbox boxaligncenter nofiles', 'userfiles'); } else { echo $OUTPUT->box(get_string('nofilesyet', 'assignment'), 'generalbox boxaligncenter nofiles', 'userfiles'); } } $this->view_upload_form(); if ($this->notes_allowed()) { echo $OUTPUT->heading(get_string('notes', 'assignment'), 3); $this->view_notes(); } } else { if ($coversheet_filename) { echo '<p>' . get_string('coversheetnotice', 'assignment_uploadpdf') . ': '; echo '<a href="' . $coversheet_url . '" target="_blank">' . $coversheet_filename . '</a></p>'; } } $this->view_footer(); }
function glossary_show_entry_entrylist($course, $cm, $glossary, $entry, $mode = '', $hook = '', $printicons = 1, $aliases = true) { global $USER, $OUTPUT; $return = false; echo '<table class="glossarypost entrylist" cellspacing="0">'; echo '<tr valign="top">'; echo '<td class="entry">'; if ($entry) { glossary_print_entry_approval($cm, $entry, $mode); $anchortagcontents = glossary_print_entry_concept($entry, true); $link = "/mod/glossary/showentry.php?courseid={$course->id}&eid={$entry->id}&displayformat=dictionary"; $action = new popup_action('click', $link . '&popup=1', 'entry', array('title' => 'entry', 'width' => 600, 'height' => 450)); $anchor = $OUTPUT->action_link($link, $anchortagcontents, $action); echo "<div class=\"concept\">{$anchor}</div> "; echo '</td><td align="right" class="entrylowersection">'; if ($printicons) { glossary_print_entry_icons($course, $cm, $glossary, $entry, $mode, $hook, 'print'); } if (!empty($entry->rating)) { echo '<br />'; echo '<span class="ratings">'; $return = glossary_print_entry_ratings($course, $entry); echo '</span>'; } echo '<br />'; } else { echo '<div style="text-align:center">'; print_string('noentry', 'glossary'); echo '</div>'; } echo '</td></tr>'; echo "</table>\n"; return $return; }
function block_exabis_eportfolio_print_extcomments($itemid) { $stredit = get_string('edit'); $strdelete = get_string('delete'); $comments = get_records("block_exabeporitemcomm", "itemid", $itemid, 'timemodified DESC'); if (!$comments) { return; } foreach ($comments as $comment) { $user = get_record('user', 'id', $comment->userid); echo '<table cellspacing="0" class="forumpost blogpost blog" width="100%">'; echo '<tr class="header"><td class="picture left">'; print_user_picture($comment->userid, SITEID, $user->picture); echo '</td>'; echo '<td class="topic starter"><div class="author">'; $fullname = fullname($user, $comment->userid); $by = new object(); $by->name = $fullname; $by->date = userdate($comment->timemodified); print_string('bynameondate', 'forum', $by); echo '</div></td></tr>'; echo '<tr><td class="left side">'; echo '</td><td class="content">' . "\n"; echo format_text($comment->entry); echo '</td></tr></table>' . "\n\n"; } }
function glossary_show_entry_entrylist($course, $cm, $glossary, $entry, $mode = '', $hook = '', $printicons = 1, $aliases = true) { global $USER, $OUTPUT; $return = false; echo '<table class="glossarypost entrylist" cellspacing="0">'; echo '<tr valign="top">'; echo '<td class="entry">'; if ($entry) { glossary_print_entry_approval($cm, $entry, $mode); $anchortagcontents = glossary_print_entry_concept($entry, true); $link = new moodle_url('/mod/glossary/showentry.php', array('courseid' => $course->id, 'eid' => $entry->id, 'displayformat' => 'dictionary')); $anchor = html_writer::link($link, $anchortagcontents); echo "<div class=\"concept\">{$anchor}</div> "; echo '</td><td align="right" class="entrylowersection">'; if ($printicons) { glossary_print_entry_icons($course, $cm, $glossary, $entry, $mode, $hook, 'print'); } if (!empty($entry->rating)) { echo '<br />'; echo '<span class="ratings">'; $return = glossary_print_entry_ratings($course, $entry); echo '</span>'; } echo '<br />'; } else { echo '<div style="text-align:center">'; print_string('noentry', 'glossary'); echo '</div>'; } echo '</td></tr>'; echo "</table>\n"; return $return; }
function glossary_show_entry_entrylist($course, $cm, $glossary, $entry, $mode = '', $hook = '', $printicons = 1, $ratings = NULL, $aliases = true) { global $USER; $return = false; echo '<table class="glossarypost entrylist" cellspacing="0">'; echo '<tr valign="top">'; echo '<td class="entry">'; if ($entry) { glossary_print_entry_approval($cm, $entry, $mode); echo "<span class=\"concept\"><a href=\"showentry.php?courseid={$course->id}&eid={$entry->id}&displayformat=dictionary\" target=\"_blank\" onClick=\"return openpopup('/mod/glossary/showentry.php?courseid={$course->id}&eid={$entry->id}&displayformat=dictionary', 'entry', 'menubar=0,location=0,scrollbars,resizable,width=600,height=450', 0);\">"; glossary_print_entry_concept($entry); echo '</a></span> '; echo '</td><td align="right" class="entrylowersection">'; if ($printicons) { glossary_print_entry_icons($course, $cm, $glossary, $entry, $mode, $hook, 'print'); } if ($ratings) { echo '<br />'; echo '<span class="ratings">'; $return = glossary_print_entry_ratings($course, $entry, $ratings); echo '</span>'; } echo '<br />'; } else { echo '<div style="text-align:center">'; print_string('noentry', 'glossary'); echo '</div>'; } echo '</td></tr>'; echo "</table>\n"; return $return; }
function glossary_show_entry_fullwithoutauthor($course, $cm, $glossary, $entry, $mode = "", $hook = "", $printicons = 1, $ratings = NULL, $aliases = true) { global $CFG, $USER; $return = false; if ($entry) { echo '<table class="glossarypost fullwithoutauthor" cellspacing="0">'; echo '<tr valign="top">'; echo '<th class="entryheader">'; echo '<div class="concept">'; glossary_print_entry_concept($entry); echo '</div>'; echo '<span class="time">(' . get_string('lastedited') . ': ' . userdate($entry->timemodified) . ')</span>'; echo '</th>'; echo '<td class="entryattachment">'; glossary_print_entry_approval($cm, $entry, $mode); glossary_print_entry_attachment($entry, $cm, 'html', 'right'); echo '</td>'; echo '</tr>'; echo '<tr valign="top">'; echo '<td width="100%" colspan="2" class="entry">'; glossary_print_entry_definition($entry, $glossary, $cm); echo '</td></tr>'; echo '<tr valign="top"><td colspan="2" class="entrylowersection">'; $return = glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, $printicons, $ratings, $aliases); echo ' '; echo '</td></tr>'; echo "</table>\n"; } else { echo '<center>'; print_string('noentry', 'glossary'); echo '</center>'; } return $return; }
function showform() { $id = required_param('id', PARAM_NUMBER); // action ?> <form name="form" method="post" action="create.php"> <center> <table cellpadding="5"> <tr valign="top"> <td align="right"><b><?php echo get_string('sudoku_create_count', 'game'); ?> :</b></td> <td> <input type="text" name="count" size="6" value="2" /><br> </td> </tr> <tr><td colspan=2><center><br><input type="submit" value="<?php print_string('sudoku_create_start', 'game'); ?> " /></td></tr> </table> <input type="hidden" name=action value="create" > <input type="hidden" name=level1 value="1" > <input type="hidden" name=level2 value="10" > <input type="hidden" name=id value="<?php echo $id; ?> " /> </form> <?php }
function glossary_show_entry_faq($course, $cm, $glossary, $entry, $mode = "", $hook = "", $printicons = 1, $aliases = true) { global $USER; if ($entry) { echo '<table class="glossarypost faq" cellspacing="0">'; echo '<tr valign="top">'; echo '<th class="entryheader">'; $entry->course = $course->id; echo '<div class="concept">' . get_string('question', 'glossary') . ': '; glossary_print_entry_concept($entry); echo '</div>'; echo '<span class="time">(' . get_string('lastedited') . ': ' . userdate($entry->timemodified) . ')</span>'; echo '</th>'; echo '<td class="entryattachment">'; glossary_print_entry_approval($cm, $entry, $mode); echo '</td>'; echo '</tr>'; echo "\n<tr>"; echo '<td colspan="2" class="entry">'; echo '<b>' . get_string('answer', 'glossary') . ':</b> '; glossary_print_entry_definition($entry, $glossary, $cm); glossary_print_entry_attachment($entry, $cm, 'html'); echo '</td></tr>'; echo '<tr valign="top"><td colspan="3" class="entrylowersection">'; glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, $printicons, $aliases); echo '</td></tr></table>'; } else { echo '<div style="text-align:center">'; print_string('noentry', 'glossary'); echo '</div>'; } }
function view() { global $USER, $OUTPUT; require_capability('mod/assignment:view', $this->context); $cansubmit = has_capability('mod/assignment:submit', $this->context); add_to_log($this->course->id, 'assignment', 'view', "view.php?id={$this->cm->id}", $this->assignment->id, $this->cm->id); $this->view_header(); if ($this->assignment->timeavailable > time() and !has_capability('mod/assignment:grade', $this->context) // grading user can see it anytime and $this->assignment->var3) { // force hiding before available date echo $OUTPUT->box_start('generalbox boxaligncenter', 'intro'); print_string('notavailableyet', 'assignment'); echo $OUTPUT->box_end(); } else { $this->view_intro(); } $this->view_dates(); if (is_enrolled($this->context, $USER)) { if ($submission = $this->get_submission($USER->id)) { $filecount = $this->count_user_files($submission->id); } else { $filecount = 0; } if ($cansubmit or !empty($filecount)) { //if a user has submitted files using a previous role we should still show the files $this->view_feedback(); if (!$this->drafts_tracked() or !$this->isopen() or $this->is_finalized($submission)) { echo $OUTPUT->heading(get_string('submission', 'assignment'), 3); } else { echo $OUTPUT->heading(get_string('submissiondraft', 'assignment'), 3); } if ($filecount and $submission) { echo $OUTPUT->box($this->print_user_files($USER->id, true), 'generalbox boxaligncenter', 'userfiles'); } else { if (!$this->isopen() or $this->is_finalized($submission)) { echo $OUTPUT->box(get_string('nofiles', 'assignment'), 'generalbox boxaligncenter nofiles', 'userfiles'); } else { echo $OUTPUT->box(get_string('nofilesyet', 'assignment'), 'generalbox boxaligncenter nofiles', 'userfiles'); } } $this->view_upload_form(); if ($this->notes_allowed()) { echo $OUTPUT->heading(get_string('notes', 'assignment'), 3); $this->view_notes(); } $this->view_final_submission(); } } $this->view_footer(); }
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(); if (trim(strip_tags($this->resource->alltext))) { echo format_text($this->resource->alltext, FORMAT_MOODLE, $formatoptions, $this->course->id); } 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; $pagetitle = strip_tags($course->shortname . ': ' . format_string($resource->name)); $inpopup = optional_param('inpopup', '', PARAM_BOOL); if ($resource->popup) { if ($inpopup) { /// Popup only add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id); print_header(); print_simple_box(format_text($resource->alltext, $resource->reference, $formatoptions, $course->id), "center", "", "", "20"); print_footer($course); } else { /// Make a page and a pop-up window print_header($pagetitle, $course->fullname, "{$this->navigation} " . format_string($resource->name), "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm)); echo "\n<script type=\"text/javascript\">"; echo "\n//<![CDATA[\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, $course->id), "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); } } else { /// not a popup at all add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id); print_header($pagetitle, $course->fullname, "{$this->navigation} " . format_string($resource->name), "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm)); 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 saml_error($err, $urltogo = false, $logfile = '') { global $CFG, $PAGE, $OUTPUT; if (!isset($CFG->debugdisplay) || !$CFG->debugdisplay) { $debug = false; } else { $debug = true; } if ($urltogo != false) { $site = get_site(); if ($site === false || !isset($site->fullname)) { $site_name = ''; } else { $site_name = $site->fullname; } $PAGE->set_title($site_name . ':Error SAML Login'); echo $OUTPUT->header(); echo '<div style="margin:20px;font-weight: bold; color: red;">'; } if (is_array($err)) { foreach ($err as $key => $messages) { if (!is_array($messages)) { if ($urltogo != false && ($debug || $key == 'course_enrollment')) { echo $messages; } $msg = 'Moodle SAML module: ' . $key . ': ' . $messages; log_saml_error($msg, $logfile); } else { foreach ($messages as $message) { if ($urltogo != false && ($debug || $key == 'course_enrollment')) { echo $message . '<br>'; } $msg = 'Moodle SAML module: ' . $key . ': ' . $message; log_saml_error($msg, $logfile); } } echo '<br>'; } } else { if ($urltogo != false) { echo $err; } $msg = 'Moodle SAML module: login: '******'</div>'; $OUTPUT->continue_button($urltogo); if ($debug) { print_string("auth_saml_disable_debugdisplay", "auth_saml"); } $OUTPUT->footer(); exit; } }
function glossary_show_entry_encyclopedia($course, $cm, $glossary, $entry, $mode = '', $hook = '', $printicons = 1, $ratings = NULL, $aliases = true) { global $CFG, $USER, $DB; $user = $DB->get_record('user', array('id' => $entry->userid)); $strby = get_string('writtenby', 'glossary'); $return = false; if ($entry) { echo '<table class="glossarypost encyclopedia" cellspacing="0">'; echo '<tr valign="top">'; echo '<td class="left picture">'; print_user_picture($user, $course->id, $user->picture); echo '</td>'; echo '<th class="entryheader">'; echo '<div class="concept">'; glossary_print_entry_concept($entry); echo '</div>'; $fullname = fullname($user); $by = new object(); $by->name = '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $user->id . '&course=' . $course->id . '">' . $fullname . '</a>'; $by->date = userdate($entry->timemodified); echo '<span class="author">' . get_string('bynameondate', 'forum', $by) . '</span>'; echo '</th>'; echo '<td class="entryapproval">'; glossary_print_entry_approval($cm, $entry, $mode); echo '</td>'; echo '</tr>'; echo '<tr valign="top">'; echo '<td class="left side" rowspan="2"> </td>'; echo '<td colspan="2" class="entry">'; if ($entry->attachment) { $entry->course = $course->id; if (strlen($entry->definition) % 2) { $align = 'right'; } else { $align = 'left'; } glossary_print_entry_attachment($entry, $cm, null, $align, false); } glossary_print_entry_definition($entry, $glossary, $cm); if ($printicons or $ratings or $aliases) { echo '</td></tr>'; echo '<tr>'; echo '<td colspan="2" class="entrylowersection">'; $return = glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, $printicons, $ratings, $aliases); echo ' '; } echo '</td></tr>'; echo "</table>\n"; } else { echo '<div style="text-align:center">'; print_string('noentry', 'glossary'); echo '</div>'; } return $return; }
function brainstorm_user_complete($course, $user, $mod, $brainstorm) { if ($responses = brainstorm_get_responses($brainstorm->id, $user->id, 0, false)) { $responses_values = array_values($responses); /// printing last entered response for that user $result->info = '"' . $responses_values[count($responses_values) - 1]->response . '"'; $result->time = $responses_values[count($responses_values) - 1]->timemodified; echo get_string('responded', 'brainstorm') . ": {$result->info} , last updated " . userdate($result->time); } else { print_string('notresponded', 'brainstorm'); } }
function lightboxgallery_user_complete($course, $user, $mod, $resource) { if ($logs = get_records_select('log', "userid='{$user->id}' AND module='lightboxgallery' AND action='view' AND info='{$resource->id}'", 'time ASC')) { $numviews = count($logs); $lastlog = array_pop($logs); $strmostrecently = get_string('mostrecently'); $strnumviews = get_string('numviews', '', $numviews); echo $strnumviews . ' - ' . $strmostrecently . ' ' . userdate($lastlog->time); } else { print_string('neverseen', 'resource'); } }
/** * @global object * @param object $course * @param object $user * @param object $mod * @param object $choice * @return string|void */ function choice_user_complete($course, $user, $mod, $choice) { global $DB; if ($answer = $DB->get_record('choice_answers', array("choiceid" => $choice->id, "userid" => $user->id))) { $result = new stdClass(); $result->info = "'" . format_string(choice_get_option_text($choice, $answer->optionid)) . "'"; $result->time = $answer->timemodified; echo get_string("answered", "choice") . ": {$result->info}. " . get_string("updated", '', userdate($result->time)); } else { print_string("notanswered", "choice"); } }
function show_edit_radio($item, $usehtmleditor = false) { $item->presentation = empty($item->presentation) ? '' : $item->presentation; ?> <table> <tr> <th colspan="2"><?php print_string('radiobutton', 'feedback'); ?> (<input type="checkbox" name="required" value="1" <?php $item->required = isset($item->required) ? $item->required : 0; echo $item->required == 1 ? 'checked="checked"' : ''; ?> /> <?php print_string('required', 'feedback'); ?> ) </th> </tr> <tr> <td><?php print_string('item_name', 'feedback'); ?> </td> <td><input type="text" id="itemname" name="itemname" size="40" maxlength="255" value="<?php echo isset($item->name) ? stripslashes_safe($item->name) : ''; ?> " /></td> </tr> <tr> <td> <?php print_string('radio_values', 'feedback'); ?> <?php print_string('use_one_line_for_each_value', 'feedback'); ?> </td> <td> <?php $itemvalues = str_replace('|', "\n", stripslashes_safe($item->presentation)); ?> <textarea name="itemvalues" cols="30" rows="5"><?php echo $itemvalues; ?> </textarea> </td> </tr> </table> <?php }
/** * Displays the assignment content - this method overrides * the parent class, adding a repository availability check */ function view() { global $USER; require_capability('mod/assignment:view', $this->context); //start of RL base-class modification $repo = $this->get_repository_object(); if (!$repo) { //configuration is not complete $message = get_string('errorrepository', 'assignment_backpack'); //wrap the error with further instructions print_error('errorrepositoryview', 'assignment_backpack', '', $message); } //end of RL base-class modification add_to_log($this->course->id, 'assignment', 'view', "view.php?id={$this->cm->id}", $this->assignment->id, $this->cm->id); $this->view_header(); if ($this->assignment->timeavailable > time() and !has_capability('mod/assignment:grade', $this->context) and $this->assignment->var3) { // force hiding before available date print_simple_box_start('center', '', '', 0, 'generalbox', 'intro'); print_string('notavailableyet', 'assignment'); print_simple_box_end(); } else { $this->view_intro(); } $this->view_dates(); $filecount = $this->count_user_files($USER->id); $submission = $this->get_submission($USER->id); $this->view_feedback(); if (!$this->drafts_tracked() or !$this->isopen() or $this->is_finalized($submission)) { print_heading(get_string('submission', 'assignment'), '', 3); } else { print_heading(get_string('submissiondraft', 'assignment'), '', 3); } if ($filecount and $submission) { print_simple_box($this->print_user_files($USER->id, true), 'center'); } else { if (!$this->isopen() or $this->is_finalized($submission)) { print_simple_box(get_string('nofiles', 'assignment'), 'center'); } else { print_simple_box(get_string('nofilesyet', 'assignment'), 'center'); } } if (has_capability('mod/assignment:submit', $this->context)) { $this->view_upload_form(); } if ($this->notes_allowed()) { print_heading(get_string('notes', 'assignment'), '', 3); $this->view_notes(); } $this->view_final_submission(); $this->view_footer(); }
/** * Callback for the "Complete" report - prints the activity summary for the given user * * @param object $course * @param object $user * @param object $mod * @param object $choice */ function choice_user_complete($course, $user, $mod, $choice) { global $DB; if ($answers = $DB->get_records('choice_answers', array("choiceid" => $choice->id, "userid" => $user->id))) { $info = []; foreach ($answers as $answer) { $info[] = "'" . format_string(choice_get_option_text($choice, $answer->optionid)) . "'"; } core_collator::asort($info); echo get_string("answered", "choice") . ": " . join(', ', $info) . ". " . get_string("updated", '', userdate($answer->timemodified)); } else { print_string("notanswered", "choice"); } }
function glossary_show_entry_fullwithauthor($course, $cm, $glossary, $entry, $mode = "", $hook = "", $printicons = 1, $ratings = NULL, $aliases = true) { global $CFG, $USER; $user = get_record('user', 'id', $entry->userid); $strby = get_string('writtenby', 'glossary'); $return = false; if ($entry) { echo '<table class="glossarypost fullwithauthor" cellspacing="0">'; echo '<tr valign="top">'; echo '<td class="picture">'; print_user_picture($user->id, $course->id, $user->picture); echo '</td>'; echo '<th class="entryheader">'; echo '<div class="concept">'; glossary_print_entry_concept($entry); echo '</div>'; $fullname = fullname($user); $by = new object(); $by->name = '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $user->id . '&course=' . $course->id . '">' . $fullname . '</a>'; $by->date = userdate($entry->timemodified); echo '<span class="author">' . get_string('bynameondate', 'forum', $by) . '</span>'; echo '</th>'; echo '<td class="entryattachment">'; glossary_print_entry_approval($cm, $entry, $mode); glossary_print_entry_attachment($entry, 'html', 'right'); echo '</td>'; echo '</tr>'; echo '<tr valign="top">'; echo '<td class="left"> </td>'; echo '<td colspan="2" class="entry">'; glossary_print_entry_definition($entry); echo '</td></tr>'; echo '<tr valign="top">'; echo '<td class="left"> </td>'; echo '<td colspan="2" class="entrylowersection">'; $return = glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, $printicons, $ratings, $aliases); echo ' '; echo '</td></tr>'; echo "</table>\n"; } else { echo '<div style="text-align:center">'; print_string('noentry', 'glossary'); echo '</div>'; } return $return; }
/** * List the certificates available to be printed. * @return unknown_type */ function action_default() { global $CFG, $USER, $CURMAN; // This is for a Moodle user, so get the Curriculum user id. $cuserid = cm_get_crlmuserid($USER->id); $curasses = curriculumstudent::get_completed_for_user($cuserid); if (count($curasses) == 0) { print_string('certificates_none_earned', 'block_curr_admin'); return; } print_string('certificates_earned', 'block_curr_admin'); echo "<UL>\n"; foreach ($curasses as $curass) { echo "<LI><a href=\"certificate.php?id={$curass->id}\">{$curass->curriculum->name}</a>\n"; } echo "</UL>\n"; }
/** * @param $course * @param $cm * @param $forum * @param context_module $context * @author Mark Nielsen */ public function view($course, $cm, $forum, context_module $context) { global $USER, $DB, $OUTPUT; require_once __DIR__ . '/lib/discussion/sort.php'; $config = get_config('hsuforum'); $mode = optional_param('mode', 0, PARAM_INT); // Display mode (for single forum) $page = optional_param('page', 0, PARAM_INT); // which page to show $forumicon = "<img src='" . $OUTPUT->pix_url('icon', 'hsuforum') . "' alt='' class='iconlarge activityicon'/> "; echo '<div id="hsuforum-header"><h2>' . $forumicon . format_string($forum->name) . '</h2>'; if (!empty($forum->intro)) { echo '<div class="hsuforum_introduction">' . format_module_intro('hsuforum', $forum, $cm->id) . '</div>'; } echo "</div>"; // Update activity group mode changes here. groups_get_activity_group($cm, true); $dsort = hsuforum_lib_discussion_sort::get_from_session($forum, $context); $dsort->set_key(optional_param('dsortkey', $dsort->get_key(), PARAM_ALPHA)); hsuforum_lib_discussion_sort::set_to_session($dsort); if (!empty($forum->blockafter) && !empty($forum->blockperiod)) { $a = new stdClass(); $a->blockafter = $forum->blockafter; $a->blockperiod = get_string('secondstotime' . $forum->blockperiod); echo $OUTPUT->notification(get_string('thisforumisthrottled', 'hsuforum', $a)); } if ($forum->type == 'qanda' && !has_capability('moodle/course:manageactivities', $context)) { echo $OUTPUT->notification(get_string('qandanotify', 'hsuforum')); } switch ($forum->type) { case 'eachuser': if (hsuforum_user_can_post_discussion($forum, null, -1, $cm)) { echo '<p class="mdl-align">'; print_string("allowsdiscussions", "hsuforum"); echo '</p>'; } // Fall through to following cases. // Fall through to following cases. case 'blog': default: hsuforum_print_latest_discussions($course, $forum, -1, $dsort->get_sort_sql(), -1, -1, $page, $config->manydiscussions, $cm); break; } }
function view() { global $USER; require_capability('mod/assignment:view', $this->context); add_to_log($this->course->id, 'assignment', 'view', "view.php?id={$this->cm->id}", $this->assignment->id, $this->cm->id); $this->view_header(); if ($this->assignment->timeavailable > time() and !has_capability('mod/assignment:grade', $this->context) and $this->assignment->var3) { // force hiding before available date print_simple_box_start('center', '', '', 0, 'generalbox', 'intro'); print_string('notavailableyet', 'assignment'); print_simple_box_end(); } else { $this->view_intro(); } $this->view_dates(); if (has_capability('mod/assignment:submit', $this->context)) { $filecount = $this->count_user_files($USER->id); $submission = $this->get_submission($USER->id); $this->view_feedback(); if (!$this->drafts_tracked() or !$this->isopen() or $this->is_finalized($submission)) { print_heading(get_string('submission', 'assignment'), '', 3); } else { print_heading(get_string('submissiondraft', 'assignment'), '', 3); } if ($filecount and $submission) { print_simple_box($this->print_user_files($USER->id, true), 'center'); } else { if (!$this->isopen() or $this->is_finalized($submission)) { print_simple_box(get_string('nofiles', 'assignment'), 'center'); } else { print_simple_box(get_string('nofilesyet', 'assignment'), 'center'); } } $this->view_upload_form(); if ($this->notes_allowed()) { print_heading(get_string('notes', 'assignment'), '', 3); $this->view_notes(); } $this->view_final_submission(); } $this->view_footer(); }
function lightboxgallery_user_complete($course, $user, $mod, $resource) { global $CFG; if ($logs = get_records_select('log', "userid='{$user->id}' AND module='lightboxgallery' AND action='view' AND info='{$resource->id}'", 'time ASC')) { $numviews = count($logs); $lastlog = array_pop($logs); $strnumviews = get_string('numviews', '', $numviews); $strmostrecently = get_string('mostrecently'); echo "{$strnumviews} - {$strmostrecently} " . userdate($lastlog->time); $sql = "SELECT c.*\n FROM {$CFG->prefix}lightboxgallery_comments c\n JOIN {$CFG->prefix}lightboxgallery l ON l.id = c.gallery\n JOIN {$CFG->prefix}user u ON u.id = c.userid\n WHERE l.id = {$mod->instance} AND u.id = {$user->id}\n ORDER BY c.timemodified ASC"; if ($comments = get_records_sql($sql)) { $cm = get_coursemodule_from_id('lightboxgallery', $mod->id); $context = get_context_instance(CONTEXT_MODULE, $cm->id); foreach ($comments as $comment) { lightboxgallery_print_comment($comment, $context); } } } else { print_string('neverseen', 'resource'); } }
function show_edit_label($item, $usehtmleditor = false) { $item->presentation = isset($item->presentation) ? $item->presentation : ''; ?> <table style="display:inline"> <tr><th><?php print_string('label', 'feedback'); ?> </th></tr> <tr> <td> <?php print_textarea($usehtmleditor, 20, 60, 680, 400, "presentation", $item->presentation); ?> <input type="hidden" id="itemname" name="itemname" value="label" /> </td> </tr> </table> <div style="clear:both"></div> <?php if ($usehtmleditor) { use_html_editor(); } }
if ($section == 0) { $frontpage = true; } else { $frontpage = false; } if (!$frontpage) { netpublish_print_sections($cm->id, $cm->instance); } else { echo ""; } echo "<table border=\"0\" cellpadding=\"6\" cellspacing=\"3\" width=\"100%\" >"; echo "<tr>"; if ($frontpage) { echo "<td width=\"200\" valign=\"top\" style=\"background-color: white; -moz-border-radius: 8px;\">"; echo '<p><strong>' . print_string("sections", "netpublish") . '</strong></p>'; netpublish_print_sections($cm->id, $cm->instance); echo "</td>"; } else { echo ""; } // <td width="*" valign="top" style="background-color: white; -moz-border-radius: 8px;"> // <td width="*" valign="top" style="background-image: url(http://www.tikshuv.org.il/moodle/file.php/141/paper-01.jpg); -moz-border-radius: 8px;"> echo "<td width=\"*\" valign=\"top\" style=\"background-image: url(" . $magtheme['articlesbackgroundimage'] . "); -moz-border-radius: 8px;\">"; if (!empty($strnoarticles) and !$frontpage) { echo $strnoarticles; } else { if (empty($article) and !$frontpage) { // Edit buttons netpublish_print_actionbuttons($cm, $articles[key($articles)], $USER->id, $course->id, true); echo "<h2>" . stripslashes($articles[key($articles)]->title) . "</h2>\n";
error("Could not find the first post in this forum"); } if ($mode) { set_user_preference("forum_displaymode", $mode); } $displaymode = get_user_preferences("forum_displaymode", $CFG->forum_displaymode); $canrate = has_capability('mod/forum:rate', $context); forum_print_discussion($course, $forum, $discussion, $post, $displaymode, NULL, $canrate); break; case 'eachuser': if (!empty($forum->intro)) { print_box(format_text($forum->intro), 'generalbox', 'intro'); } echo '<p align="center">'; if (forum_user_can_post_discussion($forum)) { print_string("allowsdiscussions", "forum"); } else { echo ' '; } echo '</p>'; if (!empty($showall)) { forum_print_latest_discussions($course, $forum, 0, 'header', '', $currentgroup, $groupmode); } else { forum_print_latest_discussions($course, $forum, $CFG->forum_manydiscussions, 'header', '', $currentgroup, $groupmode, $page); } break; case 'teacher': if (!empty($showall)) { forum_print_latest_discussions($course, $forum, 0, 'header', '', $currentgroup, $groupmode); } else { forum_print_latest_discussions($course, $forum, $CFG->forum_manydiscussions, 'header', '', $currentgroup, $groupmode, $page);
<p><label for="removeselect"><?php print_string('currentusers', 'cohort'); ?></label></p> <input type="button" id="select_remove_all" name="select_remove_all" value="Select all"> <input type="button" id="select_remove_none" name="select_remove_none" value="Select none"> <?php $existinguserselector->display() ?> </td> <td width="20%" id="buttonscell"> <div id="addcontrols"> <input name="add" id="add" type="submit" value="<?php echo $OUTPUT->larrow().' '.s(get_string('add')); ?>" title="<?php p(get_string('add')); ?>" /><br /> </div> <div id="removecontrols"> <input name="remove" id="remove" type="submit" value="<?php echo s(get_string('remove')).' '.$OUTPUT->rarrow(); ?>" title="<?php p(get_string('remove')); ?>" /> </div> </td> <td width="40%" id="potentialcell"> <p><label for="addselect"><?php print_string('potusers', 'cohort'); ?></label></p> <input type="button" id="select_add_all" name="select_add_all" value="Select all"> <input type="button" id="select_add_none" name="select_add_none" value="Select none"> <?php $potentialuserselector->display() ?> </td> </tr> <tr><td colspan="3" id='backcell'> <input type="submit" name="cancel" value="<?php p(get_string('backtobatches', 'local_batches')); ?>" /> </td></tr> </table> </div></form> <?php echo $OUTPUT->footer(); ?>
/** * Render the View of the Presenter. * Called from with the {@link render()} function when necessary. */ function render_view() { //display any feedback if (!empty($this->feedback)) { echo $this->feedback; } // Get a list of entry slides in this presenter $entries = $this->presenter->get_slides(); if (!is_array($entries)) { $entries = array(); } $numentries = count($entries); // Open the presentation box //print_box_start('generalbox boxaligncenter boxwidthwide'); // Was a specific entry requested? This is the number of entry within the presentation, NOT entry ID. // They start at 1 and go up from there within each presentation. if (isset($_REQUEST['sloodledisplayentry'])) { $displayentrynum = (int) $_REQUEST['sloodledisplayentry']; if ($displayentrynum < 1 || $displayentrynum > $numentries) { $displayentrynum = 1; } } else { $displayentrynum = 1; } // Do we have any entries to work with? if ($numentries > 0) { // Yes - go through them to figure out which entry to display $currententry = null; foreach ($entries as $entryid => $entry) { // Check if this is our current entry if ($displayentrynum == $entry->slideposition) { $currententry = $entry; } } // Display the entry header echo "<div style=\"text-align:center;\">"; echo "<h2 id=\"slide\">\"<a href=\"{$currententry->source}\" title=\"" . get_string('directlink', 'sloodle') . "\">{$currententry->name}</a>\"</h2>\n"; // Display the presentation controls $strof = get_string('of', 'sloodle'); $strviewprev = get_string('viewprev', 'sloodle'); $strviewnext = get_string('viewnext', 'sloodle'); $strviewjumpforward = get_string('jumpforward', 'sloodle'); $strviewjumpback = get_string('jumpback', 'sloodle'); echo '<p style="font-size:200%; font-weight:bold;">'; // if ($displayentrynum > 1) echo "<a href=\"?id={$this->cm->id}&sloodledisplayentry=",$displayentrynum - 1,"#slide\" title=\"{$strviewprev}\">←</a>"; // else echo "<span style=\"color:#bbbbbb;\">←</span>"; // echo " {$displayentrynum} {$strof} {$numentries} "; // if ($displayentrynum < $numentries) echo "<a href=\"?id={$this->cm->id}&sloodledisplayentry=",$displayentrynum + 1,"#slide\" title=\"{$strviewnext}\">→</a>"; //else echo "<span style=\"color:#bbbbbb;\">→</span>"; echo "</p>\n"; $entrynumcounter = 1; $jumpNumber = 5; //display >> $arrowLinks = new stdClass(); $arrowLinks->class = 'texrender'; $arrowLinks->size = array('40px', '40px', '40px', '40px'); $arrowLinks->cellpadding = '1'; $arrowLinks->width = '500px'; $slideLinks = new stdClass(); $slideLinks->class = 'texrender'; $slideLinks->size = array('20px', '20px', '20px', '20px', '20px', '20px', '20px'); $slideLinks->cellpadding = '1'; $row = array(); $arow = array(); $start = $displayentrynum - $jumpNumber - 1; if ($start >= 0) { $arow[] = "<a href=\"?id={$this->cm->id}&sloodledisplayentry={$start}#slide\" title=\"{$strviewjumpback} " . $jumpNumber . " slides\"><img style=\"vertical-align:middle;\" alt=\"{$strviewjumpback} " . $jumpNumber . " slides\" src=\"" . SLOODLE_WWWROOT . "/lib/media/bluecons_rewind.gif\" width=\"50\" height=\"50\"></a>"; } else { $arow[] = "<img style=\"vertical-align:middle;\" alt=\"{$strviewjumpback} " . $jumpNumber . " slides\" src=\"" . SLOODLE_WWWROOT . "/lib/media/bluecons_rewind.gif\" width=\"50\" height=\"50\">"; } $prev = $displayentrynum - 1; if ($displayentrynum >= 2) { $arow[] = "<a href=\"?id={$this->cm->id}&sloodledisplayentry={$prev}#slide\" title=\"{$strviewprev}\"><img alt=\"{$strviewprev}\" style=\"vertical-align:middle;\" src=\"" . SLOODLE_WWWROOT . "/lib/media/bluecons_prev.gif\" width=\"40\" height=\"40\"></a> "; } else { $arow[] = "<img alt=\"{$strviewprev}\" style=\"vertical-align:middle;\" src=\"" . SLOODLE_WWWROOT . "/lib/media/bluecons_prev.gif\" width=\"40\" height=\"40\">"; } // display hyperlinks for each slide $row = "<table width='400px'><tr>"; foreach ($entries as $entryid => $entry) { //get start and end slides $start = $displayentrynum - $jumpNumber; if ($start < 0) { $start = 0; } $end = $displayentrynum + $jumpNumber; if ($end > $numentries) { $end = $numentries; } if ($entrynumcounter >= $start && $entrynumcounter <= $end) { if ($entrynumcounter == $displayentrynum) { $row .= "<td style=\"font-weight:bold; font-size:larger;\">" . "<a href=\"?id={$this->cm->id}&sloodledisplayentry=" . $entrynumcounter . "#slide\" title=\"{$entry->name}\">{$entrynumcounter}</a></td>"; } else { $row .= "<td><a href=\"?id={$this->cm->id}&sloodledisplayentry=" . $entrynumcounter . "#slide\" title=\"{$entry->name}\">{$entrynumcounter}</td>"; } } $entrynumcounter++; } $row .= "</tr></table>"; $arow[] = $row; $end = $displayentrynum + $jumpNumber + 1; $next = $displayentrynum + 1; if ($displayentrynum + 1 <= $numentries) { $arow[] = "<a href=\"?id={$this->cm->id}&sloodledisplayentry={$next}#slide\" title=\"{$strviewnext}\"><img alt=\"{$strviewnext}\" style=\"vertical-align:middle;\" src=\"" . SLOODLE_WWWROOT . "/lib/media/bluecons_next.gif\" width=\"40\" height=\"40\"></a> "; } else { $arow[] = "<img alt=\"{$strviewnext}\" style=\"vertical-align:middle;\" src=\"" . SLOODLE_WWWROOT . "/lib/media/greycons_next.gif\" width=\"40\" height=\"40\">"; } if ($end <= $numentries) { $arow[] = "<a href=\"?id={$this->cm->id}&sloodledisplayentry=" . $end . "#slide\" title=\"{$strviewjumpforward} " . $jumpNumber . " slides\"><img alt=\"{$strviewjumpforward} " . $jumpNumber . "\" style=\"vertical-align:middle;\" src=\"" . SLOODLE_WWWROOT . "/lib/media/bluecons_fastforward.gif\" width=\"50\" height=\"50\"></a> "; } else { $arow[] = "<img alt=\"{$strviewjumpforward} " . $jumpNumber . "\" style=\"vertical-align:middle;\" src=\"" . SLOODLE_WWWROOT . "/lib/media/greycons_fastforward.gif\" width=\"50\" height=\"50\">"; } //$slideLinks->data[]=$row; $arrowLinks->data[] = $arow; print_table($arrowLinks); echo "<br><br>"; // Get the frame dimensions for this Presenter $framewidth = $this->presenter->get_frame_width(); $frameheight = $this->presenter->get_frame_height(); // Get the plugin for this slide $slideplugin = $this->_session->plugins->get_plugin('presenter-slide', $currententry->type); if (is_object($slideplugin)) { // Render the content for the web echo $slideplugin->render_slide_for_browser($currententry); } else { echo '<p style="font-size:150%; font-weight:bold; color:#880000;">', get_string('unknowntype', 'sloodle'), ': presenter-slide::', $currententry->type, '</p>'; } // Display a direct link to the media echo "<p>"; print_string('trydirectlink', 'sloodle', $currententry->source); echo "</p>\n"; echo "</div>"; } else { echo '<h4>' . get_string('presenter:empty', 'sloodle') . '</h4>'; if ($this->canedit) { echo '<p>' . get_string('presenter:clickaddslide', 'sloodle') . '</p>'; } } }
function print_log_selector_form($course, $selecteduser = 0, $selecteddate = 'today', $modname = "", $modid = 0, $modaction = '', $selectedgroup = -1, $showcourses = 0, $showusers = 0, $logformat = 'showashtml') { global $USER, $CFG; // first check to see if we can override showcourses and showusers $numcourses = count_records_select("course", "", "COUNT(id)"); if ($numcourses < COURSE_MAX_COURSES_PER_DROPDOWN && !$showcourses) { $showcourses = 1; } $sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID); $context = get_context_instance(CONTEXT_COURSE, $course->id); /// Setup for group handling. if ($course->groupmode == SEPARATEGROUPS and !has_capability('moodle/site:accessallgroups', $context)) { $selectedgroup = get_current_group($course->id); $showgroups = false; } else { if ($course->groupmode) { $selectedgroup = $selectedgroup == -1 ? get_current_group($course->id) : $selectedgroup; $showgroups = true; } else { $selectedgroup = 0; $showgroups = false; } } // Get all the possible users $users = array(); if ($course->id != SITEID) { if ($selectedgroup) { // If using a group, only get users in that group. $courseusers = get_group_users($selectedgroup, 'u.lastname ASC', '', 'u.id, u.firstname, u.lastname, u.idnumber'); } else { $courseusers = get_course_users($course->id, '', '', 'u.id, u.firstname, u.lastname, u.idnumber'); } } else { $courseusers = get_site_users("u.lastaccess DESC", "u.id, u.firstname, u.lastname, u.idnumber"); } if (count($courseusers) < COURSE_MAX_USERS_PER_DROPDOWN && !$showusers) { $showusers = 1; } if ($showusers) { if ($courseusers) { foreach ($courseusers as $courseuser) { $users[$courseuser->id] = fullname($courseuser, has_capability('moodle/site:viewfullnames', $context)); } } if ($guest = get_guest()) { $users[$guest->id] = fullname($guest); } } if (has_capability('moodle/site:viewreports', $sitecontext) && $showcourses) { if ($ccc = get_records("course", "", "", "fullname", "id,fullname,category")) { foreach ($ccc as $cc) { if ($cc->category) { $courses["{$cc->id}"] = format_string($cc->fullname); } else { $courses["{$cc->id}"] = format_string($cc->fullname) . ' (Site)'; } } } asort($courses); } $activities = array(); $selectedactivity = ""; /// Casting $course->modinfo to string prevents one notice when the field is null if ($modinfo = unserialize((string) $course->modinfo)) { $section = 0; if ($course->format == 'weeks') { // Bodgy $strsection = get_string("week"); } else { $strsection = get_string("topic"); } foreach ($modinfo as $mod) { if ($mod->mod == "label") { continue; } if ($mod->section > 0 and $section != $mod->section) { $activities["section/{$mod->section}"] = "-------------- {$strsection} {$mod->section} --------------"; } $section = $mod->section; $mod->name = strip_tags(format_string(urldecode($mod->name), true)); if (strlen($mod->name) > 55) { $mod->name = substr($mod->name, 0, 50) . "..."; } if (!$mod->visible) { $mod->name = "(" . $mod->name . ")"; } $activities["{$mod->cm}"] = $mod->name; if ($mod->cm == $modid) { $selectedactivity = "{$mod->cm}"; } } } if (has_capability('moodle/site:viewreports', $sitecontext) && $course->id == SITEID) { $activities["site_errors"] = get_string("siteerrors"); if ($modid === "site_errors") { $selectedactivity = "site_errors"; } } $strftimedate = get_string("strftimedate"); $strftimedaydate = get_string("strftimedaydate"); asort($users); // Prepare the list of action options. $actions = array('view' => get_string('view'), 'add' => get_string('add'), 'update' => get_string('update'), 'delete' => get_string('delete'), '-view' => get_string('allchanges')); // Get all the possible dates // Note that we are keeping track of real (GMT) time and user time // User time is only used in displays - all calcs and passing is GMT $timenow = time(); // GMT // What day is it now for the user, and when is midnight that day (in GMT). $timemidnight = $today = usergetmidnight($timenow); // Put today up the top of the list $dates = array("{$timemidnight}" => get_string("today") . ", " . userdate($timenow, $strftimedate)); if (!$course->startdate or $course->startdate > $timenow) { $course->startdate = $course->timecreated; } $numdates = 1; while ($timemidnight > $course->startdate and $numdates < 365) { $timemidnight = $timemidnight - 86400; $timenow = $timenow - 86400; $dates["{$timemidnight}"] = userdate($timenow, $strftimedaydate); $numdates++; } if ($selecteddate == "today") { $selecteddate = $today; } echo "<form class=\"logselectform\" action=\"{$CFG->wwwroot}/course/report/log/index.php\" method=\"get\">\n"; echo "<div>\n"; echo "<input type=\"hidden\" name=\"chooselog\" value=\"1\" />\n"; echo "<input type=\"hidden\" name=\"showusers\" value=\"{$showusers}\" />\n"; echo "<input type=\"hidden\" name=\"showcourses\" value=\"{$showcourses}\" />\n"; if (has_capability('moodle/site:viewreports', $sitecontext) && $showcourses) { choose_from_menu($courses, "id", $course->id, ""); } else { // echo '<input type="hidden" name="id" value="'.$course->id.'" />'; $courses = array(); $courses[$course->id] = $course->fullname . ($course->id == SITEID ? ' (' . get_string('site') . ') ' : ''); choose_from_menu($courses, "id", $course->id, false); if (has_capability('moodle/site:viewreports', $sitecontext)) { $a = new object(); $a->url = "{$CFG->wwwroot}/course/report/log/index.php?chooselog=0&group={$selectedgroup}&user={$selecteduser}" . "&id={$course->id}&date={$selecteddate}&modid={$selectedactivity}&showcourses=1&showusers={$showusers}"; print_string('logtoomanycourses', 'moodle', $a); } } if ($showgroups) { if ($cgroups = groups_get_all_groups($course->id)) { foreach ($cgroups as $cgroup) { $groups[$cgroup->id] = $cgroup->name; } } else { $groups = array(); } choose_from_menu($groups, "group", $selectedgroup, get_string("allgroups")); } if ($showusers) { choose_from_menu($users, "user", $selecteduser, get_string("allparticipants")); } else { $users = array(); if (!empty($selecteduser)) { $user = get_record('user', 'id', $selecteduser); $users[$selecteduser] = fullname($user); } else { $users[0] = get_string('allparticipants'); } choose_from_menu($users, 'user', $selecteduser, false); $a = new object(); $a->url = "{$CFG->wwwroot}/course/report/log/index.php?chooselog=0&group={$selectedgroup}&user={$selecteduser}" . "&id={$course->id}&date={$selecteddate}&modid={$selectedactivity}&showusers=1&showcourses={$showcourses}"; print_string('logtoomanyusers', 'moodle', $a); } choose_from_menu($dates, "date", $selecteddate, get_string("alldays")); choose_from_menu($activities, "modid", $selectedactivity, get_string("allactivities"), "", ""); choose_from_menu($actions, 'modaction', $modaction, get_string("allactions")); $logformats = array('showashtml' => get_string('displayonpage'), 'downloadascsv' => get_string('downloadtext'), 'downloadasods' => get_string('downloadods'), 'downloadasexcel' => get_string('downloadexcel')); choose_from_menu($logformats, 'logformat', $logformat, false); echo '<input type="submit" value="' . get_string('gettheselogs') . '" />'; echo '</div>'; echo '</form>'; }
function scorm_view_display($user, $scorm, $action, $cm) { global $CFG, $DB, $PAGE, $OUTPUT, $COURSE; if ($scorm->scormtype != SCORM_TYPE_LOCAL && $scorm->updatefreq == SCORM_UPDATE_EVERYTIME) { scorm_parse($scorm, false); } $organization = optional_param('organization', '', PARAM_INT); if ($scorm->displaycoursestructure == 1) { echo $OUTPUT->box_start('generalbox boxaligncenter toc'); ?> <div class="structurehead"><?php print_string('contents', 'scorm'); ?> </div> <?php } if (empty($organization)) { $organization = $scorm->launch; } if ($orgs = $DB->get_records_select_menu('scorm_scoes', 'scorm = ? AND ' . $DB->sql_isempty('scorm_scoes', 'launch', false, true) . ' AND ' . $DB->sql_isempty('scorm_scoes', 'organization', false, false), array($scorm->id), 'sortorder, id', 'id,title')) { if (count($orgs) > 1) { $select = new single_select(new moodle_url($action), 'organization', $orgs, $organization, null); $select->label = get_string('organizations', 'scorm'); $select->class = 'scorm-center'; echo $OUTPUT->render($select); } } $orgidentifier = ''; if ($sco = scorm_get_sco($organization, SCO_ONLY)) { if ($sco->organization == '' && $sco->launch == '') { $orgidentifier = $sco->identifier; } else { $orgidentifier = $sco->organization; } } $scorm->version = strtolower(clean_param($scorm->version, PARAM_SAFEDIR)); // Just to be safe if (!file_exists($CFG->dirroot . '/mod/scorm/datamodels/' . $scorm->version . 'lib.php')) { $scorm->version = 'scorm_12'; } require_once $CFG->dirroot . '/mod/scorm/datamodels/' . $scorm->version . 'lib.php'; $result = scorm_get_toc($user, $scorm, $cm->id, TOCFULLURL, $orgidentifier); $incomplete = $result->incomplete; // do we want the TOC to be displayed? if ($scorm->displaycoursestructure == 1) { echo $result->toc; echo $OUTPUT->box_end(); } // is this the first attempt ? $attemptcount = scorm_get_attempt_count($user->id, $scorm); // do not give the player launch FORM if the SCORM object is locked after the final attempt if ($scorm->lastattemptlock == 0 || $result->attemptleft > 0) { ?> <div class="scorm-center"> <form id="scormviewform" method="post" action="<?php echo $CFG->wwwroot; ?> /mod/scorm/player.php"> <?php if ($scorm->hidebrowse == 0) { print_string('mode', 'scorm'); echo ': <input type="radio" id="b" name="mode" value="browse" /><label for="b">' . get_string('browse', 'scorm') . '</label>' . "\n"; echo '<input type="radio" id="n" name="mode" value="normal" checked="checked" /><label for="n">' . get_string('normal', 'scorm') . "</label>\n"; } else { echo '<input type="hidden" name="mode" value="normal" />' . "\n"; } if ($scorm->forcenewattempt == 1) { if ($incomplete === false) { echo '<input type="hidden" name="newattempt" value="on" />' . "\n"; } } else { if (!empty($attemptcount) && $incomplete === false && ($result->attemptleft > 0 || $scorm->maxattempt == 0)) { ?> <br /> <input type="checkbox" id="a" name="newattempt" /> <label for="a"><?php print_string('newattempt', 'scorm'); ?> </label> <?php } } if (!empty($scorm->popup)) { echo '<input type="hidden" name="display" value="popup" />' . "\n"; } ?> <br /> <input type="hidden" name="scoid"/> <input type="hidden" name="cm" value="<?php echo $cm->id; ?> "/> <input type="hidden" name="currentorg" value="<?php echo $orgidentifier; ?> " /> <input type="submit" value="<?php print_string('enter', 'scorm'); ?> " /> </form> </div> <?php } }