/** * Content generation method of block; list of page links **/ function get_content() { if ($this->content !== NULL) { return $this->content; } global $CFG, $USER; $this->content = new stdClass(); $this->content->icons = array(); $this->content->footer = ''; $this->content->items = array(); $context = get_context_instance(CONTEXT_SYSTEM); $mentor = has_capability('block/student_gradeviewer:viewgrades', $context) || has_capability('block/student_gradeviewer:sportsviewgrades', $context); $admin = has_capability('block/student_gradeviewer:academicadmin', $context) || has_capability('block/student_gradeviewer:sportsadmin', $context); // If they can't view the grades, then they can't query if ($mentor) { $this->content->items[] = '<a href="' . $CFG->wwwroot . '/blocks/student_gradeviewer/viewgrades.php">' . get_string('view_grades', 'block_student_gradeviewer') . '</a>'; } // This is solely for the admins of the systems, or the Moodle admins if ($admin) { $admin = get_string('admin', 'block_student_gradeviewer'); $this->content->items[] = '<a href="' . $CFG->wwwroot . '/blocks/student_gradeviewer/admin.php">' . $admin . '</a>' . helpbutton('admin', $admin, 'block_student_gradeviewer', true, false, '', true); } if ($mentor || $admin) { $this->content->items[] = '<a href="' . $CFG->wwwroot . '/blocks/student_gradeviewer/analysis.php"> ' . get_string('analysis', 'block_student_gradeviewer') . '</a>'; } // Primary instructors can configure their digest options $cps_user = CoursePrefsUser::findByUnique($USER->username); if (!empty($CFG->cas_email) and $cps_user and $cps_user->getSectionsInfoAsTeacher()) { $this->content->items[] = '<a href="' . $CFG->wwwroot . '/blocks/student_gradeviewer/options.php">' . get_string('options', 'block_student_gradeviewer') . '</a>'; } return $this->content; }
function get_content() { global $CFG; if ($this->content !== NULL) { return $this->content; } $this->content = new stdClass(); $this->content->footer = ''; if (empty($this->instance)) { $this->content->text = ''; return $this->content; } $advancedsearch = get_string('advancedsearch', 'block_search_metadata'); //Accessibility: replaced <input value=">" type="submit"> with button-embedded image. $this->content->text = '<div class="searchform">'; //$this->content->text .= '<form name="search" action="'.$CFG->wwwroot.'/mod/metadatadc/search_metadata.php" style="display:inline">'; $this->content->text .= '<form name="search" action="' . $CFG->wwwroot . '/blocks/' . $this->name() . '/search_allmetadata.php" style="display:inline">'; $this->content->text .= '<input name="id" type="hidden" value="' . $this->instance->pageid . '" />'; // course // $this->content->text .= '<input name="id" type="hidden" value="0" />'; // course $this->content->text .= '<input name="search" type="text" size="16" value="" />'; $this->content->text .= '<button type="submit" title="' . get_string('search') . '"><img src="' . $CFG->pixpath . '/a/r_go.gif" alt="" class="resize" /><span class="accesshide">' . get_string('search') . '</span></button><br />'; $this->content->text .= '<a href="' . $CFG->wwwroot . '/blocks/' . $this->name() . '/search_allmetadata.php?id=' . $this->instance->pageid . '">' . $advancedsearch . '</a>'; $this->content->text .= helpbutton('search_los', $advancedsearch, 'moodle', true, false, '', true); $this->content->text .= '</form></div>'; return $this->content; }
function get_content() { global $CFG, $THEME; if ($this->content !== NULL) { return $this->content; } $this->content = new stdClass(); $this->content->footer = ''; if (empty($this->instance)) { $this->content->text = ''; return $this->content; } $advancedsearch = get_string('advancedsearch', 'block_search_forums'); $search = get_string('search'); //Accessibility: replaced <input value=" />" type="submit"> with configurable text/'silent' character. // Theme config, $CFG->block_search_button = get_arrow_right() .'<span class="accesshide">'.get_string('search').'</span>'; $button = isset($CFG->block_search_button) ? $CFG->block_search_button : get_string('go'); $this->content->text = '<div class="searchform">'; $this->content->text .= '<form action="' . $CFG->wwwroot . '/mod/forum/search.php" style="display:inline"><fieldset class="invisiblefieldset">'; $this->content->text .= '<input name="id" type="hidden" value="' . $this->instance->pageid . '" />'; // course $this->content->text .= '<label class="accesshide" for="searchform_search">' . $search . '</label>' . '<input id="searchform_search" name="search" type="text" size="16" />'; $this->content->text .= '<button id="searchform_button" type="submit" title="' . $search . '">' . $button . '</button><br />'; $this->content->text .= '<a href="' . $CFG->wwwroot . '/mod/forum/search.php?id=' . $this->instance->pageid . '">' . $advancedsearch . '</a>'; $this->content->text .= helpbutton('search', $advancedsearch, 'moodle', true, false, '', true); $this->content->text .= '</fieldset></form></div>'; return $this->content; }
function display_add_field($recordid = 0) { global $CFG; $text = ''; $format = 0; if ($recordid) { if ($content = get_record('data_content', 'fieldid', $this->field->id, 'recordid', $recordid)) { $text = $content->content; $format = $content->content1; } } $str = '<div title="' . $this->field->description . '">'; if (can_use_richtext_editor()) { // Show a rich text html editor. $str .= $this->gen_textarea(true, $text); $str .= helpbutton("richtext", get_string("helprichtext"), 'moodle', true, true, '', true); $str .= '<input type="hidden" name="field_' . $this->field->id . '_content1' . '" value="' . FORMAT_HTML . '" />'; } else { // Show a normal textarea. Also let the user specify the format to be used. $str .= $this->gen_textarea(false, $text); // Get the available text formats for this field. $formatsForField = format_text_menu(); $str .= '<br />'; $str .= choose_from_menu($formatsForField, 'field_' . $this->field->id . '_content1', $format, 'choose', '', '', true); $str .= helpbutton('textformat', get_string('helpformatting'), 'moodle', true, false, '', true); } $str .= '</div>'; return $str; }
public function display($forum) { // Work out current status $manualmark = !forum::mark_read_automatically(); $current = get_string($manualmark ? 'manualmark_manual' : 'manualmark_auto', 'forumng'); // Make a help button $change = get_string('manualmark_change', 'forumng'); $helpbutton = helpbutton('manualmark', $change, 'forumng', true, false, '', true); // Get the button form $params = $forum->get_link_params_array(); return parent::get_button($forum, $change, 'feature/manualmark/change.php', true, $params, $helpbutton, 'forumng-manualmark', $current . ' ', 'forumng-button-to-link'); }
function init() { global $CFG, $WS; $this->title = get_string('block_index_current', 'wiki') . helpbutton('index_current', get_string('block_index_current', 'wiki'), 'wiki', true, false, '', true); $this->version = 2004081200; //initiates images array if (isset($WS->dfcourse)) { $imgclass = 'wiki_folding_co'; } else { $imgclass = 'wiki_folding'; } if (right_to_left()) { $squaredir = 'left'; } else { $squaredir = 'right'; } // rtl support (nadavkav patch) $this->images = array('plus' => '<img src="' . $CFG->wwwroot . '/mod/wiki/images/plus.gif" class="' . $imgclass . '" alt="" />', 'minus' => '<img src="' . $CFG->wwwroot . '/mod/wiki/images/minus.gif" class="' . $imgclass . '" alt="" />', 'square' => '<img src="' . $CFG->wwwroot . '/mod/wiki/images/square-' . $squaredir . '.png" alt="" />'); }
/** * Callback function called from question_list() function (which is called from showbank()) */ function module_specific_controls($totalnumber, $recurse, $category, $cmid) { $catcontext = get_context_instance_by_id($category->contextid); if (has_capability('moodle/question:useall', $catcontext)) { for ($i = 1; $i <= min(10, $totalnumber); $i++) { $randomcount[$i] = $i; } for ($i = 20; $i <= min(100, $totalnumber); $i += 10) { $randomcount[$i] = $i; } $out = '<br />'; $out .= get_string('addrandom', 'quiz', choose_from_menu($randomcount, 'randomcount', '1', '', '', '', true)); $out .= '<input type="hidden" name="recurse" value="' . $recurse . '" />'; $out .= "<input type=\"hidden\" name=\"categoryid\" value=\"{$category->id}\" />"; $out .= ' <input type="submit" name="addrandom" value="' . get_string('add') . '" />'; $out .= helpbutton('random', get_string('random', 'quiz'), 'quiz', true, false, '', true); } else { $out = ''; } return $out; }
function get_content() { global $CFG, $USER, $SITE, $course, $context; $this->content = new stdClass(); $this->content->items = array(); $this->content->icons = array(); //if Course web site... if ($course->id !== SITEID and has_capability('moodle/course:update', $context)) { $this->title .= ' ' . helpbutton('openshare', 'OpenShare', 'block_openshare', true, false, '', true); //Query for OpenShare enabled at course level $opencourse = get_record("block_openshare_courses", "courseid", $course->id); //If OpenShare enabled on this course... if ($opencourse->status == 1) { //Link to update OpenShare status of course modules en masse $this->content->items[] = '<a href="' . $CFG->wwwroot . '/blocks/openshare/open_mods_set.php?id=' . $this->instance->pageid . '&sesskey=' . sesskey() . '">' . get_string('openmodsset', 'block_openshare') . '</a>'; $this->content->icons[] = '<img src="' . $CFG->wwwroot . '/blocks/openshare/images/open.png" alt="cc" />'; //Link to update teacher and students membership in this course's OpenShare group, Course Members $this->content->items[] = '<a href="' . $CFG->wwwroot . '/blocks/openshare/group_members.php?id=' . $this->instance->pageid . '&sesskey=' . sesskey() . '">' . get_string('updatemembers', 'block_openshare') . '</a>'; $this->content->icons[] = '<img src="' . $CFG->pixpath . '/c/user.gif" alt="user" />'; $this->content->icons[] = '<img src="' . $CFG->pixpath . '/i/cross_red_small.gif" alt="no" />'; //Link to disable OpenShare for this courses $this->content->items[] = '<a href="' . $CFG->wwwroot . '/blocks/openshare/open_course_set.php?id=' . $this->instance->pageid . '&open=0&sesskey=' . sesskey() . '">' . get_string('disablecourse', 'block_openshare') . '</a>'; } elseif ($opencourse->status < 1) { //Link to enable OpenShare for this course $this->content->icons[] = '<img src="' . $CFG->pixpath . '/i/tick_green_small.gif" alt="yes" />'; $this->content->items[] = '<a href="' . $CFG->wwwroot . '/blocks/openshare/open_course_set.php?id=' . $this->instance->pageid . '&open=1&sesskey=' . sesskey() . '">' . get_string('enablecourse', 'block_openshare') . '</a>'; } } else { //if not in a course, show the OpenShare courses RSS feed //$this->content->items[]='<a href="'.$CFG->wwwroot.'/rss/xml_generate.php">'.get_string('coursesfeed','block_openshare').'</a>'; //$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/rss.gif" alt="rss" />'; /* if(has_capability('moodle/course:update', $context){ //Update OpenShare status of course modules en masse $this->content->items[]='<a href="'.$CFG->wwwroot.'/blocks/openshare/open_mods_set.php">'.get_string('openmodsset','block_openshare').'</a>'; $this->content->icons[]='<img src="'.$CFG->wwwroot.'/blocks/openshare/images/cc.png" alt="cc" />'; }*/ } $this->content->footer = '<div style="font-size: 75%; margin: .5em 0;"><a href="http://flexknowlogy.learningfield.org/addons/openshare/">' . get_string('blockfooter', 'block_openshare') . '</a></div>'; }
function get_content() { if ($this->content !== NULL) { return $this->content; } global $CFG, $PAGE; $this->content = new stdClass(); $this->content->footer = ' '; $plugin = ''; $searchtype = 'choose'; if ($this->config) { $searchtype = $this->config->searchtype; if ($searchtype === 'forumng') { $title = get_string('searchforums', 'block_ousearch'); $this->title = $title . ' ' . helpbutton('search_forums', $title, 'forumng', true, false, '', true); $plugin = 'mod/forumng'; } elseif ($searchtype === 'multiactivity') { $this->title = get_string('searchthiswebsite', 'block_ousearch'); } } //If search type is not set print a warning or hide the block if ($searchtype === 'choose') { //Print a warning when editing is on if ($PAGE->user_is_editing()) { $this->content->text = get_string('seachtypeisnotselected', 'block_ousearch'); //Hide the block when editing is off } else { $this->title = ''; $this->content->text = ''; } return $this->content; } $this->content->text = "\n<form method='get' action='{$CFG->wwwroot}/blocks/ousearch/search.php'>\n<div>\n<input type='hidden' name='course' value='{$this->instance->pageid}'/>\n<input type='hidden' name='plugin' value='{$plugin}'/>\n<input type='text' name='query' size='12'\n/><input type='submit' value='" . get_string('search') . "'/>\n</div>\n</form>\n"; // Print a notice for user when edisting if ($searchtype === 'multiactivity' && $PAGE->user_is_editing()) { $this->content->text .= get_string('searchthiswebsitenotice', 'block_ousearch'); } return $this->content; }
function init() { $this->title = get_string('block_new_page', 'wiki') . helpbutton('new_page', get_string('block_new_page', 'wiki'), 'wiki', true, false, '', true); $this->version = 2004081200; }
echo '<input type="hidden" name="sesskey" value="' . $USER->sesskey . '" />'; $state_names = note_get_state_names(); // the first time list hack if (empty($users)) { foreach ($_POST as $k => $v) { if (preg_match('/^user(\\d+)$/', $k, $m)) { $users[] = $m[1]; } } } $strpublishstate = get_string('publishstate', 'notes'); $userlist = array(); foreach ($users as $k => $v) { if (!($user = get_record('user', 'id', $v))) { continue; } echo '<input type="hidden" name="userid[' . $k . ']" value="' . $v . '" />'; $userlist[] = fullname($user, true); } echo '<p>'; echo get_string('users') . ': ' . implode(', ', $userlist) . '.'; echo '</p>'; echo '<p>' . get_string('content', 'notes'); helpbutton('writing', get_string('helpwriting')); echo '<br /><textarea name="content" rows="5" cols="50">' . strip_tags(@$content) . '</textarea></p>'; echo '<p>' . $strpublishstate; helpbutton('status', $strpublishstate, 'notes'); choose_from_menu($state_names, 'state', empty($state) ? NOTES_STATE_PUBLIC : $state, ''); echo '</p>'; echo '<input type="submit" value="' . get_string('savechanges') . '" /></div></form>'; print_footer($course);
/** * 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); }
if ($workshop->ntassessments) { $table->head = array(get_string("examplesubmissions", "workshop"), get_string("assessmentsby", "workshop", $course->teachers), get_string("assessmentsby", "workshop", $course->students)); $table->data = array(); if ($submissions = workshop_get_teacher_submissions($workshop)) { foreach ($submissions as $submission) { $teacherassessments = workshop_print_submission_assessments($workshop, $submission, "teacher"); // If not yet assessed, show assess link if ($teacherassessments == ' ') { $teacherassessments = '<a href="assess.php?id=' . $cm->id . '&sid=' . $submission->id . '">' . get_string('assess', 'workshop') . '</a>'; } $title = workshop_print_submission_title($workshop, $submission) . " <a href=\"submissions.php?action=editsubmission&id={$cm->id}&sid={$submission->id}\">" . "<img src=\"{$CFG->pixpath}/t/edit.gif\" " . 'class="iconsmall" alt="' . get_string('edit') . '" /></a>' . " <a href=\"submissions.php?action=confirmdelete&id={$cm->id}&sid={$submission->id}\">" . "<img src=\"{$CFG->pixpath}/t/delete.gif\" " . 'class="iconsmall" alt="' . get_string('delete', 'workshop') . '" /></a>'; $table->data[] = array($title, $teacherassessments, workshop_print_submission_assessments($workshop, $submission, "student")); } } // Put in a submission link $table->data[] = array("<b><a href=\"view.php?id={$cm->id}&action=submitexample\">" . get_string("submitexampleassignment", "workshop") . "</a></b>" . helpbutton("submissionofexamples", get_string("submitexampleassignment", "workshop"), "workshop", true, false, '', true), ' ', ' '); print_table($table); workshop_print_key($workshop); } // Get all the students if (!($users = workshop_get_students($workshop))) { echo '</table>'; print_heading(get_string("nostudentsyet")); print_footer($course); exit; } if (!empty($CFG->enablegroupings) && !empty($cm->groupingid) && !empty($users)) { $groupingusers = groups_get_grouping_members($cm->groupingid, 'u.id', 'u.id'); foreach ($users as $key => $user) { if (!isset($groupingusers[$user->id])) { unset($users[$key]);
} if ($bulkoperations) { echo '<br /><div class="buttons">'; echo '<input type="button" onclick="checkall()" value="' . get_string('selectall') . '" /> '; echo '<input type="button" onclick="checknone()" value="' . get_string('deselectall') . '" /> '; $displaylist = array(); $displaylist['messageselect.php'] = get_string('messageselectadd'); if (!empty($CFG->enablenotes) && has_capability('moodle/notes:manage', $context) && $context->id != $frontpagectx->id) { $displaylist['addnote.php'] = get_string('addnewnote', 'notes'); $displaylist['groupaddnote.php'] = get_string('groupaddnewnote', 'notes'); } if ($context->id != $frontpagectx->id) { $displaylist['extendenrol.php'] = get_string('extendenrol'); $displaylist['groupextendenrol.php'] = get_string('groupextendenrol'); } helpbutton("participantswithselectedusers", get_string("withselectedusers")); choose_from_menu($displaylist, "formaction", "", get_string("withselectedusers"), "if(checksubmit(this.form))this.form.submit();", ""); echo '<input type="hidden" name="id" value="' . $course->id . '" />'; echo '<div id="noscriptparticipantsform" style="display: inline;">'; echo '<input type="submit" value="' . get_string('ok') . '" /></div>'; echo '<script type="text/javascript">' . "\n//<![CDATA[\n" . 'document.getElementById("noscriptparticipantsform").style.display = "none";' . "\n//]]>\n" . '</script>'; echo '</div>'; echo '</div>'; echo '</form>'; } if ($bulkoperations && $totalcount > $perpage * 3) { echo '<form action="index.php" class="searchform"><div><input type="hidden" name="id" value="' . $course->id . '" />' . get_string('search') . ': ' . "\n"; echo '<input type="text" name="search" value="' . s($search) . '" /> <input type="submit" value="' . get_string('search') . '" /></div></form>' . "\n"; } $perpageurl = preg_replace('/&perpage=\\d*/', '', $baseurl); if ($perpage == SHOW_ALL_PAGE_SIZE) {
/** * Display auto generated info about the assignment */ function view_summary($submission = null, $return = false) { global $USER, $CFG; $table = new Object(); $table->id = 'summary'; $table->class = 'generaltable'; $table->align = array('right', 'left'); $table->size = array('20%', ''); $table->width = '100%'; // Language $item_name = get_string('assignmentlangs', 'assignment_onlinejudge') . ':'; $lang = get_string('lang' . $this->onlinejudge->language, 'assignment_onlinejudge'); $table->data[] = array($item_name, $lang); if (is_null($submission)) { $submission = $this->get_submission(); } // Status $item_name = get_string('status') . helpbutton('status', get_string('status'), 'assignment_onlinejudge', true, false, '', true) . ':'; $item = get_string('notavailable'); if (!empty($submission->status)) { $item = get_string('status' . $submission->status, 'assignment_onlinejudge'); } $table->data[] = array($item_name, $item); // Judge time $item_name = get_string('judgetime', 'assignment_onlinejudge') . ':'; $item = get_string('notavailable'); if (isset($submission->judgetime)) { $item = userdate($submission->judgetime) . ' (' . get_string('early', 'assignment', format_time(time() - $submission->judgetime)) . ')'; } $table->data[] = array($item_name, $item); // Information $item_name = get_string('info', 'assignment_onlinejudge') . ':'; $item = get_string('notavailable'); if (isset($submission->status)) { if ($submission->status === 'pending') { if (empty($CFG->assignment_oj_daemon_pid)) { //Judge from cron $lastcron = get_field('modules', 'lastcron', 'name', 'assignment'); $left = ceil(($lastcron + $CFG->assignment_oj_cronfreq - time()) / 60); $left = $left > 0 ? $left : 0; $submission->info = get_string('infopending', 'assignment_onlinejudge', $left); } else { $submission->info = get_string('notavailable'); } } else { if ($submission->status !== 'ac' && $submission->status !== 'ce' && empty($submission->info)) { $submission->info = get_string('info' . $submission->status, 'assignment_onlinejudge'); } } if (!empty($submission->info)) { $item = $submission->info; } } $options = new stdClass(); $options->para = false; $table->data[] = array($item_name, format_text(stripslashes($item), FORMAT_MOODLE, $options)); // Statistics $item_name = get_string('statistics', 'assignment_onlinejudge') . ':'; $item = get_string('notavailable'); if (isset($submission->id)) { $item = ''; $ac_rate = $this->get_statistics($submission, &$item); if (!empty($item)) { $item .= '<br />' . get_string('successrate', 'assignment_onlinejudge') . ': ' . round($ac_rate * 100, 2) . '%'; } } $table->data[] = array($item_name, $item); // Output (Show to teacher only) $context = get_context_instance(CONTEXT_MODULE, $this->cm->id); if (has_capability('mod/assignment:grade', $context) && isset($submission->output)) { $table->data[] = array(get_string('output', 'assignment_onlinejudge') . ':', format_text(stripslashes($submission->output), FORMAT_PLAIN)); } $output = print_table($table, true); if ($return) { return $output; } echo $output; }
if ($cron == 1) { mtrace("<p>Su cuestionario sera generado mas tarde</a></p>"); $continue = "{$CFG->wwwroot}/mod/blended/edit_paperquiz.php?a={$a}"; print_continue($continue); // Finish the page print_footer($course); } else { // Generate every job matching this data. (This makes a grouping of attempts) $job->quiz = $quiz->id; $job->userid = $USER->id; $job->blended = $blended->id; $job->timestamp = $timestamp; list($numattempts, $pdfFile) = generateJobs($job); if ($numattempts > 0) { $tex = new object(); $tex->href = "{$CFG->wwwroot}/files/index.php?id={$course->id}&wdir=%2F{$pdfFile->inCourseFolderRelativePath}"; $tex->hrefText = $pdfFile->inCourseFolderRelativePath; $tex->directLinkhref = "{$CFG->wwwroot}/file.php/{$pdfFile->RelativePath}?forcedownload=1"; $tex->directLinkText = $pdfFile->Name; echo get_string("PDFgeneratedMessage", "blended", $tex); } else { echo "<p>No PDF file generated.</p>"; } $continue = "{$CFG->wwwroot}/mod/blended/edit_paperquiz.php?a={$a}"; print_continue($continue); // Finish the page echo "<center>"; helpbutton($page = 'generateQuizesPDF', get_string('pagehelp', 'blended'), $module = 'blended', $image = true, $linktext = true, $text = '', $return = false, $imagetext = ''); echo "</center>"; print_footer($course); }
/** * Prints the table of questions in a category with interactions * * @param object $course The course object * @param int $categoryid The id of the question category to be displayed * @param int $quizid The quiz id if we are in the context of a particular quiz, 0 otherwise * @param int $recurse This is 1 if subcategories should be included, 0 otherwise * @param int $page The number of the page to be displayed * @param int $perpage Number of questions to show per page * @param boolean $showhidden True if also hidden questions should be displayed * @param boolean $showquestiontext whether the text of each question should be shown in the list */ function question_list($course, $categoryid, $quizid = 0, $recurse = 1, $page = 0, $perpage = 100, $showhidden = false, $sortorder = 'qtype, name ASC', $showquestiontext = false) { global $USER, $CFG, $THEME; $qtypemenu = question_type_menu(); if ($rqp_types = get_records('question_rqp_types')) { foreach ($rqp_types as $type) { $qtypemenu['rqp_' . $type->id] = $type->name; } } $strcategory = get_string("category", "quiz"); $strquestion = get_string("question", "quiz"); $straddquestions = get_string("addquestions", "quiz"); $strimportquestions = get_string("importquestions", "quiz"); $strexportquestions = get_string("exportquestions", "quiz"); $strnoquestions = get_string("noquestions", "quiz"); $strselect = get_string("select", "quiz"); $strselectall = get_string("selectall", "quiz"); $strselectnone = get_string("selectnone", "quiz"); $strcreatenewquestion = get_string("createnewquestion", "quiz"); $strquestionname = get_string("questionname", "quiz"); $strdelete = get_string("delete"); $stredit = get_string("edit"); $straction = get_string("action"); $strrestore = get_string('restore'); $straddtoquiz = get_string("addtoquiz", "quiz"); $strtype = get_string("type", "quiz"); $strcreatemultiple = get_string("createmultiple", "quiz"); $strpreview = get_string("preview", "quiz"); if (!$categoryid) { echo "<p style=\"text-align:center;\"><b>"; print_string("selectcategoryabove", "quiz"); echo "</b></p>"; if ($quizid) { echo "<p>"; print_string("addingquestions", "quiz"); echo "</p>"; } return; } if (!($category = get_record('question_categories', 'id', $categoryid))) { notify('Category not found!'); return; } $canedit = has_capability('moodle/question:manage', get_context_instance(CONTEXT_COURSE, $category->course)); $editingquiz = false; if ($quizid) { $cm = get_coursemodule_from_instance('quiz', $quizid); $editingquiz = has_capability('mod/quiz:manage', get_context_instance(CONTEXT_MODULE, $cm->id)); } echo '<div class="boxaligncenter">'; $formatoptions = new stdClass(); $formatoptions->noclean = true; echo format_text($category->info, FORMAT_MOODLE, $formatoptions, $course->id); echo '<table><tr>'; // check if editing questions in this category is allowed if ($canedit) { echo "<td valign=\"top\"><b>{$strcreatenewquestion}:</b></td>"; echo '<td valign="top" align="right">'; popup_form("{$CFG->wwwroot}/question/question.php?category={$category->id}&qtype=", $qtypemenu, "addquestion", "", "choose", "", "", false, "self"); echo '</td><td valign="top" align="right">'; helpbutton("questiontypes", $strcreatenewquestion, "quiz"); echo '</td>'; } else { echo '<td>'; print_string("publishedit", "quiz"); echo '</td>'; } echo '</tr></table>'; echo '</div>'; $categorylist = $recurse ? question_categorylist($category->id) : $category->id; // hide-feature $showhidden = $showhidden ? '' : " AND hidden = '0'"; if (!($totalnumber = count_records_select('question', "category IN ({$categorylist}) AND parent = '0' {$showhidden}"))) { echo "<p style=\"text-align:center;\">"; print_string("noquestions", "quiz"); echo "</p>"; return; } if (!($questions = get_records_select('question', "category IN ({$categorylist}) AND parent = '0' {$showhidden}", $sortorder, '*', $page * $perpage, $perpage))) { // There are no questions on the requested page. $page = 0; if (!($questions = get_records_select('question', "category IN ({$categorylist}) AND parent = '0' {$showhidden}", $sortorder, '*', 0, $perpage))) { // There are no questions at all echo "<p style=\"text-align:center;\">"; print_string("noquestions", "quiz"); echo "</p>"; return; } } print_paging_bar($totalnumber, $page, $perpage, "edit.php?courseid={$course->id}&perpage={$perpage}&"); echo '<form method="post" action="edit.php?courseid=' . $course->id . '">'; echo '<fieldset class="invisiblefieldset" style="display: block;">'; echo '<input type="hidden" name="sesskey" value="' . $USER->sesskey . '" />'; echo '<table id="categoryquestions" style="width: 100%"><tr>'; echo "<th style=\"white-space:nowrap;\" class=\"header\" scope=\"col\">{$straction}</th>"; $sortoptions = array('name, qtype ASC' => get_string("sortalpha", "quiz"), 'qtype, name ASC' => get_string("sorttypealpha", "quiz"), 'id ASC' => get_string("sortage", "quiz")); $orderselect = choose_from_menu($sortoptions, 'sortorder', $sortorder, false, 'this.form.submit();', '0', true); $orderselect .= '<noscript><div><input type="submit" value="' . get_string("sortsubmit", "quiz") . '" /></div></noscript>'; echo "<th style=\"white-space:nowrap; text-align: left;\" class=\"header\" scope=\"col\">{$strquestionname} {$orderselect}</th>\n <th style=\"white-space:nowrap; text-align: right;\" class=\"header\" scope=\"col\">{$strtype}</th>"; echo "</tr>\n"; foreach ($questions as $question) { $nameclass = ''; $textclass = ''; if ($question->hidden) { $nameclass = 'dimmed_text'; $textclass = 'dimmed_text'; } if ($showquestiontext) { $nameclass .= ' header'; } if ($nameclass) { $nameclass = 'class="' . $nameclass . '"'; } if ($textclass) { $textclass = 'class="' . $textclass . '"'; } echo "<tr>\n<td style=\"white-space:nowrap;\" {$nameclass}>\n"; // add to quiz if ($editingquiz) { echo "<a title=\"{$straddtoquiz}\" href=\"edit.php?addquestion={$question->id}&quizid={$quizid}&sesskey={$USER->sesskey}\"><img\n src=\"{$CFG->pixpath}/t/moveleft.gif\" alt=\"{$straddtoquiz}\" /></a> "; } // preview link_to_popup_window('/question/preview.php?id=' . $question->id . '&quizid=' . $quizid, 'questionpreview', "<img src=\"{$CFG->pixpath}/t/preview.gif\" class=\"iconsmall\" alt=\"{$strpreview}\" />", 0, 0, $strpreview, QUESTION_PREVIEW_POPUP_OPTIONS); // edit, hide, delete question, using question capabilities, not quiz capabilieies if ($canedit) { echo "<a title=\"{$stredit}\" href=\"{$CFG->wwwroot}/question/question.php?id={$question->id}\"><img\n src=\"{$CFG->pixpath}/t/edit.gif\" alt=\"{$stredit}\" /></a> "; // hide-feature if ($question->hidden) { echo "<a title=\"{$strrestore}\" href=\"edit.php?courseid={$course->id}&unhide={$question->id}&sesskey={$USER->sesskey}\"><img\n src=\"{$CFG->pixpath}/t/restore.gif\" alt=\"{$strrestore}\" /></a>"; } else { echo "<a title=\"{$strdelete}\" href=\"edit.php?courseid={$course->id}&deleteselected={$question->id}&q{$question->id}=1\"><img\n src=\"{$CFG->pixpath}/t/delete.gif\" alt=\"{$strdelete}\" /></a>"; } } echo " <input title=\"{$strselect}\" type=\"checkbox\" name=\"q{$question->id}\" value=\"1\" />"; echo "</td>\n"; echo "<td {$nameclass}>" . format_string($question->name) . "</td>\n"; echo "<td {$nameclass} style='text-align: right'>\n"; print_question_icon($question); echo "</td>\n"; echo "</tr>\n"; if ($showquestiontext) { echo '<tr><td colspan="3" ' . $textclass . '>'; $formatoptions = new stdClass(); $formatoptions->noclean = true; $formatoptions->para = false; echo format_text($question->questiontext, $question->questiontextformat, $formatoptions, $course->id); echo "</td></tr>\n"; } } echo "</table>\n"; $paging = print_paging_bar($totalnumber, $page, $perpage, "edit.php?courseid={$course->id}&perpage={$perpage}&", 'page', false, true); if ($totalnumber > DEFAULT_QUESTIONS_PER_PAGE) { if ($perpage == DEFAULT_QUESTIONS_PER_PAGE) { $showall = '<a href="edit.php?courseid=' . $course->id . '&perpage=1000">' . get_string('showall', 'moodle', $totalnumber) . '</a>'; } else { $showall = '<a href="edit.php?courseid=' . $course->id . '&perpage=' . DEFAULT_QUESTIONS_PER_PAGE . '">' . get_string('showperpage', 'moodle', DEFAULT_QUESTIONS_PER_PAGE) . '</a>'; } if ($paging) { $paging = substr($paging, 0, strrpos($paging, '</div>')); $paging .= "<br />{$showall}</div>"; } else { $paging = "<div class='paging'>{$showall}</div>"; } } echo $paging; echo '<table class="quiz-edit-selected"><tr><td colspan="2">'; echo '<a href="javascript:select_all_in(\'TABLE\',null,\'categoryquestions\');">' . $strselectall . '</a> /' . ' <a href="javascript:deselect_all_in(\'TABLE\',null,\'categoryquestions\');">' . $strselectnone . '</a>' . '</td><td align="right"><b> ' . get_string('withselected', 'quiz') . ':</b></td></tr><tr><td>'; if ($editingquiz) { echo "<input type=\"submit\" name=\"add\" value=\"{$THEME->larrow} {$straddtoquiz}\" />\n"; echo '</td><td>'; } // print delete and move selected question if ($canedit) { echo '<input type="submit" name="deleteselected" value="' . $strdelete . "\" /></td><td>\n"; echo '<input type="submit" name="move" value="' . get_string('moveto', 'quiz') . "\" />\n"; question_category_select_menu($course->id, false, true, $category->id); } echo "</td></tr></table>"; // add random question if ($editingquiz) { for ($i = 1; $i <= min(10, $totalnumber); $i++) { $randomcount[$i] = $i; } for ($i = 20; $i <= min(100, $totalnumber); $i += 10) { $randomcount[$i] = $i; } echo '<br />'; print_string('addrandom', 'quiz', choose_from_menu($randomcount, 'randomcount', '1', '', '', '', true)); echo '<input type="hidden" name="recurse" value="' . $recurse . '" />'; echo "<input type=\"hidden\" name=\"categoryid\" value=\"{$category->id}\" />"; echo ' <input type="submit" name="addrandom" value="' . get_string('add') . '" />'; helpbutton('random', get_string('random', 'quiz'), 'quiz'); } echo '</fieldset>'; echo "</form>\n"; }
echo '</td></tr>'; echo '<tr><td valign="top" colspan="2" align="center"><h3>' . $strimport . '</h3></td></tr>'; echo '<tr><td><label for="fromfile">' . $strfromfile . '</label>'; helpbutton('importfromfile', '', 'data', true, true); echo '</td><td>'; echo '<form id="uploadpreset" method="post" action="preset.php">'; echo '<fieldset class="invisiblefieldset">'; echo '<input type="hidden" name="d" value="' . $data->id . '" />'; echo '<input type="hidden" name="action" value="importzip" />'; echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />'; echo '<input name="file" size="20" value="" id="fromfile" type="text" /><input name="coursefiles" value="' . $strchooseorupload . '" onclick="return openpopup(' . "'/files/index.php?id={$course->id}&choose=uploadpreset.file', 'coursefiles', 'menubar=0,location=0,scrollbars,resizable,width=750,height=500', 0" . ');" type="button" />'; echo '<input type="submit" value="' . $strimport . '" />'; echo '</fieldset></form>'; echo '</td></tr>'; echo '<tr valign="top"><td><label>' . $strusestandard . '</label>'; helpbutton('usepreset', '', 'data', true, true); echo '</td><td>'; echo '<form id="presets" method="post" action="preset.php" >'; echo '<fieldset class="invisiblefieldset">'; echo '<input type="hidden" name="d" value="' . $data->id . '" />'; echo '<input type="hidden" name="action" value="importpreset" />'; echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />'; $i = 0; foreach ($presets as $id => $preset) { $screenshot = ''; if (!empty($preset->userid)) { $user = get_record('user', 'id', $preset->userid); $desc = $preset->name . ' (' . fullname($user, true) . ')'; } else { $desc = $preset->name; }
echo '<p> <a href="' . htmlspecialchars('export.php?action=exportfile&id=' . $id) . '">' . get_string('export_questions', 'feedback') . '</a>/ <a href="' . htmlspecialchars('import.php?id=' . $id) . '">' . get_string('import_questions', 'feedback') . '</a> </p>'; } // print_simple_box_end(); print_box_end(); } /////////////////////////////////////////////////////////////////////////// ///print the Item-Edit-section /////////////////////////////////////////////////////////////////////////// if ($do_show == 'edit') { $add_item_form->display(); if (is_array($feedbackitems)) { $itemnr = 0; $helpbutton = helpbutton('preview', get_string('preview', 'feedback'), 'feedback', true, false, '', true); print_heading($helpbutton . get_string('preview', 'feedback')); if (isset($SESSION->feedback->moving) and $SESSION->feedback->moving->shouldmoving == 1) { print_heading('<a href="' . htmlspecialchars($ME . '?id=' . $id) . '">' . get_string('cancel_moving', 'feedback') . '</a>'); } // print_simple_box_start('center', '80%'); print_box_start('generalbox boxaligncenter boxwidthwide'); //check, if there exists required-elements $countreq = $DB->count_records('feedback_item', array('feedback' => $feedback->id, 'required' => 1)); if ($countreq > 0) { // echo '<font color="red">(*)' . get_string('items_are_required', 'feedback') . '</font>'; echo '<span class="feedback_required_mark">(*)' . get_string('items_are_required', 'feedback') . '</span>'; } echo '<table>'; if (isset($SESSION->feedback->moving) and $SESSION->feedback->moving->shouldmoving == 1) { $moveposition = 1;
echo '<td class="wikisearchform">'; wiki_print_search_form($cm->id, $q, $userid, $groupid, false); echo '</td>'; /// Internal Wikilinks echo '<td class="wikilinksblock">'; wiki_print_wikilinks_block($cm->id, $wiki->ewikiacceptbinary); echo '</td>'; /// Administrative Links if ($canedit) { echo '<td class="wikiadminactions">'; wiki_print_administration_actions($wiki, $cm->id, $userid, $groupid, $ewiki_title, $wiki->htmlmode != 2, $course); echo '</td>'; } /// Formatting Rules echo '<td class="howtowiki">'; helpbutton('howtowiki', get_string('howtowiki', 'wiki'), 'wiki'); echo '</td>'; echo '</tr></table>'; } echo '</div> <div id="wiki-view" class="mwiki"> '; if ($wiki_entry && $ewiki_title == $wiki_entry->pagename && !empty($wiki->summary)) { if (trim(strip_tags($wiki->summary))) { print_box(format_text($wiki->summary, FORMAT_MOODLE), 'generalbox', 'intro'); } } // The wiki Contents if (!empty($canedit)) { /// Print tabs with commands for this page $tabs = array('view', 'edit', 'links', 'info');
print_heading(get_string('feedback', 'brainstorm'), '', 3); $report = get_record('brainstorm_userdata', 'brainstormid', $brainstorm->id, 'userid', $gradefor); print_simple_box(format_string(format_text(@$report->report, @$report->reportformat))); if (!$brainstorm->singlegrade && $brainstorm->seqaccessfeedback) { echo '<br/>'; print_string('gradeforfeedback', 'brainstorm'); echo ' : '; make_grading_menu($brainstorm, 'feedback', @$gradeset->feedback, false); } // print a final feedback form echo '<br/><br/><table width="80%"><tr valign="top"><td><b>' . get_string('feedback') . ':</b></td><td>'; $usehtmleditor = can_use_html_editor(); print_textarea($usehtmleditor, 20, 50, 680, 400, 'teacherfeedback', @$report->feedback); if (!$usehtmleditor) { echo '<p align="right">'; helpbutton('textformat', get_string('formattexttype')); print_string('formattexttype'); echo ": "; if (empty($report->feedbackformat)) { $report->feedbackformat = FORMAT_MOODLE; } choose_from_menu(format_text_menu(), 'feedbackformat', $report->feedbackformat, ''); } else { $htmleditorneeded = 1; } echo '</td></tr></table>'; // if single grading, print a single grade scale if ($brainstorm->singlegrade) { echo '<br/>'; print_string('grade'); echo ' : ';
if ($preview_url) { link_to_popup_window($preview_url, 'popup', get_string('preview')); } echo '</fieldset>'; } // show the content of the original English file either in core space or plugin space if ($origlocation != '' && $origplugin != '') { // non-core help file $ensrc = "{$CFG->dirroot}/{$origlocation}/{$origplugin}/lang/en_utf8/help/{$currentfile}"; } else { // core help file $ensrc = "{$enlangdir}/{$currentfile}"; } if (is_readable($ensrc)) { echo '<fieldset><legend>' . $strlangmasterenglish; helpbutton('langpackages', $strlangmasterenglish); echo '</legend>'; echo "<div align=\"center\">\n<textarea rows=\"{$fileeditorrows}\" cols=\"{$fileeditorcols}\" name=\"\">"; echo htmlspecialchars(file_get_contents($ensrc)); echo "</textarea>\n</div>\n"; $preview_url = lang_help_preview_url($currentfile, true, 'en_utf8'); // do not display en_utf8_local if ($preview_url) { link_to_popup_window($preview_url, 'popup', get_string('preview')); } echo '</fieldset>'; } echo '</div>'; // translator box error_reporting($CFG->debug); }
/** * Print a conversation and allow a new entry * * Render out entries for the specified conversation as HTML showing the * avatar for the user who initiated the dialogue. Follow up with a text * box to allow user to add a new response entry * * @param object $dialogue * @param int $conversation */ function dialogue_print_conversation($dialogue, $conversation) { global $USER, $CFG; if (!($course = get_record('course', 'id', $dialogue->course))) { error('Course is misconfigured'); } if (!($cm = get_coursemodule_from_instance('dialogue', $dialogue->id, $course->id))) { error('Course Module ID was incorrect'); } $context = get_context_instance(CONTEXT_MODULE, $cm->id); $dialoguemanagers = array_keys(get_users_by_capability($context, 'mod/dialogue:manage')); $timenow = time(); $showbutton = false; require_once 'dialogue_reply_form.php'; $mform = new mod_dialogue_reply_form('dialogues.php', array('conversationid' => $conversation->id)); $mform->set_data(array('id' => $cm->id, 'action' => 'insertentries', 'pane' => DIALOGUEPANE_CURRENT)); $showbutton = true; print_simple_box_start('center', ''); echo "<table align=\"center\" border=\"1\" cellspacing=\"0\" valign=\"top\" cellpadding=\"4\" \n width=\"100%\">\n"; echo "<tr><td>\n"; if (in_array($USER->id, $dialoguemanagers)) { if (!in_array($conversation->userid, $dialoguemanagers)) { if (!($otheruser = get_record('user', 'id', $conversation->userid))) { error("User's record not found"); } } else { if (!($otheruser = get_record('user', 'id', $conversation->recipientid))) { error("User's record not found"); } } } else { if ($USER->id != $conversation->userid) { if (!($otheruser = get_record('user', 'id', $conversation->userid))) { error("User's record not found"); } } else { if (!($otheruser = get_record('user', 'id', $conversation->recipientid))) { error("User's record not found"); } } } $picture = print_user_picture($otheruser->id, $course->id, $otheruser->picture, false, true); echo $picture . " <b>" . get_string('dialoguewith', 'dialogue', fullname($otheruser)) . '</b></td>'; echo '<td><i>' . format_string($conversation->subject) . " </i><br />\n"; echo "<div align=\"right\">\n"; if (!$conversation->subject) { // conversation does not have a subject, show add subject link echo "<a href=\"dialogues.php?action=getsubject&id={$cm->id}&cid={$conversation->id}&pane=" . DIALOGUEPANE_CURRENT . "\">" . get_string('addsubject', 'dialogue') . "</a>\n"; helpbutton('addsubject', get_string('addsubject', 'dialogue'), 'dialogue'); echo ' | '; } if (!$conversation->closed && has_capability('mod/dialogue:close', $context)) { echo "<a href=\"dialogues.php?action=confirmclose&id={$cm->id}&cid={$conversation->id}&pane=" . DIALOGUEPANE_CURRENT . "\">" . get_string('close', 'dialogue') . "</a>\n"; helpbutton('closedialogue', get_string('close', 'dialogue'), 'dialogue'); } echo "</div></td></tr>\n"; if ($entries = get_records_select('dialogue_entries', "conversationid = {$conversation->id}", 'id')) { $firstentry = true; foreach ($entries as $entry) { if (!($otheruser = get_record('user', 'id', $entry->userid))) { error('User not found'); } $canedit = false; if (!$conversation->closed && $entry->userid == $USER->id && $timenow < $entry->timecreated + $dialogue->edittime * 60) { $canedit = true; } if ($entry->timecreated != $entry->timemodified) { $modified = get_string('updated', 'dialogue', userdate($entry->timemodified)); } else { $modified = ''; } if ($entry->userid == $USER->id) { echo "<tr><td colspan=\"2\" bgcolor=\"#FFFFFF\">\n"; if ($canedit) { if ($firstentry) { echo "<a href=\"dialogues.php?action=editconversation&id={$cm->id}&entryid={$entry->id}&pane=" . DIALOGUEPANE_CURRENT . "\">" . get_string('edit') . '</a>'; } else { echo "<a href=\"dialogues.php?action=editreply&id={$cm->id}&entryid={$entry->id}&pane=" . DIALOGUEPANE_CURRENT . "\">" . get_string('edit') . '</a>'; } } echo "<p><font size=\"1\">" . get_string('onyouwrote', 'dialogue', userdate($entry->timecreated) . ' ' . $modified); echo ":</font></p><br />" . format_text($entry->text); } else { echo "<tr><td colspan=\"2\">\n"; echo "<p><font size=\"1\">" . get_string("onwrote", "dialogue", userdate($entry->timecreated) . " {$modified} " . fullname($otheruser)); echo ":</font></p><br />" . format_text($entry->text); } echo dialogue_print_attachments($entry); echo "</td></tr>\n"; $firstentry = false; } } echo "</table><br />\n"; if (!$conversation->closed && (has_capability('mod/dialogue:participateany', $context) || $conversation->userid == $USER->id || $conversation->recipientid == $USER->id)) { $mform->display(); } print_simple_box_end(); if (!$conversation->seenon && $conversation->lastrecipientid == $USER->id) { set_field('dialogue_conversations', 'seenon', time(), 'id', $conversation->id); } dialogue_mark_conversation_read($conversation->id, $USER->id); }
/** * Prints the table of questions in a category with interactions * * @param object $course The course object * @param int $categoryid The id of the question category to be displayed * @param int $cm The course module record if we are in the context of a particular module, 0 otherwise * @param int $recurse This is 1 if subcategories should be included, 0 otherwise * @param int $page The number of the page to be displayed * @param int $perpage Number of questions to show per page * @param boolean $showhidden True if also hidden questions should be displayed * @param boolean $showquestiontext whether the text of each question should be shown in the list */ function question_list($contexts, $pageurl, $categoryandcontext, $cm = null, $recurse = 1, $page = 0, $perpage = 100, $showhidden = false, $sortorder = 'typename', $sortorderdecoded = 'qtype, name ASC', $showquestiontext = false, $addcontexts = array()) { global $USER, $CFG, $THEME, $COURSE; $lastchangedid = optional_param('lastchanged', 0, PARAM_INT); list($categoryid, $contextid) = explode(',', $categoryandcontext); $qtypemenu = question_type_menu(); $strcategory = get_string("category", "quiz"); $strquestion = get_string("question", "quiz"); $straddquestions = get_string("addquestions", "quiz"); $strimportquestions = get_string("importquestions", "quiz"); $strexportquestions = get_string("exportquestions", "quiz"); $strnoquestions = get_string("noquestions", "quiz"); $strselect = get_string("select", "quiz"); $strselectall = get_string("selectall", "quiz"); $strselectnone = get_string("selectnone", "quiz"); $strcreatenewquestion = get_string("createnewquestion", "quiz"); $strquestionname = get_string("questionname", "quiz"); $strdelete = get_string("delete"); $stredit = get_string("edit"); $strmove = get_string('moveqtoanothercontext', 'question'); $strview = get_string("view"); $straction = get_string("action"); $strrestore = get_string('restore'); $strtype = get_string("type", "quiz"); $strcreatemultiple = get_string("createmultiple", "quiz"); $strpreview = get_string("preview", "quiz"); if (!$categoryid) { echo "<p style=\"text-align:center;\"><b>"; print_string("selectcategoryabove", "quiz"); echo "</b></p>"; return; } if (!($category = get_record('question_categories', 'id', $categoryid, 'contextid', $contextid))) { notify('Category not found!'); return; } $catcontext = get_context_instance_by_id($contextid); $canadd = has_capability('moodle/question:add', $catcontext); //check for capabilities on all questions in category, will also apply to sub cats. $caneditall = has_capability('moodle/question:editall', $catcontext); $canuseall = has_capability('moodle/question:useall', $catcontext); $canmoveall = has_capability('moodle/question:moveall', $catcontext); if ($cm and $cm->modname == 'quiz') { $quizid = $cm->instance; } else { $quizid = 0; } $returnurl = $pageurl->out(); $questionurl = new moodle_url("{$CFG->wwwroot}/question/question.php", array('returnurl' => $returnurl)); if ($cm !== null) { $questionurl->param('cmid', $cm->id); } else { $questionurl->param('courseid', $COURSE->id); } $questionmoveurl = new moodle_url("{$CFG->wwwroot}/question/contextmoveq.php", array('returnurl' => $returnurl)); if ($cm !== null) { $questionmoveurl->param('cmid', $cm->id); } else { $questionmoveurl->param('courseid', $COURSE->id); } echo '<div class="boxaligncenter">'; $formatoptions = new stdClass(); $formatoptions->noclean = true; echo format_text($category->info, FORMAT_MOODLE, $formatoptions, $COURSE->id); echo '<table><tr>'; if ($canadd) { echo '<td valign="top" align="right">'; popup_form($questionurl->out(false, array('category' => $category->id)) . '&qtype=', $qtypemenu, "addquestion", "", "choose", "", "", false, "self", "<strong>{$strcreatenewquestion}</strong>"); echo '</td><td valign="top" align="right">'; helpbutton("questiontypes", $strcreatenewquestion, "quiz"); echo '</td>'; } else { echo '<td>'; print_string('nopermissionadd', 'question'); echo '</td>'; } echo '</tr></table>'; echo '</div>'; $categorylist = $recurse ? question_categorylist($category->id) : $category->id; // hide-feature $showhidden = $showhidden ? '' : " AND hidden = '0'"; if (!($totalnumber = count_records_select('question', "category IN ({$categorylist}) AND parent = '0' {$showhidden}"))) { echo "<p style=\"text-align:center;\">"; print_string("noquestions", "quiz"); echo "</p>"; return; } if (!($questions = get_records_select('question', "category IN ({$categorylist}) AND parent = '0' {$showhidden}", $sortorderdecoded, '*', $page * $perpage, $perpage))) { // There are no questions on the requested page. $page = 0; if (!($questions = get_records_select('question', "category IN ({$categorylist}) AND parent = '0' {$showhidden}", $sortorderdecoded, '*', 0, $perpage))) { // There are no questions at all echo "<p style=\"text-align:center;\">"; print_string("noquestions", "quiz"); echo "</p>"; return; } } print_paging_bar($totalnumber, $page, $perpage, $pageurl, 'qpage'); echo question_sort_options($pageurl, $sortorder); echo '<form method="post" action="edit.php">'; echo '<fieldset class="invisiblefieldset" style="display: block;">'; echo '<input type="hidden" name="sesskey" value="' . $USER->sesskey . '" />'; echo $pageurl->hidden_params_out(); echo '<table id="categoryquestions" style="width: 100%"><tr>'; echo "<th style=\"white-space:nowrap;\" class=\"header\" scope=\"col\">{$straction}</th>"; echo "<th style=\"white-space:nowrap; text-align: left;\" class=\"header\" scope=\"col\">{$strquestionname}</th>\n <th style=\"white-space:nowrap; text-align: right;\" class=\"header\" scope=\"col\">{$strtype}</th>"; echo "</tr>\n"; foreach ($questions as $question) { $nameclass = ''; $textclass = ''; if ($question->hidden) { $nameclass = 'dimmed_text'; $textclass = 'dimmed_text'; } if ($showquestiontext) { $nameclass .= ' header'; } if ($question->id == $lastchangedid) { $nameclass = 'highlight'; } if ($nameclass) { $nameclass = 'class="' . $nameclass . '"'; } if ($textclass) { $textclass = 'class="' . $textclass . '"'; } echo "<tr>\n<td style=\"white-space:nowrap;\" {$nameclass}>\n"; $canuseq = question_has_capability_on($question, 'use', $question->category); if (function_exists('module_specific_actions')) { echo module_specific_actions($pageurl, $question->id, $cm->id, $canuseq); } // preview if ($canuseq) { $quizorcourseid = $quizid ? '&quizid=' . $quizid : '&courseid=' . $COURSE->id; link_to_popup_window('/question/preview.php?id=' . $question->id . $quizorcourseid, 'questionpreview', "<img src=\"{$CFG->pixpath}/t/preview.gif\" class=\"iconsmall\" alt=\"{$strpreview}\" />", 0, 0, $strpreview, QUESTION_PREVIEW_POPUP_OPTIONS); } // edit, hide, delete question, using question capabilities, not quiz capabilieies if (question_has_capability_on($question, 'edit', $question->category) || question_has_capability_on($question, 'move', $question->category)) { echo "<a title=\"{$stredit}\" href=\"" . $questionurl->out(false, array('id' => $question->id)) . "\"><img\n src=\"{$CFG->pixpath}/t/edit.gif\" alt=\"{$stredit}\" /></a> "; } elseif (question_has_capability_on($question, 'view', $question->category)) { echo "<a title=\"{$strview}\" href=\"" . $questionurl->out(false, array('id' => $question->id)) . "\"><img\n src=\"{$CFG->pixpath}/i/info.gif\" alt=\"{$strview}\" /></a> "; } if (question_has_capability_on($question, 'move', $question->category) && question_has_capability_on($question, 'view', $question->category)) { echo "<a title=\"{$strmove}\" href=\"" . $questionurl->out(false, array('id' => $question->id, 'movecontext' => 1)) . "\"><img\n src=\"{$CFG->pixpath}/t/move.gif\" alt=\"{$strmove}\" /></a> "; } if (question_has_capability_on($question, 'edit', $question->category)) { // hide-feature if ($question->hidden) { echo "<a title=\"{$strrestore}\" href=\"edit.php?" . $pageurl->get_query_string() . "&unhide={$question->id}&sesskey={$USER->sesskey}\"><img\n src=\"{$CFG->pixpath}/t/restore.gif\" alt=\"{$strrestore}\" /></a>"; } else { echo "<a title=\"{$strdelete}\" href=\"edit.php?" . $pageurl->get_query_string() . "&deleteselected={$question->id}&q{$question->id}=1\"><img\n src=\"{$CFG->pixpath}/t/delete.gif\" alt=\"{$strdelete}\" /></a>"; } } if ($caneditall || $canmoveall || $canuseall) { echo " <input title=\"{$strselect}\" type=\"checkbox\" name=\"q{$question->id}\" value=\"1\" />"; } echo "</td>\n"; echo "<td {$nameclass}>" . format_string($question->name) . "</td>\n"; echo "<td {$nameclass} style='text-align: right'>\n"; print_question_icon($question); echo "</td>\n"; echo "</tr>\n"; if ($showquestiontext) { echo '<tr><td colspan="3" ' . $textclass . '>'; $formatoptions = new stdClass(); $formatoptions->noclean = true; $formatoptions->para = false; echo format_text($question->questiontext, $question->questiontextformat, $formatoptions, $COURSE->id); echo "</td></tr>\n"; } } echo "</table>\n"; $paging = print_paging_bar($totalnumber, $page, $perpage, $pageurl, 'qpage', false, true); if ($totalnumber > DEFAULT_QUESTIONS_PER_PAGE) { if ($perpage == DEFAULT_QUESTIONS_PER_PAGE) { $showall = '<a href="edit.php?' . $pageurl->get_query_string(array('qperpage' => 1000)) . '">' . get_string('showall', 'moodle', $totalnumber) . '</a>'; } else { $showall = '<a href="edit.php?' . $pageurl->get_query_string(array('qperpage' => DEFAULT_QUESTIONS_PER_PAGE)) . '">' . get_string('showperpage', 'moodle', DEFAULT_QUESTIONS_PER_PAGE) . '</a>'; } if ($paging) { $paging = substr($paging, 0, strrpos($paging, '</div>')); $paging .= "<br />{$showall}</div>"; } else { $paging = "<div class='paging'>{$showall}</div>"; } } echo $paging; if ($caneditall || $canmoveall || $canuseall) { echo '<a href="javascript:select_all_in(\'TABLE\',null,\'categoryquestions\');">' . $strselectall . '</a> /' . ' <a href="javascript:deselect_all_in(\'TABLE\',null,\'categoryquestions\');">' . $strselectnone . '</a>'; echo '<br />'; echo '<strong> ' . get_string('withselected', 'quiz') . ':</strong><br />'; if (function_exists('module_specific_buttons')) { echo module_specific_buttons($cm->id); } // print delete and move selected question if ($caneditall) { echo '<input type="submit" name="deleteselected" value="' . $strdelete . "\" />\n"; } if ($canmoveall && count($addcontexts)) { echo '<input type="submit" name="move" value="' . get_string('moveto', 'quiz') . "\" />\n"; question_category_select_menu($addcontexts, false, 0, "{$category->id},{$category->contextid}"); } if (function_exists('module_specific_controls') && $canuseall) { echo module_specific_controls($totalnumber, $recurse, $category, $cm->id); } } echo '</fieldset>'; echo "</form>\n"; }
echo '</td></tr>'; echo '<tr><td valign="top" colspan="2" align="center"><h3>' . $strimport . '</h3></td></tr>'; echo '<tr><td><label for="fromfile">' . $strfromfile . '</label>'; helpbutton('importfromfile', '', 'data'); echo '</td><td>'; echo '<form id="uploadpreset" method="post" action="preset.php">'; echo '<fieldset class="invisiblefieldset">'; echo '<input type="hidden" name="d" value="' . $data->id . '" />'; echo '<input type="hidden" name="action" value="importzip" />'; echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />'; echo '<input name="file" size="20" value="" id="fromfile" type="text" /><input name="coursefiles" value="' . $strchooseorupload . '" onclick="return openpopup(' . "'/files/index.php?id=2&choose=uploadpreset.file', 'coursefiles', 'menubar=0,location=0,scrollbars,resizable,width=750,height=500', 0" . ');" type="button" />'; echo '<input type="submit" value="' . $strimport . '" />'; echo '</fieldset></form>'; echo '</td></tr>'; echo '<tr valign="top"><td><label>' . $strusestandard . '</label>'; helpbutton('usepreset', '', 'data'); echo '</td><td>'; echo '<form id="presets" method="post" action="preset.php" >'; echo '<fieldset class="invisiblefieldset">'; echo '<input type="hidden" name="d" value="' . $data->id . '" />'; echo '<input type="hidden" name="action" value="importpreset" />'; echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />'; $i = 0; foreach ($presets as $id => $preset) { $screenshot = ''; if (!empty($preset->userid)) { $user = get_record('user', 'id', $preset->userid); $desc = $preset->name . ' (' . fullname($user, true) . ')'; } else { $desc = $preset->name; }
/** * Abstracted version of helpbutton() / help_icon() to work with Moodle 1.8 through 2.0 * * @param string $page The keyword that defines a help page * @param string $title The title of links * @param string $module Which module is the page defined in * @param mixed $image Use a help image for the link? (true/false/"both") * @param boolean $linktext If true, display the title next to the help icon. * @param string $text If defined then this text is used in the page * @param boolean $return If true then the output is returned as a string, if false it is printed to the current page. * @param string $imagetext The full text for the helpbutton icon. If empty use default help.gif * @return string|void Depending on value of $return */ function turnitintool_help_icon($page, $title, $module = 'moodle', $image = true, $linktext = false, $text = '', $return = false, $imagetext = '') { global $OUTPUT; if (is_callable(array($OUTPUT, 'help_icon'))) { if (!$return) { echo $OUTPUT->help_icon($page, 'turnitintool'); } else { return $OUTPUT->help_icon($page, 'turnitintool'); } } else { return helpbutton($page, $title, $module, $image, $linktext, $text, $return, $imagetext); } }
function print_options_form($quiz, $cm, $attempts, $lowlimit = 0, $pagesize = 10) { global $CFG, $USER; echo '<div class="controls">'; echo '<form id="options" action="report.php" method="post">'; echo '<fieldset class="invisiblefieldset">'; echo '<p class="quiz-report-options">' . get_string('analysisoptions', 'quiz') . ': </p>'; echo '<input type="hidden" name="id" value="' . $cm->id . '" />'; echo '<input type="hidden" name="q" value="' . $quiz->id . '" />'; echo '<input type="hidden" name="mode" value="analysis" />'; echo '<p><label for="menuattemptselection">' . get_string('attemptselection', 'quiz_analysis') . '</label> '; $options = array(QUIZ_ALLATTEMPTS => get_string("attemptsall", 'quiz_analysis'), QUIZ_HIGHESTATTEMPT => get_string("attemptshighest", 'quiz_analysis'), QUIZ_FIRSTATTEMPT => get_string("attemptsfirst", 'quiz_analysis'), QUIZ_LASTATTEMPT => get_string("attemptslast", 'quiz_analysis')); choose_from_menu($options, "attemptselection", "{$attempts}", ""); echo '</p>'; echo '<p><label for="lowmarklimit">' . get_string('lowmarkslimit', 'quiz_analysis') . '</label> '; echo '<input type="text" id="lowmarklimit" name="lowmarklimit" size="1" value="' . $lowlimit . '" /> % </p>'; echo '<p><label for="pagesize">' . get_string('pagesize', 'quiz_analysis') . '</label> '; echo '<input type="text" id="pagesize" name="pagesize" size="1" value="' . $pagesize . '" /></p>'; echo '<p><input type="submit" value="' . get_string('go') . '" />'; helpbutton("analysisoptions", get_string("analysisoptions", 'quiz_analysis'), 'quiz'); echo '</p>'; echo '</fieldset>'; echo '</form>'; echo '</div>'; echo "\n"; echo '<table class="boxaligncenter"><tr>'; $options = array(); $options["id"] = "{$cm->id}"; $options["q"] = "{$quiz->id}"; $options["mode"] = "analysis"; $options['sesskey'] = $USER->sesskey; $options["noheader"] = "yes"; echo '<td>'; $options["download"] = "ODS"; print_single_button("report.php", $options, get_string("downloadods")); echo "</td>\n"; echo '<td>'; $options["download"] = "Excel"; print_single_button("report.php", $options, get_string("downloadexcel")); echo "</td>\n"; if (file_exists("{$CFG->libdir}/phpdocwriter/lib/include.php")) { echo '<td>'; $options["download"] = "OOo"; print_single_button("report.php", $options, get_string("downloadooo", "quiz_analysis")); echo "</td>\n"; } echo '<td>'; $options["download"] = "CSV"; print_single_button('report.php', $options, get_string("downloadtext")); echo "</td>\n"; echo "<td>"; helpbutton('analysisdownload', get_string('analysisdownload', 'quiz_analysis'), 'quiz'); echo "</td>\n"; echo '</tr></table>'; }
echo "</div>\n"; echo "</td></tr>\n"; for ($i = 0; $i < $lesson->maxanswers; $i++) { $iplus1 = $i + 1; echo "<tr><td><strong>" . get_string("description", "lesson") . " {$iplus1}:</strong><br />\n"; print_textarea(false, 10, 70, 630, 300, "answer[{$i}]"); echo "</td></tr>\n"; echo "<tr><td><strong>" . get_string("jump", "lesson") . " {$iplus1}:</strong> \n"; if ($i) { // answers 2, 3, 4... jumpto this page choose_from_menu($jump, "jumpto[{$i}]", 0, ""); } else { // answer 1 jumpto next page choose_from_menu($jump, "jumpto[{$i}]", LESSON_NEXTPAGE, ""); } helpbutton("jumpto", get_string("jump", "lesson"), "lesson"); echo "</td></tr>\n"; } // close table and form ?> </table><br /> <input type="submit" value="<?php print_string("addabranchtable", "lesson"); ?> " /> <input type="submit" name="cancel" value="<?php print_string("cancel"); ?> " /> </fieldset> </form>
echo "<a title=\"{$strallowchoice}\" href=\"subscribe.php?id={$forum->id}&force=no\">{$strallowchoice}</a>"; } else { echo $streveryoneisnowsubscribed; } echo '</span><br />'; } else { if ($forum->forcesubscribe == FORUM_DISALLOWSUBSCRIBE) { $strsubscriptionsoff = get_string('disallowsubscribe', 'forum'); echo $strsubscriptionsoff; helpbutton("subscription", $strsubscriptionsoff, "forum"); } else { $streveryonecannowchoose = get_string("everyonecannowchoose", "forum"); $strforcesubscribe = get_string("forcesubscribe", "forum"); $strshowsubscribers = get_string("showsubscribers", "forum"); echo '<span class="helplink">' . get_string("allowsallsubscribe", 'forum') . '</span><br />'; helpbutton("subscription", $strforcesubscribe, "forum"); echo ' '; if (has_capability('moodle/course:manageactivities', $context)) { echo "<span class=\"helplink\"><a title=\"{$strforcesubscribe}\" href=\"subscribe.php?id={$forum->id}&force=yes\">{$strforcesubscribe}</a></span>"; echo "<br />"; echo "<span class=\"helplink\"><a href=\"subscribers.php?id={$forum->id}\">{$strshowsubscribers}</a></span>"; } else { echo '<span class="helplink">' . $streveryonecannowchoose . '</span>'; } echo '<div class="helplink" id="subscriptionlink">', forum_get_subscribe_link($forum, $context, array('forcesubscribed' => '', 'cantsubscribe' => '')), '</div>'; } } if ($forum->trackingtype == FORUM_TRACKING_OPTIONAL && forum_tp_can_track_forums($forum)) { echo '<div class="helplink" id="trackinglink">' . forum_get_tracking_link($forum) . '</div>'; } }
} function setfocus() { document.getElementsByName("chat_message")[0].focus(); } </script> <?php $meta = ob_get_clean(); // TODO: there will be two onload in body tag, does it matter? print_header('', '', '', 'inputform.chat_message', $meta, false, ' ', '', false, 'onload="setfocus();"'); ?> <form action="../empty.php" method="get" target="empty" id="inputform" onsubmit="return empty_field_and_submit();"> <input type="text" name="chat_message" size="60" value="" /> <?php helpbutton("chatting", get_string("helpchatting", "chat"), "chat", true, false); ?> </form> <form action="<?php echo "http://{$CFG->chat_serverhost}:{$CFG->chat_serverport}/"; ?> " method="get" target="empty" id="sendform"> <input type="hidden" name="win" value="message" /> <input type="hidden" name="chat_message" value="" /> <input type="hidden" name="chat_msgidnr" value="0" /> <input type="hidden" name="chat_sid" value="<?php echo $chat_sid; ?> " /> </form>