function display_search_field($content = '') { global $CFG, $DB; $varcharcontent = $DB->sql_compare_text('content', 255); $sql = "SELECT DISTINCT {$varcharcontent} AS content\n FROM {data_content}\n WHERE fieldid=? AND content IS NOT NULL"; $usedoptions = array(); if ($used = $DB->get_records_sql($sql, array($this->field->id))) { foreach ($used as $data) { $value = $data->content; if ($value === '') { continue; } $usedoptions[$value] = $value; } } $options = array(); foreach (explode("\n", $this->field->param1) as $option) { $option = trim($option); if (!isset($usedoptions[$option])) { continue; } $options[$option] = $option; } if (!$options) { // oh, nothing to search for return ''; } $return = html_writer::label(get_string('namemenu', 'data'), 'menuf_' . $this->field->id, false, array('class' => 'accesshide')); $return .= html_writer::select($options, 'f_' . $this->field->id, $content); return $return; }
public function display_options_adv() { echo "<br />\n"; echo html_writer::label(get_string('searchtext', 'local_searchquestions'), 'searchtext'); echo html_writer::empty_tag('input', array('name' => 'searchtext', 'id' => 'searchtext', 'class' => 'searchoptions', 'value' => $this->searchtext)); echo "<br />\n"; echo html_writer::empty_tag('input', array('type' => 'checkbox', 'name' => 'searchanswers', 'id' => 'searchanswers', 'class' => 'searchoptions', 'value' => 1)); echo html_writer::label(get_string('searchanswers', 'local_searchquestions'), 'searchanswers'); }
function display_search_field($value = '') { global $CFG, $DB; $varcharcontent = $DB->sql_compare_text('content', 255); $used = $DB->get_records_sql("SELECT DISTINCT {$varcharcontent} AS content\n FROM {data_content}\n WHERE fieldid=?\n ORDER BY {$varcharcontent}", array($this->field->id)); $options = array(); if (!empty($used)) { foreach ($used as $rec) { $options[$rec->content] = $rec->content; //Build following indicies from the sql. } } $return = html_writer::label(get_string('nameradiobutton', 'data'), 'menuf_' . $this->field->id, false, array('class' => 'accesshide')); $return .= html_writer::select($options, 'f_' . $this->field->id, $value); return $return; }
function display_search_field($value = '') { global $CFG, $DB; $varcharlat = $DB->sql_compare_text('content'); $varcharlong = $DB->sql_compare_text('content1'); $latlongsrs = $DB->get_recordset_sql("SELECT DISTINCT {$varcharlat} AS la, {$varcharlong} AS lo\n FROM {data_content}\n WHERE fieldid = ?\n ORDER BY {$varcharlat}, {$varcharlong}", array($this->field->id)); $options = array(); foreach ($latlongsrs as $latlong) { $latitude = format_float($latlong->la, 4); $longitude = format_float($latlong->lo, 4); $options[$latlong->la . ',' . $latlong->lo] = $latitude . ' ' . $longitude; } $latlongsrs->close(); $return = html_writer::label(get_string('latlong', 'data'), 'menuf_' . $this->field->id, false, array('class' => 'accesshide')); $return .= html_writer::select($options, 'f_' . $this->field->id, $value); return $return; }
public function display_options_adv() { global $DB; global $output; require_login(); $tags = $this->get_tags_used(); $attr = array('multiple' => 'true', 'class' => 'searchoptions large searchbytags'); if (count($tags) > 10) { $attr['size'] = 10; } echo html_writer::label('Show questions with tags:', 'tags[]'); echo "<br />\n"; echo html_writer::select($tags, 'tags[]', $this->tags, array('' => '--show all--'), $attr); echo "<br />\n"; echo html_writer::label('Show questions WITHOUT tags:', 'tags[]'); echo "<br />\n"; echo html_writer::select($tags, 'nottags[]', $this->nottags, array('' => '--show all--'), $attr); echo "<br />\n"; }
public function formulation_and_controls(question_attempt $qa, question_display_options $options) { $question = $qa->get_question(); $stemorder = $question->get_stem_order(); $response = $qa->get_last_qt_data(); $choices = $this->format_choices($question); $result = ''; $result .= html_writer::tag('div', $question->format_questiontext($qa), array('class' => 'qtext')); $result .= html_writer::start_tag('div', array('class' => 'ablock')); $result .= html_writer::start_tag('table', array('class' => 'answer')); $result .= html_writer::start_tag('tbody'); $parity = 0; $i = 1; foreach ($stemorder as $key => $stemid) { $result .= html_writer::start_tag('tr', array('class' => 'r' . $parity)); $fieldname = 'sub' . $key; $result .= html_writer::tag('td', $this->format_stem_text($qa, $stemid), array('class' => 'text')); $classes = 'control'; $feedbackimage = ''; if (array_key_exists($fieldname, $response)) { $selected = $response[$fieldname]; } else { $selected = 0; } $fraction = (int) ($selected && $selected == $question->get_right_choice_for($stemid)); if ($options->correctness && $selected) { $classes .= ' ' . $this->feedback_class($fraction); $feedbackimage = $this->feedback_image($fraction); } $result .= html_writer::tag('td', html_writer::label(get_string('answer', 'qtype_match', $i), 'menu' . $qa->get_qt_field_name('sub' . $key), false, array('class' => 'accesshide')) . html_writer::select($choices, $qa->get_qt_field_name('sub' . $key), $selected, array('0' => 'choose'), array('disabled' => $options->readonly)) . ' ' . $feedbackimage, array('class' => $classes)); $result .= html_writer::end_tag('tr'); $parity = 1 - $parity; $i++; } $result .= html_writer::end_tag('tbody'); $result .= html_writer::end_tag('table'); $result .= html_writer::end_tag('div'); // Closes <div class="ablock">. if ($qa->get_state() == question_state::$invalid) { $result .= html_writer::nonempty_tag('div', $question->get_validation_error($response), array('class' => 'validationerror')); } return $result; }
/** * Returns XHTML select field and wrapping div(s) * * @see output_select_html() * * @param string $data the option to show as selected * @param string $query * @return string XHTML field and wrapping div */ public function output_html($data, $query = '') { $html = ''; $baseid = $this->get_id(); $inputname = $this->get_full_name(); foreach ($this->flowtypes as $flowtype) { $html .= \html_writer::start_div(); $flowtypeid = $baseid . '_' . $flowtype; $radioattrs = ['type' => 'radio', 'name' => $inputname, 'id' => $flowtypeid, 'value' => $flowtype]; if ($data === $flowtype || empty($data) && $flowtype === $this->get_defaultsetting()) { $radioattrs['checked'] = 'checked'; } $typename = get_string('cfg_loginflow_' . $flowtype, 'auth_oidc'); $typedesc = get_string('cfg_loginflow_' . $flowtype . '_desc', 'auth_oidc'); $html .= \html_writer::empty_tag('input', $radioattrs); $html .= \html_writer::label($typename, $flowtypeid, false); $html .= '<br />'; $html .= \html_writer::span($typedesc); $html .= '<br /><br />'; $html .= \html_writer::end_div(); } return format_admin_setting($this, $this->visiblename, $html, $this->description, true, '', null, $query); }
/** * Produces the html that represents this rating in the UI * * @param rating $rating the page object on which this rating will appear * @return string */ function render_rating(rating $rating) { global $CFG, $USER; if ($rating->settings->aggregationmethod == RATING_AGGREGATE_NONE) { return null;//ratings are turned off } $ratingmanager = new rating_manager(); // Initialise the JavaScript so ratings can be done by AJAX. $ratingmanager->initialise_rating_javascript($this->page); $strrate = get_string("rate", "rating"); $ratinghtml = ''; //the string we'll return // permissions check - can they view the aggregate? if ($rating->user_can_view_aggregate()) { $aggregatelabel = $ratingmanager->get_aggregate_label($rating->settings->aggregationmethod); $aggregatestr = $rating->get_aggregate_string(); $aggregatehtml = html_writer::tag('span', $aggregatestr, array('id' => 'ratingaggregate'.$rating->itemid, 'class' => 'ratingaggregate')).' '; if ($rating->count > 0) { $countstr = "({$rating->count})"; } else { $countstr = '-'; } $aggregatehtml .= html_writer::tag('span', $countstr, array('id'=>"ratingcount{$rating->itemid}", 'class' => 'ratingcount')).' '; $ratinghtml .= html_writer::tag('span', $aggregatelabel, array('class'=>'rating-aggregate-label')); if ($rating->settings->permissions->viewall && $rating->settings->pluginpermissions->viewall) { $nonpopuplink = $rating->get_view_ratings_url(); $popuplink = $rating->get_view_ratings_url(true); $action = new popup_action('click', $popuplink, 'ratings', array('height' => 400, 'width' => 600)); $ratinghtml .= $this->action_link($nonpopuplink, $aggregatehtml, $action); } else { $ratinghtml .= $aggregatehtml; } } $formstart = null; // if the item doesn't belong to the current user, the user has permission to rate // and we're within the assessable period if ($rating->user_can_rate()) { $rateurl = $rating->get_rate_url(); $inputs = $rateurl->params(); //start the rating form $formattrs = array( 'id' => "postrating{$rating->itemid}", 'class' => 'postratingform', 'method' => 'post', 'action' => $rateurl->out_omit_querystring() ); $formstart = html_writer::start_tag('form', $formattrs); $formstart .= html_writer::start_tag('div', array('class' => 'ratingform')); // add the hidden inputs foreach ($inputs as $name => $value) { $attributes = array('type' => 'hidden', 'class' => 'ratinginput', 'name' => $name, 'value' => $value); $formstart .= html_writer::empty_tag('input', $attributes); } if (empty($ratinghtml)) { $ratinghtml .= $strrate.': '; } $ratinghtml = $formstart.$ratinghtml; $scalearray = array(RATING_UNSET_RATING => $strrate.'...') + $rating->settings->scale->scaleitems; $scaleattrs = array('class'=>'postratingmenu ratinginput','id'=>'menurating'.$rating->itemid); $ratinghtml .= html_writer::label($rating->rating, 'menurating'.$rating->itemid, false, array('class' => 'accesshide')); $ratinghtml .= html_writer::select($scalearray, 'rating', $rating->rating, false, $scaleattrs); //output submit button $ratinghtml .= html_writer::start_tag('span', array('class'=>"ratingsubmit")); $attributes = array('type' => 'submit', 'class' => 'postratingmenusubmit', 'id' => 'postratingsubmit'.$rating->itemid, 'value' => s(get_string('rate', 'rating'))); $ratinghtml .= html_writer::empty_tag('input', $attributes); if (!$rating->settings->scale->isnumeric) { // If a global scale, try to find current course ID from the context if (empty($rating->settings->scale->courseid) and $coursecontext = $rating->context->get_course_context(false)) { $courseid = $coursecontext->instanceid; } else { $courseid = $rating->settings->scale->courseid; } $ratinghtml .= $this->help_icon_scale($courseid, $rating->settings->scale); } $ratinghtml .= html_writer::end_tag('span'); $ratinghtml .= html_writer::end_tag('div'); $ratinghtml .= html_writer::end_tag('form'); } return $ratinghtml; }
echo $OUTPUT->header(); // This will contain all available the based On select options, but we'll disable some on them on a per user basis. echo $OUTPUT->heading($straddnote); echo '<form method="post" action="addnote.php">'; echo '<fieldset class="invisiblefieldset">'; echo '<input type="hidden" name="id" value="' . $course->id . '" />'; echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />'; echo '</fieldset>'; $table = new html_table(); $table->head = array(get_string('fullnameuser'), get_string('content', 'notes'), get_string('publishstate', 'notes') . $OUTPUT->help_icon('publishstate', 'notes')); $table->align = array('left', 'center', 'center'); $statenames = note_get_state_names(); // The first time list hack. if (empty($users) and $post = data_submitted()) { foreach ($post as $k => $v) { if (preg_match('/^user(\\d+)$/', $k, $m)) { $users[] = $m[1]; } } } foreach ($users as $k => $v) { if (!($user = $DB->get_record('user', array('id' => $v)))) { continue; } $checkbox = html_writer::label(get_string('selectnotestate', 'notes'), 'menustates_' . $v, false, array('class' => 'accesshide')); $checkbox .= html_writer::select($statenames, 'states[' . $k . ']', empty($states[$k]) ? NOTES_STATE_PUBLIC : $states[$k], false, array('id' => 'menustates_' . $v)); $table->data[] = array('<input type="hidden" name="userid[' . $k . ']" value="' . $v . '" />' . fullname($user, true), '<textarea name="contents[' . $k . ']" rows="2" cols="40" spellcheck="true">' . strip_tags(@$contents[$k]) . '</textarea>', $checkbox); } echo html_writer::table($table); echo '<div style="width:100%;text-align:center;"><input type="submit" value="' . get_string('savechanges') . '" /></div></form>'; echo $OUTPUT->footer();
/** * Display all the submissions ready for grading * * @global object * @global object * @global object * @global object * @param string $message * @return bool|void */ function display_submissions($message = '') { global $CFG, $DB, $USER, $DB, $OUTPUT, $PAGE; require_once $CFG->libdir . '/gradelib.php'; /* first we check to see if the form has just been submitted * to request user_preference updates */ $filters = array(self::FILTER_ALL => get_string('all'), self::FILTER_REQUIRE_GRADING => get_string('requiregrading', 'assignment')); $updatepref = optional_param('updatepref', 0, PARAM_BOOL); if ($updatepref) { $perpage = optional_param('perpage', 10, PARAM_INT); $perpage = $perpage <= 0 ? 10 : $perpage; $filter = optional_param('filter', 0, PARAM_INT); set_user_preference('assignment_perpage', $perpage); set_user_preference('assignment_quickgrade', optional_param('quickgrade', 0, PARAM_BOOL)); set_user_preference('assignment_filter', $filter); } /* next we get perpage and quickgrade (allow quick grade) params * from database */ $perpage = get_user_preferences('assignment_perpage', 10); $quickgrade = get_user_preferences('assignment_quickgrade', 0) && $this->quickgrade_mode_allowed(); $filter = get_user_preferences('assignment_filter', 0); $grading_info = grade_get_grades($this->course->id, 'mod', 'assignment', $this->assignment->id); if (!empty($CFG->enableoutcomes) and !empty($grading_info->outcomes)) { $uses_outcomes = true; } else { $uses_outcomes = false; } $page = optional_param('page', 0, PARAM_INT); $strsaveallfeedback = get_string('saveallfeedback', 'assignment'); /// Some shortcuts to make the code read better $course = $this->course; $assignment = $this->assignment; $cm = $this->cm; $hassubmission = false; // reset filter to all for offline assignment only. if ($assignment->assignmenttype == 'offline') { if ($filter == self::FILTER_SUBMITTED) { $filter = self::FILTER_ALL; } } else { $filters[self::FILTER_SUBMITTED] = get_string('submitted', 'assignment'); } $tabindex = 1; //tabindex for quick grading tabbing; Not working for dropdowns yet add_to_log($course->id, 'assignment', 'view submission', 'submissions.php?id=' . $this->cm->id, $this->assignment->id, $this->cm->id); $PAGE->set_title(format_string($this->assignment->name, true)); $PAGE->set_heading($this->course->fullname); echo $OUTPUT->header(); echo '<div class="usersubmissions">'; //hook to allow plagiarism plugins to update status/print links. echo plagiarism_update_status($this->course, $this->cm); $course_context = get_context_instance(CONTEXT_COURSE, $course->id); if (has_capability('gradereport/grader:view', $course_context) && has_capability('moodle/grade:viewall', $course_context)) { echo '<div class="allcoursegrades"><a href="' . $CFG->wwwroot . '/grade/report/grader/index.php?id=' . $course->id . '">' . get_string('seeallcoursegrades', 'grades') . '</a></div>'; } if (!empty($message)) { echo $message; // display messages here if any } $context = get_context_instance(CONTEXT_MODULE, $cm->id); /// Check to see if groups are being used in this assignment /// find out current groups mode $groupmode = groups_get_activity_groupmode($cm); $currentgroup = groups_get_activity_group($cm, true); groups_print_activity_menu($cm, $CFG->wwwroot . '/mod/assignment/submissions.php?id=' . $this->cm->id); /// Print quickgrade form around the table if ($quickgrade) { $formattrs = array(); $formattrs['action'] = new moodle_url('/mod/assignment/submissions.php'); $formattrs['id'] = 'fastg'; $formattrs['method'] = 'post'; echo html_writer::start_tag('form', $formattrs); echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'id', 'value' => $this->cm->id)); echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'mode', 'value' => 'fastgrade')); echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'page', 'value' => $page)); echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey())); } /// Get all ppl that are allowed to submit assignments list($esql, $params) = get_enrolled_sql($context, 'mod/assignment:submit', $currentgroup); if ($filter == self::FILTER_ALL) { $sql = "SELECT u.id FROM {user} u " . "LEFT JOIN ({$esql}) eu ON eu.id=u.id " . "WHERE u.deleted = 0 AND eu.id=u.id "; } else { $wherefilter = ' AND s.assignment = ' . $this->assignment->id; $assignmentsubmission = "LEFT JOIN {assignment_submissions} s ON (u.id = s.userid) "; if ($filter == self::FILTER_SUBMITTED) { $wherefilter .= ' AND s.timemodified > 0 '; } else { if ($filter == self::FILTER_REQUIRE_GRADING && $assignment->assignmenttype != 'offline') { $wherefilter .= ' AND s.timemarked < s.timemodified '; } else { // require grading for offline assignment $assignmentsubmission = ""; $wherefilter = ""; } } $sql = "SELECT u.id FROM {user} u " . "LEFT JOIN ({$esql}) eu ON eu.id=u.id " . $assignmentsubmission . "WHERE u.deleted = 0 AND eu.id=u.id " . $wherefilter; } $users = $DB->get_records_sql($sql, $params); if (!empty($users)) { if ($assignment->assignmenttype == 'offline' && $filter == self::FILTER_REQUIRE_GRADING) { //remove users who has submitted their assignment foreach ($this->get_submissions() as $submission) { if (array_key_exists($submission->userid, $users)) { unset($users[$submission->userid]); } } } $users = array_keys($users); } // if groupmembersonly used, remove users who are not in any group if ($users and !empty($CFG->enablegroupmembersonly) and $cm->groupmembersonly) { if ($groupingusers = groups_get_grouping_members($cm->groupingid, 'u.id', 'u.id')) { $users = array_intersect($users, array_keys($groupingusers)); } } $extrafields = get_extra_user_fields($context); $tablecolumns = array_merge(array('picture', 'fullname'), $extrafields, array('grade', 'submissioncomment', 'timemodified', 'timemarked', 'status', 'finalgrade')); if ($uses_outcomes) { $tablecolumns[] = 'outcome'; // no sorting based on outcomes column } $extrafieldnames = array(); foreach ($extrafields as $field) { $extrafieldnames[] = get_user_field_name($field); } $tableheaders = array_merge(array('', get_string('fullnameuser')), $extrafieldnames, array(get_string('grade'), get_string('comment', 'assignment'), get_string('lastmodified') . ' (' . get_string('submission', 'assignment') . ')', get_string('lastmodified') . ' (' . get_string('grade') . ')', get_string('status'), get_string('finalgrade', 'grades'))); if ($uses_outcomes) { $tableheaders[] = get_string('outcome', 'grades'); } require_once $CFG->libdir . '/tablelib.php'; $table = new flexible_table('mod-assignment-submissions'); $table->define_columns($tablecolumns); $table->define_headers($tableheaders); $table->define_baseurl($CFG->wwwroot . '/mod/assignment/submissions.php?id=' . $this->cm->id . '&currentgroup=' . $currentgroup); $table->sortable(true, 'lastname'); //sorted by lastname by default $table->collapsible(true); $table->initialbars(true); $table->column_suppress('picture'); $table->column_suppress('fullname'); $table->column_class('picture', 'picture'); $table->column_class('fullname', 'fullname'); foreach ($extrafields as $field) { $table->column_class($field, $field); } $table->column_class('grade', 'grade'); $table->column_class('submissioncomment', 'comment'); $table->column_class('timemodified', 'timemodified'); $table->column_class('timemarked', 'timemarked'); $table->column_class('status', 'status'); $table->column_class('finalgrade', 'finalgrade'); if ($uses_outcomes) { $table->column_class('outcome', 'outcome'); } $table->set_attribute('cellspacing', '0'); $table->set_attribute('id', 'attempts'); $table->set_attribute('class', 'submissions'); $table->set_attribute('width', '100%'); $table->no_sorting('finalgrade'); $table->no_sorting('outcome'); $table->text_sorting('submissioncomment'); // Start working -- this is necessary as soon as the niceties are over $table->setup(); /// Construct the SQL list($where, $params) = $table->get_sql_where(); if ($where) { $where .= ' AND '; } if ($filter == self::FILTER_SUBMITTED) { $where .= 's.timemodified > 0 AND '; } else { if ($filter == self::FILTER_REQUIRE_GRADING) { $where = ''; if ($assignment->assignmenttype != 'offline') { $where .= 's.timemarked < s.timemodified AND '; } } } if ($sort = $table->get_sql_sort()) { $sort = ' ORDER BY ' . $sort; } $ufields = user_picture::fields('u', $extrafields); if (!empty($users)) { $select = "SELECT {$ufields},\n s.id AS submissionid, s.grade, s.submissioncomment,\n s.timemodified, s.timemarked,\n CASE WHEN s.timemarked > 0 AND s.timemarked >= s.timemodified THEN 1\n ELSE 0 END AS status "; $sql = 'FROM {user} u ' . 'LEFT JOIN {assignment_submissions} s ON u.id = s.userid AND s.assignment = ' . $this->assignment->id . ' ' . 'WHERE ' . $where . 'u.id IN (' . implode(',', $users) . ') '; $ausers = $DB->get_records_sql($select . $sql . $sort, $params, $table->get_page_start(), $table->get_page_size()); $table->pagesize($perpage, count($users)); ///offset used to calculate index of student in that particular query, needed for the pop up to know who's next $offset = $page * $perpage; $strupdate = get_string('update'); $strgrade = get_string('grade'); $strview = get_string('view'); $grademenu = make_grades_menu($this->assignment->grade); if ($ausers !== false) { $grading_info = grade_get_grades($this->course->id, 'mod', 'assignment', $this->assignment->id, array_keys($ausers)); $endposition = $offset + $perpage; $currentposition = 0; foreach ($ausers as $auser) { if ($currentposition == $offset && $offset < $endposition) { $rowclass = null; $final_grade = $grading_info->items[0]->grades[$auser->id]; $grademax = $grading_info->items[0]->grademax; $final_grade->formatted_grade = round($final_grade->grade, 2) . ' / ' . round($grademax, 2); $locked_overridden = 'locked'; if ($final_grade->overridden) { $locked_overridden = 'overridden'; } // TODO add here code if advanced grading grade must be reviewed => $auser->status=0 $picture = $OUTPUT->user_picture($auser); if (empty($auser->submissionid)) { $auser->grade = -1; //no submission yet } if (!empty($auser->submissionid)) { $hassubmission = true; ///Prints student answer and student modified date ///attach file or print link to student answer, depending on the type of the assignment. ///Refer to print_student_answer in inherited classes. if ($auser->timemodified > 0) { $studentmodifiedcontent = $this->print_student_answer($auser->id) . userdate($auser->timemodified); if ($assignment->timedue && $auser->timemodified > $assignment->timedue && $this->supports_lateness()) { $studentmodifiedcontent .= $this->display_lateness($auser->timemodified); $rowclass = 'late'; } } else { $studentmodifiedcontent = ' '; } $studentmodified = html_writer::tag('div', $studentmodifiedcontent, array('id' => 'ts' . $auser->id)); ///Print grade, dropdown or text if ($auser->timemarked > 0) { $teachermodified = '<div id="tt' . $auser->id . '">' . userdate($auser->timemarked) . '</div>'; if ($final_grade->locked or $final_grade->overridden) { $grade = '<div id="g' . $auser->id . '" class="' . $locked_overridden . '">' . $final_grade->formatted_grade . '</div>'; } else { if ($quickgrade) { $attributes = array(); $attributes['tabindex'] = $tabindex++; $menu = html_writer::label(get_string('assignment:grade', 'assignment'), 'menumenu' . $auser->id, false, array('class' => 'accesshide')); $menu .= html_writer::select(make_grades_menu($this->assignment->grade), 'menu[' . $auser->id . ']', $auser->grade, array(-1 => get_string('nograde')), $attributes); $grade = '<div id="g' . $auser->id . '">' . $menu . '</div>'; } else { $grade = '<div id="g' . $auser->id . '">' . $this->display_grade($auser->grade) . '</div>'; } } } else { $teachermodified = '<div id="tt' . $auser->id . '"> </div>'; if ($final_grade->locked or $final_grade->overridden) { $grade = '<div id="g' . $auser->id . '" class="' . $locked_overridden . '">' . $final_grade->formatted_grade . '</div>'; } else { if ($quickgrade) { $attributes = array(); $attributes['tabindex'] = $tabindex++; $menu = html_writer::label(get_string('assignment:grade', 'assignment'), 'menumenu' . $auser->id, false, array('class' => 'accesshide')); $menu .= html_writer::select(make_grades_menu($this->assignment->grade), 'menu[' . $auser->id . ']', $auser->grade, array(-1 => get_string('nograde')), $attributes); $grade = '<div id="g' . $auser->id . '">' . $menu . '</div>'; } else { $grade = '<div id="g' . $auser->id . '">' . $this->display_grade($auser->grade) . '</div>'; } } } ///Print Comment if ($final_grade->locked or $final_grade->overridden) { $comment = '<div id="com' . $auser->id . '">' . shorten_text(strip_tags($final_grade->str_feedback), 15) . '</div>'; } else { if ($quickgrade) { $comment = '<div id="com' . $auser->id . '">' . '<textarea tabindex="' . $tabindex++ . '" name="submissioncomment[' . $auser->id . ']" id="submissioncomment' . $auser->id . '" rows="2" cols="20">' . $auser->submissioncomment . '</textarea></div>'; } else { $comment = '<div id="com' . $auser->id . '">' . shorten_text(strip_tags($auser->submissioncomment), 15) . '</div>'; } } } else { $studentmodified = '<div id="ts' . $auser->id . '"> </div>'; $teachermodified = '<div id="tt' . $auser->id . '"> </div>'; $status = '<div id="st' . $auser->id . '"> </div>'; if ($final_grade->locked or $final_grade->overridden) { $grade = '<div id="g' . $auser->id . '">' . $final_grade->formatted_grade . '</div>'; $hassubmission = true; } else { if ($quickgrade) { // allow editing $attributes = array(); $attributes['tabindex'] = $tabindex++; $menu = html_writer::label(get_string('assignment:grade', 'assignment'), 'menumenu' . $auser->id, false, array('class' => 'accesshide')); $menu .= html_writer::select(make_grades_menu($this->assignment->grade), 'menu[' . $auser->id . ']', $auser->grade, array(-1 => get_string('nograde')), $attributes); $grade = '<div id="g' . $auser->id . '">' . $menu . '</div>'; $hassubmission = true; } else { $grade = '<div id="g' . $auser->id . '">-</div>'; } } if ($final_grade->locked or $final_grade->overridden) { $comment = '<div id="com' . $auser->id . '">' . $final_grade->str_feedback . '</div>'; } else { if ($quickgrade) { $comment = '<div id="com' . $auser->id . '">' . '<textarea tabindex="' . $tabindex++ . '" name="submissioncomment[' . $auser->id . ']" id="submissioncomment' . $auser->id . '" rows="2" cols="20">' . $auser->submissioncomment . '</textarea></div>'; } else { $comment = '<div id="com' . $auser->id . '"> </div>'; } } } if (empty($auser->status)) { /// Confirm we have exclusively 0 or 1 $auser->status = 0; } else { $auser->status = 1; } $buttontext = $auser->status == 1 ? $strupdate : $strgrade; if ($final_grade->locked or $final_grade->overridden) { $buttontext = $strview; } ///No more buttons, we use popups ;-). $popup_url = '/mod/assignment/submissions.php?id=' . $this->cm->id . '&userid=' . $auser->id . '&mode=single' . '&filter=' . $filter . '&offset=' . $offset++; $button = $OUTPUT->action_link($popup_url, $buttontext); $status = '<div id="up' . $auser->id . '" class="s' . $auser->status . '">' . $button . '</div>'; $finalgrade = '<span id="finalgrade_' . $auser->id . '">' . $final_grade->str_grade . '</span>'; $outcomes = ''; if ($uses_outcomes) { foreach ($grading_info->outcomes as $n => $outcome) { $outcomes .= '<div class="outcome"><label for="' . 'outcome_' . $n . '_' . $auser->id . '">' . $outcome->name . '</label>'; $options = make_grades_menu(-$outcome->scaleid); if ($outcome->grades[$auser->id]->locked or !$quickgrade) { $options[0] = get_string('nooutcome', 'grades'); $outcomes .= ': <span id="outcome_' . $n . '_' . $auser->id . '">' . $options[$outcome->grades[$auser->id]->grade] . '</span>'; } else { $attributes = array(); $attributes['tabindex'] = $tabindex++; $attributes['id'] = 'outcome_' . $n . '_' . $auser->id; $outcomes .= ' ' . html_writer::select($options, 'outcome_' . $n . '[' . $auser->id . ']', $outcome->grades[$auser->id]->grade, array(0 => get_string('nooutcome', 'grades')), $attributes); } $outcomes .= '</div>'; } } $userlink = '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $auser->id . '&course=' . $course->id . '">' . fullname($auser, has_capability('moodle/site:viewfullnames', $this->context)) . '</a>'; $extradata = array(); foreach ($extrafields as $field) { $extradata[] = $auser->{$field}; } $row = array_merge(array($picture, $userlink), $extradata, array($grade, $comment, $studentmodified, $teachermodified, $status, $finalgrade)); if ($uses_outcomes) { $row[] = $outcomes; } $table->add_data($row, $rowclass); } $currentposition++; } if ($hassubmission && method_exists($this, 'download_submissions')) { echo html_writer::start_tag('div', array('class' => 'mod-assignment-download-link')); echo html_writer::link(new moodle_url('/mod/assignment/submissions.php', array('id' => $this->cm->id, 'download' => 'zip')), get_string('downloadall', 'assignment')); echo html_writer::end_tag('div'); } $table->print_html(); /// Print the whole table } else { if ($filter == self::FILTER_SUBMITTED) { echo html_writer::tag('div', get_string('nosubmisson', 'assignment'), array('class' => 'nosubmisson')); } else { if ($filter == self::FILTER_REQUIRE_GRADING) { echo html_writer::tag('div', get_string('norequiregrading', 'assignment'), array('class' => 'norequiregrading')); } } } } /// Print quickgrade form around the table if ($quickgrade && $table->started_output && !empty($users)) { $mailinfopref = false; if (get_user_preferences('assignment_mailinfo', 1)) { $mailinfopref = true; } $emailnotification = html_writer::checkbox('mailinfo', 1, $mailinfopref, get_string('enablenotification', 'assignment')); $emailnotification .= $OUTPUT->help_icon('enablenotification', 'assignment'); echo html_writer::tag('div', $emailnotification, array('class' => 'emailnotification')); $savefeedback = html_writer::empty_tag('input', array('type' => 'submit', 'name' => 'fastg', 'value' => get_string('saveallfeedback', 'assignment'))); echo html_writer::tag('div', $savefeedback, array('class' => 'fastgbutton')); echo html_writer::end_tag('form'); } else { if ($quickgrade) { echo html_writer::end_tag('form'); } } echo '</div>'; /// End of fast grading form /// Mini form for setting user preference $formaction = new moodle_url('/mod/assignment/submissions.php', array('id' => $this->cm->id)); $mform = new MoodleQuickForm('optionspref', 'post', $formaction, '', array('class' => 'optionspref')); $mform->addElement('hidden', 'updatepref'); $mform->setDefault('updatepref', 1); $mform->addElement('header', 'qgprefs', get_string('optionalsettings', 'assignment')); $mform->addElement('select', 'filter', get_string('show'), $filters); $mform->setDefault('filter', $filter); $mform->addElement('text', 'perpage', get_string('pagesize', 'assignment'), array('size' => 1)); $mform->setDefault('perpage', $perpage); if ($this->quickgrade_mode_allowed()) { $mform->addElement('checkbox', 'quickgrade', get_string('quickgrade', 'assignment')); $mform->setDefault('quickgrade', $quickgrade); $mform->addHelpButton('quickgrade', 'quickgrade', 'assignment'); } $mform->addElement('submit', 'savepreferences', get_string('savepreferences')); $mform->display(); echo $OUTPUT->footer(); }
/** * Display month selector options * * @param string $name for the select element * @param string|array $selected options for select elements */ function calendar_print_month_selector($name, $selected) { $months = array(); for ($i = 1; $i <= 12; $i++) { $months[$i] = userdate(gmmktime(12, 0, 0, $i, 15, 2000), '%B'); } echo html_writer::label(get_string('months'), 'menu' . $name, false, array('class' => 'accesshide')); echo html_writer::select($months, $name, $selected, false); }
/** * This function is used to generate and display selector form * * @global stdClass $USER * @global stdClass $CFG * @global moodle_database $DB * @global core_renderer $OUTPUT * @global stdClass $SESSION * @uses CONTEXT_SYSTEM * @uses COURSE_MAX_COURSES_PER_DROPDOWN * @uses CONTEXT_COURSE * @uses SEPARATEGROUPS * @param stdClass $course course instance * @param int $selecteduser id of the selected user * @param string $selecteddate Date selected * @param string $modname course_module->id * @param string $modid number or 'site_errors' * @param string $modaction an action as recorded in the logs * @param int $selectedgroup Group to display * @param int $showcourses whether to show courses if we're over our limit. * @param int $showusers whether to show users if we're over our limit. * @param string $logformat Format of the logs (downloadascsv, showashtml, downloadasods, downloadasexcel) * @return void */ function report_plog_print_selector_form($student, $startdate = 0, $course, $metric, $test) { global $USER, $CFG, $DB, $OUTPUT, $SESSION; $sitecontext = context_system::instance(); $context = context_course::instance($course->id); if (has_capability('report/plog:viewcourse', $context)) { $showusers = 1; } else { $showusers = 0; } //probably remove this - not currently worried about groups (should we be though?) /// Setup for group handling. if ($course->groupmode == SEPARATEGROUPS and !has_capability('moodle/site:accessallgroups', $context)) { $selectedgroup = -1; $showgroups = false; } else { if ($course->groupmode) { $showgroups = true; } else { $selectedgroup = 0; $showgroups = false; } } if ($selectedgroup === -1) { if (isset($SESSION->currentgroup[$course->id])) { $selectedgroup = $SESSION->currentgroup[$course->id]; } else { $selectedgroup = groups_get_all_groups($course->id, $USER->id); if (is_array($selectedgroup)) { $selectedgroup = array_shift(array_keys($selectedgroup)); $SESSION->currentgroup[$course->id] = $selectedgroup; } else { $selectedgroup = 0; } } } // Get all the possible users $users = array(); // Define limitfrom and limitnum for queries below // If $showusers is enabled... don't apply limitfrom and limitnum $limitfrom = empty($showusers) ? 0 : ''; $limitnum = empty($showusers) ? COURSE_MAX_USERS_PER_DROPDOWN + 1 : ''; //this needs to be modified so we don't include admin and tutors for this course in the list? $courseusers = get_enrolled_users($context, '', $selectedgroup, 'u.id, u.firstname, u.lastname', null, $limitfrom, $limitnum); if ($showusers) { if ($courseusers) { foreach ($courseusers as $courseuser) { $users[$courseuser->id] = fullname($courseuser, has_capability('moodle/site:viewfullnames', $context)); } } $users[$CFG->siteguest] = get_string('guestuser'); } //echo $course->id; //$n = "select distinct clusteringname from cluster_runs r where r.courseid = $course->id"; $n = "select distinct clusteringname from cluster_runs r where r.courseid = {$course->id}"; $metrica = $DB->get_records_sql($n); //there has to be a better way of doing this... $metrics = array(); foreach ($metrica as $row) { $metrics[] = $row->clusteringname; } $strftimedate = get_string("strftimedate"); $strftimedaydate = get_string("strftimedaydate"); asort($users); $timenow = time(); // GMT // What day is it now for the user, and when is midnight that day (in GMT). $timemidnight = $today = usergetmidnight($timenow); // Put today up the top of the list //$dates = array("$timemidnight" => get_string("today").", ".userdate($timenow, $strftimedate) ); $dates = array(); if (!$course->startdate or $course->startdate > $timenow) { $course->startdate = $course->timecreated; } //want to change this so we have a number of intervals //from start of course //last week //last fortnight //last month $numdates = 1; while ($timemidnight > $course->startdate and $numdates < 5) { $timemidnight = $timemidnight - 604800; //number of seconds in a week $timenow = $timenow - 604800; $dates["{$timemidnight}"] = $numdates . " weeks:" . userdate($timenow, $strftimedaydate); $numdates++; } echo "<form class=\"logselectform\" action=\"{$CFG->wwwroot}/report/plog/index.php\" method=\"get\">\n"; echo "<div>\n"; echo "<input type=\"hidden\" name=\"chooselog\" value=\"1\" />\n"; echo "<input type=\"hidden\" name=\"showusers\" value=\"{$showusers}\" />\n"; echo "<input type=\"hidden\" name=\"test\" value=\"{$test}\" />\n"; if ($showusers) { echo html_writer::label(get_string('selctauser'), 'menuuser', false, array('class' => 'accesshide')); echo html_writer::select($users, "student", $student); } echo html_writer::label(get_string('date'), 'menudate', false, array('class' => 'accesshide')); echo html_writer::select($dates, "startdate", $startdate, get_string("alldays")); echo '<select id="menumetric" class="select menumetric" name="metric">'; foreach ($metrics as $metric) { echo "<option value='{$metric}'>{$metric}</option>"; } echo '</select>'; //echo html_writer::select($metrics, "metric", $metric, "metric"); echo '<input type="submit" value="' . get_string('gettheselogs') . '" />'; echo '</div>'; echo '</form>'; }
/** * Internal implementation of url_select rendering * @param single_select $select * @return string HTML fragment */ protected function render_url_select(url_select $select) { global $CFG; $select = clone $select; if (empty($select->formid)) { $select->formid = html_writer::random_id('url_select_f'); } if (empty($select->attributes['id'])) { $select->attributes['id'] = html_writer::random_id('url_select'); } if ($select->disabled) { $select->attributes['disabled'] = 'disabled'; } if ($select->tooltip) { $select->attributes['title'] = $select->tooltip; } $output = ''; if ($select->label) { $output .= html_writer::label($select->label, $select->attributes['id']); } if ($select->helpicon instanceof help_icon) { $output .= $this->render($select->helpicon); } else { if ($select->helpicon instanceof old_help_icon) { $output .= $this->render($select->helpicon); } } // For security reasons, the script course/jumpto.php requires URL starting with '/'. To keep // backward compatibility, we are removing heading $CFG->wwwroot from URLs here. $urls = array(); foreach ($select->urls as $k => $v) { if (is_array($v)) { // optgroup structure foreach ($v as $optgrouptitle => $optgroupoptions) { foreach ($optgroupoptions as $optionurl => $optiontitle) { if (empty($optionurl)) { $safeoptionurl = ''; } else { if (strpos($optionurl, $CFG->wwwroot . '/') === 0) { // debugging('URLs passed to url_select should be in local relative form - please fix the code.', DEBUG_DEVELOPER); $safeoptionurl = str_replace($CFG->wwwroot, '', $optionurl); } else { if (strpos($optionurl, '/') !== 0) { debugging("Invalid url_select urls parameter inside optgroup: url '{$optionurl}' is not local relative url!"); continue; } else { $safeoptionurl = $optionurl; } } } $urls[$k][$optgrouptitle][$safeoptionurl] = $optiontitle; } } } else { // plain list structure if (empty($k)) { // nothing selected option } else { if (strpos($k, $CFG->wwwroot . '/') === 0) { $k = str_replace($CFG->wwwroot, '', $k); } else { if (strpos($k, '/') !== 0) { debugging("Invalid url_select urls parameter: url '{$k}' is not local relative url!"); continue; } } } $urls[$k] = $v; } } $selected = $select->selected; if (!empty($selected)) { if (strpos($select->selected, $CFG->wwwroot . '/') === 0) { $selected = str_replace($CFG->wwwroot, '', $selected); } else { if (strpos($selected, '/') !== 0) { debugging("Invalid value of parameter 'selected': url '{$selected}' is not local relative url!"); } } } $output .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey())); $output .= html_writer::select($urls, 'jump', $selected, $select->nothing, $select->attributes); if (!$select->showbutton) { $go = html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('go'))); $output .= html_writer::tag('noscript', html_writer::tag('div', $go), array('style' => 'inline')); $nothing = empty($select->nothing) ? false : key($select->nothing); $output .= $this->page->requires->js_init_call('M.util.init_url_select', array($select->formid, $select->attributes['id'], $nothing)); } else { $output .= html_writer::empty_tag('input', array('type' => 'submit', 'value' => $select->showbutton)); } // then div wrapper for xhtml strictness $output = html_writer::tag('div', $output); // now the form itself around it $formattributes = array('method' => 'post', 'action' => new moodle_url('/course/jumpto.php'), 'id' => $select->formid); $output = html_writer::tag('form', $output, $formattributes); // and finally one more wrapper with class return html_writer::tag('div', $output, array('class' => $select->class)); }
/** * Returns XHTML field(s) as required by choices * * Relies on data being an array should data ever be another valid vartype with * acceptable value this may cause a warning/error * if (!is_array($data)) would fix the problem * * @todo Add vartype handling to ensure $data is an array * * @param array $data An array of checked values * @param string $query * @return string XHTML field */ public function output_html($data, $query = '') { $return = html_writer::start_tag('div', array('style' => 'float:left; width:auto; margin-right: 0.5em;')); $return .= html_writer::tag('div', get_string('roles', 'role'), array('style' => 'height: 2em;')); foreach ($data as $role) { $return .= html_writer::tag('div', s($role['name']), array('style' => 'height: 2em;')); } $return .= html_writer::end_tag('div'); $return .= html_writer::start_tag('div', array('style' => 'float:left; width:auto; margin-right: 0.5em;')); $return .= html_writer::tag('div', get_string('contexts', 'enrol_ldap'), array('style' => 'height: 2em;')); foreach ($data as $role) { $contextid = $this->get_id() . '[' . $role['id'] . '][contexts]'; $contextname = $this->get_full_name() . '[' . $role['id'] . '][contexts]'; $return .= html_writer::start_tag('div', array('style' => 'height: 2em;')); $return .= html_writer::label(get_string('role_mapping_context', 'enrol_ldap', $role['name']), $contextid, false, array('class' => 'accesshide')); $attrs = array('type' => 'text', 'size' => '40', 'id' => $contextid, 'name' => $contextname, 'value' => s($role['contexts'])); $return .= html_writer::empty_tag('input', $attrs); $return .= html_writer::end_tag('div'); } $return .= html_writer::end_tag('div'); $return .= html_writer::start_tag('div', array('style' => 'float:left; width:auto; margin-right: 0.5em;')); $return .= html_writer::tag('div', get_string('memberattribute', 'enrol_ldap'), array('style' => 'height: 2em;')); foreach ($data as $role) { $memberattrid = $this->get_id() . '[' . $role['id'] . '][memberattribute]'; $memberattrname = $this->get_full_name() . '[' . $role['id'] . '][memberattribute]'; $return .= html_writer::start_tag('div', array('style' => 'height: 2em;')); $return .= html_writer::label(get_string('role_mapping_attribute', 'enrol_ldap', $role['name']), $memberattrid, false, array('class' => 'accesshide')); $attrs = array('type' => 'text', 'size' => '15', 'id' => $memberattrid, 'name' => $memberattrname, 'value' => s($role['memberattribute'])); $return .= html_writer::empty_tag('input', $attrs); $return .= html_writer::end_tag('div'); } $return .= html_writer::end_tag('div'); $return .= html_writer::tag('div', '', array('style' => 'clear:both;')); return format_admin_setting($this, $this->visiblename, $return, $this->description, true, '', '', $query); }
$home_url->param('action', 'movefile'); $home_url->param('draftpath', $draftpath); $home_url->param('filename', $filename); file_get_drafarea_folders($itemid, '/', $data); print_draft_area_tree($data, true, $home_url); echo $OUTPUT->footer(); break; case 'mkdirform': echo $OUTPUT->header(); echo $OUTPUT->container_start(); echo html_writer::link($home_url, get_string('back', 'repository')); echo $OUTPUT->container_end(); $home_url->param('draftpath', $draftpath); $home_url->param('action', 'mkdir'); echo ' <form method="post" action="' . $home_url->out() . '">'; echo html_writer::label(get_string('entername', 'repository'), 'newdirname', array('class' => 'accesshide')); echo ' <input name="newdirname" id="newdirname" type="text" />'; echo ' <input name="draftpath" type="hidden" value="' . s($draftpath) . '" />'; echo ' <input type="submit" value="' . s(get_string('makeafolder', 'moodle')) . '" />'; echo ' </form>'; echo $OUTPUT->footer(); break; case 'mkdir': $newfolderpath = $draftpath . trim($newdirname, '/') . '/'; $fs->create_directory($user_context->id, 'user', 'draft', $itemid, $newfolderpath); $home_url->param('action', 'browse'); if (!empty($newdirname)) { $home_url->param('draftpath', $newfolderpath); $str = get_string('createfoldersuccess', 'repository'); } else { $home_url->param('draftpath', $draftpath);
/** * Output a select menu of question categories. * * Categories from this course and (optionally) published categories from other courses * are included. Optionally, only categories the current user may edit can be included. * * @param integer $courseid the id of the course to get the categories for. * @param integer $published if true, include publised categories from other courses. * @param integer $only_editable if true, exclude categories this user is not allowed to edit. * @param integer $selected optionally, the id of a category to be selected by * default in the dropdown. */ function question_category_select_menu($contexts, $top = false, $currentcat = 0, $selected = "", $nochildrenof = -1) { global $OUTPUT; $categoriesarray = question_category_options($contexts, $top, $currentcat, false, $nochildrenof); if ($selected) { $choose = ''; } else { $choose = 'choosedots'; } $options = array(); foreach ($categoriesarray as $group => $opts) { $options[] = array($group => $opts); } echo html_writer::label($selected, 'menucategory', false, array('class' => 'accesshide')); echo html_writer::select($options, 'category', $selected, $choose); }
protected function writequestion($question) { global $OUTPUT; // Turns question into string. // Question reflects database fields for general question and specific to type. // If a category switch, just ignore. if ($question->qtype == 'category') { return ''; } // Initial string. $expout = ""; $id = $question->id; // Add comment and div tags. $expout .= "<!-- question: {$id} name: {$question->name} -->\n"; $expout .= "<div class=\"question\">\n"; // Add header. $expout .= "<h3>{$question->name}</h3>\n"; // Format and add the question text. $text = question_rewrite_question_preview_urls($question->questiontext, $question->id, $question->contextid, 'question', 'questiontext', $question->id, $question->contextid, 'qformat_xhtml'); $expout .= '<p class="questiontext">' . format_text($text, $question->questiontextformat, array('noclean' => true)) . "</p>\n"; // Selection depends on question type. switch ($question->qtype) { case 'truefalse': $sttrue = get_string('true', 'qtype_truefalse'); $stfalse = get_string('false', 'qtype_truefalse'); $expout .= "<ul class=\"truefalse\">\n"; $expout .= " <li><input name=\"quest_{$id}\" type=\"radio\" value=\"{$sttrue}\" />{$sttrue}</li>\n"; $expout .= " <li><input name=\"quest_{$id}\" type=\"radio\" value=\"{$stfalse}\" />{$stfalse}</li>\n"; $expout .= "</ul>\n"; break; case 'multichoice': $expout .= "<ul class=\"multichoice\">\n"; foreach ($question->options->answers as $answer) { $answertext = $this->repchar($answer->answer); if ($question->options->single) { $expout .= " <li><input name=\"quest_{$id}\" type=\"radio\" value=\"" . s($answertext) . "\" />{$answertext}</li>\n"; } else { $expout .= " <li><input name=\"quest_{$id}\" type=\"checkbox\" value=\"" . s($answertext) . "\" />{$answertext}</li>\n"; } } $expout .= "</ul>\n"; break; case 'shortanswer': $expout .= html_writer::start_tag('ul', array('class' => 'shortanswer')); $expout .= html_writer::start_tag('li'); $expout .= html_writer::label(get_string('answer'), 'quest_' . $id, false, array('class' => 'accesshide')); $expout .= html_writer::empty_tag('input', array('id' => "quest_{$id}", 'name' => "quest_{$id}", 'type' => 'text')); $expout .= html_writer::end_tag('li'); $expout .= html_writer::end_tag('ul'); break; case 'numerical': $expout .= html_writer::start_tag('ul', array('class' => 'numerical')); $expout .= html_writer::start_tag('li'); $expout .= html_writer::label(get_string('answer'), 'quest_' . $id, false, array('class' => 'accesshide')); $expout .= html_writer::empty_tag('input', array('id' => "quest_{$id}", 'name' => "quest_{$id}", 'type' => 'text')); $expout .= html_writer::end_tag('li'); $expout .= html_writer::end_tag('ul'); break; case 'match': $expout .= html_writer::start_tag('ul', array('class' => 'match')); // Build answer list. $answerlist = array(); foreach ($question->options->subquestions as $subquestion) { $answerlist[] = $this->repchar($subquestion->answertext); } shuffle($answerlist); // Random display order. // Build select options. $selectoptions = array(); foreach ($answerlist as $ans) { $selectoptions[s($ans)] = s($ans); } // Display. $option = 0; foreach ($question->options->subquestions as $subquestion) { // Build drop down for answers. $questiontext = $this->repchar($subquestion->questiontext); if ($questiontext != '') { $dropdown = html_writer::label(get_string('answer', 'qtype_match', $option + 1), 'quest_' . $id . '_' . $option, false, array('class' => 'accesshide')); $dropdown .= html_writer::select($selectoptions, "quest_{$id}_{$option}", '', false, array('id' => "quest_{$id}_{$option}")); $expout .= html_writer::tag('li', $questiontext); $expout .= $dropdown; $option++; } } $expout .= html_writer::end_tag('ul'); break; case 'description': break; case 'multianswer': default: $expout .= "<!-- export of {$question->qtype} type is not supported -->\n"; } // Close off div. $expout .= "</div>\n\n\n"; return $expout; }
} $table->id = 'frontpagefiltersettings'; $table->attributes['class'] = 'admintable generaltable'; $table->data = array(); // iterate through filters adding to display table foreach ($availablefilters as $filter => $filterinfo) { $row = array(); // Filter name. $row[] = filter_get_name($filter); // Default/on/off choice. if ($filterinfo->inheritedstate == TEXTFILTER_ON) { $activechoices[TEXTFILTER_INHERIT] = $strdefaulton; } else { $activechoices[TEXTFILTER_INHERIT] = $strdefaultoff; } $select = html_writer::label($filterinfo->localstate, 'menu' . $filter, false, array('class' => 'accesshide')); $select .= html_writer::select($activechoices, $filter, $filterinfo->localstate, false); $row[] = $select; // Settings link, if required if ($settingscol) { $settings = ''; if ($filterinfo->hassettings) { $settings = '<a href="' . $baseurl->out(true, array('filter' => $filter)) . '">' . $strsettings . '</a>'; } $row[] = $settings; } $table->data[] = $row; } echo html_writer::table($table); echo html_writer::start_tag('div', array('class' => 'buttons')); echo html_writer::empty_tag('input', array('type' => 'submit', 'name' => 'savechanges', 'value' => get_string('savechanges')));
/** * Column select * * @param stdClass $tag * @return string */ public function col_select($tag) { $id = "tagselect" . $tag->id; return html_writer::label(get_string('selecttag', 'tag', $tag->rawname), $id, false, array('class' => 'accesshide')) . html_writer::empty_tag('input', array('type' => 'checkbox', 'name' => 'tagschecked[]', 'value' => $tag->id, 'id' => $id)); }
echo '<input type="hidden" name="id" value="' . $course->id . '" />'; echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />'; $state_names = note_get_state_names(); // the first time list hack if (empty($users) and $post = data_submitted()) { foreach ($post as $k => $v) { if (preg_match('/^user(\\d+)$/', $k, $m)) { $users[] = $m[1]; } } } $userlist = array(); foreach ($users as $k => $v) { if (!($user = $DB->get_record('user', array('id' => $v)))) { continue; } echo '<input type="hidden" name="userid[' . $k . ']" value="' . $v . '" />'; $userlist[] = fullname($user, true); } echo '<p>'; echo get_string('users') . ': ' . implode(', ', $userlist) . '.'; echo '</p>'; echo '<p>' . get_string('content', 'notes'); echo '<br /><textarea name="content" rows="5" cols="50" spellcheck="true">' . strip_tags(@$content) . '</textarea></p>'; echo '<p>'; echo html_writer::label(get_string('publishstate', 'notes'), 'menustate'); echo $OUTPUT->help_icon('publishstate', 'notes'); echo html_writer::select($state_names, 'state', empty($state) ? NOTES_STATE_PUBLIC : $state, false); echo '</p>'; echo '<input type="submit" value="' . get_string('savechanges') . '" /></div></form>'; echo $OUTPUT->footer();
/** * @global object * @param object $choicegroup * @param object $course * @param object $coursemodule * @param array $allresponses * * @param bool $allresponses * @return object */ function prepare_choicegroup_show_results($choicegroup, $course, $cm, $allresponses, $forcepublish = false) { global $CFG, $FULLSCRIPT, $PAGE, $OUTPUT; $display = clone $choicegroup; $display->coursemoduleid = $cm->id; $display->courseid = $course->id; //debugging('<pre>'.print_r($choicegroup->option, true).'</pre>', DEBUG_DEVELOPER); //debugging('<pre>'.print_r($allresponses, true).'</pre>', DEBUG_DEVELOPER); //overwrite options value; $display->options = array(); $totaluser = 0; foreach ($choicegroup->option as $optionid => $groupid) { $display->options[$optionid] = new stdClass(); $display->options[$optionid]->groupid = $groupid; $display->options[$optionid]->maxanswer = $choicegroup->maxanswers[$optionid]; if (array_key_exists($groupid, $allresponses)) { $display->options[$optionid]->user = $allresponses[$groupid]; $totaluser += count($allresponses[$groupid]); } } if ($choicegroup->showunanswered) { $display->options[0]->user = $allresponses[0]; } unset($display->option); unset($display->maxanswers); $display->numberofuser = $totaluser; $context = context_module::instance($cm->id); $display->viewresponsecapability = has_capability('mod/choicegroup:readresponses', $context); $display->deleterepsonsecapability = has_capability('mod/choicegroup:deleteresponses', $context); $display->fullnamecapability = has_capability('moodle/site:viewfullnames', $context); if (empty($allresponses)) { echo $OUTPUT->heading(get_string("nousersyet")); return false; } $totalresponsecount = 0; foreach ($allresponses as $optionid => $userlist) { if ($choicegroup->showunanswered || $optionid) { $totalresponsecount += count($userlist); } } $context = context_module::instance($cm->id); $hascapfullnames = has_capability('moodle/site:viewfullnames', $context); $viewresponses = has_capability('mod/choicegroup:readresponses', $context); switch ($forcepublish) { case CHOICEGROUP_PUBLISH_NAMES: echo '<div id="tablecontainer">'; if ($viewresponses) { echo '<form id="attemptsform" method="post" action="' . $FULLSCRIPT . '" onsubmit="var menu = document.getElementById(\'menuaction\'); return (menu.options[menu.selectedIndex].value == \'delete\' ? \'' . addslashes_js(get_string('deleteattemptcheck', 'quiz')) . '\' : true);">'; echo '<div>'; echo '<input type="hidden" name="id" value="' . $cm->id . '" />'; echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />'; echo '<input type="hidden" name="mode" value="overview" />'; } echo "<table cellpadding=\"5\" cellspacing=\"10\" class=\"results names\">"; echo "<tr>"; $columncount = array(); // number of votes in each column if ($choicegroup->showunanswered) { $columncount[0] = 0; echo "<th class=\"col0 header\" scope=\"col\">"; print_string('notanswered', 'choicegroup'); echo "</th>"; } $count = 1; foreach ($choicegroup->option as $optionid => $optiontext) { $columncount[$optionid] = 0; // init counters echo "<th class=\"col{$count} header\" scope=\"col\">"; echo format_string($optiontext); echo "</th>"; $count++; } echo "</tr><tr>"; if ($choicegroup->showunanswered) { echo "<td class=\"col{$count} data\" >"; // added empty row so that when the next iteration is empty, // we do not get <table></table> error from w3c validator // MDL-7861 echo "<table class=\"choicegroupresponse\"><tr><td></td></tr>"; if (!empty($allresponses[0])) { foreach ($allresponses[0] as $user) { echo "<tr>"; echo "<td class=\"picture\">"; echo $OUTPUT->user_picture($user, array('courseid' => $course->id)); echo "</td><td class=\"fullname\">"; echo "<a href=\"{$CFG->wwwroot}/user/view.php?id={$user->id}&course={$course->id}\">"; echo fullname($user, $hascapfullnames); echo "</a>"; echo "</td></tr>"; } } echo "</table></td>"; } $count = 1; foreach ($choicegroup->option as $optionid => $optiontext) { echo '<td class="col' . $count . ' data" >'; // added empty row so that when the next iteration is empty, // we do not get <table></table> error from w3c validator // MDL-7861 echo '<table class="choicegroupresponse"><tr><td></td></tr>'; if (isset($allresponses[$optionid])) { foreach ($allresponses[$optionid] as $user) { $columncount[$optionid] += 1; echo '<tr><td class="attemptcell">'; if ($viewresponses and has_capability('mod/choicegroup:deleteresponses', $context)) { echo '<input type="checkbox" name="userid[]" value="' . $user->id . '" />'; } echo '</td><td class="picture">'; echo $OUTPUT->user_picture($user, array('courseid' => $course->id)); echo '</td><td class="fullname">'; echo "<a href=\"{$CFG->wwwroot}/user/view.php?id={$user->id}&course={$course->id}\">"; echo fullname($user, $hascapfullnames); echo '</a>'; echo '</td></tr>'; } } $count++; echo '</table></td>'; } echo "</tr><tr>"; $count = 1; if ($choicegroup->showunanswered) { echo "<td></td>"; } foreach ($choicegroup->option as $optionid => $optiontext) { echo "<td align=\"center\" class=\"col{$count} count\">"; if ($choicegroup->limitanswers) { echo get_string("taken", "choicegroup") . ":"; echo $columncount[$optionid]; echo "<br/>"; echo get_string("limit", "choicegroup") . ":"; echo $choicegroup->maxanswers[$optionid]; } else { if (isset($columncount[$optionid])) { echo $columncount[$optionid]; } } echo "</td>"; $count++; } echo "</tr>"; /// Print "Select all" etc. if ($viewresponses and has_capability('mod/choicegroup:deleteresponses', $context)) { echo '<tr><td></td><td>'; echo '<a href="javascript:select_all_in(\'DIV\',null,\'tablecontainer\');">' . get_string('selectall') . '</a> / '; echo '<a href="javascript:deselect_all_in(\'DIV\',null,\'tablecontainer\');">' . get_string('deselectall') . '</a> '; echo ' '; echo html_writer::label(get_string('withselected', 'choicegroup'), 'menuaction'); echo html_writer::select(array('delete' => get_string('delete')), 'action', '', array('' => get_string('withselectedusers')), array('id' => 'menuaction')); $PAGE->requires->js_init_call('M.util.init_select_autosubmit', array('attemptsform', 'menuaction', '')); echo '<noscript id="noscriptmenuaction" style="display:inline">'; echo '<div>'; echo '<input type="submit" value="' . get_string('go') . '" /></div></noscript>'; echo '</td><td></td></tr>'; } echo "</table></div>"; if ($viewresponses) { echo "</form></div>"; } break; } return $display; }
// add 'Category' column $category = coursecat::get($acourse->category, IGNORE_MISSING, true); $cell = new html_table_cell($category->get_formatted_name()); $cell->attributes['class'] = $category->visible ? '' : 'dimmed_text'; array_splice($table->data[count($table->data) - 1]->cells, 1, 0, array($cell)); } } if ($abletomovecourses) { $movetocategories = coursecat::make_categories_list('moodle/category:manage'); $movetocategories[$id] = get_string('moveselectedcoursesto'); $cell = new html_table_cell(); $cell->colspan = 3; $cell->attributes['class'] = 'mdl-right'; $cell->text = html_writer::label(get_string('moveselectedcoursesto'), 'movetoid', false, array('class' => 'accesshide')); $cell->text .= html_writer::select($movetocategories, 'moveto', $id, null, array('id' => 'movetoid', 'class' => 'autosubmit')); $cell->text .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'categoryid', 'value' => $id)); $PAGE->requires->yui_module('moodle-core-formautosubmit', 'M.core.init_formautosubmit', array(array('selectid' => 'movetoid', 'nothing' => $id)) ); $table->data[] = new html_table_row(array($cell)); } $actionurl = new moodle_url('/course/manage.php'); $pagingurl = new moodle_url('/course/manage.php', array('categoryid' => $id, 'perpage' => $perpage) + $searchcriteria); echo $OUTPUT->paging_bar($totalcount, $page, $perpage, $pagingurl); echo html_writer::start_tag('form', array('id' => 'movecourses', 'action' => $actionurl, 'method' => 'post')); echo html_writer::start_tag('div');
echo html_writer::start_div('', array('id' => 'showall')); echo html_writer::link($perpageurl, get_string('showperpage', '', DEFAULT_PAGE_SIZE)); echo html_writer::end_div(); } else { if ($matchcount > 0 && $perpage < $matchcount) { $perpageurl = new moodle_url($baseurl, array('perpage' => SHOW_ALL_PAGE_SIZE)); echo html_writer::start_div('', array('id' => 'showall')); echo html_writer::link($perpageurl, get_string('showall', '', $matchcount)); echo html_writer::end_div(); } } echo '<div class="selectbuttons">'; echo '<input type="button" id="checkall" value="' . get_string('selectall') . '" /> ' . "\n"; echo '<input type="button" id="checknone" value="' . get_string('deselectall') . '" /> ' . "\n"; if ($perpage >= $matchcount) { echo '<input type="button" id="checknos" value="' . get_string('selectnos') . '" />' . "\n"; } echo '</div>'; echo '<div>'; echo html_writer::label(get_string('withselectedusers'), 'formactionselect'); $displaylist['messageselect.php'] = get_string('messageselectadd'); echo html_writer::select($displaylist, 'formaction', '', array('' => 'choosedots'), array('id' => 'formactionselect')); echo $OUTPUT->help_icon('withselectedusers'); echo '<input type="submit" value="' . get_string('ok') . '" />' . "\n"; echo '</div>'; echo '</div>' . "\n"; echo '</form>' . "\n"; echo '</div>' . "\n"; $PAGE->requires->js_init_call('M.report_participation.init'); } echo $OUTPUT->footer();
/** * Creates necessary fields in the messaging config form. * * @param array $preferences An array of user preferences */ function config_form($preferences) { global $USER, $OUTPUT, $CFG; $string = ''; $choices = array(); $choices['0'] = get_string('textformat'); $choices['1'] = get_string('htmlformat'); $current = $preferences->mailformat; $string .= $OUTPUT->container(html_writer::label(get_string('emailformat'), 'mailformat')); $string .= $OUTPUT->container(html_writer::select($choices, 'mailformat', $current, false, array('id' => 'mailformat'))); $string .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'userid', 'value' => $USER->id)); if (!empty($CFG->allowusermailcharset)) { $choices = array(); $charsets = get_list_of_charsets(); if (!empty($CFG->sitemailcharset)) { $choices['0'] = get_string('site') . ' (' . $CFG->sitemailcharset . ')'; } else { $choices['0'] = get_string('site') . ' (UTF-8)'; } $choices = array_merge($choices, $charsets); $current = $preferences->mailcharset; $string .= $OUTPUT->container(html_writer::label(get_string('emailcharset'), 'mailcharset')); $string .= $OUTPUT->container(html_writer::select($choices, 'preference_mailcharset', $current, false, array('id' => 'mailcharset'))); } if (!empty($CFG->messagingallowemailoverride)) { $inputattributes = array('size' => '30', 'name' => 'email_email', 'value' => $preferences->email_email, 'id' => 'email_email'); $string .= html_writer::label(get_string('email', 'message_email'), 'email_email'); $string .= $OUTPUT->container(html_writer::empty_tag('input', $inputattributes)); if (empty($preferences->email_email) && !empty($preferences->userdefaultemail)) { $string .= $OUTPUT->container(get_string('ifemailleftempty', 'message_email', $preferences->userdefaultemail)); } if (!empty($preferences->email_email) && !validate_email($preferences->email_email)) { $string .= $OUTPUT->container(get_string('invalidemail'), 'error'); } $string .= '<br/>'; } return $string; }
echo '<input type="hidden" name="courseitemfilter" value="'.$courseitemfilter.'" />'; echo '<input type="hidden" name="courseitemfiltertyp" value="'.$courseitemfiltertyp.'" />'; echo '<input type="hidden" name="courseid" value="'.$courseid.'" />'; echo html_writer::script('', $CFG->wwwroot.'/mod/feedback/feedback.js'); $sql = 'select DISTINCT c.id, c.shortname from {course} c, '. '{feedback_value} fv, {feedback_item} fi '. 'where c.id = fv.course_id and fv.item = fi.id '. 'and fi.feedback = ? '. 'and ('.$DB->sql_like('c.shortname', '?', false).' OR '.$DB->sql_like('c.fullname', '?', false).')'; $params = array($feedback->id, "%$searchcourse%", "%$searchcourse%"); if ($courses = $DB->get_records_sql_menu($sql, $params)) { echo ' '. html_writer::label(get_string('filter_by_course', 'feedback'), 'coursefilterid'). ': '; echo html_writer::select($courses, 'coursefilter', $coursefilter, null, array('id'=>'coursefilterid')); $PAGE->requires->js_init_call('M.util.init_select_autosubmit', array('analysis-form', 'coursefilterid', false)); } echo '<hr />'; $itemnr = 0; //print the items in an analysed form echo '<tr><td>'; foreach ($items as $item) { if ($item->hasvalue == 0) { continue; } echo '<table width="100%" class="generalbox">';
public function recipientsform($courseid, $userid) { global $COURSE, $DB; $options = array(); $owngroups = groups_get_user_groups($courseid, $userid); $content = html_writer::start_tag('div', array('id' => 'local_mail_recipients_form', 'class' => 'local_mail_form mail_hidden')); if ($COURSE->groupmode == SEPARATEGROUPS and empty($owngroups[0])) { return ''; } $content .= html_writer::start_tag('div', array('class' => 'mail_recipients_toolbar')); // Roles $context = context_course::instance($courseid); $roles = role_get_names($context); $userroles = local_mail_get_user_roleids($userid, $context); $mailsamerole = has_capability('local/mail:mailsamerole', $context); foreach ($roles as $key => $role) { $count = $DB->count_records_select('role_assignments', "contextid = :contextid AND roleid = :roleid AND userid <> :userid", array('contextid' => $context->id, 'roleid' => $role->id, 'userid' => $userid)); if (($count && $mailsamerole) || ($count && !$mailsamerole && !in_array($role->id, $userroles))) { $options[$key] = $role->localname; } } $text = get_string('role', 'moodle'); $content .= html_writer::start_tag('span', array('class' => 'roleselector')); $content .= html_writer::label($text, 'local_mail_roles'); $text = get_string('all', 'local_mail'); $content .= html_writer::select($options, 'local_mail_roles', '', array('' => $text), array('id' => 'local_mail_recipients_roles', 'class' => '')); $content .= html_writer::end_tag('span'); // Groups $groups = groups_get_all_groups($courseid); if ($COURSE->groupmode == NOGROUPS or ($COURSE->groupmode == VISIBLEGROUPS and empty($groups))) { $content .= html_writer::tag('span', get_string('allparticipants', 'moodle'), array('class' => 'groupselector groupname')); } else { if ($COURSE->groupmode == VISIBLEGROUPS or has_capability('moodle/site:accessallgroups', $context)) { unset($options); foreach ($groups as $key => $group) { $options[$key] = $group->name; } $text = get_string('group', 'moodle'); $content .= html_writer::start_tag('span', array('class' => 'groupselector')); $content .= html_writer::label($text, 'local_mail_recipients_groups'); $text = get_string('allparticipants', 'moodle'); $content .= html_writer::select($options, 'local_mail_recipients_groups', '', array('' => $text), array('id' => 'local_mail_recipients_groups', 'class' => '')); $content .= html_writer::end_tag('span'); } else if (count($owngroups[0]) == 1) {// SEPARATEGROUPS and user in only one group $text = get_string('group', 'moodle'); $content .= html_writer::start_tag('span', array('class' => 'groupselector')); $content .= html_writer::label("$text: ", null); $content .= html_writer::tag('span', groups_get_group_name($owngroups[0][0]), array('class' => 'groupname')); $content .= html_writer::end_tag('span'); } else if (count($owngroups[0]) > 1) {// SEPARATEGROUPS and user in several groups unset($options); foreach ($owngroups[0] as $key => $group) { $options[$group] = groups_get_group_name($group); } $text = get_string('group', 'moodle'); $content .= html_writer::start_tag('span', array('class' => 'groupselector')); $content .= html_writer::label($text, 'local_mail_recipients_groups'); $text = get_string('allparticipants', 'moodle'); $content .= html_writer::select($options, 'local_mail_recipients_groups', '', array(key($options) => current($options)), array('id' => 'local_mail_recipients_groups', 'class' => '')); $content .= html_writer::end_tag('span'); } } $content .= html_writer::tag('div', '', array('class' => 'mail_separator')); // Search $content .= html_writer::start_tag('div', array('class' => 'mail_recipients_search')); $attributes = array( 'type' => 'text', 'name' => 'recipients_search', 'value' => '', 'maxlength' => '100', 'class' => 'mail_search' ); $text = get_string('search', 'local_mail'); $content .= html_writer::label($text, 'recipients_search'); $content .= html_writer::empty_tag('input', $attributes); // Select all recipients $content .= html_writer::start_tag('span', array('class' => 'mail_all_recipients_actions')); $attributes = array( 'type' => 'button', 'name' => "to_all", 'value' => get_string('to', 'local_mail') ); $content .= html_writer::empty_tag('input', $attributes); $attributes = array( 'type' => 'button', 'name' => "cc_all", 'value' => get_string('cc', 'local_mail') ); $content .= html_writer::empty_tag('input', $attributes); $attributes = array( 'type' => 'button', 'name' => "bcc_all", 'value' => get_string('bcc', 'local_mail') ); $content .= html_writer::empty_tag('input', $attributes); $attributes = array('type' => 'image', 'name' => "remove_all", 'src' => $this->output->pix_url('t/delete'), 'alt' => get_string('remove')); $content .= html_writer::empty_tag('input', $attributes); $content .= html_writer::end_tag('span'); $content .= html_writer::end_tag('div'); $content .= html_writer::end_tag('div'); $content .= html_writer::tag('div', '', array('id' => 'local_mail_recipients_list', 'class' => 'mail_form_recipients')); $content .= html_writer::start_tag('div', array('class' => 'mail_recipients_loading')); $content .= $this->output->pix_icon('i/loading', get_string('actions'), 'moodle', array('class' => 'loading_icon')); $content .= html_writer::end_tag('div'); $content .= html_writer::end_tag('div'); return $content; }
public function custom_generator_tools($datasetdef) { global $OUTPUT; if (preg_match('~^(uniform|loguniform):([^:]*):([^:]*):([0-9]*)$~', $datasetdef->options, $regs)) { $defid = "{$datasetdef->type}-{$datasetdef->category}-{$datasetdef->name}"; for ($i = 0; $i < 10; ++$i) { $lengthoptions[$i] = get_string($regs[1] == 'uniform' ? 'decimals' : 'significantfigures', 'qtype_calculated', $i); } $menu1 = html_writer::label(get_string('lengthoption', 'qtype_calculated'), 'menucalclength', false, array('class' => 'accesshide')); $menu1 .= html_writer::select($lengthoptions, 'calclength[]', $regs[4], null); $options = array('uniform' => get_string('uniformbit', 'qtype_calculated'), 'loguniform' => get_string('loguniformbit', 'qtype_calculated')); $menu2 = html_writer::label(get_string('distributionoption', 'qtype_calculated'), 'menucalcdistribution', false, array('class' => 'accesshide')); $menu2 .= html_writer::select($options, 'calcdistribution[]', $regs[1], null); return '<input type="submit" onclick="' . "getElementById('addform').regenerateddefid.value='{$defid}'; return true;" . '" value="' . get_string('generatevalue', 'qtype_calculated') . '"/><br/>' . '<input type="text" size="3" name="calcmin[]" ' . " value=\"{$regs['2']}\"/> & <input name=\"calcmax[]\" " . ' type="text" size="3" value="' . $regs[3] . '"/> ' . $menu1 . '<br/>' . $menu2; } else { return ''; } }
} echo $OUTPUT->header(); $cohorts = cohort_get_cohorts($context->id, $page, 25, $searchquery); $count = ''; if ($cohorts['allcohorts'] > 0) { if ($searchquery === '') { $count = ' (' . $cohorts['allcohorts'] . ')'; } else { $count = ' (' . $cohorts['totalcohorts'] . '/' . $cohorts['allcohorts'] . ')'; } } echo $OUTPUT->heading(get_string('cohortsin', 'cohort', $context->get_context_name()) . $count); // Add search form. $search = html_writer::start_tag('form', array('id' => 'searchcohortquery', 'method' => 'get')); $search .= html_writer::start_tag('div'); $search .= html_writer::label(get_string('searchcohort', 'cohort'), 'cohort_search_q'); // No : in form labels! $search .= html_writer::empty_tag('input', array('id' => 'cohort_search_q', 'type' => 'text', 'name' => 'search', 'value' => $searchquery)); $search .= html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('search', 'cohort'))); $search .= html_writer::end_tag('div'); $search .= html_writer::end_tag('form'); echo $search; // Output pagination bar. $params = array('page' => $page); if ($contextid) { $params['contextid'] = $contextid; } if ($search) { $params['search'] = $searchquery; } $baseurl = new moodle_url('/cohort/index.php', $params);
} // Check to see if we have a normalisation message to send. if (!empty($normalisationmessage)) { echo $OUTPUT->notification($normalisationmessage, 'notifymessage'); } echo html_writer::table($grade_edit_tree->table); echo '<div id="gradetreesubmit">'; if (!$moving) { echo '<input class="advanced" type="submit" value="' . get_string('savechanges') . '" />'; } // We don't print a bulk move menu if there are no other categories than course category if (!$moving && count($grade_edit_tree->categories) > 1) { echo '<br /><br />'; echo '<input type="hidden" name="bulkmove" value="0" id="bulkmoveinput" />'; $attributes = array('id' => 'menumoveafter', 'class' => 'ignoredirty'); echo html_writer::label(get_string('moveselectedto', 'grades'), 'menumoveafter'); echo html_writer::select($grade_edit_tree->categories, 'moveafter', '', array('' => 'choosedots'), $attributes); $OUTPUT->add_action_handler(new component_action('change', 'submit_bulk_move'), 'menumoveafter'); echo '<div id="noscriptgradetreeform" class="hiddenifjs"> <input type="submit" value="' . get_string('go') . '" /> </div>'; } echo '</div>'; echo '</div></form>'; echo $OUTPUT->box_end(); // Print action buttons echo $OUTPUT->container_start('buttons mdl-align'); if ($moving) { echo $OUTPUT->single_button(new moodle_url('index.php', array('id' => $course->id)), get_string('cancel'), 'get'); } else { echo $OUTPUT->single_button(new moodle_url('category.php', array('courseid' => $course->id)), get_string('addcategory', 'grades'), 'get');
echo "<br />"; $yes = get_string("yes"); $no = get_string("no"); echo '<form method="post" action="formats.php" id="form">'; echo '<table width="90%" align="center" class="generalbox">'; ?> <tr> <td colspan="3" align="center"><strong> <?php echo get_string('displayformat' . $displayformat->name, 'glossary'); ?> </strong></td> </tr> <tr valign="top"> <td align="right" width="20%"><?php echo html_writer::label(get_string('popupformat', 'glossary'), 'menupopupformatname'); ?> </td> <td> <?php //get and update available formats $recformats = glossary_get_available_formats(); $formats = array(); //Take names foreach ($recformats as $format) { $formats[$format->name] = get_string("displayformat{$format->name}", "glossary"); } //Sort it asort($formats); echo html_writer::select($formats, 'popupformatname', $displayformat->popupformatname, false); ?>