function print_header() { global $CFG; popup_form('admin.php?type=' . $this->type . '&path=', $this->current_assignments, 'path_selector', $this->path, 'Year/College/Major', '', '', false, 'self', get_string('academic_current', 'block_student_gradeviewer')); // Once we have everything we need, then we can load the javascript // for the auto complete echo '<script type="text/javascript">'; foreach ($this->fields as $field => $values) { echo data_reduce($field, $values); } echo '</script>'; // Get all the libraries required for the yui stuff require_js(array($CFG->wwwroot . '/lib/yui/yahoo/yahoo-min.js', $CFG->wwwroot . '/lib/yui/event/event-min.js', $CFG->wwwroot . '/lib/yui/animation/animation-min.js', $CFG->wwwroot . '/lib/yui/yahoo-dom-event/yahoo-dom-event.js', $CFG->wwwroot . '/lib/yui/autocomplete/autocomplete-min.js', $CFG->wwwroot . '/blocks/student_gradeviewer/admin/functions.js')); // The yui autocomplete has to have the most complicated html setup echo '<div class="admin_header"> <div class="yui-skin-sam"> <form method="post"> <div class="admin_inputs"> ' . array_reduce($this->input_fields, array($this, 'input_reduce'), ' ') . ' </div> <div class="submit_button"> <input type="submit" value="' . get_string('submit') . '"> </div> </form> </div> </div>'; $this->print_errors(); $header_strings = array_reduce($this->input_fields, array($this, 'header_strings'), ''); $assigning = get_string('admin_assigning', 'block_student_gradeviewer'); $this->header_string($assigning . $header_strings); }
function print_header() { popup_form('admin.php?type=' . $this->type . '&path=', $this->mentors, 'mentor_selector', $this->path, 'choose', '', '', false, 'self', get_string('person_assign', 'block_student_gradeviewer')); $this->print_errors(); if (isset($this->mentors[$this->path])) { $a->person = $this->mentors[$this->path]; } $header = $this->path == 0 ? get_string('person_select', 'block_student_gradeviewer') : get_string('person_mentors', 'block_student_gradeviewer', $a); $this->header_string($header); }
function print_header() { global $CFG; popup_form('admin.php?type=' . $this->type . '&path=', $this->sports, 'sport_selector', $this->path, '', '', '', false, 'self', get_string('sports_assign', 'block_student_gradeviewer')); if ($this->path != 'NA') { echo ' <a href="admin.php?type=name&path=' . $this->path . '"><img src="' . $CFG->pixpath . '/i/edit.gif"/></a>'; } // Any validation errors should be printed first $this->print_errors(); $this->header_string(get_string('admin_assigning', 'block_student_gradeviewer') . $this->get_sport()); }
function update_student_status_menu($userid, $courseid) { global $CFG; $userid = optional_param('userid', 0, PARAM_INT); if ($userid > 0) { $user = get_record('user', 'id', $userid); } else { $user = $USER; } if (!($post = get_record('ilpconcern_status', 'userid', $user->id))) { $post->status = 0; } $options = array(get_string('green', 'ilpconcern'), get_string('amber', 'ilpconcern'), get_string('red', 'ilpconcern')); popup_form($CFG->wwwroot . '/mod/ilpconcern/concerns_view.php?' . ($courseid > 1 ? 'courseid=' . $courseid . '&' : '') . '&userid=' . $userid . '&action=updatestatus&studentstatus=', $options, "studentstatus", $post->status, "", "", "", false, 'self', get_string('updatestatus', 'ilpconcern')); }
function report_stats_mode_menu($course, $mode, $time, $url) { global $CFG; /* $reportoptions = stats_get_report_options($course->id, $mode); $timeoptions = report_stats_timeoptions($mode); if (empty($timeoptions)) { print_error('nostatstodisplay', '', $CFG->wwwroot.'/course/view.php?id='.$course->id); } */ $options = array(); $options[STATS_MODE_GENERAL] = get_string('statsmodegeneral'); $options[STATS_MODE_DETAILED] = get_string('statsmodedetailed'); if (has_capability('coursereport/stats:view', get_context_instance(CONTEXT_SYSTEM))) { $options[STATS_MODE_RANKED] = get_string('reports'); } return popup_form($url . "?course={$course->id}&time={$time}&mode=", $options, 'switchmode', $mode, '', '', '', true); }
function get_content() { global $CFG, $ME, $COURSE; //get list of themes $themes = get_list_of_themes(); if ($this->content !== NULL) { return $this->content; } $this->content->footer = ''; $this->content->text = ''; $context = get_context_instance(CONTEXT_BLOCK, $this->instance->id); if (has_capability('block/session_theme:switchthemes', $context)) { $this->content->text .= popup_form($ME . '?id=' . $COURSE->id . '&theme=', $themes, 'sessionthemeform', current_theme(), 'choose', '', '', true); $this->content->footer .= ''; } else { $this->content = ''; } return $this->content; }
function print_header($title) { global $USER, $CFG; $replacements = array('%fullname%' => get_string('mymoodle', 'my')); foreach ($replacements as $search => $replace) { $title = str_replace($search, $replace, $title); } $site = get_site(); $button = update_mymoodle_icon($USER->id); $nav = get_string('mymoodle', 'my'); $header = $site->shortname . ': ' . $nav; $navlinks = array(array('name' => $nav, 'link' => '', 'type' => 'misc')); $navigation = build_navigation($navlinks); $loggedinas = user_login_string($site); if (empty($CFG->langmenu)) { $langmenu = ''; } else { $currlang = current_language(); $langs = get_list_of_languages(); $langlabel = get_accesshide(get_string('language')); $langmenu = popup_form($CFG->wwwroot . '/my/index.php?lang=', $langs, 'chooselang', $currlang, '', '', '', true, 'self', $langlabel); } print_header($title, $header, $navigation, '', '', true, $button, $loggedinas . $langmenu); }
protected function menuitems_to_html($menuitems, $depth = 0) { if (empty($menuitems)) { return ''; } $options = array(); $children = array(); $selected = ''; foreach ($menuitems as $menuitem) { $options[$menuitem->url] = $menuitem->title; if ($menuitem->childtree) { // Sort of hackish, but works $selected = $menuitem->url; $children[] = $this->menuitems_to_html($menuitem->childtree, $depth + 1); } // This selected takes priority if (!empty($menuitem->active)) { $selected = $menuitem->url; } } $html = popup_form('', $options, "pagemenudropdown{$depth}", $selected, 'choose', '', '', true); $html .= "<br /><br />\n" . implode("<br /><br />\n", $children); return $html; }
FROM ' . $CFG->prefix . 'user WHERE ' . $select . ' AND id NOT IN ( SELECT u.id FROM ' . $CFG->prefix . 'role_assignments r, ' . $CFG->prefix . 'user u WHERE r.contextid = ' . $contextid . ' AND u.id = r.userid AND r.roleid = ' . $roleid . ' ' . $selectsql . ') ORDER BY lastname ASC, firstname ASC'); $usercount = $availableusers->_numOfRows; } echo '<div class="selector">'; $assignableroles = array('0' => get_string('listallroles', 'role') . '...') + $assignableroles; popup_form("{$CFG->wwwroot}/{$CFG->admin}/roles/assign.php?userid={$userid}&courseid={$courseid}&contextid={$contextid}&roleid=", $assignableroles, 'switchrole', $roleid, '', '', '', false, 'self', $strroletoassign); echo '</div>'; print_simple_box_start('center'); include 'assign.html'; print_simple_box_end(); if (!empty($errors)) { $msg = '<p>'; foreach ($errors as $e) { $msg .= $e . '<br />'; } $msg .= '</p>'; print_simple_box_start('center'); notify($msg); print_simple_box_end(); } //Back to Assign Roles button
} $rolenames = array(-1 => $strallsiteusers) + $rolenames; } /// If there are multiple Roles in the course, then show a drop down menu for switching if (count($rolenames) > 1) { echo '<div class="rolesform">'; echo '<label for="rolesform_jump">' . get_string('currentrole', 'role') . ' </label>'; if ($context->id != $frontpagectx->id) { $rolenames = array(0 => get_string('all')) + $rolenames; } else { if (!$CFG->defaultfrontpageroleid) { // we do not want "All users with role" - we already have all users in defualt frontpage role option $rolenames = array(0 => get_string('userswithrole', 'role')) + $rolenames; } } popup_form("{$CFG->wwwroot}/user/index.php?contextid={$context->id}&sifirst=&silast=&roleid=", $rolenames, 'rolesform', $roleid, ''); echo '</div>'; } else { if (count($rolenames) == 1) { // when all users with the same role - print its name echo '<div class="rolesform">'; echo get_string('role') . ': '; $rolename = reset($rolenames); echo $rolename; echo '</div>'; } } if ($roleid > 0) { if (!($currentrole = $DB->get_record('role', array('id' => $roleid)))) { print_error('invalidroleid'); }
function action_default() { // Get parameters $sort = optional_param('sort', 'name', PARAM_ALPHA); $dir = optional_param('dir', 'ASC', PARAM_ALPHA); $page = optional_param('page', 0, PARAM_INT); $perpage = optional_param('perpage', 30, PARAM_INT); // how many per page $namesearch = trim(optional_param('search', '', PARAM_TEXT)); $alpha = optional_param('alpha', '', PARAM_ALPHA); $parent = $this->optional_param('id', 0, PARAM_INT); $classification = $this->optional_param('classification', NULL, PARAM_SAFEDIR); if ($parent) { $this->print_tabs('subclusters', array('id' => $parent)); } // Define columns $columns = array('name' => get_string('cluster_name', 'block_curr_admin'), 'display' => get_string('cluster_description', 'block_curr_admin')); $extrafilters = array('contexts' => clusterpage::get_contexts('block/curr_admin:cluster:view'), 'parent' => $parent, 'classification' => $classification); $items = cluster_get_listing($sort, $dir, $page * $perpage, $perpage, $namesearch, $alpha, $extrafilters); $numitems = cluster_count_records($namesearch, $alpha, $extrafilters); clusterpage::get_contexts('block/curr_admin:cluster:edit'); clusterpage::get_contexts('block/curr_admin:cluster:delete'); $this->print_list_view($items, $numitems, $columns, $filter = null, $alphaflag = true, $searchflag = true); if ($this->optional_param('id', 0, PARAM_INT)) { //get the non-parent clusters that are accessible based on the edit capability $contexts = clusterpage::get_contexts('block/curr_admin:cluster:edit'); $non_parent_clusters = cluster_get_possible_sub_clusters($this->optional_param('id', 0, PARAM_INT), $contexts); //display the dropdown if there are one or more available clusters if (count($non_parent_clusters) > 0) { echo '<div align="center">'; echo get_string('cluster_subcluster_prompt', 'block_curr_admin') . ': '; $url = $this->get_new_page(array('action' => 'subcluster', 'id' => $this->optional_param('id', 0, PARAM_INT)))->get_url() . '&subclusterid='; popup_form($url, $non_parent_clusters, 'assignsubcluster', '', 'Choose...'); echo '</div>'; } } }
/** * 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"; }
} if ($section < $course->numsections) { // Add a arrow to move section down echo '<a href="view.php?id=' . $course->id . '&random=' . rand(1, 10000) . '&section=' . $section . '&move=1&sesskey=' . $USER->sesskey . '#section-' . ($section + 1) . '" title="' . $strmovedown . '">' . '<img src="' . $CFG->pixpath . '/t/down.gif" class="iconsmall down" alt="' . $strmovedown . '" /></a><br />'; } } echo '</td></tr>'; echo '<tr class="section separator"><td colspan="3" class="spacer"></td></tr>'; } $section++; $weekdate = $nextweekdate; } echo '</table>'; if (!empty($sectionmenu)) { echo '<div class="jumpmenu">'; echo popup_form($CFG->wwwroot . '/course/view.php?id=' . $course->id . '&', $sectionmenu, 'sectionmenu', '', get_string('jumpto'), '', '', true); echo '</div>'; } print_container_end(); echo '</td>'; break; case 'right': // The right column if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $editing) { echo '<td style="width: ' . $preferred_width_right . 'px;" id="right-column">'; print_container_start(); blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT); print_container_end(); echo '</td>'; } break;
function blocks_print_adminblock(&$page, &$pageblocks) { global $USER; $missingblocks = blocks_get_missing($page, $pageblocks); if (!empty($missingblocks)) { $strblocks = '<div class="title"><h2>'; $strblocks .= get_string('blocks'); $strblocks .= '</h2></div>'; $stradd = get_string('add'); foreach ($missingblocks as $blockid) { $block = blocks_get_record($blockid); $blockobject = block_instance($block->name); if ($blockobject === false) { continue; } if (!$blockobject->user_can_addto($page)) { continue; } $menu[$block->id] = $blockobject->get_title(); } asort($menu); $target = $page->url_get_full(array('sesskey' => $USER->sesskey, 'blockaction' => 'add')); $content = popup_form($target . '&blockid=', $menu, 'add_block', '', $stradd . '...', '', '', true); print_side_block($strblocks, $content, NULL, NULL, NULL, array('class' => 'block_adminblock')); } }
/** * Prints an appropriate group selection menu * * @uses VISIBLEGROUPS * @param array $groups ? * @param int $groupmode ? * @param string $currentgroup ? * @param string $urlroot ? * @param boolean $showall: if set to 0, it is a student in separate groups, do not display all participants * @todo Finish documenting this function */ function print_group_menu($groups, $groupmode, $currentgroup, $urlroot, $showall = 1, $return = false) { $output = ''; $groupsmenu = array(); /// Add an "All groups" to the start of the menu if ($showall) { $groupsmenu[0] = get_string('allparticipants'); } foreach ($groups as $key => $group) { $groupsmenu[$key] = format_string($group->name); } if ($groupmode == VISIBLEGROUPS) { $grouplabel = get_string('groupsvisible'); } else { $grouplabel = get_string('groupsseparate'); } if (count($groupsmenu) == 1) { $groupname = reset($groupsmenu); $output .= $grouplabel . ': ' . $groupname; } else { $output .= popup_form($urlroot . '&group=', $groupsmenu, 'selectgroup', $currentgroup, '', '', '', true, 'self', $grouplabel); } if ($return) { return $output; } else { echo $output; } }
/** * 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"; }
print_header("{$site->shortname}: {$category->name}", "{$site->fullname}: {$strcourses}", $navigation, "", "", true, $navbaritem); } /// Print button to turn editing off if ($adminediting) { echo '<div class="categoryediting button">' . update_category_button($category->id) . '</div>'; } /// Print link to roles if (has_capability('moodle/role:assign', $context)) { echo '<div class="rolelink"><a href="' . $CFG->wwwroot . '/' . $CFG->admin . '/roles/assign.php?contextid=' . $context->id . '">' . get_string('assignroles', 'role') . '</a></div>'; } /// Print the category selector $displaylist = array(); $parentlist = array(); make_categories_list($displaylist, $parentlist, ""); echo '<div class="categorypicker">'; popup_form('category.php?id=', $displaylist, 'switchcategory', $category->id, '', '', '', false, 'self', $strcategories . ':'); echo '</div>'; /// Print current category description if (!$creatorediting && $category->description) { print_box_start(); echo format_text($category->description); // for multilang filter print_box_end(); } /// Editing functions if ($creatorediting) { /// Move a specified course to a new category if (!empty($deletecourses) and $data = data_submitted() and confirm_sesskey()) { // Some courses are being moved // user must have category update in both cats to perform this require_capability('moodle/category:update', $context);
/** * Given a course and a (current) coursemodule * This function returns a small popup menu with all the * course activity modules in it, as a navigation menu * The data is taken from the serialised array stored in * the course record * * @param course $course A {@link $COURSE} object. * @param course $cm A {@link $COURSE} object. * @param string $targetwindow ? * @return string * @todo Finish documenting this function */ function navmenu($course, $cm = NULL, $targetwindow = 'self') { global $CFG, $THEME, $USER, $DB; require_once $CFG->dirroot . '/course/lib.php'; // Required for get_fast_modinfo if (empty($THEME->navmenuwidth)) { $width = 50; } else { $width = $THEME->navmenuwidth; } if ($cm) { $cm = $cm->id; } if ($course->format == 'weeks') { $strsection = get_string('week'); } else { $strsection = get_string('topic'); } $strjumpto = get_string('jumpto'); $modinfo = get_fast_modinfo($course); $context = get_context_instance(CONTEXT_COURSE, $course->id); $section = -1; $selected = ''; $url = ''; $previousmod = NULL; $backmod = NULL; $nextmod = NULL; $selectmod = NULL; $logslink = NULL; $flag = false; $menu = array(); $menustyle = array(); $sections = $DB->get_records('course_sections', array('course' => $course->id), 'section', 'section,visible,summary'); if (!empty($THEME->makenavmenulist)) { /// A hack to produce an XHTML navmenu list for use in themes $THEME->navmenulist = navmenulist($course, $sections, $modinfo, $strsection, $strjumpto, $width, $cm); } foreach ($modinfo->cms as $mod) { if ($mod->modname == 'label') { continue; } if ($mod->sectionnum > $course->numsections) { /// Don't show excess hidden sections break; } if (!$mod->uservisible) { // do not icnlude empty sections at all continue; } if ($mod->sectionnum > 0 and $section != $mod->sectionnum) { $thissection = $sections[$mod->sectionnum]; if ($thissection->visible or !$course->hiddensections or has_capability('moodle/course:viewhiddensections', $context)) { $thissection->summary = strip_tags(format_string($thissection->summary, true)); if ($course->format == 'weeks' or empty($thissection->summary)) { $menu[] = '--' . $strsection . " " . $mod->sectionnum; } else { if (strlen($thissection->summary) < $width - 3) { $menu[] = '--' . $thissection->summary; } else { $menu[] = '--' . substr($thissection->summary, 0, $width) . '...'; } } $section = $mod->sectionnum; } else { // no activities from this hidden section shown continue; } } $url = $mod->modname . '/view.php?id=' . $mod->id; if ($flag) { // the current mod is the "next" mod $nextmod = $mod; $flag = false; } $localname = $mod->name; if ($cm == $mod->id) { $selected = $url; $selectmod = $mod; $backmod = $previousmod; $flag = true; // set flag so we know to use next mod for "next" $localname = $strjumpto; $strjumpto = ''; } else { $localname = strip_tags(format_string($localname, true)); $tl = textlib_get_instance(); if ($tl->strlen($localname) > $width + 5) { $localname = $tl->substr($localname, 0, $width) . '...'; } if (!$mod->visible) { $localname = '(' . $localname . ')'; } } $menu[$url] = $localname; if (empty($THEME->navmenuiconshide)) { $menustyle[$url] = 'style="background-image: url(' . $CFG->modpixpath . '/' . $mod->modname . '/icon.gif);"'; // Unfortunately necessary to do this here } $previousmod = $mod; } //Accessibility: added Alt text, replaced > < with 'silent' character and 'accesshide' text. if ($selectmod and has_capability('coursereport/log:view', $context)) { $logstext = get_string('alllogs'); $logslink = '<li>' . "\n" . '<a title="' . $logstext . '" ' . $CFG->frametarget . 'onclick="this.target=\'' . $CFG->framename . '\';"' . ' href="' . $CFG->wwwroot . '/course/report/log/index.php?chooselog=1&user=0&date=0&id=' . $course->id . '&modid=' . $selectmod->id . '">' . '<img class="icon log" src="' . $CFG->pixpath . '/i/log.gif" alt="' . $logstext . '" /></a>' . "\n" . '</li>'; } if ($backmod) { $backtext = get_string('activityprev', 'access'); $backmod = '<li><form action="' . $CFG->wwwroot . '/mod/' . $backmod->modname . '/view.php" ' . 'onclick="this.target=\'' . $CFG->framename . '\';"' . '><fieldset class="invisiblefieldset">' . '<input type="hidden" name="id" value="' . $backmod->id . '" />' . '<button type="submit" title="' . $backtext . '">' . link_arrow_left($backtext, $url = '', $accesshide = true) . '</button></fieldset></form></li>'; } if ($nextmod) { $nexttext = get_string('activitynext', 'access'); $nextmod = '<li><form action="' . $CFG->wwwroot . '/mod/' . $nextmod->modname . '/view.php" ' . 'onclick="this.target=\'' . $CFG->framename . '\';"' . '><fieldset class="invisiblefieldset">' . '<input type="hidden" name="id" value="' . $nextmod->id . '" />' . '<button type="submit" title="' . $nexttext . '">' . link_arrow_right($nexttext, $url = '', $accesshide = true) . '</button></fieldset></form></li>'; } return '<div class="navigation">' . "\n" . '<ul>' . $logslink . $backmod . '<li>' . popup_form($CFG->wwwroot . '/mod/', $menu, 'navmenupopup', $selected, $strjumpto, '', '', true, $targetwindow, '', $menustyle) . '</li>' . $nextmod . '</ul>' . "\n" . '</div>'; }
redirect(get_login_url()); } else { if ($user = $mform_signup->get_data()) { $user->confirmed = 0; $user->lang = current_language(); $user->firstaccess = time(); $user->mnethostid = $CFG->mnet_localhost_id; $user->secret = random_string(15); $user->auth = $CFG->registerauth; $authplugin->user_signup($user, true); // prints notice and link to login/index.php exit; //never reached } } $newaccount = get_string('newaccount'); $login = get_string('login'); if (empty($CFG->langmenu)) { $langmenu = ''; } else { $currlang = current_language(); $langs = get_list_of_languages(); $langmenu = popup_form("{$CFG->wwwroot}/login/signup.php?lang=", $langs, "chooselang", $currlang, "", "", "", true); } $navlinks = array(); $navlinks[] = array('name' => $login, 'link' => "index.php", 'type' => 'misc'); $navlinks[] = array('name' => $newaccount, 'link' => null, 'type' => 'misc'); $navigation = build_navigation($navlinks); print_header($newaccount, $newaccount, $navigation, $mform_signup->focus(), "", true, "<div class=\"langmenu\">{$langmenu}</div>"); $mform_signup->display(); print_footer();
$groups = array(forum::ALL_GROUPS => get_string('allparticipants')); $groups = $groups + $oldgroups; } // Get label for selector if ($course->groupmode == VISIBLEGROUPS) { $grouplabel = get_string('groupsvisible'); } else { $grouplabel = get_string('groupsseparate'); } // Draw group selector $url = $CFG->wwwroot . "/mod/forumng/feature/userposts/list.php?" . $forum->get_link_params(forum::PARAM_HTML); if (count($groups) == 1) { print '<div class="groupselector">' . $grouplabel . ': ' . end($groups) . '</div>'; } else { // do only if we have more than one group $popupform = popup_form($url . '&group=', $groups, 'forumng-groupselector', $groupid, '', '', '', false, 'self', $grouplabel); } } print '<div class="clearer"></div>'; // Get all users if (!($users = $forum->get_monitored_users($groupid))) { print_string('nothingtodisplay', 'forumng'); // Display link to the discussion print link_arrow_left($forum->get_name(), '../../view.php?id=' . $cmid); // Display footer print_footer($course); return; } $data = array(); foreach ($users as $id => $u) { // Set table-row colour to gray for users without data (default)
function scorm_get_toc($user, $scorm, $liststyle, $currentorg = '', $scoid = '', $mode = 'normal', $attempt = '', $play = false) { global $CFG; $strexpand = get_string('expcoll', 'scorm'); $modestr = ''; if ($mode == 'browse') { $modestr = '&mode=' . $mode; } $scormpixdir = $CFG->modpixpath . '/scorm/pix'; $result = new stdClass(); $result->toc = "<ul id='s0' class='{$liststyle}'>\n"; $tocmenus = array(); $result->prerequisites = true; $incomplete = false; // // Get the current organization infos // $organizationsql = ''; if (!empty($currentorg)) { if (($organizationtitle = get_field('scorm_scoes', 'title', 'scorm', $scorm->id, 'identifier', $currentorg)) != '') { $result->toc .= "\t<li>{$organizationtitle}</li>\n"; $tocmenus[] = $organizationtitle; } $organizationsql = "AND organization='{$currentorg}'"; } // // If not specified retrieve the last attempt number // if (empty($attempt)) { $attempt = scorm_get_last_attempt($scorm->id, $user->id); } $result->attemptleft = $scorm->maxattempt - $attempt; if ($scoes = get_records_select('scorm_scoes', "scorm='{$scorm->id}' {$organizationsql} order by id ASC")) { // // Retrieve user tracking data for each learning object // $usertracks = array(); foreach ($scoes as $sco) { if (!empty($sco->launch)) { if ($usertrack = scorm_get_tracks($sco->id, $user->id, $attempt)) { if ($usertrack->status == '') { $usertrack->status = 'notattempted'; } $usertracks[$sco->identifier] = $usertrack; } } } $level = 0; $sublist = 1; $previd = 0; $nextid = 0; $findnext = false; $parents[$level] = '/'; foreach ($scoes as $sco) { $isvisible = false; $sco->title = stripslashes($sco->title); if ($optionaldatas = scorm_get_sco($sco->id, SCO_DATA)) { if (!isset($optionaldatas->isvisible) || isset($optionaldatas->isvisible) && $optionaldatas->isvisible == 'true') { $isvisible = true; } } else { $isvisible = true; } if ($parents[$level] != $sco->parent) { if ($newlevel = array_search($sco->parent, $parents)) { for ($i = 0; $i < $level - $newlevel; $i++) { $result->toc .= "\t\t</ul></li>\n"; } $level = $newlevel; } else { $i = $level; $closelist = ''; while ($i > 0 && $parents[$level] != $sco->parent) { $closelist .= "\t\t</ul></li>\n"; $i--; } if ($i == 0 && $sco->parent != $currentorg) { $style = ''; if (isset($_COOKIE['hide:SCORMitem' . $sco->id])) { $style = ' style="display: none;"'; } $result->toc .= "\t\t<li><ul id='s{$sublist}' class='{$liststyle}'{$style}>\n"; $level++; } else { $result->toc .= $closelist; $level = $i; } $parents[$level] = $sco->parent; } } if ($isvisible) { $result->toc .= "\t\t<li>"; } $nextsco = next($scoes); $nextisvisible = false; if ($nextsco !== false && ($optionaldatas = scorm_get_sco($nextsco->id, SCO_DATA))) { if (!isset($optionaldatas->isvisible) || isset($optionaldatas->isvisible) && $optionaldatas->isvisible == 'true') { $nextisvisible = true; } } if ($nextisvisible && $nextsco !== false && $sco->parent != $nextsco->parent && ($level == 0 || $level > 0 && $nextsco->parent == $sco->identifier)) { $sublist++; $icon = 'minus'; if (isset($_COOKIE['hide:SCORMitem' . $nextsco->id])) { $icon = 'plus'; } $result->toc .= '<a href="javascript:expandCollide(\'img' . $sublist . '\',' . $sublist . ',' . $nextsco->id . ');"><img id="img' . $sublist . '" src="' . $scormpixdir . '/' . $icon . '.gif" alt="' . $strexpand . '" title="' . $strexpand . '"/></a>'; // $result->toc .= '<a href="#" onclick="elementToggleHide(\''.$sublist.'\',true);"><img id="img'.$sublist.'" src="'.$scormpixdir.'/'.$icon.'.gif" alt="'.$strexpand.'" title="'.$strexpand.'"/></a>'; } else { if ($isvisible) { $result->toc .= '<img src="' . $scormpixdir . '/spacer.gif" />'; } } if (empty($sco->title)) { $sco->title = $sco->identifier; } if (!empty($sco->launch)) { if ($isvisible) { $startbold = ''; $endbold = ''; $score = ''; if (empty($scoid) && $mode != 'normal') { $scoid = $sco->id; } if (isset($usertracks[$sco->identifier])) { $usertrack = $usertracks[$sco->identifier]; $strstatus = get_string($usertrack->status, 'scorm'); if ($sco->scormtype == 'sco') { $statusicon = '<img src="' . $scormpixdir . '/' . $usertrack->status . '.gif" alt="' . $strstatus . '" title="' . $strstatus . '" />'; } else { $statusicon = '<img src="' . $scormpixdir . '/assetc.gif" alt="' . get_string('assetlaunched', 'scorm') . '" title="' . get_string('assetlaunched', 'scorm') . '" />'; } if ($usertrack->status == 'notattempted' || $usertrack->status == 'incomplete' || $usertrack->status == 'browsed') { $incomplete = true; if ($play && empty($scoid)) { $scoid = $sco->id; } } if ($usertrack->score_raw != '') { $score = '(' . get_string('score', 'scorm') . ': ' . $usertrack->score_raw . ')'; } $strsuspended = get_string('suspended', 'scorm'); if (isset($usertrack->{'cmi.core.exit'}) && $usertrack->{'cmi.core.exit'} == 'suspend') { $statusicon = '<img src="' . $scormpixdir . '/suspend.gif" alt="' . $strstatus . ' - ' . $strsuspended . '" title="' . $strstatus . ' - ' . $strsuspended . '" />'; } } else { if ($play && empty($scoid)) { $scoid = $sco->id; } $incomplete = true; if ($sco->scormtype == 'sco') { $statusicon = '<img src="' . $scormpixdir . '/notattempted.gif" alt="' . get_string('notattempted', 'scorm') . '" title="' . get_string('notattempted', 'scorm') . '" />'; } else { $statusicon = '<img src="' . $scormpixdir . '/asset.gif" alt="' . get_string('asset', 'scorm') . '" title="' . get_string('asset', 'scorm') . '" />'; } } if ($sco->id == $scoid) { $scodata = scorm_get_sco($sco->id, SCO_DATA); $startbold = '<b>'; $endbold = '</b>'; $findnext = true; $shownext = isset($scodata->next) ? $scodata->next : 0; $showprev = isset($scodata->previous) ? $scodata->previous : 0; } if ($nextid == 0 && scorm_count_launchable($scorm->id, $currentorg) > 1 && $nextsco !== false && !$findnext) { if (!empty($sco->launch)) { $previd = $sco->id; } } if (empty($sco->prerequisites) || scorm_eval_prerequisites($sco->prerequisites, $usertracks)) { if ($sco->id == $scoid) { $result->prerequisites = true; } $url = $CFG->wwwroot . '/mod/scorm/player.php?a=' . $scorm->id . '&currentorg=' . $currentorg . $modestr . '&scoid=' . $sco->id; $result->toc .= $statusicon . ' ' . $startbold . '<a href="' . $url . '">' . format_string($sco->title) . '</a>' . $score . $endbold . "</li>\n"; $tocmenus[$sco->id] = scorm_repeater('−', $level) . '>' . format_string($sco->title); } else { if ($sco->id == $scoid) { $result->prerequisites = false; } $result->toc .= $statusicon . ' ' . format_string($sco->title) . "</li>\n"; } } } else { $result->toc .= ' ' . format_string($sco->title) . "</li>\n"; } if ($nextsco !== false && $nextid == 0 && $findnext) { if (!empty($nextsco->launch)) { $nextid = $nextsco->id; } } } for ($i = 0; $i < $level; $i++) { $result->toc .= "\t\t</ul></li>\n"; } if ($play) { // it is possible that scoid is still not set, in this case we dont want an empty object if ($scoid) { $sco = scorm_get_sco($scoid); } $sco->previd = $previd; $sco->nextid = $nextid; $result->sco = $sco; $result->incomplete = $incomplete; } else { $result->incomplete = $incomplete; } } $result->toc .= "\t</ul>\n"; if ($scorm->hidetoc == 0) { $result->toc .= ' <script type="text/javascript"> //<![CDATA[ function expandCollide(which,list,item) { var nn=document.ids?true:false var w3c=document.getElementById?true:false var beg=nn?"document.ids.":w3c?"document.getElementById(":"document.all."; var mid=w3c?").style":".style"; which = which.substring(0,(which.length)); if (eval(beg+list+mid+".display") != "none") { document.getElementById(which).src = "' . $scormpixdir . '/plus.gif"; eval(beg+list+mid+".display=\'none\';"); new cookie("hide:SCORMitem" + item, 1, 356, "/").set(); } else { document.getElementById(which).src = "' . $scormpixdir . '/minus.gif"; eval(beg+list+mid+".display=\'block\';"); new cookie("hide:SCORMitem" + item, 1, -1, "/").set(); } } //]]> </script>' . "\n"; } $url = $CFG->wwwroot . '/mod/scorm/player.php?a=' . $scorm->id . '&currentorg=' . $currentorg . $modestr . '&scoid='; $result->tocmenu = popup_form($url, $tocmenus, "tocmenu", $sco->id, '', '', '', true); return $result; }
print_heading(format_string($course->shortname) . ' ' . $stroverview, 'center', 3); echo $strfiltergroups; if (!empty($CFG->enablegroupings)) { $options = array(); $options[0] = get_string('all'); foreach ($groupings as $grouping) { $options[$grouping->id] = strip_tags(format_string($grouping->name)); } popup_form($rooturl . '&group=' . $groupid . '&grouping=', $options, 'selectgrouping', $groupingid, '', '', '', false, 'self', $strgrouping); } $options = array(); $options[0] = get_string('all'); foreach ($groups as $group) { $options[$group->id] = strip_tags(format_string($group->name)); } popup_form($rooturl . '&grouping=' . $groupingid . '&group=', $options, 'selectgroup', $groupid, '', '', '', false, 'self', $strgroup); /// Print table $printed = false; foreach ($members as $gpgid => $groupdata) { if ($groupingid and $groupingid != $gpgid) { continue; // do not show } $table = new object(); $table->head = array(get_string('groupscount', 'group', count($groupdata)), get_string('groupmembers', 'group'), get_string('usercount', 'group')); $table->size = array('20%', '70%', '10%'); $table->align = array('left', 'left', 'center'); $table->width = '90%'; $table->data = array(); foreach ($groupdata as $gpid => $users) { if ($groupid and $groupid != $gpid) {
// Any other case, just display the fallback form // Any other case, just display the fallback form default: $file = 'fallback_form.html'; } // If a file has been specified, display it with the site header/footer. if (isset($file)) { // Define variables used in page if (!($site = get_site())) { print_error('auth_openid_no_site', 'auth_openid'); } if (empty($CFG->langmenu)) { $langmenu = ""; } else { $currlang = current_language(); $langs = get_list_of_languages(); $langlabel = '<span class="accesshide">' . get_string('language') . ':</span>'; $langmenu = popup_form("{$CFG->httpswwwroot}/login/index.php?lang=", $langs, "chooselang", $currlang, "", "", "", true, 'self', $langlabel); } $loginsite = get_string("loginsite"); $navlinks = array(array('name' => $loginsite, 'link' => null, 'type' => 'misc')); $navigation = build_navigation($navlinks); print_header("{$site->fullname}: {$loginsite}", $site->fullname, $navigation, '', '', true, '<div class="langmenu">' . $langmenu . '</div>'); include $file; print_footer(); } else { if (!isset($redirmsg)) { $redirmsg = ''; } redirect($CFG->wwwroot, $redirmsg); }
/** * Invoke method, every class will have its own * returns true/false on completion, setting both * errormsg and output as necessary */ function invoke() { parent::invoke(); $result = true; /// Set own core attributes $this->does_generate = ACTION_GENERATE_HTML; /// These are always here global $CFG, $XMLDB; /// Do the job, setting result as needed /// Get the dir containing the file $dirpath = required_param('dir', PARAM_PATH); $dirpath = $CFG->dirroot . stripslashes_safe($dirpath); /// Get the correct dirs if (!empty($XMLDB->dbdirs)) { $dbdir =& $XMLDB->dbdirs[$dirpath]; } else { return false; } if (!empty($XMLDB->editeddirs)) { $editeddir =& $XMLDB->editeddirs[$dirpath]; $structure =& $editeddir->xml_file->getStructure(); } /// ADD YOUR CODE HERE /// Get parameters $tableparam = required_param('table', PARAM_PATH); if (!($table =& $structure->getTable($tableparam))) { $this->errormsg = 'Wrong table specified: ' . $tableparam; return false; } $generatorparam = optional_param('generator', null, PARAM_ALPHANUM); if (empty($generatorparam)) { $generatorparam = $CFG->dbtype; } /// Calculate list of available SQL generators $plugins = get_list_of_plugins('lib/xmldb/classes/generators'); $generators = array(); foreach ($plugins as $plugin) { $generators[$plugin] = $plugin; } /// Check we have the selected generator if (!in_array($generatorparam, $generators)) { $generatorparam = reset($generators); } /// The back to edit table button $b = ' <p class="centerpara buttons">'; $b .= '<a href="index.php?action=edit_table&table=' . $tableparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['back'] . ']</a>'; $b .= '</p>'; $o = $b; $o .= ' <table id="formelements" class="boxaligncenter" cellpadding="5">'; $o .= ' <tr><td align="center">' . $this->str['selectdb']; /// Show the popup of generators $url = 'index.php?action=view_table_sql&table=' . $tableparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&generator='; $o .= popup_form($url, $generators, 'selectgenerator', $generatorparam, '', '', '', true); $o .= ' </td></tr>'; $o .= ' <tr><td><textarea cols="80" rows="32">'; /// Get an array of statements if ($starr = $table->getCreateTableSQL($generatorparam, $CFG->prefix)) { $sqltext = ''; foreach ($starr as $st) { $sqltext .= s($st) . "\n\n"; } $sqltext = trim($sqltext); $o .= $sqltext; } $o .= '</textarea></td></tr>'; $o .= ' </table>'; $this->output = $o; /// Launch postaction if exists (leave this here!) if ($this->getPostAction() && $result) { return $this->launch($this->getPostAction()); } /// Return ok if arrived here return $result; }
require_once $CFG->libdir . '/adminlib.php'; admin_externalpage_setup('frontpageroles', '', array('contextid' => $contextid, 'roleid' => $roleid), $CFG->wwwroot . '/' . $CFG->admin . '/roles/override.php'); admin_externalpage_print_header(); $currenttab = 'override'; include_once 'tabs.php'; } else { $currenttab = 'override'; include_once 'tabs.php'; } } print_heading_with_help(get_string('overridepermissionsin', 'role', print_context_name($context)), 'overrides'); if ($roleid) { /// prints a form to swap roles echo '<div class="selector">'; $overridableroles = array('0' => get_string('listallroles', 'role') . '...') + $overridableroles; popup_form("{$CFG->wwwroot}/{$CFG->admin}/roles/override.php?userid={$userid}&courseid={$courseid}&contextid={$contextid}&roleid=", $overridableroles, 'switchrole', $roleid, '', '', '', false, 'self', $strroletooverride); echo '</div>'; $parentcontexts = get_parent_contexts($context); if (!empty($parentcontexts)) { $parentcontext = array_shift($parentcontexts); $parentcontext = get_context_instance_by_id($parentcontext); } else { $parentcontext = $context; // site level in override?? } $r_caps = role_context_capabilities($roleid, $parentcontext); $localoverrides = get_records_select('role_capabilities', "roleid = {$roleid} AND contextid = {$context->id}", '', 'capability, permission, id'); $lang = str_replace('_utf8', '', current_language()); if (!empty($capabilities)) { // Print the capabilities overrideable in this context print_simple_box_start('center');
$strsection = get_string("topic"); } $section = -1; foreach ($forums as $courseforum) { if (!empty($courseforum->section) and $section != $courseforum->section) { $forummenu[] = "-------------- {$strsection} {$courseforum->section} --------------"; } $section = $courseforum->section; if ($courseforum->id != $forum->id) { $url = "discuss.php?d={$discussion->id}&fromforum={$discussion->forum}&move={$courseforum->id}"; $forummenu[$url] = format_string($courseforum->name, true); } } if (!empty($forummenu)) { echo "<div style=\"float:right;\">"; echo popup_form("{$CFG->wwwroot}/mod/forum/", $forummenu, "forummenu", "", get_string("movethisdiscussionto", "forum"), "", "", true); echo "</div>"; } } } echo "</td></tr></table>"; if (!empty($forum->blockafter) && !empty($forum->blockperiod)) { $a->blockafter = $forum->blockafter; $a->blockperiod = get_string('secondstotime' . $forum->blockperiod); notify(get_string('thisforumisthrottled', 'forum', $a)); } if ($forum->type == 'qanda' && !has_capability('mod/forum:viewqandawithoutposting', $modcontext) && !forum_user_has_posted($forum->id, $discussion->id, $USER->id)) { notify(get_string('qandanotify', 'forum')); } if (isset($discussionmoved)) { notify(get_string("discussionmoved", "forum", format_string($forum->name, true)));
print_string('savechanges'); ?> " /> <input type="submit" name="cancel" value="<?php print_string('cancel'); ?> " /> </div> </div></form> <?php print_box_end(); } /// Print a form to swap roles, and a link back to the all roles list. echo '<div class="backlink">'; popup_form($baseurl . '&roleid=', $nameswithcounts, 'switchrole', $roleid, '', '', '', false, 'self', get_string('overrideanotherrole', 'role')); echo '<p><a href="' . $baseurl . '">' . get_string('backtoallroles', 'role') . '</a></p>'; echo '</div>'; } else { if (empty($overridableroles)) { /// Print a message that there are no roles that can me assigned here. print_heading(get_string('notabletooverrideroleshere', 'role'), 'center', 3); } else { /// Show UI for choosing a role to assign. $table->tablealign = 'center'; $table->width = '60%'; $table->head = array(get_string('role'), get_string('description'), get_string('overrides', 'role')); $table->wrap = array('nowrap', '', 'nowrap'); $table->align = array('right', 'left', 'center'); foreach ($overridableroles as $roleid => $rolename) { $countusers = 0;
/// Standard resource types require_once "{$CFG->dirroot}/mod/resource/lib.php"; $resourceraw = resource_get_resource_types(); foreach ($resourceraw as $type => $name) { $resources["resource&type={$type}"] = $name; } $resources['label'] = get_string('resourcetypelabel', 'resource'); } $output = '<div style="text-align: right">'; $output .= popup_form("exercise.php?id={$course->id}§ion={$section}&sesskey={$USER->sesskey}&add=", $resources, "ressection{$section}", "", $straddresource, 'resource/types', $straddresource, true); if ($vertical) { $output .= '<div>'; } // var_dump($modnames ); $output .= ' '; $output .= popup_form("exercise.php?id={$course->id}§ion={$section}&sesskey={$USER->sesskey}&add=", $modnames, "section{$section}", "", $straddactivity, 'mods', $straddactivity, true); if ($vertical) { $output .= '</div>'; } $output .= '</div>'; echo $output; } else { // Moves, adds, updates, duplicates or deletes modules in a course -> in a hiperbook echo "1"; require "../../config.php"; require "../../course/lib.php"; echo "1a"; // require_login(); // $sectionreturn = optional_param('sr', '', PARAM_INT); if (isset($SESSION->modform)) { // Variables are stored in the session
} } if (get_moodle_cookie() == '') { set_moodle_cookie('nobody'); // To help search for cookies on login page } if (!empty($USER->id)) { add_to_log(SITEID, 'course', 'view', 'view.php?id=' . SITEID, SITEID); } if (empty($CFG->langmenu)) { $langmenu = ''; } else { $currlang = current_language(); $langs = get_list_of_languages(); $langlabel = get_accesshide(get_string('language')); $langmenu = popup_form($CFG->wwwroot . '/index.php?lang=', $langs, 'chooselang', $currlang, '', '', '', true, 'self', $langlabel); } $PAGE = page_create_object(PAGE_COURSE_VIEW, SITEID); $pageblocks = blocks_setup($PAGE); $editing = $PAGE->user_is_editing(); $preferred_width_left = bounded_number(BLOCK_L_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), BLOCK_L_MAX_WIDTH); $preferred_width_right = bounded_number(BLOCK_R_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), BLOCK_R_MAX_WIDTH); print_header($SITE->fullname, $SITE->fullname, 'home', '', '<meta name="description" content="' . strip_tags(format_text($SITE->summary, FORMAT_HTML)) . '" />', true, '', user_login_string($SITE) . $langmenu); ?> <table id="layout-table" summary="layout"> <tr> <?php $lt = empty($THEME->layouttable) ? array('left', 'middle', 'right') : $THEME->layouttable; foreach ($lt as $column) {
$menufiles['extra'] = '------------'; $menufiles_coregrp = 0; } } } $menufiles[$item_key] = $item_label; if ($currentfile == $helpfile['filename']) { $origlocation = $helpfile['location']; $origplugin = $helpfile['plugin']; } } $selectionlabel = '<code class="path">'; //$selectionlabel .= $strfilestoredin; $selectionlabel .= $uselocal ? "{$currentlang}_local" : $currentlang; $selectionlabel .= '/help/</code>'; popup_form("{$CFG->wwwroot}/{$CFG->admin}/lang.php?mode=helpfiles&currentfile=", $menufiles, "choosefile", $currentfile, $strchoosefiletoedit, '', '', false, 'self', $selectionlabel); helpbutton('langswitchstorage', $strfilestoredinhelp, 'moodle'); print_box_end(); if (!empty($currentfile)) { if (!file_exists("{$saveto}/{$currentfile}")) { $dbg .= "File does not exist: {$saveto}/{$currentfile}\n"; //check if directory exist if (!file_exists(dirname("{$saveto}/{$currentfile}"))) { if (!lang_make_directory(dirname("{$saveto}/{$currentfile}"))) { echo 'Cannot create directory: ' . dirname("{$saveto}/{$currentfile}"); } } // // file doesn't exist - let's check webserver's permission to create it // if (!@touch("{$saveto}/{$currentfile}")) {