} else { // Create a form. echo html_writer::start_tag('form', array('method' => 'post', 'action' => 'custom_toolbar_example.php')); echo html_writer::start_div(); // Basic editor options. $options = array(); $atto = new atto_texteditor(); // Normal Atto. echo html_writer::start_div('normaldiv'); echo $OUTPUT->heading('Normal Atto'); echo html_writer::div(html_writer::tag('textarea', '', array('id' => 'normaleditor', 'name' => 'normaleditor', 'rows' => 10))); $atto->use_editor('normaleditor', $options); echo html_writer::end_div(); // Second Atto with custom options. echo html_writer::start_div('specialdiv'); $options['atto:toolbar'] = <<<EOT style1 = bold, italic list = unorderedlist, orderedlist EOT; echo $OUTPUT->heading('Special Atto'); echo html_writer::div(html_writer::tag('textarea', '', array('id' => 'specialeditor', 'name' => 'specialeditor', 'rows' => 10))); $atto->use_editor('specialeditor', $options); echo html_writer::end_div(); // Button to submit form. echo html_writer::start_div('', array('style' => 'margin-top: 20px')); echo html_writer::tag('button', 'Submit and see the HTML'); echo html_writer::end_div(); echo html_writer::end_div(); echo html_writer::end_tag('form'); } echo $OUTPUT->footer();
/** * Print HTML to display the "Also show old questions" checkbox */ public function display_options_adv() { echo \html_writer::start_div(); echo \html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'showhidden', 'value' => '0', 'id' => 'showhidden_off')); echo \html_writer::checkbox('showhidden', '1', !$this->hide, get_string('showhidden', 'question'), array('id' => 'showhidden_on', 'class' => 'searchoptions')); echo \html_writer::end_div() . "\n"; }
/** * Render the edit page * * @param \quiz $quizobj object containing all the quiz settings information. * @param structure $structure object containing the structure of the quiz. * @param \question_edit_contexts $contexts the relevant question bank contexts. * @param \moodle_url $pageurl the canonical URL of this page. * @param array $pagevars the variables from {@link question_edit_setup()}. * @return string HTML to output. */ public function edit_page(\quiz $quizobj, structure $structure, \question_edit_contexts $contexts, \moodle_url $pageurl, array $pagevars) { $output = ''; // Page title. $output .= $this->heading_with_help(get_string('editingquizx', 'quiz', format_string($quizobj->get_quiz_name())), 'editingquiz', 'quiz', '', get_string('basicideasofquiz', 'quiz'), 2); // Information at the top. $output .= $this->quiz_state_warnings($structure); $output .= $this->quiz_information($structure); $output .= $this->maximum_grade_input($structure, $pageurl); $output .= $this->repaginate_button($structure, $pageurl); $output .= $this->total_marks($quizobj->get_quiz()); // Show the questions organised into sections and pages. $output .= $this->start_section_list($structure); foreach ($structure->get_sections() as $section) { $output .= $this->start_section($structure, $section); $output .= $this->questions_in_section($structure, $section, $contexts, $pagevars, $pageurl); if ($structure->is_last_section($section)) { $output .= \html_writer::start_div('last-add-menu'); $output .= html_writer::tag('span', $this->add_menu_actions($structure, 0, $pageurl, $contexts, $pagevars), array('class' => 'add-menu-outer')); $output .= \html_writer::end_div(); } $output .= $this->end_section(); } $output .= $this->end_section_list(); // Initialise the JavaScript. $this->initialise_editing_javascript($structure, $contexts, $pagevars, $pageurl); // Include the contents of any other popups required. if ($structure->can_be_edited()) { $popups = ''; $popups .= $this->question_bank_loading(); $this->page->requires->yui_module('moodle-mod_quiz-quizquestionbank', 'M.mod_quiz.quizquestionbank.init', array('class' => 'questionbank', 'cmid' => $structure->get_cmid())); $popups .= $this->random_question_form($pageurl, $contexts, $pagevars); $this->page->requires->yui_module('moodle-mod_quiz-randomquestion', 'M.mod_quiz.randomquestion.init'); $output .= html_writer::div($popups, 'mod_quiz_edit_forms'); // Include the question chooser. $output .= $this->question_chooser(); $this->page->requires->yui_module('moodle-mod_quiz-questionchooser', 'M.mod_quiz.init_questionchooser'); } return $output; }
/** * Renderers a key value pair of information for display. * * @param string $key * @param string $value * @param string $class * @return string */ protected function detail_pair($key, $value, $class = '') { $html = html_writer::start_div('detail-pair row yui3-g ' . preg_replace('#[^a-zA-Z0-9_\\-]#', '-', $class)); $html .= html_writer::div(html_writer::span($key), 'pair-key span4 yui3-u-1-4'); $html .= html_writer::div(html_writer::span($value), 'pair-value span8 yui3-u-3-4'); $html .= html_writer::end_div(); return $html; }
protected function detail_pair($key, $value, $class = '') { $html = html_writer::start_div('detail-pair row ' . preg_replace('#[^a-zA-Z0-9_\\-]#', '-', $class)); $html .= html_writer::div(html_writer::span($key), 'pair-key col-sm-3'); $html .= html_writer::div(html_writer::span($value), 'pair-value col-sm-9'); $html .= html_writer::end_div(); return $html; }
/** * Starts to output progress. * * Called in constructor and in update_progress if required. * * @throws \coding_exception If already started */ public function start_html() { if ($this->bar) { throw new \coding_exception('Already started'); } $this->bar = new \progress_bar(); $this->bar->create(); echo \html_writer::start_div('wibbler'); }
/** * The backup and restore pages may display a log (if any) in a scrolling box. * * @param string $loghtml Log content in HTML format * @return string HTML content that shows the log */ public function log_display($loghtml) { global $OUTPUT; $out = html_writer::start_div('backup_log'); $out .= $OUTPUT->heading(get_string('backuplog', 'backup')); $out .= html_writer::start_div('backup_log_contents'); $out .= $loghtml; $out .= html_writer::end_div(); $out .= html_writer::end_div(); return $out; }
public function render_library_content($config, $id) { $this->page->requires->js('/blocks/library/module.js'); $html = html_writer::start_div('library-block'); // Build the Header. $headerimage = html_writer::empty_tag('img', array('src' => '/blocks/library/pix/library-banner.jpg')); $header = html_writer::link(get_string('universityhomelink', 'block_library'), $headerimage, array('target' => '_blank')); $header .= html_writer::link(get_string('libraryloginlink', 'block_library'), get_string('librarylogin', 'block_library'), array('class' => 'my-account', 'target' => '_blank')); // Library search. if (empty($config) || $config->enablesearch == 1) { $search = ''; $search .= html_writer::start_tag('form', array('onsubmit' => 'return M.block_library.ebscoHostSearchGo(this);', 'id' => 'ebscohostCustomSearchBox', 'class' => 'searcher', 'name' => 'ebscoSearch', 'method' => 'post')); $search .= html_writer::tag('input', '', array('id' => 'ebscohostwindow', 'name' => 'ebscohostwindow', 'type' => 'hidden', 'value' => '0')); $search .= html_writer::tag('input', '', array('id' => 'ebscohosturl', 'name' => 'ebscohosturl', 'type' => 'hidden', 'value' => get_string('ebscohosturl', 'block_library'))); $search .= html_writer::tag('input', '', array('id' => 'ebscohostsearchsrc', 'name' => 'ebscohostsearchsrc', 'type' => 'hidden', 'value' => 'db')); $search .= html_writer::tag('input', '', array('id' => 'ebscohostsearchmode', 'name' => 'ebscohostsearchmode', 'type' => 'hidden', 'value' => '+')); $search .= html_writer::tag('input', '', array('id' => 'ebscohostkeywords', 'name' => 'ebscohostkeywords', 'type' => 'hidden')); $search .= html_writer::tag('input', '', array('id' => 'oversizeNiceInput', 'name' => 'ebscohostsearchtext', 'type' => 'text', 'class' => 'oversize input-text front', 'title' => get_string('searchtip', 'block_library'), 'placeholder' => get_string('findbooks', 'block_library'))); $search .= html_writer::tag('button', get_string('searchbuttontext', 'block_library'), array('type' => 'submit', 'value' => 'Search', 'class' => 'lib_button mleft', 'onclick' => '_gaq.push([\'_trackEvent\', \'eds\', \'clicked\'])')); $search .= html_writer::end_tag('form'); } $html .= $header; $html .= $search; // Library Links. if (empty($config) || $config->enablelibrarylinks == 1) { $llinks = ''; $llinks .= html_writer::tag('div', get_string('library_links', 'block_library'), array('class' => 'library-links')); $html .= $llinks; } // Course links. if (!empty($config->enablecourselinks) && $config->enablecourselinks == 1 && !empty($config->rawhtml['text'])) { $clinks = ''; $clinks .= html_writer::start_tag('div'); $clinks .= html_writer::tag('p', get_string('librarycourse', 'block_library'), array('class' => 'library-coursetitle')); $clinks .= $config->rawhtml['text']; $clinks .= html_writer::end_tag('div'); $html .= $clinks; } // Build the footer content. $listitems = array(); $askcontent = ''; if (empty($config) || $config->enableaskbubble == 1) { $listitems[] = html_writer::link(get_string('asklibrarystafflink', 'block_library'), get_string('asklibrarystaff', 'block_library'), array('class' => 'ask-main', 'target' => '_blank')); $listitems[] = html_writer::link(get_string('asklibrarystafflink', 'block_library'), get_string('textstaff', 'block_library'), array('target' => '_blank')); $listitems[] = html_writer::link(get_string('chatwithstafflink', 'block_library'), get_string('chatwithstaff', 'block_library'), array('target' => '_blank')); $listitems[] = html_writer::link(get_string('emailstafflink', 'block_library'), get_string('emailstaff', 'block_library'), array('target' => '_blank')); $listitems[] = html_writer::link(get_string('asklibrarystafflink', 'block_library'), get_string('phonestaff', 'block_library'), array('class' => 'last', 'target' => '_blank')); $askcontent = html_writer::alist($listitems, array('class' => 'ask')); } $footer = html_writer::tag('div', $askcontent, array('class' => 'library-bottom')); $html .= $footer; $html .= html_writer::end_div(); return $html; }
public function full_header() { $html = html_writer::start_tag('header', array('id' => 'page-header', 'class' => 'clearfix')); $html .= html_writer::start_div('clearfix', array('id' => 'page-navbar')); $html .= html_writer::tag('nav', $this->navbar(), array('class' => 'breadcrumb-nav')); $html .= html_writer::div($this->page_heading_button(), 'breadcrumb-button'); $html .= html_writer::end_div(); $html .= html_writer::tag('div', $this->course_header(), array('id' => 'course-header')); $html .= html_writer::end_tag('header'); return $html; }
public function search_form(moodle_url $formtarget, $searchvalue) { $content = html_writer::start_tag('form', array('class' => 'adminsearchform', 'method' => 'get', 'action' => $formtarget, 'role' => 'search')); $content .= html_writer::start_div('input-group'); $content .= html_writer::empty_tag('input', array('id' => 'adminsearchquery', 'type' => 'text', 'name' => 'query', 'class' => 'form-control', 'placeholder' => s(get_string('searchinsettings', 'admin')), 'value' => s($searchvalue))); $content .= html_writer::start_span('input-group-btn'); $content .= html_writer::tag('button', s(get_string('go')), array('type' => 'button', 'class' => 'btn btn-default')); $content .= html_writer::end_span(); $content .= html_writer::end_div(); $content .= html_writer::end_tag('form'); return $content; }
public function eclass_header($columns) { global $CFG, $SITE; $output = html_writer::start_tag('header', array("role" => "banner", "class" => "navbar navbar-fixed-top moodle-has-zindex")); $output .= html_writer::start_tag('nav', array("role" => "navigation", "class" => "navbar-inner")); $output .= html_writer::start_div("container-fluid"); $output .= html_writer::tag('img', '', array("src" => $this->pix_url('ua-logo', 'theme'), "class" => "uofa-logo", "height" => "40px")); $output .= html_writer::link($CFG->wwwroot, $SITE->shortname, array("class" => "brand")); $output .= html_writer::end_div(); $output .= html_writer::end_tag('nav'); $output .= html_writer::end_tag('header'); return $output; }
/** * Render the edit page * * @param \offlinequiz $offlinequizobj object containing all the offlinequiz settings information. * @param structure $structure object containing the structure of the offlinequiz. * @param \question_edit_contexts $contexts the relevant question bank contexts. * @param \moodle_url $pageurl the canonical URL of this page. * @param array $pagevars the variables from {@link question_edit_setup()}. * @return string HTML to output. */ public function edit_page(\offlinequiz $offlinequizobj, structure $structure, \question_edit_contexts $contexts, \moodle_url $pageurl, array $pagevars, array $groupletters) { $offlinequiz = $offlinequizobj->get_offlinequiz(); $output = ''; // Page title. $output .= $this->heading_with_help(get_string('editingofflinequizx', 'offlinequiz', format_string($offlinequizobj->get_offlinequiz_name())) . ' (' . get_string('group', 'offlinequiz') . ' ' . $groupletters[$offlinequiz->groupnumber] . ') ', 'editingofflinequiz', 'offlinequiz', '', get_string('basicideasofofflinequiz', 'offlinequiz'), 2); // Information at the top. $output .= $this->offlinequiz_group_selector($offlinequiz, $pageurl); $output .= $this->offlinequiz_information($structure); $output .= $this->maximum_grade_input($offlinequiz, $this->page->url); $output .= $this->offlinequiz_state_warnings($structure); $output .= $this->repaginate_button($structure, $pageurl, $offlinequiz); $output .= $this->total_marks($offlinequiz); // Start form for question checkboxes $output .= $this->start_add_to_group_form($offlinequiz, $pageurl); // Add buttons for adding selected to another group and for removing selected. $output .= $this->add_to_group_button($structure, $offlinequiz, $pageurl); $output .= $this->remove_selected_button($structure, $offlinequiz, $pageurl); $output .= $this->select_all_links($structure); // Show the questions organised into sections and pages. $output .= $this->start_section_list(); $sections = $structure->get_offlinequiz_sections(); $lastsection = end($sections); foreach ($sections as $section) { $output .= $this->start_section($section); $output .= $this->questions_in_section($structure, $section, $contexts, $pagevars, $pageurl); if ($section === $lastsection) { $output .= \html_writer::start_div('last-add-menu'); $output .= html_writer::tag('span', $this->add_menu_actions($structure, 0, $pageurl, $contexts, $pagevars), array('class' => 'add-menu-outer')); $output .= \html_writer::end_div(); } $output .= $this->end_section(); } $output .= $this->end_section_list(); $output .= $this->end_add_to_group_form(); // Inialise the JavaScript. $this->initialise_editing_javascript($offlinequizobj->get_course(), $offlinequizobj->get_offlinequiz(), $structure, $contexts, $pagevars, $pageurl); // Include the contents of any other popups required. if ($structure->can_be_edited()) { $popups = ''; $popups .= $this->question_bank_loading(); $this->page->requires->yui_module('moodle-mod_offlinequiz-offlinequizquestionbank', 'M.mod_offlinequiz.offlinequizquestionbank.init', array('class' => 'questionbank', 'cmid' => $structure->get_cmid())); $popups .= $this->random_question_form($pageurl, $contexts, $pagevars); $this->page->requires->yui_module('moodle-mod_offlinequiz-randomquestion', 'M.mod_offlinequiz.randomquestion.init'); $output .= html_writer::div($popups, 'mod_offlinequiz_edit_forms'); // Include the question chooser. $output .= $this->question_chooser(); $this->page->requires->yui_module('moodle-mod_offlinequiz-questionchooser', 'M.mod_offlinequiz.init_questionchooser'); } return $output; }
/** * Starts displaying the progress bar, with optional heading and a special * div so it can be hidden later. * * @see \core\progress\display::start_html() */ public function start_html() { global $OUTPUT; $this->id = 'core_progress_display_if_slow' . self::$nextid; self::$nextid++; // Containing div includes a CSS class so that it can be themed if required, // and an id so it can be automatically hidden at end. echo \html_writer::start_div('core_progress_display_if_slow', array('id' => $this->id)); // Display optional heading. if ($this->heading !== '') { echo $OUTPUT->heading($this->heading, 3); } // Use base class to display progress bar. parent::start_html(); }
public function eclass_header($columns) { global $CFG, $SITE; $output = html_writer::start_tag('header', array("role" => "banner", "class" => "navbar navbar-fixed-top moodle-has-zindex")); $output .= html_writer::start_tag('nav', array("role" => "navigation", "class" => "navbar-inner")); $output .= html_writer::start_div("container-fluid"); $output .= html_writer::tag('img', '', array("src" => $this->pix_url('ua-logo', 'theme'), "class" => "uofa-logo", "height" => "40px")); $output .= html_writer::div(html_writer::link($CFG->wwwroot, $SITE->shortname, array("class" => "brand")), 'nav-brand'); $output .= html_writer::start_div("pull-right"); $output .= $this->custom_menu(); $headingmenu = $this->page_heading_menu(); $output .= html_writer::alist(array($headingmenu), array("class" => "nav pull-right")); $output .= html_writer::div(html_writer::span('', "glyphicons collapse_top"), "scroll-top pull-right", array("title" => "Scroll to top")); $output .= $this->login_info(); $output .= html_writer::end_div(); $output .= html_writer::end_div(); $output .= html_writer::end_tag('nav'); // Mobile stuff. $toggleleft = '<li><label class="toggle toggle-navigation" for="toggle-left" onclick>' . '<div class="mobile-nav-icon glyphicons list"></div><span>Navigation</span></label></li>'; $togglecenter = '<li><label class="toggle toggle-content" for="toggle-center" onclick>' . '<div class="mobile-nav-icon glyphicons book"></div><span>Content</span></label></li>'; $toggleright = ''; if ($this->page->blocks->region_has_content('side-post', $this)) { $toggleright = '<li><label class="toggle toggle-blocks" for="toggle-right" onclick>' . '<div class="mobile-nav-icon glyphicons show_big_thumbnails"></div><span>Blocks</span></label></li>'; } $toggleprofile = '<li><label class="toggle toggle-profile" for="toggle-profile" onclick>' . '<div class="mobile-nav-icon glyphicons user"></div><span>Profile</span></label></li>'; switch ($columns) { default: case 1: $togglelist = $togglecenter . $toggleprofile; break; case 2: $togglelist = $toggleleft . $togglecenter . $toggleprofile; break; case 3: $togglelist = $toggleleft . $togglecenter . $toggleright . $toggleprofile; break; } $togglelist .= html_writer::div('', 'active-indicator'); $output .= html_writer::start_tag('nav', array("class" => "mobile-nav")); $output .= html_writer::tag('ul', $togglelist, array("class" => "view-selector")); $output .= html_writer::end_tag('nav'); $output .= html_writer::end_tag('header'); return $output; }
/** * Renders the event list page with filter form and datatable. * * @param eventfilter_form $form Event filter form. * @param array $tabledata An array of event data to be used by the datatable. * @return string HTML to be displayed. */ public function render_event_list($form, $tabledata) { global $PAGE; $title = get_string('pluginname', 'report_eventlist'); // Header. $html = $this->output->header(); $html .= $this->output->heading($title); // Form. ob_start(); $form->display(); $html .= ob_get_contents(); ob_end_clean(); $PAGE->requires->yui_module('moodle-report_eventlist-eventfilter', 'Y.M.report_eventlist.EventFilter.init', array(array('tabledata' => $tabledata))); $PAGE->requires->strings_for_js(array('eventname', 'component', 'action', 'crud', 'edulevel', 'affectedtable', 'dname', 'legacyevent', 'since'), 'report_eventlist'); $html .= html_writer::start_div('report-eventlist-data-table', array('id' => 'report-eventlist-table')); $html .= html_writer::end_div(); $html .= $this->output->footer(); return $html; }
/** * 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); }
/** * Outputs the forum post indicated by $activity. * * @param object $activity the activity object the forum resides in * @param int $courseid the id of the course the forum resides in * @param bool $detail not used, but required for compatibilty with other modules * @param int $modnames not used, but required for compatibilty with other modules * @param bool $viewfullnames not used, but required for compatibilty with other modules */ function forum_print_recent_mod_activity($activity, $courseid, $detail, $modnames, $viewfullnames) { global $OUTPUT; $content = $activity->content; if ($content->parent) { $class = 'reply'; } else { $class = 'discussion'; } $tableoptions = ['border' => '0', 'cellpadding' => '3', 'cellspacing' => '0', 'class' => 'forum-recent']; $output = html_writer::start_tag('table', $tableoptions); $output .= html_writer::start_tag('tr'); $post = (object) ['parent' => $content->parent]; $forum = (object) ['type' => $content->forumtype]; $authorhidden = forum_is_author_hidden($post, $forum); // Show user picture if author should not be hidden. if (!$authorhidden) { $pictureoptions = ['courseid' => $courseid, 'link' => $authorhidden, 'alttext' => $authorhidden]; $picture = $OUTPUT->user_picture($activity->user, $pictureoptions); $output .= html_writer::tag('td', $picture, ['class' => 'userpicture', 'valign' => 'top']); } // Discussion title and author. $output .= html_writer::start_tag('td', ['class' => $class]); if ($content->parent) { $class = 'title'; } else { // Bold the title of new discussions so they stand out. $class = 'title bold'; } $output .= html_writer::start_div($class); if ($detail) { $aname = s($activity->name); $output .= html_writer::img($OUTPUT->pix_url('icon', $activity->type), $aname, ['class' => 'icon']); } $discussionurl = new moodle_url('/mod/forum/discuss.php', ['d' => $content->discussion]); $discussionurl->set_anchor('p' . $activity->content->id); $output .= html_writer::link($discussionurl, $content->subject); $output .= html_writer::end_div(); $timestamp = userdate($activity->timestamp); if ($authorhidden) { $authornamedate = $timestamp; } else { $fullname = fullname($activity->user, $viewfullnames); $userurl = new moodle_url('/user/view.php'); $userurl->params(['id' => $activity->user->id, 'course' => $courseid]); $by = new stdClass(); $by->name = html_writer::link($userurl, $fullname); $by->date = $timestamp; $authornamedate = get_string('bynameondate', 'forum', $by); } $output .= html_writer::div($authornamedate, 'user'); $output .= html_writer::end_tag('td'); $output .= html_writer::end_tag('tr'); $output .= html_writer::end_tag('table'); echo $output; }
public function course_search_form($value = '', $format = 'plain') { static $count = 0; $formid = 'coursesearch'; if (++$count > 1) { $formid .= $count; } $inputid = 'coursesearchbox'; $inputsize = 30; if ($format === 'navbar') { $formid = 'coursesearchnavbar'; $inputid = 'navsearchbox'; } $strsearchcourses = get_string("searchcourses"); $searchurl = new moodle_url('/course/search.php'); $form = array('id' => $formid, 'action' => $searchurl, 'method' => 'get', 'class' => "form-inline", 'role' => 'form'); $output = html_writer::start_tag('form', $form); $output .= html_writer::start_div('input-group'); $output .= html_writer::tag('label', $strsearchcourses, array('for' => $inputid, 'class' => 'sr-only')); $search = array('type' => 'text', 'id' => $inputid, 'size' => $inputsize, 'name' => 'search', 'class' => 'form-control', 'value' => s($value), 'placeholder' => $strsearchcourses); $output .= html_writer::empty_tag('input', $search); $button = array('type' => 'submit', 'class' => 'btn btn-default'); $output .= html_writer::start_span('input-group-btn'); $output .= html_writer::tag('button', get_string('go'), $button); $output .= html_writer::end_span(); $output .= html_writer::end_div(); // Close form-group. $output .= html_writer::end_tag('form'); return $output; }
require_once 'locallib.php'; require_login(0, false); $PAGE->set_context(context_system::instance()); $PAGE->set_pagelayout(get_layout()); $PAGE->set_title(get_string('viewnote', 'local_note')); $PAGE->set_heading(get_string('viewnote', 'local_note')); $PAGE->set_url($CFG->wwwroot . '/local/note/view_all_note.php'); $note = new \moi\note($DB, $USER->id); $id = optional_param('id', false, PARAM_INT); $row = $note->get_note($id); $PAGE->navbar->add($row['title']); echo $OUTPUT->header(); echo html_writer::start_div('row'); if (!$note->haspermission($id)) { throw new moodle_exception('nopermissiontoshow'); } $content = html_writer::tag('p', $row['title'], ['class' => 'lead']); $link = html_writer::link(new moodle_url($CFG->wwwroot . '/user/profile.php?id=' . $row['publisherid']), $row['name']); $content .= html_writer::tag('p', get_string('author', 'local_note') . ' ' . $link); $content .= html_writer::tag('p', get_string('postedon', 'local_note') . userdate($row['datetime'], '%d %b %Y'), ['class' => 'pull-left']); if (isset($row['attchfilename'])) { $content .= html_writer::tag('p', get_string('attachment', 'local_note') . ' <i class="icon icon-download-alt"></i><a href="' . $row['attchfile'] . '">Download</a>', ['class' => 'pull-right']); } $content .= html_writer::empty_tag('br'); $content .= html_writer::empty_tag('hr'); $content .= html_writer::div($row['content']); echo html_writer::start_div('span12'); echo $content; echo html_writer::end_div(); echo html_writer::end_div(); echo $OUTPUT->footer();
public function mail($message, $reply = false, $offset = 0) { global $CFG, $USER; $totalusers = 0; $output = ''; if (!$reply) { $output .= html_writer::empty_tag('input', array( 'type' => 'hidden', 'name' => 'm', 'value' => $message->id(), )); $output .= html_writer::empty_tag('input', array( 'type' => 'hidden', 'name' => 'offset', 'value' => $offset, )); } $output .= $this->output->container_start('mail_header'); $output .= $this->output->container_start('left'); $output .= $this->output->user_picture($message->sender()); $output .= $this->output->container_end(); $output .= $this->output->container_start('mail_info'); $output .= html_writer::link(new moodle_url('/user/view.php', array( 'id' => $message->sender()->id, 'course' => $message->course()->id )), fullname($message->sender()), array('class' => 'user_from')); $output .= $this->date($message, true); if (!$reply) { $output .= $this->output->container_start('mail_recipients'); foreach (array('to', 'cc', 'bcc') as $role) { $recipients = $message->recipients($role); if (!empty($recipients)) { if ($role == 'bcc' and $message->sender()->id !== $USER->id) { continue; } $output .= html_writer::start_tag('div'); $output .= html_writer::tag('span', get_string($role, 'local_mail'), array('class' => 'mail_role')); $numusers = count($recipients); $totalusers += $numusers; $cont = 1; foreach ($recipients as $user) { $output .= html_writer::link(new moodle_url('/user/view.php', array( 'id' => $user->id, 'course' => $message->course()->id )), fullname($user)); if ($cont < $numusers) { $output .= ', '; } $cont += 1; } $output .= ' '; $output .= html_writer::end_tag('div'); } } $output .= $this->output->container_end(); } else { $output .= html_writer::tag('div', '', array('class' => 'mail_recipients')); } $output .= $this->output->container_end(); $output .= $this->output->container_end(); $output .= $this->output->container_start('mail_body'); $output .= $this->output->container_start('mail_content'); $output .= local_mail_format_content($message); $attachments = local_mail_attachments($message); if ($attachments) { $output .= $this->output->container_start('mail_attachments'); if (count($attachments) > 1) { $text = get_string('attachnumber', 'local_mail', count($attachments)); $output .= html_writer::tag('span', $text, array('class' => 'mail_attachment_text')); $downloadurl = new moodle_url($this->page->url, array('downloadall' => '1')); $iconimage = $this->output->pix_icon('a/download_all', get_string('downloadall', 'local_mail'), 'moodle', array('class' => 'icon')); $output .= html_writer::start_div('mail_attachment_downloadall'); $output .= html_writer::link($downloadurl, $iconimage); $output .= html_writer::link($downloadurl, get_string('downloadall', 'local_mail'), array('class' => 'mail_downloadall_text')); $output .= html_writer::end_div(); } foreach ($attachments as $attach) { $filename = $attach->get_filename(); $filepath = $attach->get_filepath(); $mimetype = $attach->get_mimetype(); $iconimage = $this->output->pix_icon(file_file_icon($attach), get_mimetype_description($attach), 'moodle', array('class' => 'icon')); $path = '/'.$attach->get_contextid().'/local_mail/message/'.$attach->get_itemid().$filepath.$filename; $fullurl = moodle_url::make_file_url('/pluginfile.php', $path, true); $output .= html_writer::start_tag('div', array('class' => 'mail_attachment')); $output .= html_writer::link($fullurl, $iconimage); $output .= html_writer::link($fullurl, s($filename)); $output .= html_writer::tag('span', display_size($attach->get_filesize()), array('class' => 'mail_attachment_size')); $output .= html_writer::end_tag('div'); } $output .= $this->output->container_end(); } $output .= $this->output->container_end(); $output .= $this->newlabelform(); if (!$reply) { if ($message->sender()->id !== $USER->id) { $output .= $this->toolbar('reply', $message->course()->id, array('replyall' => ($totalusers > 1))); } else { $output .= $this->toolbar('forward', $message->course()->id); } } $output .= $this->output->container_end(); return $output; }
function displaydir($wdir, $files) { // $wdir == / or /a or /a/b/c/d etc @ini_set('memory_limit', '1024M'); global $courseid, $DB, $OUTPUT; global $USER, $CFG, $COURSE; global $choose; global $deptstr, $userstr; require_once $CFG->dirroot . '/blocks/morsle/constants.php'; $course = $COURSE; $user = $USER; // Get the sort parameter if there is one $sort = optional_param('sort', 1, PARAM_INT); $dirlist = array(); $filelist = array(); $dirhref = array(); $filehref = array(); $courseid = $course->id; $coursecontext = context_course::instance($COURSE->id); // separate all the files list into directories and files foreach ($files as $name => $file) { if (is_folder($file)) { $dirlist[$name] = $file; } else { $filelist[$name] = $file; } } // setup variables and strings $strname = get_string("name", 'block_morsle'); $strsize = get_string("size"); $strmodified = get_string("modified"); $straction = get_string("action"); $strmakeafolder = get_string("morslemakecollection", 'block_morsle'); $struploadafile = get_string("uploadafile"); $strselectall = get_string("selectall"); $strselectnone = get_string("deselectall"); $strwithchosenfiles = get_string("withchosenfiles"); $strmovetoanotherfolder = get_string("movetoanotherfolder"); $strlinktocourse = get_string("linktocourse", 'block_morsle'); $strmovefilestohere = get_string("movefilestohere"); $strdeletefromcollection = get_string("deletefromcollection", 'block_morsle'); $strcreateziparchive = get_string("createziparchive"); $strrename = get_string("rename"); $stredit = get_string("edit"); $strunzip = get_string("unzip"); $strlist = get_string("list"); $strrestore = get_string("restore"); $strchoose = get_string("choose"); $strfolder = get_string("folder"); $strfile = get_string("file"); $strdownload = get_string("strdownload", 'block_morsle'); $struploadthisfile = get_string("uploadthisfile"); $struploadandlinkthisfile = get_string("uploadandlinkthisfile", 'block_morsle'); $filesize = 'Varies as to type of document'; $strmaxsize = get_string("maxsize", "", $filesize); $strcancel = get_string("cancel"); $strmodified = get_string("strmodified", 'block_morsle'); //CLAMP #289 set color and background-color to transparent //Kevin Wiliarty 2011-03-08 $padrename = get_string("rename"); $padedit = $padunzip = $padlist = $padrestore = $padchoose = $padfolder = $padfile = $padlink = ''; $attsArr = array($padedit => $stredit, $padunzip => $strunzip, $padlist => $strlist, $padrestore => $strrestore, $padchoose => $strchoose, $padfolder => $strfolder, $padfile => $strfile, $padlink => $strlinktocourse); foreach ($attsArr as $key => $value) { $key = html_writer::div($value . ' ', '', array('style' => 'color:transparent; background-color:transparent; display:inline;')); } /* $padedit = html_writer::div($stredit . ' ','', array('style'=>'color:transparent; background-color:transparent; display:inline')); $padunzip = html_writer::div($strunzip . ' ','', array('style'=>'color:transparent; background-color:transparent; display:inline')); $padlist = html_writer::div($strlist . ' ','', array('style'=>'color:transparent; background-color:transparent; display:inline')); $padrestore = html_writer::div($strrestore . ' ','', array('style'=>'color:transparent; background-color:transparent; display:inline')); $padchoose = html_writer::div($strchoose . ' ','', array('style'=>'color: transparent; background-color:transparent; display:inline')); $padfolder = html_writer::div($strfolder . ' ','', array('style'=>'color:transparent; background-color:transparent; display:inline;')); $padfile = html_writer::div($strfile . ' ','', array('style'=>'color:transparent; background-color; transparent; display:inline;')); $padlink = html_writer::div($strlinktocourse . ' ','', array('style'=>'color:transparent; background-color:transparent; display:inline;')); */ $gdocsstr = 'Google-Docs-Storage-for-'; // Set sort arguments so that clicking on a column that is already sorted reverses the sort order $sortvalues = array(1, 2, 3); foreach ($sortvalues as &$sortvalue) { if ($sortvalue == $sort) { $sortvalue = -$sortvalue; } } $upload_max_filesize = get_max_upload_file_size($CFG->maxbytes); // beginning of with selected files portion echo html_writer::start_tag('table', array('border' => '0', 'cellspacing' => '2', 'cellpadding' => '2', 'style' => 'min-width: 900px; margin-left:auto; margin-right:auto', 'class' => 'files')); if ($wdir !== '') { echo html_writer::start_tag('tr'); //html_writer::table($table); if (!empty($USER->fileop) and $USER->fileop == "move" and $USER->filesource != $wdir) { echo html_writer::start_tag('td', array('colspan' => '3', 'align' => 'center')); // move files to other folder form echo html_writer::start_tag('form', array('action' => 'morslefiles.php', 'method' => 'get')); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'choose', 'value' => $choose)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'courseid', 'value' => $courseid)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'wdir', 'value' => $wdir)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'action', 'value' => 'paste')); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'sesskey', 'value' => $USER->sesskey)); echo html_writer::tag('input', '', array('align' => 'center', 'type' => 'submit', 'value' => $strmovefilestohere)); //echo "<span> --> <b>$wdir</b></span><br />"; echo html_writer::start_span() . '-->' . html_writer::tag('b', $wdir) . html_writer::end_span() . html_writer::end_tag('br'); echo html_writer::end_tag('td'); echo html_writer::start_tag('td'); echo html_writer::end_tag('form'); // cancel moving form echo html_writer::start_tag('form', array('action' => 'morslefiles.php', 'method' => 'get', 'align' => 'left')); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'choose', 'value' => $choose)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'courseid', 'value' => $courseid)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'wdir', 'value' => $wdir)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'action', 'value' => 'cancel')); echo html_writer::tag('input', '', array('type' => 'submit', 'value' => $strcancel, 'style' => 'color:red; margin-left:10px')); echo html_writer::end_tag('form'); echo html_writer::end_tag('td'); } else { if (has_capability('moodle/course:update', $coursecontext) || strpos($wdir, '-write')) { echo html_writer::start_tag('tr', array('style' => 'background-color: #ffddbb;')); echo html_writer::start_tag('td', array('colspan' => '3', 'align' => 'left', 'style' => 'background-color:#ffddbb; padding-left:5px;')); // file upload form // TODO: what if we're in the user or departmental dir? echo html_writer::start_tag('form', array('enctype' => 'multipart/form-data', 'method' => 'post', 'action' => 'morslefiles.php')); echo html_writer::start_span() . ' ' . $struploadafile . ' (' . $strmaxsize . ') ' . html_writer::tag('b', $wdir) . html_writer::end_span() . html_writer::tag('br', ''); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'choose', 'value' => $choose)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'courseid', 'value' => $courseid)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'wdir', 'value' => $wdir)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'action', 'value' => 'upload')); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'sesskey', 'value' => $USER->sesskey)); if (!isset($coursebytes)) { $coursebytes = 0; } if (!isset($modbytes)) { $modbytes = 0; } $maxbytes = get_max_upload_file_size($CFG->maxbytes, $coursebytes, $modbytes); $str = html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'MAX_FILE_SIZE', 'value' => $maxbytes)) . "\n"; $name = 'userfile'; $str .= html_writer::tag('input', '', array('type' => 'file', 'size' => '50', 'name' => $name, 'alt' => $name, 'style' => 'margin-left: 5px;')) . html_writer::end_tag('br') . "\n"; echo $str; echo html_writer::tag('input', '', array('type' => 'submit', 'name' => 'save', 'value' => $struploadthisfile, 'style' => 'color:green; padding-left:5px;')); echo html_writer::tag('input', '', array('type' => 'submit', 'name' => 'savelink', 'value' => $struploadandlinkthisfile, 'style' => 'color:blue; padding-left:5px;')); echo html_writer::end_tag('form'); echo html_writer::end_tag('td'); echo html_writer::end_tag('tr'); // cancel button div only if not in root morsle directory echo html_writer::start_tag('tr'); echo html_writer::tag('td', '', array('colspan' => '2', 'style' => 'background-color:#ffddbb;')); echo html_writer::start_tag('td', array('style' => 'background-color:#ffddbb; padding-left:5px;', 'colspan' => '1', 'align' => 'right')); echo html_writer::start_tag('form', array('action' => 'morslefiles.php', 'method' => 'get', 'align' => 'left')); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'choose', 'value' => $choose)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'courseid', 'value' => $courseid)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'wdir', 'value' => $wdir)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'action', 'value' => 'cancel')); echo html_writer::tag('input', '', array('type' => 'submit', 'value' => $strcancel, 'align' => 'left', 'style' => 'color:red;')); echo html_writer::end_tag('form'); echo html_writer::end_tag('td'); echo html_writer::end_tag('tr'); echo html_writer::end_tag('tr'); echo html_writer::start_tag('tr'); echo html_writer::start_tag('tr') . html_writer::tag('td', '<br>', array('colspace' => '4')) . html_writer::end_tag('tr'); echo html_writer::start_tag('td', array('style' => 'max-width:50px; white-space:nowrap;', 'colspan' => '2', 'align' => 'left')); //dummy form - alignment only echo html_writer::start_tag('form', array('action' => 'morslefiles.php', 'method' => 'get')); echo html_writer::start_tag('fieldset', array('class' => 'invisiblefieldset')); echo html_writer::tag('input', '', array('type' => 'button', 'value' => $strselectall, 'onclick' => 'checkall();', 'style' => 'color:green;')); echo html_writer::tag('input', '', array('type' => 'button', 'value' => $strselectnone, 'onclick' => 'checknone();', 'style' => 'color:red;')); echo html_writer::end_tag('fieldset'); echo html_writer::end_tag('form'); echo html_writer::end_tag('td'); echo html_writer::start_tag('td', array('align' => 'center', 'colspan' => '2')); // makedir form // TODO: program to allow this in user and departmental directory if (strpos($wdir, $deptstr) === false && strpos($wdir, $userstr) === false) { // not a user or departmental folder echo html_writer::start_tag('form', array('action' => 'morslefiles.php', 'method' => 'get')); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'choose', 'value' => $choose)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'courseid', 'value' => $courseid)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'wdir', 'value' => $wdir)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'action', 'value' => 'makedir')); echo html_writer::tag('input', '', array('type' => 'submit', 'value' => $strmakeafolder)); echo html_writer::end_tag('form'); } echo html_writer::end_tag('td'); echo html_writer::end_tag('tr'); } } } echo html_writer::start_tag('form', array('action' => 'morslefiles.php', 'method' => 'post', 'id' => 'dirform')); echo html_writer::start_div(); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'choose', 'value' => $choose)); echo html_writer::start_tag('tr'); echo html_writer::start_tag('th', array('class' => 'header', 'scope' => 'col', 'style' => 'max-width:40px;')); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'courseid', 'value' => $courseid)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'choose', 'value' => $choose)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'wdir', 'value' => $wdir)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'sesskey', 'value' => $USER->sesskey)); // $options = array ("delete" => "$strdeletefromcollection"); // only editing teachers can link items to course page if (has_capability('moodle/course:update', $coursecontext)) { $options['link'] = "{$strlinktocourse}"; } if (!empty($filelist) || !empty($dirlist)) { // echo html_writer::tag('label', "$strwithchosenfiles...", array('for'=>'formactionid')); // echo html_writer::select($options, "$strwithchosenfiles...", '', array(1 => "$strwithchosenfiles...")); echo html_writer::start_div('', array('id' => 'noscriptgo', 'style' => 'display:inline;')); echo html_writer::tag('input', '', array('type' => 'submit', 'value' => get_string('go'))); echo html_writer::script('document.getElementById("noscriptgo").style.display="none"'); echo html_writer::end_div(); } echo html_writer::end_tag('th'); echo html_writer::start_tag('th', array('style' => 'padding-right:120px;', 'class' => 'header name', 'scope' => 'col')) . html_writer::link(qualified_me(), $strname, array('&sort' => '{' . $sortvalues[0] . '}')) . html_writer::end_tag('th'); echo html_writer::start_tag('th', array('class' => 'header date', 'scope' => 'col')) . html_writer::link(qualified_me(), $strmodified, array('&sort' => '{' . $sortvalues[2] . '}')) . html_writer::end_tag('th'); echo html_writer::tag('th', $straction, array('class' => 'header commands', 'scope' => 'col')); echo html_writer::end_tag('tr') . "\n"; // Sort parameter indicates column to sort by, and parity gives the direction switch ($sort) { case 1: $sortcmp = 'return strcasecmp($a[0],$b[0]);'; break; case -1: $sortcmp = 'return strcasecmp($b[0],$a[0]);'; break; case 2: $sortcmp = 'return ($a[1] - $b[1]);'; break; case -2: $sortcmp = 'return ($b[1] - $a[1]);'; break; case 3: $sortcmp = 'return ($a[2] - $b[2]);'; break; case -3: $sortcmp = 'return ($b[2] - $a[2]);'; break; } // Create a 2D array of directories and sort $dirdetails = array(); foreach ($dirlist as $name => $dir) { $dirdetails[$name] = new stdClass(); $dirdetails[$name]->updated = docdate($dir); $dirdetails[$name]->link = $dir->alternateLink; // usort($dirdetails, create_function('$a,$b', $sortcmp)); } // TODO: change to handle cross-listed courses // TODO: this needs to change if we eliminate morsle table if ($wdir === '') { $shortname = is_number(substr($course->shortname, 0, 5)) ? substr($course->shortname, 6) : $course->shortname; // SPLIT INTO DEPARTMENTAL CODES $dept = explode("-", $shortname); $deptpart = defined($dept[0]) ? CONSTANT($dept[0]) : null; $deptstr = $deptpart . $deptstr; $deptaccount = strtolower($deptstr); // only show the user collection if we're in the base folder $dirdetails[$userstr] = new stdClass(); $dirdetails[$userstr]->updated = date('Y-m-d'); $dirdetails[$userstr]->link = 'https://drive.google.com'; // always include departmental directory if exists // check to see if we even have a departmental account for this department but don't show the departmental collection if we're already in it indicated by $wdir if ($is_morsle_dept = $DB->get_record('morsle_active', array('shortname' => $deptaccount)) && has_capability('moodle/course:update', $coursecontext)) { $dirdetails[$deptstr] = new stdClass(); $dirdetails[$deptstr]->updated = date('Y-m-d'); } } // Create a 2D array of files and sort $filedetails = array(); $filetitles = array(); foreach ($filelist as $name => $file) { $filedetails[$name] = new stdClass(); $filedetails[$name]->updated = docdate($file); $filedetails[$name]->link = $file->alternateLink; // $row = array($filename, $filedate); // array_push($filedetails, $row); // usort($filedetails, create_function('$a,$b', $sortcmp)); } // TODO: fix this hack so we're back to being able to sort // ksort($filedetails); // sets the locked in sorting to name // need this in order to look up the link for the file based on doc title (key) /* if (sizeof($filelist) > 0) { $filevalues = array_values($filelist); $filelist = array_combine($filetitles, $filevalues); } */ // $count = 0; // $countdir = 0; $edittext = $padchoose . $padedit . $padunzip . $padlist . $padrestore; if ($wdir !== '') { $pathparts = explode('/', $wdir); array_pop($pathparts); $wdir = implode('/', $pathparts); echo "<tr class=\"folder\">"; print_cell(); print_cell('left', '<a href="morslefiles.php?courseid=' . $courseid . '&wdir=' . $wdir . '&choose=' . $choose . '&name=' . $name . '"><img src="' . $OUTPUT->pix_url('f/folder') . '" class="icon" alt="" /> ' . get_string('parentfolder') . '</a>', 'name'); // print_cell('left', '<a style="padding-left:0px" href="morslefiles.php?courseid='.$courseid.'&wdir='.$wdir.'/&choose='.$choose.'"> '.get_string('parentfolder').'</a>', 'parent'); echo "</tr>"; } if (!empty($dirdetails)) { foreach ($dirdetails as $name => $dir) { echo html_writer::start_tag('tr', array('class' => 'folder')); $filedate = $dir->updated; $filesafe = rawurlencode($name); $filename = $name; $fileurl = $dir->link; // $countdir++; // TODO: fix the parent directory if ($name == '..') { // $fileurl = rawurlencode(dirname($wdir)); print_cell(); // alt attribute intentionally empty to prevent repetition in screen reader //CLAMP #289 change padding-left from 10 to 0px //Kevin Wiliarty 2011-03-08 print_cell('left', '<a style="padding-left:0px" href="morslefiles.php?courseid=' . $courseid . '&wdir=' . $wdir . '/' . $fileurl . '&choose=' . $choose . '"><img src="' . $OUTPUT->pix_url('f/parent.gif') . '" class="icon" alt="" /> ' . get_string('parentfolder') . '</a>', 'name'); print_cell(); print_cell(); print_cell(); /* } else if ($name === $userstr) { // if departmental account or user collection // TODO: need to determine what $wdir is if we're coming in from one of the course subcollections // don't know where this fits in $branchdir = strpos($wdir,'read') !== false || strpos($wdir,'write') !== false || $wdir === '' ? $filesafe : "$wdir/$filesafe"; print_cell(); // alt attribute intentionally empty to prevent repetition in screen reader //CLAMP #289 change padding-left from 10 to 0px //Kevin Wiliarty 2011-03-08 print_cell('left', '<a style="padding-left:0px" href="morslefiles.php?courseid=' . $courseid . '&wdir=' . $wdir . '&choose=' . $choose .'&name=' . $name . '"><img src="'.$OUTPUT->pix_url('f/folder').'" class="icon" alt="" /> '. $name .'</a>', 'name'); // print_cell('left', '<a style="padding-left:0px" href="' . $fileurl . '" target="_blank"><img src="'. $OUTPUT->pix_url("f/folder") .'" class="icon" alt="" /> '. $filename .'</a>'); print_cell("right", $filedate, 'date'); // print_cell(); print_cell(); // print_cell(); } else if ($name === $deptstr){ // TODO: need to determine what $wdir is if we're coming in from one of the course subcollections $branchdir = strpos($wdir,'read') !== false || strpos($wdir,'write') !== false || $wdir === '' ? $filesafe : "$wdir/$filesafe"; print_cell("center", "<input type=\"checkbox\" name=\"dir$countdir\" value=\"$filename\" />", 'checkbox'); // alt attribute intentionally empty to prevent repetition in screen reader //CLAMP #289 change padding-left from 10 to 0px //Kevin Wiliarty 2011-03-08 print_cell('left', '<a style="padding-left:0px" href="morslefiles.php?courseid=' . $courseid . '&wdir=' . $branchdir . '&choose=' . $choose . '&name=' . $name . '"><img src="'.$OUTPUT->pix_url('f/folder').'" class="icon" alt="" /> '. $name .'</a>', 'name'); print_cell("right", $filedate, 'date'); // print_cell(); if (has_capability('moodle/course:update', $coursecontext)) { print_cell("left", "$edittext<a href=\"morslefiles.php?courseid=$courseid&wdir=$branchdir&file=$filename&action=link&type=dir&choose=$choose\">$strlinktocourse</a>", 'commands'); } // print_cell(); */ } else { // not a user or departmental folder print_cell(); // print_cell("center", "<input type=\"checkbox\" name=\"$name\" value=\"$filename\" />", 'checkbox'); // print_cell("left", "<a href=\"morslefiles.php?courseid=$courseid&wdir=$wdir/$filesafe&choose=$choose\"><img src=\"$OUTPUT->pix_url('f/folder')\" class=\"icon\" alt=\"$strfolder\" /> ".$filename."</a>", 'name'); $branchdir = "{$wdir}/{$filesafe}"; // $branchdir = strpos($wdir,'read') !== false || strpos($wdir,'write') !== false || $wdir === '' ? $filesafe : "$wdir/$filesafe"; print_cell('left', '<a href="morslefiles.php?courseid=' . $courseid . '&wdir=' . $branchdir . '&choose=' . $choose . '&name=' . $name . '"><img src="' . $OUTPUT->pix_url('f/folder') . '" class="icon" alt="" /> ' . $filename . '</a>', 'name'); print_cell("right", $filedate, 'date'); // print_cell(); if (has_capability('moodle/course:update', $coursecontext)) { print_cell("left", "{$edittext}<a href=\"morslefiles.php?courseid={$courseid}&wdir={$branchdir}&file={$filename}&action=link&type=dir&choose={$choose}\">{$strlinktocourse}</a>", 'commands'); // print_cell("left", "$edittext<a href=\"morslefiles.php?courseid=$courseid&wdir=$wdir&file=$filename&action=link&type=dir&choose=$choose\">$strlinktocourse</a>", 'commands'); } } echo html_writer::end_tag('tr'); } } $iconchoices = array('excel' => 'download/spreadsheets', 'powerpoint' => 'download/presentations', 'word' => 'download/documents', 'pdf' => 'application/pdf'); if (!empty($filedetails)) { foreach ($filedetails as $name => $file) { if (isset($filelist[$name]->exportLinks)) { $links = array(); $links = array_values($filelist[$name]->exportLinks); $exportlink = $links[0]; } else { $exportlink = $filelist[$name]->alternateLink; } // positively identify the correct icon regardless of filename extension $icon = $filelist[$name]->iconLink; $filename = $name; $fileurl = $file->link; $embedlink = $filelist[$name]->embedLink; $embedsafe = rawurlencode($embedlink); $fileurlsafe = rawurlencode($fileurl); $filedate = $file->updated; $fileid = $filelist[$name]->id; $selectfile = trim($fileurl, "/"); // echo html_writer::start_tag('td', array('class'=>'file')); // echo html_writer::end_tag('td'); print_cell("center", "<input type=\"checkbox\" name=\"file\" value=\"{$filename}\" />", 'checkbox'); //CLAMP #289 change padding-left from 10 to 0px //Kevin Wiliarty 2011-03-08 // echo html_writer::start_tag('td', array('align'=>'left','style'=>'white-space:nowrap; padding-left:0px;','class'=>'name')); print_cell('left', '<a href="' . $fileurl . '" class="morslefile" target="_blank"> <img src="' . $icon . '" class="icon" alt="' . $strfile . '" /> ' . $filename . '</a>', 'name'); // $echovar = '<a href="' . $fileurl . '" target="_blank"> // <img src="' . $OUTPUT->pix_url("f/$icon") . '" class="icon" alt="' . $strfile . '" /> ' . htmlspecialchars($filename) . '</a>'; // echo $echovar; //html_writer::link(qualified_me(), $strname, array('&sort'=>'{'.$sortvalues[0].'}')) //$echovar = html_writer::tag('a', $fileurl, array('target'=>'_blank')) . html_writer::img($OUTPUT->pix_url("f/$icon"), $strfile, array('class'=>'icon')) . ' '.htmlspecialchars($filename) . html_writer::end_tag('a'); //echo $echovar; // echo html_writer::end_tag('td'); print_cell("right", $filedate, 'date'); if (has_capability('moodle/course:update', $coursecontext)) { if (strpos($wdir, $gdocsstr) === 1) { print_cell("left", "{$edittext} <a href=\"morslefiles.php?courseid={$courseid}&wdir={$wdir}/{$fileid}&file={$filename}&name={$filename}&filelink={$fileurl}&action=link&type=file&choose={$choose}\">{$strlinktocourse}</a>", 'commands'); } else { print_cell("left", "{$edittext} <a href=\"morslefiles.php?courseid={$courseid}&wdir={$wdir}&file={$filename}&action=link&type=file&choose={$choose}\">{$strlinktocourse}</a>", 'commands'); } // print_cell('left', '  <a title="' . $name . '" href="embeddoc.php?courseid=$courseid&embedlink=' . $embedsafe . '&name=' . $filename . '"> Embed </a>','embed'); } // print_cell('left', '  <a title="' . strip_tags($strdownload) . ': ' . $name . '" href="' .$CFG->wwwroot // . '/blocks/morsle/docs_export.php?exportlink=' . s($exportlink) . '&shortname=' . $course->shortname . '&title=' . $filename . '" target="_blank"> Download </a>','commands'); print_cell(); print_cell('left', '  <a title="' . $name . '" href="' . s($exportlink) . '" target="_blank"> Download </a>', 'commands'); //print_cell('left', '  <a title="' . $name . '" href="embeddoc.php?"' . s($embedlink) . '" target="_blank"> Embed in a Page resource </a>','commands'); echo html_writer::end_tag('tr'); } } echo html_writer::end_div(); echo html_writer::end_tag('form'); echo html_writer::end_tag('table'); }
$PAGE->requires->string_for_js('show', 'moodle'); $PAGE->requires->string_for_js('popupsblocked', 'scorm'); $name = false; echo html_writer::start_div('', array('id' => 'scormpage')); echo html_writer::start_div('', array('id' => 'tocbox')); echo html_writer::div(html_writer::tag('script', '', array('id' => 'external-scormapi', 'type' => 'text/JavaScript')), '', array('id' => 'scormapi-parent')); if ($scorm->hidetoc == SCORM_TOC_POPUP or $mode == 'browse' or $mode == 'review') { echo html_writer::start_div('', array('id' => 'scormtop')); echo $mode == 'browse' ? html_writer::div(get_string('browsemode', 'scorm'), 'scorm-left', array('id' => 'scormmode')) : ''; echo $mode == 'review' ? html_writer::div(get_string('reviewmode', 'scorm'), 'scorm-left', array('id' => 'scormmode')) : ''; if ($scorm->hidetoc == SCORM_TOC_POPUP) { echo html_writer::div($result->tocmenu, 'scorm-right', array('id' => 'scormnav')); } echo html_writer::end_div(); } echo html_writer::start_div('', array('id' => 'toctree')); if (empty($scorm->popup) || $displaymode == 'popup') { echo $result->toc; } else { // Added incase javascript popups are blocked we don't provide a direct link // to the pop-up as JS communication can fail - the user must disable their pop-up blocker. $linkcourse = html_writer::link($CFG->wwwroot . '/course/view.php?id=' . $scorm->course, get_string('finishscormlinkname', 'scorm')); echo $OUTPUT->box(get_string('finishscorm', 'scorm', $linkcourse), 'generalbox', 'altfinishlink'); } echo html_writer::end_div(); // Toc tree ends. echo html_writer::end_div(); // Toc box ends. echo html_writer::tag('noscript', html_writer::div(get_string('noscriptnoscorm', 'scorm'), '', array('id' => 'noscript'))); if ($result->prerequisites) { if ($scorm->popup != 0 && $displaymode !== 'popup') {
public function test_start_div() { // All options. $this->assertSame('<div class="frog" id="kermit">', html_writer::start_div('frog', array('id' => 'kermit'))); // Combine class from attributes and $class. $this->assertSame('<div class="amphibian frog">', html_writer::start_div('frog', array('class' => 'amphibian'))); // Class only. $this->assertSame('<div class="frog">', html_writer::start_div('frog')); // Attributes only. $this->assertSame('<div id="kermit">', html_writer::start_div('', array('id' => 'kermit'))); // No options. $this->assertSame('<div>', html_writer::start_div()); }
$groupby = ' GROUP BY r.postid'; } $conditionsparams = array_merge($conditionsparams, $groupparams, $havingparams); $ratingsl = $DB->get_recordset_sql("SELECT {$counttype}, {$postid}\n FROM {$from}\n {$postjoin}\n INNER JOIN {forumng_discussions} fd ON fp.discussionid = fd.id\n INNER JOIN {forumng} f ON f.id = fd.forumngid\n WHERE {$conditions}\n AND fd.deleted = 0\n AND fp.deleted = 0\n AND fp.oldversion = 0\n {$groupwhere}\n {$groupby}\n {$having}\n ORDER BY rawgrade DESC\n ", $conditionsparams, 0, 5); // Get the ratings. foreach ($ratingsl as $apost) { if ($gradingtype == mod_forumng::GRADING_AVERAGE) { $apost->rawgrade = round($apost->rawgrade, 2); } $post = mod_forumng_post::get_from_id($apost->postid, $cloneid, true, true); list($content, $user) = $renderer->render_usage_post_info($forum, $post->get_discussion(), $post); $ratingslist[] = $renderer->render_usage_list_item($forum, $apost->rawgrade, $user, $content); } // Print out ratings usage. $usageoutput .= $renderer->render_usage_ratings($ratingslist, $forum, $gradingstr, $gradingtype); } } if (!empty($usageoutput)) { echo html_writer::start_div('forumng_usage_section'); echo $OUTPUT->heading(get_string('usage', 'forumngfeature_usage'), 4, 'forumng_usage_sectitle'); echo $usageoutput; echo html_writer::start_div('clearer') . html_writer::end_div(); echo html_writer::end_div(); } echo $OUTPUT->footer(); // Log usage view. $params = array('context' => $forum->get_context(), 'objectid' => $forum->get_id(), 'other' => array('url' => $thisurl->out_as_local_url())); $event = \forumngfeature_usage\event\usage_viewed::create($params); $event->add_record_snapshot('course_modules', $forum->get_course_module()); $event->add_record_snapshot('course', $forum->get_course()); $event->trigger();
/** * Create the html code of the grade publishing feature. * * @return string $output html code of the grade publishing. */ public function get_grade_publishing_url() { $url = $this->get_export_url(); $output = html_writer::start_div(); $output .= html_writer::tag('p', get_string('gradepublishinglink', 'grades', html_writer::link($url, $url))); $output .= html_writer::end_div(); return $output; }
/** * Helper method to render the information about the available plugin update * * @param core_plugin_manager $pluginman plugin manager instance * @param \core\update\info $updateinfo information about the available update for the plugin */ protected function plugin_available_update_info(core_plugin_manager $pluginman, \core\update\info $updateinfo) { $boxclasses = 'pluginupdateinfo'; $info = array(); if (isset($updateinfo->release)) { $info[] = html_writer::div(get_string('updateavailable_release', 'core_plugin', $updateinfo->release), 'info release'); } if (isset($updateinfo->maturity)) { $info[] = html_writer::div(get_string('maturity' . $updateinfo->maturity, 'core_admin'), 'info maturity'); $boxclasses .= ' maturity' . $updateinfo->maturity; } if (isset($updateinfo->download)) { $info[] = html_writer::div(html_writer::link($updateinfo->download, get_string('download')), 'info download'); } if (isset($updateinfo->url)) { $info[] = html_writer::div(html_writer::link($updateinfo->url, get_string('updateavailable_moreinfo', 'core_plugin')), 'info more'); } $box = html_writer::start_div($boxclasses); $box .= html_writer::div(get_string('updateavailable', 'core_plugin', $updateinfo->version), 'version'); $box .= html_writer::div(implode(html_writer::span(' ', 'separator'), $info), 'infos'); if ($pluginman->is_remote_plugin_installable($updateinfo->component, $updateinfo->version, $reason)) { $box .= $this->output->single_button(new moodle_url($this->page->url, array('installupdate' => $updateinfo->component, 'installupdateversion' => $updateinfo->version)), get_string('updateavailableinstall', 'core_admin'), 'post', array('class' => 'singlebutton updateavailableinstall')); } else { $reasonhelp = $this->info_remote_plugin_not_installable($reason); if ($reasonhelp) { $box .= html_writer::div($reasonhelp, 'reasonhelp updateavailableinstall'); } } $box .= html_writer::end_div(); return $box; }
/** * Renderers a search result course list item. * * This function will be called for every course being displayed by course_listing. * * @param course_in_list $course The course to produce HTML for. * @param int $selectedcourse The id of the currently selected course. * @return string */ public function search_listitem(course_in_list $course, $selectedcourse) { $text = $course->get_formatted_name(); $attributes = array('class' => 'listitem listitem-course', 'data-id' => $course->id, 'data-selected' => $selectedcourse == $course->id ? '1' : '0', 'data-visible' => $course->visible ? '1' : '0'); $bulkcourseinput = array('type' => 'checkbox', 'name' => 'bc[]', 'value' => $course->id, 'class' => 'bulk-action-checkbox'); $viewcourseurl = new moodle_url($this->page->url, array('courseid' => $course->id)); $categoryname = coursecat::get($course->category)->get_formatted_name(); $html = html_writer::start_tag('li', $attributes); $html .= html_writer::start_div('clearfix'); $html .= html_writer::start_div('float-left'); $html .= html_writer::empty_tag('input', $bulkcourseinput) . ' '; $html .= html_writer::end_div(); $html .= html_writer::link($viewcourseurl, $text, array('class' => 'float-left coursename')); $html .= html_writer::tag('span', $categoryname, array('class' => 'float-left categoryname')); $html .= html_writer::start_div('float-right'); $html .= $this->search_listitem_actions($course); $html .= html_writer::tag('span', s($course->idnumber), array('class' => 'dimmed idnumber')); $html .= html_writer::end_div(); $html .= html_writer::end_div(); $html .= html_writer::end_tag('li'); return $html; }
echo '<input type="hidden" name="returnto" value="' . s($PAGE->url) . '" />' . "\n"; echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />' . "\n"; foreach ($users as $u) { $data = array('<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $u->userid . '&course=' . $course->id . '">' . fullname($u, true) . '</a>' . "\n", !empty($u->count) ? get_string('yes') . ' (' . $u->count . ') ' : get_string('no'), '<input type="checkbox" class="usercheckbox" name="user' . $u->userid . '" value="' . $u->count . '" />' . "\n"); $table->add_data($data); } $table->print_html(); if ($perpage == SHOW_ALL_PAGE_SIZE) { $perpageurl = new moodle_url($baseurl, array('perpage' => DEFAULT_PAGE_SIZE)); 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'));
/** * Displays the general information about a backup file with unknown format * * @param moodle_url $nextstageurl URL to send user to * @return string HTML code to display */ public function backup_details_unknown(moodle_url $nextstageurl) { $html = html_writer::start_div('unknownformat'); $html .= $this->output->heading(get_string('errorinvalidformat', 'backup'), 2); $html .= $this->output->notification(get_string('errorinvalidformatinfo', 'backup'), 'notifyproblem'); $html .= $this->output->single_button($nextstageurl, get_string('continue'), 'post'); $html .= html_writer::end_div(); return $html; }
/** * writes overview info for course_overview block - displays upcoming scorm objects that have a due date * * @param object $type - type of log(aicc,scorm12,scorm13) used as prefix for filename * @param array $htmlarray * @return mixed */ function scorm_print_overview($courses, &$htmlarray) { global $USER, $CFG; if (empty($courses) || !is_array($courses) || count($courses) == 0) { return array(); } if (!$scorms = get_all_instances_in_courses('scorm', $courses)) { return; } $strscorm = get_string('modulename', 'scorm'); $strduedate = get_string('duedate', 'scorm'); foreach ($scorms as $scorm) { $time = time(); $showattemptstatus = false; if ($scorm->timeopen) { $isopen = ($scorm->timeopen <= $time && $time <= $scorm->timeclose); } if ($scorm->displayattemptstatus == SCORM_DISPLAY_ATTEMPTSTATUS_ALL || $scorm->displayattemptstatus == SCORM_DISPLAY_ATTEMPTSTATUS_MY) { $showattemptstatus = true; } if ($showattemptstatus || !empty($isopen) || !empty($scorm->timeclose)) { $str = html_writer::start_div('scorm overview').html_writer::div($strscorm. ': '. html_writer::link($CFG->wwwroot.'/mod/scorm/view.php?id='.$scorm->coursemodule, $scorm->name, array('title' => $strscorm, 'class' => $scorm->visible ? '' : 'dimmed')), 'name'); if ($scorm->timeclose) { $str .= html_writer::div($strduedate.': '.userdate($scorm->timeclose), 'info'); } if ($showattemptstatus) { require_once($CFG->dirroot.'/mod/scorm/locallib.php'); $str .= html_writer::div(scorm_get_attempt_status($USER, $scorm), 'details'); } $str .= html_writer::end_div(); if (empty($htmlarray[$scorm->course]['scorm'])) { $htmlarray[$scorm->course]['scorm'] = $str; } else { $htmlarray[$scorm->course]['scorm'] .= $str; } } } }