/** * This display all the documentation * @param array $functions contains all decription objects * @param array $authparam keys contains 'tokenid' * @param boolean $printableformat true if we want to display the documentation in a printable format * @param array $activatedprotocol * @param string $parenturl url of the calling page - needed for the print button url: * '/admin/documentation.php' or '/webservice/wsdoc.php' (default) * @return string the html to diplay */ public function documentation_html($functions, $printableformat, $activatedprotocol, $authparams, $parenturl = '/webservice/wsdoc.php') { $documentationhtml = $this->output->heading(get_string('wsdocapi', 'webservice')); $br = html_writer::empty_tag('br', array()); $brakeline = <<<EOF EOF; /// Some general information $docinfo = new stdClass(); $docurl = new moodle_url('http://docs.moodle.org/dev/Creating_a_web_service_client'); $docinfo->doclink = html_writer::tag('a', get_string('wsclientdoc', 'webservice'), array('href' => $docurl)); $documentationhtml .= html_writer::start_tag('table', array('style' => "margin-left:auto; margin-right:auto;")); $documentationhtml .= html_writer::start_tag('tr', array()); $documentationhtml .= html_writer::start_tag('td', array()); $documentationhtml .= get_string('wsdocumentationintro', 'webservice', $docinfo); $documentationhtml .= $br . $br; /// Print button $authparams['print'] = true; //$parameters = array ('token' => $token, 'wsusername' => $username, 'wspassword' => $password, 'print' => true); $url = new moodle_url($parenturl, $authparams); // Required $documentationhtml .= $this->output->single_button($url, get_string('print', 'webservice')); $documentationhtml .= $br; /// each functions will be displayed into a collapsible region //(opened if printableformat = true) foreach ($functions as $functionname => $description) { if (empty($printableformat)) { $documentationhtml .= print_collapsible_region_start('', 'aera_' . $functionname, html_writer::start_tag('strong', array()) . $functionname . html_writer::end_tag('strong'), false, !$printableformat, true); } else { $documentationhtml .= html_writer::tag('strong', $functionname); $documentationhtml .= $br; } /// function global description $documentationhtml .= $br; $documentationhtml .= html_writer::start_tag('div', array('style' => 'border:solid 1px #DEDEDE;background:#E2E0E0; color:#222222;padding:4px;')); $documentationhtml .= $description->description; $documentationhtml .= html_writer::end_tag('div'); $documentationhtml .= $br . $br; /// function arguments documentation $documentationhtml .= html_writer::start_tag('span', array('style' => 'color:#EA33A6')); $documentationhtml .= get_string('arguments', 'webservice'); $documentationhtml .= html_writer::end_tag('span'); $documentationhtml .= $br; foreach ($description->parameters_desc->keys as $paramname => $paramdesc) { /// a argument documentation $documentationhtml .= html_writer::start_tag('span', array('style' => 'font-size:80%')); if ($paramdesc->required == VALUE_REQUIRED) { $required = get_string('required', 'webservice'); } if ($paramdesc->required == VALUE_DEFAULT) { if ($paramdesc->default === null) { $default = "null"; } else { $default = print_r($paramdesc->default, true); } $required = get_string('default', 'webservice', $default); } if ($paramdesc->required == VALUE_OPTIONAL) { $required = get_string('optional', 'webservice'); } $documentationhtml .= html_writer::start_tag('b', array()); $documentationhtml .= $paramname; $documentationhtml .= html_writer::end_tag('b'); $documentationhtml .= " (" . $required . ")"; // argument is required or optional ? $documentationhtml .= $br; $documentationhtml .= " " . $paramdesc->desc; // argument description $documentationhtml .= $br . $br; ///general structure of the argument $documentationhtml .= $this->colored_box_with_pre_tag( get_string('generalstructure', 'webservice'), $this->detailed_description_html($paramdesc), 'FFF1BC'); ///xml-rpc structure of the argument in PHP format if (!empty($activatedprotocol['xmlrpc'])) { $documentationhtml .= $this->colored_box_with_pre_tag( get_string('phpparam', 'webservice'), htmlentities('[' . $paramname . '] =>' . $this->xmlrpc_param_description_html($paramdesc)), 'DFEEE7'); } ///POST format for the REST protocol for the argument if (!empty($activatedprotocol['rest'])) { $documentationhtml .= $this->colored_box_with_pre_tag( get_string('restparam', 'webservice'), htmlentities($this->rest_param_description_html( $paramdesc, $paramname)), 'FEEBE5'); } $documentationhtml .= html_writer::end_tag('span'); } $documentationhtml .= $br . $br; /// function response documentation $documentationhtml .= html_writer::start_tag('span', array('style' => 'color:#EA33A6')); $documentationhtml .= get_string('response', 'webservice'); $documentationhtml .= html_writer::end_tag('span'); $documentationhtml .= $br; /// function response description $documentationhtml .= html_writer::start_tag('span', array('style' => 'font-size:80%')); if (!empty($description->returns_desc->desc)) { $documentationhtml .= $description->returns_desc->desc; $documentationhtml .= $br . $br; } if (!empty($description->returns_desc)) { ///general structure of the response $documentationhtml .= $this->colored_box_with_pre_tag( get_string('generalstructure', 'webservice'), $this->detailed_description_html($description->returns_desc), 'FFF1BC'); ///xml-rpc structure of the response in PHP format if (!empty($activatedprotocol['xmlrpc'])) { $documentationhtml .= $this->colored_box_with_pre_tag( get_string('phpresponse', 'webservice'), htmlentities($this->xmlrpc_param_description_html( $description->returns_desc)), 'DFEEE7'); } ///XML response for the REST protocol if (!empty($activatedprotocol['rest'])) { $restresponse = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" . $brakeline . "<RESPONSE>" . $brakeline; $restresponse .= $this->description_in_indented_xml_format( $description->returns_desc); $restresponse .="</RESPONSE>" . $brakeline; $documentationhtml .= $this->colored_box_with_pre_tag( get_string('restcode', 'webservice'), htmlentities($restresponse), 'FEEBE5'); } } $documentationhtml .= html_writer::end_tag('span'); $documentationhtml .= $br . $br; /// function errors documentation for REST protocol if (!empty($activatedprotocol['rest'])) { $documentationhtml .= html_writer::start_tag('span', array('style' => 'color:#EA33A6')); $documentationhtml .= get_string('errorcodes', 'webservice'); $documentationhtml .= html_writer::end_tag('span'); $documentationhtml .= $br . $br; $documentationhtml .= html_writer::start_tag('span', array('style' => 'font-size:80%')); $errormessage = get_string('invalidparameter', 'debug'); $restexceptiontext = <<<EOF <?xml version="1.0" encoding="UTF-8"?> <EXCEPTION class="invalid_parameter_exception"> <MESSAGE>{$errormessage}</MESSAGE> <DEBUGINFO></DEBUGINFO> </EXCEPTION> EOF; $documentationhtml .= $this->colored_box_with_pre_tag( get_string('restexception', 'webservice'), htmlentities($restexceptiontext), 'FEEBE5'); $documentationhtml .= html_writer::end_tag('span'); } $documentationhtml .= $br . $br; if (empty($printableformat)) { $documentationhtml .= print_collapsible_region_end(true); } } /// close the table and return the documentation $documentationhtml .= html_writer::end_tag('td'); $documentationhtml .= html_writer::end_tag('tr'); $documentationhtml .= html_writer::end_tag('table'); return $documentationhtml; }
} elseif ($ownsubmission) { $PAGE->navbar->add(get_string('mysubmission', 'workshop')); } else { $PAGE->navbar->add(get_string('submission', 'workshop')); } // Output starts here $output = $PAGE->get_renderer('mod_workshop'); echo $output->header(); echo $output->heading(format_string($workshop->name), 2); // show instructions for submitting as thay may contain some list of questions and we need to know them // while reading the submitted answer if (trim($workshop->instructauthors)) { $instructions = file_rewrite_pluginfile_urls($workshop->instructauthors, 'pluginfile.php', $PAGE->context->id, 'mod_workshop', 'instructauthors', 0, workshop::instruction_editors_options($PAGE->context)); print_collapsible_region_start('', 'workshop-viewlet-instructauthors', get_string('instructauthors', 'workshop')); echo $output->box(format_text($instructions, $workshop->instructauthorsformat, array('overflowdiv' => true)), array('generalbox', 'instructions')); print_collapsible_region_end(); } // if in edit mode, display the form to edit the submission if ($edit) { if (!empty($CFG->enableplagiarism)) { require_once $CFG->libdir . '/plagiarismlib.php'; echo plagiarism_print_disclosure($cm->id); } $mform->display(); echo $output->footer(); die; } // else display the submission if ($submission->id) { if ($seenaspublished) { $showauthor = has_capability('mod/workshop:viewauthorpublished', $workshop->context);
/** * Output this user_selector as HTML. * @param boolean $return if true, return the HTML as a string instead of outputting it. * @return mixed if $return is true, returns the HTML as a string, otherwise returns nothing. */ public function display($return = false) { global $PAGE; // Get the list of requested users. $search = optional_param($this->name . '_searchtext', '', PARAM_RAW); if (optional_param($this->name . '_clearbutton', false, PARAM_BOOL)) { $search = ''; } $groupedusers = $this->find_users($search); // Output the select. $name = $this->name; $multiselect = ''; if ($this->multiselect) { $name .= '[]'; $multiselect = 'multiple="multiple" '; } $output = '<div class="userselector" id="' . $this->name . '_wrapper">' . "\n" . '<select name="' . $name . '" id="' . $this->name . '" ' . $multiselect . 'size="' . $this->rows . '">' . "\n"; // Populate the select. $output .= $this->output_options($groupedusers, $search); // Output the search controls. $output .= "</select>\n<div>\n"; $output .= '<input type="text" name="' . $this->name . '_searchtext" id="' . $this->name . '_searchtext" size="15" value="' . s($search) . '" />'; $output .= '<input type="submit" name="' . $this->name . '_searchbutton" id="' . $this->name . '_searchbutton" value="' . $this->search_button_caption() . '" />'; $output .= '<input type="submit" name="' . $this->name . '_clearbutton" id="' . $this->name . '_clearbutton" value="' . get_string('clear') . '" />'; // And the search options. $optionsoutput = false; if (!user_selector_base::$searchoptionsoutput) { $output .= print_collapsible_region_start('', 'userselector_options', get_string('searchoptions'), 'userselector_optionscollapsed', true, true); $output .= $this->option_checkbox('preserveselected', $this->preserveselected, get_string('userselectorpreserveselected')); $output .= $this->option_checkbox('autoselectunique', $this->autoselectunique, get_string('userselectorautoselectunique')); $output .= $this->option_checkbox('searchanywhere', $this->searchanywhere, get_string('userselectorsearchanywhere')); $output .= print_collapsible_region_end(true); $PAGE->requires->js_init_call('M.core_user.init_user_selector_options_tracker', array(), false, self::$jsmodule); user_selector_base::$searchoptionsoutput = true; } $output .= "</div>\n</div>\n\n"; // Initialise the ajax functionality. $output .= $this->initialise_javascript($search); // Return or output it. if ($return) { return $output; } else { echo $output; } }
/** * Print (or return) a collapsible region, that has a caption that can * be clicked to expand or collapse the region. * * If JavaScript is off, then the region will always be expanded. * * @param string $contents the contents of the box. * @param string $classes class names added to the div that is output. * @param string $id id added to the div that is output. Must not be blank. * @param string $caption text displayed at the top. Clicking on this will cause the region to expand or contract. * @param string $userpref the name of the user preference that stores the user's preferred default state. * (May be blank if you do not wish the state to be persisted. * @param boolean $default Initial collapsed state to use if the user_preference it not set. * @param boolean $return if true, return the HTML as a string, rather than printing it. * @return string|void If $return is false, returns nothing, otherwise returns a string of HTML. */ function print_collapsible_region($contents, $classes, $id, $caption, $userpref = '', $default = false, $return = false) { $output = print_collapsible_region_start($classes, $id, $caption, $userpref, $default, true); $output .= $contents; $output .= print_collapsible_region_end(true); if ($return) { return $output; } else { echo $output; } }
protected function render_workshop_random_examples_helper(workshop_random_examples_helper $helper) { $precision = ini_set('precision',4); $o = ''; $infos = array(); $problems = array(); $titles = workshop_random_examples_helper::$descriptors[count($helper->slices)]; $helptext = $this->output->heading_with_help("What does this mean?","randomexampleshelp",'workshop'); foreach($helper->slices as $i => $s) { $o .= "<div class='slice' style='background-color: #$s->colour; width: $s->width; left: $s->min%'></div>"; $o .= "<div class='mean' style='background-color: #$s->meancolour; left: $s->mean%'></div>"; $count = count($s->submissions); $infos[] = "<div class='info'><h3 style='color:#$s->meancolour'>$titles[$i]</h3>Range $s->min% to $s->max% | Average $s->mean%</div>"; if (isset($s->warnings)) $problems = array_merge($problems, $s->warnings); foreach($s->submissions as $a) { $o .= "<div class='submission' style='background-color: #$s->subcolour; left:$a->grade%'></div>"; } } $problemstr = ""; if (count($problems)) { $problemstr = print_collapsible_region_start('random-examples-problems','random_examples_problems','Warnings','',true,true); $problemstr .= "<ul>"; foreach($problems as $p) $problemstr .= "<li>$p</li>"; $problemstr .= print_collapsible_region_end(true); $problemstr .= "</ul>"; } ini_set('precision',$precision); return "$helptext<div class='random-examples-helper'>$o</div> <div class='random-examples-info'>" . implode($infos) . "</div>$problemstr"; }
/** * Renders the full assessment * * @param workshop_assessment $assessment * @return string HTML */ protected function render_workshop_assessment(workshop_assessment $assessment) { $o = ''; // output HTML code $anonymous = is_null($assessment->reviewer); $classes = 'assessment-full'; if ($anonymous) { $classes .= ' anonymous'; } $o .= $this->output->container_start($classes); $o .= $this->output->container_start('header'); if (!empty($assessment->title)) { $title = s($assessment->title); } else { $title = get_string('assessment', 'workshop'); } if ($assessment->url instanceof moodle_url and $this->page->url != $assessment->url) { $o .= $this->output->container(html_writer::link($assessment->url, $title), 'title'); } else { $o .= $this->output->container($title, 'title'); } if (!$anonymous) { $reviewer = $assessment->reviewer; $userpic = $this->output->user_picture($reviewer, array('courseid' => $this->page->course->id, 'size' => 32)); $userurl = new moodle_url('/user/view.php', array('id' => $reviewer->id, 'course' => $this->page->course->id)); $a = new stdClass(); $a->name = fullname($reviewer); $a->url = $userurl->out(); $byfullname = get_string('assessmentby', 'workshop', $a); $oo = $this->output->container($userpic, 'picture'); $oo .= $this->output->container($byfullname, 'fullname'); $o .= $this->output->container($oo, 'reviewer'); } if (is_null($assessment->realgrade)) { $o .= $this->output->container(get_string('notassessed', 'workshop'), 'grade nograde'); } else { $a = new stdClass(); $a->max = $assessment->maxgrade; $a->received = $assessment->realgrade; $o .= $this->output->container(get_string('gradeinfo', 'workshop', $a), 'grade'); if (!is_null($assessment->weight) and $assessment->weight != 1) { $o .= $this->output->container(get_string('weightinfo', 'workshop', $assessment->weight), 'weight'); } } $o .= $this->output->container_start('actions'); foreach ($assessment->actions as $action) { $o .= $this->output->single_button($action->url, $action->label, $action->method); } $o .= $this->output->container_end(); // actions $o .= $this->output->container_end(); // header if (!is_null($assessment->form)) { $o .= print_collapsible_region_start('assessment-form-wrapper', uniqid('workshop-assessment'), get_string('assessmentform', 'workshop'), '', false, true); $o .= $this->output->container(self::moodleform($assessment->form), 'assessment-form'); $o .= print_collapsible_region_end(true); if (!$assessment->form->is_editable()) { $o .= $this->overall_feedback($assessment); } } $o .= $this->output->container_end(); // main wrapper return $o; }
/** * Output the html for a single section page . * * @param stdClass $course The course entry from DB * @param array $sections The course_sections entries from the DB * @param array $mods used for print_section() * @param array $modnames used for print_section() * @param array $modnamesused used for print_section() * @param int $displaysection The section number in the course which is being displayed */ public function print_single_section_page($course, $sections, $mods, $modnames, $modnamesused, $displaysection) { global $PAGE, $OUTPUT; $real_course_display = $course->realcoursedisplay; $modinfo = get_fast_modinfo($course); $course = course_get_format($course)->get_course(); $course->realcoursedisplay = $real_course_display; $sections = $modinfo->get_section_info_all(); // Can we view the section in question? $context = context_course::instance($course->id); $canviewhidden = has_capability('moodle/course:viewhiddensections', $context); if (!isset($sections[$displaysection])) { // This section doesn't exist print_error('unknowncoursesection', 'error', null, $course->fullname); return; } // Copy activity clipboard.. echo $this->course_activity_clipboard($course, $displaysection); // General section if non-empty and course_display is multiple. if ($course->realcoursedisplay == COURSE_DISPLAY_MULTIPAGE) { $thissection = $sections[0]; if (($thissection->visible && $thissection->available || $canviewhidden) && ($thissection->summary || $thissection->sequence || $PAGE->user_is_editing())) { echo $this->start_section_list(); echo $this->section_header($thissection, $course, true); echo $this->courserenderer->course_section_cm_list($course, $thissection, $displaysection); echo $this->courserenderer->course_section_add_cm_control($course, 0, $displaysection); echo $this->section_footer(); echo $this->end_section_list(); } } // Start single-section div echo html_writer::start_tag('div', array('class' => 'single-section onetopic')); //Move controls $can_move = false; if ($PAGE->user_is_editing() && has_capability('moodle/course:movesections', $context) && $displaysection > 0) { $can_move = true; } $move_list_html = ''; $count_move_sections = 0; //Init custom tabs $section = 0; $sectionmenu = array(); $tabs = array(); $inactive_tabs = array(); $default_topic = -1; while ($section <= $course->numsections) { if ($course->realcoursedisplay == COURSE_DISPLAY_MULTIPAGE && $section == 0) { $section++; continue; } $thissection = $sections[$section]; $showsection = true; if (!$thissection->visible || !$thissection->available) { $showsection = false; } else { if ($section == 0 && !($thissection->summary || $thissection->sequence || $PAGE->user_is_editing())) { $showsection = false; } } if (!$showsection) { $showsection = $canviewhidden || !$course->hiddensections; } if (isset($displaysection)) { if ($showsection) { if ($default_topic < 0) { $default_topic = $section; if ($displaysection == 0) { $displaysection = $default_topic; } } $format_options = course_get_format($course)->get_format_options($thissection); $sectionname = get_section_name($course, $thissection); if ($displaysection != $section) { $sectionmenu[$section] = $sectionname; } $custom_styles = ''; $level = 0; if (is_array($format_options)) { if (!empty($format_options['fontcolor'])) { $custom_styles .= 'color: ' . $format_options['fontcolor'] . ';'; } if (!empty($format_options['bgcolor'])) { $custom_styles .= 'background-color: ' . $format_options['bgcolor'] . ';'; } if (!empty($format_options['cssstyles'])) { $custom_styles .= $format_options['cssstyles'] . ';'; } if (isset($format_options['level'])) { $level = $format_options['level']; } } if ($section == 0) { $url = new moodle_url('/course/view.php', array('id' => $course->id, 'section' => 0)); } else { $url = course_get_url($course, $section); } $special_style = 'tab_position_' . $section . ' tab_level_' . $level; if ($course->marker == $section) { $special_style = ' marker '; } if (!$thissection->visible || !$thissection->available) { $special_style .= ' dimmed '; if (!$canviewhidden) { $inactive_tabs[] = "tab_topic_" . $section; } } $new_tab = new tabobject("tab_topic_" . $section, $url, '<div style="' . $custom_styles . '" class="tab_content ' . $special_style . '">' . s($sectionname) . "</div>", s($sectionname)); if (is_array($format_options) && isset($format_options['level'])) { if ($format_options['level'] == 0 || count($tabs) == 0) { $tabs[] = $new_tab; $new_tab->level = 1; } else { $parent_index = count($tabs) - 1; if (!is_array($tabs[$parent_index]->subtree)) { $tabs[$parent_index]->subtree = array(); } else { if (count($tabs[$parent_index]->subtree) == 0) { $tabs[$parent_index]->subtree[0] = clone $tabs[$parent_index]; $tabs[$parent_index]->subtree[0]->id .= '_index'; $parent_section = $sections[$section - 1]; $parentformat_options = course_get_format($course)->get_format_options($parent_section); if ($parentformat_options['firsttabtext']) { $firsttab_text = $parentformat_options['firsttabtext']; } else { $firsttab_text = get_string('index', 'format_onetopic'); } $tabs[$parent_index]->subtree[0]->text = '<div class="tab_content tab_initial">' . $firsttab_text . "</div>"; $tabs[$parent_index]->subtree[0]->level = 2; if ($displaysection == $section - 1) { $tabs[$parent_index]->subtree[0]->selected = true; } } } $new_tab->level = 2; $tabs[$parent_index]->subtree[] = $new_tab; } } else { $tabs[] = $new_tab; } //Init move section list*************************************************************************** if ($can_move) { if ($section > 0) { // Move section $baseurl = course_get_url($course, $displaysection); $baseurl->param('sesskey', sesskey()); $url = clone $baseurl; $url->param('move', $section - $displaysection); //ToDo: For new feature: subtabs. It is not implemented yet /* $strsubtopictoright = get_string('subtopictoright', 'format_onetopic'); $url = new moodle_url('/course/view.php', array('id' => $course->id, 'subtopicmove' => 'right', 'subtopic' => $section)); $icon = $this->output->pix_icon('t/right', $strsubtopictoright); $subtopic_move = html_writer::link($url, $icon.get_accesshide($strsubtopictoright), array('class' => 'subtopic-increase-sections')); if ($displaysection != $section) { $move_list_html .= html_writer::tag('li', $subtopic_move . html_writer::link($url, $sectionname)); } else { $move_list_html .= html_writer::tag('li', $subtopic_move . $sectionname); } */ //Define class from sublevels in order to move a margen in the left. Not apply if it is the first element (condition !empty($move_list_html)) because the first element can't be a sublevel $li_class = ''; if (is_array($format_options) && isset($format_options['level']) && $format_options['level'] > 0 && !empty($move_list_html)) { $li_class = 'sublevel'; } if ($displaysection != $section) { $move_list_html .= html_writer::tag('li', html_writer::link($url, $sectionname), array('class' => $li_class)); } else { $move_list_html .= html_writer::tag('li', $sectionname, array('class' => $li_class)); } } } //End move section list*************************************************************************** } } $section++; } // Title with section navigation links. $sectionnavlinks = $this->get_nav_links($course, $sections, $displaysection); $sectiontitle = ''; if (!$course->hidetabsbar && count($tabs[0]) > 0) { if ($PAGE->user_is_editing() && has_capability('moodle/course:update', $context)) { // Increase number of sections. $straddsection = get_string('increasesections', 'moodle'); $url = new moodle_url('/course/changenumsections.php', array('courseid' => $course->id, 'increase' => true, 'sesskey' => sesskey())); $icon = $this->output->pix_icon('t/switch_plus', $straddsection); $tabs[] = new tabobject("tab_topic_add", $url, $icon, s($straddsection)); if ($course->numsections > 0) { // Reduce number of sections. $strremovesection = get_string('reducesections', 'moodle'); $url = new moodle_url('/course/changenumsections.php', array('courseid' => $course->id, 'increase' => false, 'sesskey' => sesskey())); $icon = $this->output->pix_icon('t/switch_minus', $strremovesection); $tabs[] = new tabobject("tab_topic_remove", $url, $icon, s($strremovesection)); } } $sectiontitle .= $OUTPUT->tabtree($tabs, "tab_topic_" . $displaysection, $inactive_tabs); //print_tabs($tabs, "tab_topic_" . $displaysection, $inactive_tabs, $active_tabs, true); } echo $sectiontitle; if (!$sections[$displaysection]->uservisible && !$canviewhidden) { if (!$course->hiddensections) { //Not used more, is controled in /course/view.php } // Can't view this section. } else { if ($course->realcoursedisplay != COURSE_DISPLAY_MULTIPAGE || $displaysection !== 0) { // Now the list of sections.. echo $this->start_section_list(); // The requested section page. $thissection = $sections[$displaysection]; echo $this->section_header($thissection, $course, true); // Show completion help icon. $completioninfo = new completion_info($course); echo $completioninfo->display_help_icon(); echo $this->courserenderer->course_section_cm_list($course, $thissection, $displaysection); echo $this->courserenderer->course_section_add_cm_control($course, $displaysection, $displaysection); echo $this->section_footer(); echo $this->end_section_list(); } } // Display section bottom navigation. $sectionbottomnav = ''; $sectionbottomnav .= html_writer::start_tag('div', array('class' => 'section-navigation mdl-bottom')); $sectionbottomnav .= html_writer::tag('span', $sectionnavlinks['previous'], array('class' => 'mdl-left')); $sectionbottomnav .= html_writer::tag('span', $sectionnavlinks['next'], array('class' => 'mdl-right')); $sectionbottomnav .= html_writer::end_tag('div'); echo $sectionbottomnav; // close single-section div. echo html_writer::end_tag('div'); if ($PAGE->user_is_editing() && has_capability('moodle/course:update', $context)) { echo '<br class="utilities-separator" />'; print_collapsible_region_start('move-list-box clearfix collapsible mform', 'course_format_onetopic_config_movesection', get_string('utilities', 'format_onetopic'), '', true); //Move controls if ($can_move && !empty($move_list_html)) { echo html_writer::start_div("form-item clearfix"); echo html_writer::start_div("form-label"); echo html_writer::tag('label', get_string('movesectionto', 'format_onetopic')); echo html_writer::end_div(); echo html_writer::start_div("form-setting"); echo html_writer::tag('ul', $move_list_html, array('class' => 'move-list')); echo html_writer::end_div(); echo html_writer::start_div("form-description"); echo html_writer::tag('p', get_string('movesectionto_help', 'format_onetopic')); echo html_writer::end_div(); echo html_writer::end_div(); } $baseurl = course_get_url($course, $displaysection); $baseurl->param('sesskey', sesskey()); $url = clone $baseurl; global $USER, $OUTPUT; if (isset($USER->onetopic_da[$course->id]) && $USER->onetopic_da[$course->id]) { $url->param('onetopic_da', 0); $text_button_disableajax = get_string('enable', 'format_onetopic'); } else { $url->param('onetopic_da', 1); $text_button_disableajax = get_string('disable', 'format_onetopic'); } echo html_writer::start_div("form-item clearfix"); echo html_writer::start_div("form-label"); echo html_writer::tag('label', get_string('disableajax', 'format_onetopic')); echo html_writer::end_div(); echo html_writer::start_div("form-setting"); echo html_writer::link($url, $text_button_disableajax); echo html_writer::end_div(); echo html_writer::start_div("form-description"); echo html_writer::tag('p', get_string('disableajax_help', 'format_onetopic')); echo html_writer::end_div(); echo html_writer::end_div(); //Duplicate current section option if (has_capability('moodle/course:manageactivities', $context)) { $url_duplicate = new moodle_url('/course/format/onetopic/duplicate.php', array('courseid' => $course->id, 'section' => $displaysection, 'sesskey' => sesskey())); $link = new action_link($url_duplicate, get_string('duplicate', 'format_onetopic')); $link->add_action(new confirm_action(get_string('duplicate_confirm', 'format_onetopic'), null, get_string('duplicate', 'format_onetopic'))); echo html_writer::start_div("form-item clearfix"); echo html_writer::start_div("form-label"); echo html_writer::tag('label', get_string('duplicatesection', 'format_onetopic')); echo html_writer::end_div(); echo html_writer::start_div("form-setting"); echo $this->render($link); echo html_writer::end_div(); echo html_writer::start_div("form-description"); echo html_writer::tag('p', get_string('duplicatesection_help', 'format_onetopic')); echo html_writer::end_div(); echo html_writer::end_div(); } print_collapsible_region_end(); } }
/** * Print the "advanced" UI elements for the form to select which questions. Hidden by default. */ protected function display_advanced_search_form() { print_collapsible_region_start('', 'advancedsearch', get_string('advancedsearchoptions', 'question'), 'question_bank_advanced_search'); foreach ($this->searchconditions as $searchcondition) { echo $searchcondition->display_options_adv($this); } print_collapsible_region_end(); }
function forum_print_posts_nested($course, &$cm, $forum, $discussion, $parent, $reply, $forumtracked, $posts, $parentid = 0, $count = 1, $flag = 0) { global $USER, $CFG, $DB; $link = false; $modcontext = context_module::instance($cm->id); if (!empty($posts[$parent->id]->children)) { $posts = $posts[$parent->id]->children; foreach ($posts as $post) { if ((show_discussion($parentid, $forum) and $post->userid != $USER->id and !$flag) && !has_capability('mod/forum:editanypost', $modcontext)) { continue; } else { $flag = 1; } echo '<div class="indent">'; if (!isloggedin()) { $ownpost = false; } else { $ownpost = $USER->id == $post->userid; } $post->subject = format_string($post->subject); $postread = !empty($post->postread); if ($forum->type == 'collaborate' and $post->parent == $parentid) { $regionid = 'forum-questionview' . $count; print_collapsible_region_start('', $regionid, get_string('questionview', 'forum')); forum_print_post($post, $discussion, $forum, $cm, $course, $ownpost, $reply, false, '', '', $postread, true, $forumtracked, false, $parentid); } else { forum_print_post($post, $discussion, $forum, $cm, $course, $ownpost, $reply, false, '', '', $postread, true, $forumtracked, false, $parentid); } if ($forum->type == 'collaborate') { $n = $DB->count_records('forum_posts', array('parent' => $post->id)); if ($n == 0) { print_collapsible_region_end(); } } forum_print_posts_nested($course, $cm, $forum, $discussion, $post, $reply, $forumtracked, $posts, $parentid, $count + 1, $flag); $flag = 0; echo "</div>\n"; $count = $count + 1; } } }
/** * Returns HTML of the end of collapsible region with trailing content. * * @param string $content_after * @return string */ public function end_region($contentafter = '') { return "\n" . print_collapsible_region_end(true) . "\n" . $contentafter; }
////$currentExam .= print_single_button($link, $options, $label, 'get', '', true, '', $disabled); //$currentExam .= print_container_end(true); //$currentExam .= "<div id='info_$record->id'></div><br/>"; //$currentExam .= "<hr>"; } else { echo "Your Exam is OVER2<br />"; //echo date($format,$currentTime)." is after ".date($format,$record->endtime). "<br />"; $cm = $DB->get_record('course_modules', array('course' => $course->id, 'module' => '12', 'id' => $record->quizid)); $quiz = $DB->get_record('quiz', array('id' => $cm->instance)); $caption = "<i>" . $quiz->name . ":</i>"; $id = "prev_" . $record->id; $prevExam .= print_collapsible_region_start("", $id, $caption, false, true, true); //$prevExam .= "<b>Your Previous Grades for: </b><i>".$quiz->name.":</i><br/><br/>"; $prevExam .= $record->grade1 . "/" . $quiz->sumgrades; $prevExam .= " | <a href='{$CFG->wwwroot}/mod/quiz/summary.php?attempt={$record->attemptid}'>Summary</a>"; $prevExam .= print_collapsible_region_end(true); } } } } } $records->close(); // Counter //echo "<script language='JavaScript'>"; //echo "var countDownInterval=$timeleft;"; //configure refresh interval (in seconds) 1800 = 30 min //echo "var c_reloadwidth=200;"; //configure width of displayed text, in px (applicable only in NS4) //echo "</script>"; //echo "<ilayer id='c_reload' width=&{c_reloadwidth}; ><layer id='c_reload2' width=&{c_reloadwidth}; left=0 top=0></layer></ilayer>"; echo $currentExam; if (!empty($prevExam)) { echo "<b>Your Previous Grades for: </b>";