Exemple #1
0
function virtualclass_online_server($url, $authusername, $authpassword, $role, $rid, $room,
            $popupoptions, $popupwidth, $popupheight, $upload, $down, $debug = false, 
            $anyonepresenter = 0, $audio = 0, $pushtotalk = 0, $themecolor = 'black') {
    global $USER;
    $form = html_writer::start_tag('form', array('id' => 'overrideform', 'action' => $url, 'method' => 'post',
        'onsubmit' => 'return virtualclass_online_popup(this)', 'data-popupoption' => $popupoptions,
        'data-popupwidth' => $popupwidth, 'data-popupheight' => $popupheight));
    $form .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()));
    $form .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'uid', 'value' => $USER->id));
    $form .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'name', 'value' => $USER->username));
    $form .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'role', 'value' => $role));
    $form .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'room', 'value' => $room));
    $form .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'sid', 'value' => $USER->sesskey));
    $form .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'user', 'value' => $authusername));
    $form .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'pass', 'value' => $authpassword));
    $form .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'rid', 'value' => $rid));
    $form .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'upload', 'value' => $upload));
    $form .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'down', 'value' => $down));
    $form .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'debug', 'value' => $debug));
    $form .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'audio', 'value' => $audio));
    $form .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'themecolor', 'value' => $themecolor));
    $form .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'pushtotalk', 'value' => $pushtotalk));
    $form .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'anyonepresenter', 'value' => $anyonepresenter));
    $form .= html_writer::empty_tag('input', array('type' => 'submit', 'name' => 'submit',
         'value' => get_string('joinroom', 'virtualclass')));
    $form .= html_writer::end_tag('form');
    return $form;
}
 /**
  * Updating output to include javascript to initiate a lightbox effect on drawing type questions
  * so that the images are smaller unless clicked on for review
  *
  * @param \mod_activequiz\activequiz_question $question The realtime quiz question
  * @param array                               $attempts An array of \mod_activequiz\activequiz_attempt classes
  * @param string                              $output The current output from getting the results
  * @return string Return the updated output to be passed to the client
  */
 public function modify_questionresults_duringquiz($question, $attempts, $output)
 {
     global $DB;
     // if no attempts just return the output
     if (empty($attempts)) {
         return $output;
     }
     // get the question definition to determine response format
     reset($attempts);
     $attempt = current($attempts);
     /** @var \mod_activequiz\activequiz_attempt $attempt */
     $quba = $attempt->get_quba();
     $slot = $attempt->get_question_slot($question);
     $qa = $quba->get_question_attempt($slot);
     // now get question definition
     $questiondef = $qa->get_question();
     if ($questiondef->responseformat == 'picture') {
         // if the response format is a picture, meaning drawing type add the js for lightbox stuff
         $picturejs = \html_writer::start_tag('script', array('type' => 'text/javascript', 'id' => 'poodllrecording_js'));
         $picturejs .= '
             activequiz.questionmodifiers.poodllrecording.lightbox_images();
         ';
         $picturejs .= \html_writer::end_tag('script');
         $newoutput = $output . $picturejs;
         $newoutput = \html_writer::div($newoutput, '', array('id' => 'poodllrecording-picture'));
     } else {
         $newoutput = $output;
     }
     return $newoutput;
 }
 function filter($text, array $options = array())
 {
     $coursectx = $this->context->get_course_context(false);
     if (!$coursectx) {
         return $text;
     }
     $courseid = $coursectx->instanceid;
     // Initialise/invalidate our trivial cache if dealing with a different course
     if (!isset(self::$cachedcourseid) || self::$cachedcourseid !== (int) $courseid) {
         self::$activitylist = null;
     }
     self::$cachedcourseid = (int) $courseid;
     /// It may be cached
     if (is_null(self::$activitylist)) {
         self::$activitylist = array();
         $modinfo = get_fast_modinfo($courseid);
         if (!empty($modinfo->cms)) {
             self::$activitylist = array();
             // We will store all the created filters here.
             // Create array of visible activities sorted by the name length (we are only interested in properties name and url).
             $sortedactivities = array();
             foreach ($modinfo->cms as $cm) {
                 // Exclude labels, hidden activities and activities for group members only.
                 if ($cm->visible and empty($cm->groupmembersonly) and $cm->has_view()) {
                     $sortedactivities[] = (object) array('name' => $cm->name, 'url' => $cm->url, 'id' => $cm->id, 'namelen' => strlen($cm->name));
                 }
             }
             core_collator::asort_objects_by_property($sortedactivities, 'namelen', SORT_NUMERIC);
             foreach ($sortedactivities as $cm) {
                 $title = s(trim(strip_tags($cm->name)));
                 $currentname = trim($cm->name);
                 $entitisedname = s($currentname);
                 // Avoid empty or unlinkable activity names.
                 if (!empty($title)) {
                     $href_tag_begin = html_writer::start_tag('a', array('class' => 'autolink', 'title' => $title, 'href' => $cm->url));
                     self::$activitylist[$cm->id] = new filterobject($currentname, $href_tag_begin, '</a>', false, true);
                     if ($currentname != $entitisedname) {
                         // If name has some entity (&amp; &quot; &lt; &gt;) add that filter too. MDL-17545.
                         self::$activitylist[$cm->id . '-e'] = new filterobject($entitisedname, $href_tag_begin, '</a>', false, true);
                     }
                 }
             }
         }
     }
     $filterslist = array();
     if (self::$activitylist) {
         $cmid = $this->context->instanceid;
         if ($this->context->contextlevel == CONTEXT_MODULE && isset(self::$activitylist[$cmid])) {
             // remove filterobjects for the current module
             $filterslist = array_values(array_diff_key(self::$activitylist, array($cmid => 1, $cmid . '-e' => 1)));
         } else {
             $filterslist = array_values(self::$activitylist);
         }
     }
     if ($filterslist) {
         return $text = filter_phrases($text, $filterslist);
     } else {
         return $text;
     }
 }
 private function construct_ablock_select(question_attempt $qa, question_display_options $options)
 {
     $question = $qa->get_question();
     $response = $qa->get_last_qt_data();
     $stemorder = $question->get_stem_order();
     $choices = $this->format_choices($question);
     $o = html_writer::start_tag('table', array('class' => 'answer'));
     $o .= html_writer::start_tag('tbody');
     $parity = 0;
     foreach ($stemorder as $key => $stemid) {
         $o .= html_writer::start_tag('tr', array('class' => 'r' . $parity));
         $o .= html_writer::tag('td', $question->format_text($question->stems[$stemid], $question->stemformat[$stemid], $qa, 'qtype_order', 'subquestion', $stemid), array('class' => 'text'));
         $classes = 'control';
         $feedback = $this->get_feedback_class_image($qa, $options, $key);
         if ($feedback->class) {
             $classes .= ' ' . $feedback->class;
         }
         $selected = $this->get_selected($question, $response, $key);
         $o .= html_writer::tag('td', html_writer::select($choices, $qa->get_qt_field_name($question->get_field_name($key)), $selected, array('0' => 'choose'), array('disabled' => $options->readonly)) . ' ' . $feedback->image, array('class' => $classes));
         $o .= html_writer::end_tag('tr');
         $parity = 1 - $parity;
     }
     $o .= html_writer::end_tag('tbody');
     $o .= html_writer::end_tag('table');
     return $o;
 }
Exemple #5
0
/**
 *
 * Sends message to administrator listing all updated
 * duplicate custom fields
 * @param array $data
 */
function facetoface_send_admin_upgrade_msg($data)
{
    global $SITE;
    // No data - no need to send email.
    if (empty($data)) {
        return;
    }
    $table = new html_table();
    $table->head = array('Custom field ID', 'Custom field original shortname', 'Custom field new shortname');
    $table->data = $data;
    $table->align = array('center', 'center', 'center');
    $title = "{$SITE->fullname}: Face to Face upgrade info";
    $note = 'During the last site upgrade the face-to-face module has been modified. It now
requires session custom fields to have unique shortnames. Since some of your
custom fields had duplicate shortnames, they have been renamed to remove
duplicates (see table below). This could impact on your email messages if you
reference those custom fields in the message templates.';
    $message = html_writer::start_tag('html');
    $message .= html_writer::start_tag('head') . html_writer::tag('title', $title) . html_writer::end_tag('head');
    $message .= html_writer::start_tag('body');
    $message .= html_writer::tag('p', $note) . html_writer::table($table, true);
    $message .= html_writer::end_tag('body');
    $message .= html_writer::end_tag('html');
    $admin = get_admin();
    email_to_user($admin, $admin, $title, '', $message);
}
Exemple #6
0
 /**
  * Runs the entire 'make' process.
  *
  * @return int Course id
  */
 public function make()
 {
     global $DB, $CFG;
     raise_memory_limit(MEMORY_EXTRA);
     if ($this->progress && !CLI_SCRIPT) {
         echo html_writer::start_tag('ul');
     }
     $entirestart = microtime(true);
     // Create courses.
     $prevchdir = getcwd();
     chdir($CFG->dirroot);
     $ncourse = self::get_last_testcourse_id();
     foreach (self::$sitecourses as $coursesize => $ncourses) {
         for ($i = 1; $i <= $ncourses[$this->size]; $i++) {
             // Non language-dependant shortname.
             $ncourse++;
             $this->run_create_course(self::SHORTNAMEPREFIX . $ncourse, $coursesize);
         }
     }
     chdir($prevchdir);
     // Store last course id to return it (will be the bigger one).
     $lastcourseid = $DB->get_field('course', 'id', array('shortname' => self::SHORTNAMEPREFIX . $ncourse));
     // Log total time.
     $this->log('sitecompleted', round(microtime(true) - $entirestart, 1));
     if ($this->progress && !CLI_SCRIPT) {
         echo html_writer::end_tag('ul');
     }
     return $lastcourseid;
 }
 /**
  * Generate the display of a question in a particular state, and with certain
  * display options. Normally you do not call this method directly. Intsead
  * you call {@link question_usage_by_activity::render_question()} which will
  * call this method with appropriate arguments.
  *
  * @param question_attempt $qa the question attempt to display.
  * @param qbehaviour_renderer $behaviouroutput the renderer to output the behaviour
  *      specific parts.
  * @param qtype_renderer $qtoutput the renderer to output the question type
  *      specific parts.
  * @param question_display_options $options controls what should and should not be displayed.
  * @param string|null $number The question number to display. 'i' is a special
  *      value that gets displayed as Information. Null means no number is displayed.
  * @return string HTML representation of the question.
  */
 public function question(question_attempt $qa, qbehaviour_renderer $behaviouroutput, qtype_renderer $qtoutput, question_display_options $options, $number)
 {
     //start a new output buffer
     $output = '';
     //add the quesiton number (TODO: style?)
     //$output .= '<strong>' . $number .'.</strong>&nbsp; &nbsp;';
     $output .= html_writer::start_tag('table', array('style' => 'width: 100%; padding-bottom: 4px;'));
     $output .= html_writer::start_tag('tr', array());
     $output .= html_writer::tag('td', $number . '.', array('valign' => 'top', 'width' => '10%', 'style' => 'padding-right: 10px;'));
     $output .= html_writer::start_tag('td', array('width' => '90%'));
     //get the question from the attempt object
     $question = $qa->get_question();
     $pragmas = self::extract_pragmas($question->format_questiontext($qa));
     //add the question's formulation
     $output .= $this->formulation($qa, $behaviouroutput, $qtoutput, $options);
     //an indication of output, if appropriate
     $output .= $this->outcome($qa, $behaviouroutput, $qtoutput, $options);
     //any manual comments, if appropriate
     $output .= $this->manual_comment($qa, $behaviouroutput, $qtoutput, $options);
     //the user's response history, if appropriate
     $output .= $this->response_history($qa, $behaviouroutput, $qtoutput, $options);
     $output .= html_writer::end_tag('td');
     $output .= html_writer::end_tag('tr');
     $output .= html_writer::end_tag('table');
     //if a pragma exists specifying the space after a given quesiton, use it; otherwise, assume 5px
     //$space_after = array_key_exists('space_after', $pragmas) ? $pragmas['space_after'] : '5px';
     $space_after = array_key_exists('space_after', $pragmas) ? $pragmas['space_after'] : 0;
     //and add a spacer after the given question
     if ($space_after !== 0) {
         $output .= html_writer::tag('div', '&nbsp;', array('style' => 'height: ' . $space_after . ';'));
     }
     //return the contents of the output buffer
     return $output;
 }
Exemple #8
0
 function get_content()
 {
     global $CFG, $OUTPUT, $USER;
     $id = optional_param('id', NULL, PARAM_INT);
     if ($this->content !== null) {
         return $this->content;
     }
     if (empty($this->instance)) {
         $this->content = '';
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->items = array();
     $this->content->icons = array();
     $this->content->footer = '';
     $alink = new moodle_url("/blocks/groupreg/process.php", array("id" => $id));
     $o = "";
     $o .= html_writer::start_tag('div');
     $o .= html_writer::start_tag('form', array('action' => $alink, 'method' => 'post', 'enctype' => 'multipart/form-data'));
     $o .= html_writer::start_tag('div');
     $o .= html_writer::empty_tag('input', array('type' => 'file', 'name' => 'file_csv', 'value' => ''));
     $o .= html_writer::end_tag('div');
     $o .= html_writer::start_tag('div');
     $o .= html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('upload')));
     $o .= $OUTPUT->help_icon('pluginname', 'block_groupreg');
     $o .= html_writer::end_tag('div');
     $o .= html_writer::end_tag('form');
     $o .= html_writer::end_tag('div');
     if ($USER->id != 2) {
         return false;
     }
     $this->content->text .= $o;
     return $this->content;
 }
 protected function definition_inner($mform)
 {
     global $PAGE, $CFG;
     $PAGE->requires->css('/question/type/easyoselectjs/easyoselectjs_styles.css');
     $marvinjsconfig = get_config('qtype_easyoselectjs_options');
     $marvinjspath = $marvinjsconfig->path;
     $protocol = (empty($_SERVER['HTTPS']) or $_SERVER['HTTPS'] == 'off') ? 'http://' : 'https://';
     $PAGE->requires->js(new moodle_url($protocol . $_SERVER['HTTP_HOST'] . $marvinjspath . '/js/promise-0.1.1.min.js'));
     $PAGE->requires->js(new moodle_url($protocol . $_SERVER['HTTP_HOST'] . $marvinjspath . '/js/marvinjslauncher.js'));
     $mform->addElement('static', 'answersinstruct', get_string('correctanswers', 'qtype_easyoselectjs'), get_string('filloutoneanswer', 'qtype_easyoselectjs'));
     $mform->closeHeaderBefore('answersinstruct');
     $mform->setType('structure', PARAM_RAW);
     $mform->addElement('hidden', 'structure', "", array('id' => 'id_structure'));
     $mform->addElement('html', html_writer::start_tag('div', array('id' => 'appletdiv', 'class' => 'easyomechjs resizable')));
     $mform->addElement('html', html_writer::start_tag('div', array('style' => 'float: left;font-style: italic ;')));
     $mform->addElement('html', html_writer::start_tag('small'));
     $easyoselectjshomeurl = 'http://www.chemaxon.com';
     $mform->addElement('html', html_writer::link($easyoselectjshomeurl, get_string('easyoselectjseditor', 'qtype_easyoselectjs')));
     $mform->addElement('html', html_writer::empty_tag('br'));
     $mform->addElement('html', html_writer::tag('span', get_string('author', 'qtype_easyoselectjs'), array('class' => 'easyoselectjsauthor')));
     $mform->addElement('html', html_writer::end_tag('small'));
     $mform->addElement('html', html_writer::end_tag('div'));
     $mform->addElement('html', html_writer::end_tag('div'));
     $marvinconfig = get_config('qtype_easyoselectjs_options');
     $marvinpath = $marvinconfig->path;
     $PAGE->requires->js_init_call('M.qtype_easyoselectjs.insert_applet', array($CFG->wwwroot, $marvinpath));
     $this->add_per_answer_fields($mform, get_string('answerno', 'qtype_easyoselectjs', '{no}'), question_bank::fraction_options());
     $this->add_interactive_settings();
     $PAGE->requires->js_init_call('M.qtype_easyoselectjs.init_getanswerstring', array($CFG->version));
     $PAGE->requires->js_init_call('M.qtype_easyoselectjs.init_viewanswerstring', array($CFG->version));
 }
Exemple #10
0
/**
 * Prints the 'All A B C ...' alphabetical filter bar.
 *
 * @param object $moodle_url the moodle url object for the alpha/letter links
 * @param string $pname      the parameter name to be appended to the moodle_url
 *                           i.e. 'pname=alpha'
 * @param string $label      optional label - defaults to none
 */
function pmalphabox($moodle_url, $pname = 'alpha', $label = null)
{
    $alpha = optional_param($pname, null, PARAM_ALPHA);
    $alphabet = explode(',', get_string('alphabet', 'langconfig'));
    $strall = get_string('all');
    echo html_writer::start_tag('div', array('style' => 'text-align:center'));
    if (!empty($label)) {
        echo $label, ' ';
        // TBD: html_writer::???
    }
    if ($alpha) {
        $url = clone $moodle_url;
        // TBD
        $url->remove_params($pname);
        echo html_writer::link($url, $strall);
    } else {
        echo html_writer::tag('b', $strall);
    }
    foreach ($alphabet as $letter) {
        if ($letter == $alpha) {
            echo ' ', html_writer::tag('b', $letter);
        } else {
            $url = clone $moodle_url;
            // TBD
            // Set current page to 0
            $url->params(array($pname => $letter, 'page' => 0));
            echo ' ', html_writer::link($url, $letter);
        }
    }
    echo html_writer::end_tag('div');
}
Exemple #11
0
function block_campusclash_print_page($campusclash, $return = false)
{
    //Add Page Title
    global $OUTPUT, $COURSE;
    $display = $OUTPUT->heading($campusclash->pagetitle);
    //Open a box
    $display .= $OUTPUT->box_start();
    //Display the Date
    if ($campusclash->displaydate) {
        $display .= html_writer::start_tag('div', array('class' => 'displaydate'));
        $display .= userdate($campusclash->displaydate);
        $display .= html_writer::end_tag('div');
    }
    //Display Text
    $display .= clean_text($campusclash->displaytext);
    //close the box
    $display .= $OUTPUT->box_end();
    //Display the Picture
    if ($campusclash->displaypicture) {
        $display .= $OUTPUT->box_start();
        $images = block_campusclash_images();
        $display .= $images[$campusclash->picture];
        $display .= html_writer::start_tag('p');
        $display .= clean_text($campusclash->description);
        $display .= html_writer::end_tag('p');
        $display .= $OUTPUT->box_end();
    }
    //Check to ensure that it was set before trying to output it
    if ($return) {
        return $display;
    } else {
        echo $display;
    }
}
Exemple #12
0
 /**
  * Render a series of section links.
  *
  * @param stdClass $course The course we are rendering for.
  * @param array $sections An array of section objects to render.
  * @param bool|int The section to provide a jump to link for.
  * @return string The HTML to display.
  */
 public function render_section_links(stdClass $course, array $sections, $jumptosection = false)
 {
     $html = html_writer::start_tag('ol', array('class' => 'inline-list'));
     foreach ($sections as $section) {
         $attributes = array();
         if (!$section->visible) {
             $attributes['class'] = 'dimmed';
         }
         $html .= html_writer::start_tag('li');
         $sectiontext = $section->section;
         if ($section->highlight) {
             $sectiontext = html_writer::tag('strong', $sectiontext);
         }
         $html .= html_writer::link(course_get_url($course, $section->section), $sectiontext, $attributes);
         $html .= html_writer::end_tag('li') . ' ';
     }
     $html .= html_writer::end_tag('ol');
     if ($jumptosection && isset($sections[$jumptosection])) {
         if ($course->format == 'weeks') {
             $linktext = new lang_string('jumptocurrentweek', 'block_section_links');
         } else {
             if ($course->format == 'topics') {
                 $linktext = new lang_string('jumptocurrenttopic', 'block_section_links');
             }
         }
         $attributes = array();
         if (!$sections[$jumptosection]->visible) {
             $attributes['class'] = 'dimmed';
         }
         $html .= html_writer::link(course_get_url($course, $jumptosection), $linktext, $attributes);
     }
     return $html;
 }
 public function user_report($data)
 {
     $html = '';
     foreach ($data->info as $i) {
         $html .= html_writer::start_tag('strong');
         $html .= html_writer::tag('span', $i->title);
         $html .= html_writer::end_tag('strong');
         $html .= html_writer::empty_tag('br');
         $html .= $this->output->help_icon('weighting', 'engagementindicator_login');
         $html .= html_writer::tag('span', get_string('weighting', 'engagementindicator_login') . ': ' . $i->weighting);
         $html .= html_writer::empty_tag('br');
         $html .= $this->output->help_icon('localrisk', 'engagementindicator_login');
         $html .= html_writer::tag('span', get_string('localrisk', 'engagementindicator_login') . ': ' . $i->localrisk);
         $html .= html_writer::empty_tag('br');
         $html .= $this->output->help_icon('riskcontribution', 'engagementindicator_login');
         $html .= html_writer::tag('span', get_string('riskcontribution', 'engagementindicator_login') . ': ' . $i->riskcontribution);
         $html .= html_writer::empty_tag('br');
         $html .= $this->output->help_icon('logic', 'engagementindicator_assessment');
         $html .= html_writer::tag('span', get_string('logic', 'engagementindicator_login') . ': ' . $i->logic);
         $html .= html_writer::empty_tag('br');
         $html .= html_writer::empty_tag('br');
     }
     $value = sprintf("%.0f%%", 100 * $data->risk);
     $html .= html_writer::tag('span', get_string('riskscore', 'engagement') . ": {$value}");
     return $html;
 }
Exemple #14
0
 function commenthtmlform($loginuserid = '') {
        $popup = html_writer:: start_tag('div',array('id'=>"basicModal$loginuserid",'style'=>'display:none;'));
        $popup .= html_writer:: tag('h4','Add Comment',array('class'=>'formheading'));
        $popup .= html_writer:: start_tag('form',array('name'=>'commentsform','onsubmit'=>'mycommentpopupform('.$loginuserid.')','action'=>''));
        //$popup .= html_writer:: empty_tag('input',array('type'=>'hidden','name'=>'queryid'));
        $popup .= html_writer:: start_tag('div',array('class'=>'summerylabel'));
        $popup .= html_writer:: tag('label','Summery',array('for'=>'summery'));
        
        $popup .= html_writer:: start_tag('span',array('class'=>'summerytextbox'));
        $popup .= html_writer:: empty_tag('input',array('type'=>'text','name'=>'summery','class'=>'textbox'));
        $popup .= html_writer:: end_tag('span');
        
        $popup .= html_writer:: end_tag('div');
        
        $popup .= html_writer:: start_tag('div',array('class'=>'summerylabel'));
        
        $popup .= html_writer:: tag('label','Comment',array('for'=>'comment'));
        
        $popup .= html_writer:: start_tag('span',array('class'=>'summerytextbox'));
        $popup .= html_writer:: tag('textarea','comment',array('class'=>'commentfield'));
        $popup .= html_writer:: end_tag('span');
        
        $popup .= html_writer:: end_tag('div');
        
        $popup .= html_writer:: start_tag('div',array('class'=>'submitbutton'));
        $popup .= html_writer:: empty_tag('input',array('type'=>'submit','name'=>'summery','value'=>'submit'));
        $popup .= html_writer:: end_tag('div');
        $popup .= html_writer:: end_tag('form');
        
        $popup .= html_writer:: end_tag('div');
        return $popup;
      }
Exemple #15
0
function block_advance_print_page($advance, $return = false)
{
    //add page title
    global $OUTPUT, $COURSE;
    $display = $OUTPUT->heading($advance->pagetitle);
    $display .= $OUTPUT->box_start();
    //date display
    if ($advance->displaydate) {
        $display .= html_writer::start_tag('div', array('class' => 'advance displaydate'));
        $display .= userdate($advance->displaydate);
        $display .= html_writer::end_tag('div');
    }
    //display text
    $display .= clean_text($advance->displaytext);
    //close the box
    $display .= $OUTPUT->box_end();
    //display picture
    if ($advance->displaypicture) {
        $display .= $OUTPUT->box_start();
        $images = block_advance_images();
        $display .= $images[$advance->picture];
        $display .= html_writer::start_tag('p');
        $display .= clean_text($advance->description);
        $display .= html_writer::end_tag('p');
        $display .= $OUTPUT->box_end();
    }
    //display it
    if ($return) {
        return $display;
    } else {
        echo $display;
    }
}
Exemple #16
0
 public function formulation_and_controls(question_attempt $qa, question_display_options $options)
 {
     $question = $qa->get_question();
     $response = $qa->get_last_qt_var('answer', '');
     $inputname = $qa->get_qt_field_name('answer');
     $trueattributes = array('type' => 'radio', 'name' => $inputname, 'value' => 1, 'id' => $inputname . 'true');
     $falseattributes = array('type' => 'radio', 'name' => $inputname, 'value' => 0, 'id' => $inputname . 'false');
     if ($options->readonly) {
         $trueattributes['disabled'] = 'disabled';
         $falseattributes['disabled'] = 'disabled';
     }
     // Work out which radio button to select (if any).
     $truechecked = false;
     $falsechecked = false;
     $responsearray = array();
     if ($response) {
         $trueattributes['checked'] = 'checked';
         $truechecked = true;
         $responsearray = array('answer' => 1);
     } else {
         if ($response !== '') {
             $falseattributes['checked'] = 'checked';
             $falsechecked = true;
             $responsearray = array('answer' => 1);
         }
     }
     // Work out visual feedback for answer correctness.
     $trueclass = '';
     $falseclass = '';
     $truefeedbackimg = '';
     $falsefeedbackimg = '';
     if ($options->correctness) {
         if ($truechecked) {
             $trueclass = ' ' . $this->feedback_class((int) $question->rightanswer);
             $truefeedbackimg = $this->feedback_image((int) $question->rightanswer);
         } else {
             if ($falsechecked) {
                 $falseclass = ' ' . $this->feedback_class((int) (!$question->rightanswer));
                 $falsefeedbackimg = $this->feedback_image((int) (!$question->rightanswer));
             }
         }
     }
     $radiotrue = html_writer::empty_tag('input', $trueattributes) . html_writer::tag('label', get_string('true', 'qtype_truefalse'), array('for' => $trueattributes['id']));
     $radiofalse = html_writer::empty_tag('input', $falseattributes) . html_writer::tag('label', get_string('false', 'qtype_truefalse'), array('for' => $falseattributes['id']));
     $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::tag('div', get_string('selectone', 'qtype_truefalse'), array('class' => 'prompt'));
     $result .= html_writer::start_tag('div', array('class' => 'answer'));
     $result .= html_writer::tag('div', $radiotrue . ' ' . $truefeedbackimg, array('class' => 'r0' . $trueclass));
     $result .= html_writer::tag('div', $radiofalse . ' ' . $falsefeedbackimg, array('class' => 'r1' . $falseclass));
     $result .= html_writer::end_tag('div');
     // Answer.
     $result .= html_writer::end_tag('div');
     // Ablock.
     if ($qa->get_state() == question_state::$invalid) {
         $result .= html_writer::nonempty_tag('div', $question->get_validation_error($responsearray), array('class' => 'validationerror'));
     }
     return $result;
 }
 /**
  * Renders a custom menu node as part of a submenu
  *
  * The custom menu this method override the render_custom_menu_item function
  * in outputrenderers.php
  *
  * @see render_custom_menu()
  *
  * @staticvar int $submenucount
  * @param custom_menu_item $menunode
  * @return string
  */
 protected function render_custom_menu_item(custom_menu_item $menunode)
 {
     // Required to ensure we get unique trackable id's
     static $submenucount = 0;
     $content = html_writer::start_tag('li');
     if ($menunode->has_children()) {
         // If the child has menus render it as a sub menu
         $submenucount++;
         if ($menunode->get_url() !== null) {
             $url = $menunode->get_url();
         } else {
             $url = '#cm_submenu_' . $submenucount;
         }
         $content .= html_writer::start_tag('span', array('class' => 'customitem'));
         $content .= html_writer::link($url, $menunode->get_text(), array('title' => $menunode->get_title()));
         $content .= html_writer::end_tag('span');
         $content .= html_writer::start_tag('ul');
         foreach ($menunode->get_children() as $menunode) {
             $content .= $this->render_custom_menu_item($menunode);
         }
         $content .= html_writer::end_tag('ul');
     } else {
         // The node doesn't have children so produce a final menuitem
         if ($menunode->get_url() !== null) {
             $url = $menunode->get_url();
         } else {
             $url = '#';
         }
         $content .= html_writer::link($url, $menunode->get_text(), array('title' => $menunode->get_title()));
     }
     $content .= html_writer::end_tag('li');
     // Return the sub menu
     return $content;
 }
 public function apply($discussion, $all, $selected, $formdata)
 {
     global $COURSE, $USER, $CFG, $PAGE;
     $d = $discussion->get_id();
     $forum = $discussion->get_forum();
     $PAGE->set_pagelayout('embedded');
     $out = mod_forumng_utils::get_renderer();
     print $out->header();
     $backlink = new moodle_url('/mod/forumng/discuss.php', $discussion->get_link_params_array());
     print html_writer::start_tag('div', array('class' => 'forumng-printable-header'));
     print html_writer::tag('div', link_arrow_left($discussion->get_subject(), $backlink), array('class' => 'forumng-printable-backlink'));
     print html_writer::tag('div', get_string('printedat', 'forumngfeature_print', userdate(time())), array('class' => 'forumng-printable-date'));
     print html_writer::tag('div', '', array('class' => 'clearer'));
     print "\n";
     print $out->box(get_string('back', 'forumngfeature_print', $backlink->out()), 'generalbox forumng-donotprint');
     print html_writer::start_tag('div', array('class' => 'forumng-showprintable'));
     if ($all) {
         print $out->render_discussion($discussion, array(mod_forumng_post::OPTION_NO_COMMANDS => true, mod_forumng_post::OPTION_CHILDREN_EXPANDED => true, mod_forumng_post::OPTION_PRINTABLE_VERSION => true));
     } else {
         $allhtml = '';
         $alltext = '';
         $discussion->build_selected_posts_email($selected, $alltext, $allhtml, array(mod_forumng_post::OPTION_PRINTABLE_VERSION));
         print $allhtml;
     }
     print html_writer::end_tag('div');
     $forum->print_js(0, false);
     print $out->footer();
 }
Exemple #19
0
 /**
  * This method is used to generate HTML for a subscriber selection form that
  * uses two user_selector controls
  *
  * @param user_selector_base $existinguc
  * @param user_selector_base $potentialuc
  * @return string
  */
 public function subscriber_selection_form(user_selector_base $existinguc, user_selector_base $potentialuc)
 {
     $output = '';
     $formattributes = array();
     $formattributes['id'] = 'subscriberform';
     $formattributes['action'] = '';
     $formattributes['method'] = 'post';
     $output .= html_writer::start_tag('form', $formattributes);
     $output .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()));
     $existingcell = new html_table_cell();
     $existingcell->text = $existinguc->display(true);
     $existingcell->attributes['class'] = 'existing';
     $actioncell = new html_table_cell();
     $actioncell->text = html_writer::start_tag('div', array());
     $actioncell->text .= html_writer::empty_tag('input', array('type' => 'submit', 'name' => 'subscribe', 'value' => $this->page->theme->larrow . ' ' . get_string('add'), 'class' => 'actionbutton'));
     $actioncell->text .= html_writer::empty_tag('br', array());
     $actioncell->text .= html_writer::empty_tag('input', array('type' => 'submit', 'name' => 'unsubscribe', 'value' => $this->page->theme->rarrow . ' ' . get_string('remove'), 'class' => 'actionbutton'));
     $actioncell->text .= html_writer::end_tag('div', array());
     $actioncell->attributes['class'] = 'actions';
     $potentialcell = new html_table_cell();
     $potentialcell->text = $potentialuc->display(true);
     $potentialcell->attributes['class'] = 'potential';
     $table = new html_table();
     $table->attributes['class'] = 'subscribertable boxaligncenter';
     $table->data = array(new html_table_row(array($existingcell, $actioncell, $potentialcell)));
     $output .= html_writer::table($table);
     $output .= html_writer::end_tag('form');
     return $output;
 }
Exemple #20
0
 /**
  * Write a single record
  *
  * @param array $record
  * @param int $rownum
  */
 public function write_record($record, $rownum)
 {
     echo \html_writer::start_tag('tr');
     foreach ($record as $cell) {
         echo \html_writer::tag('td', $cell);
     }
     echo \html_writer::end_tag('tr');
 }
 private function createlistitem($text, $link, $target = null)
 {
     $link = urldecode($link);
     $html = html_writer::start_tag('a', array('href' => $link, 'target' => $target ? $target : '_parent'));
     $html .= html_writer::tag('span', $text, array('class' => 'instancename'));
     $html .= html_writer::end_tag('a');
     return html_writer::tag('li', $html);
 }
 /**
  * Render the block's body content.
  *
  * @param \block_mycontacts $block
  *
  * @return string
  */
 public function body(block_mycontacts $block)
 {
     $contacts = $block->get_contacts();
     $innerhtml = '';
     foreach ($contacts as $contact) {
         $innerhtml .= $this->contact($contact);
     }
     return html_writer::start_tag('ul') . $innerhtml . html_writer::end_tag('ul');
 }
    function get_content() {
        global $CFG, $OUTPUT, $USER, $COURSE,$DB;
        
        require_once($CFG->dirroot.'/message/lib.php');
		require_once($CFG->dirroot.'/blocks/userinfo/lib.php');
        
        if ($this->content !== NULL) {
            return $this->content;
        }

        $this->content = new stdClass;
        $this->content->text = '';
		if(is_siteadmin()){
			$this->content->text.= '<div class="userinfoblock">';
			$this->content->text.= '<div class="userinfo_details">';
			$this->content->text.= "<a>".fullname($USER,true)."</a>";
			$this->content->text.="<br>";
            $this->content->text.= $OUTPUT->user_picture($USER, array('size' => 100, 'class' => 'userinfoblockimg'));
			
//            $this->content->text.= $OUTPUT->user_picture($USER, array('size' => 100, 'class' => 'userinfoblockimg'));
//			$this->content->text.= "<br/><a href=\"$CFG->wwwroot/user/profile.php?id=$USER->id\">".fullname($USER,true)."</a>";
//            //$this->content->text.= "<br/><a href=\"$CFG->wwwroot/user/profile.php?id=$USER->id\">".fullname($USER,true)."</a>&nbsp;"
//            //        ."(<a href=\"$CFG->wwwroot/login/logout.php?sesskey=".sesskey()."\">".get_string('logout').'</a>)';
			$user = $DB->get_record_sql("SELECT * FROM {user} WHERE id = $USER->id");
		    $this->content->text.= html_writer::tag('p',$user->email,array());
			$this->content->text.= '</div>';
			
			$this->content->text.=  html_writer::start_tag('div',array('class'=>'profile_icon'));
			$this->content->text.=  html_writer::start_tag('div',array('class'=>'profile_row_left'));
			$icon = html_writer::empty_tag('img', array('title' => 'Upload picture', 'alt' => 'Upload picture', 'src' => $CFG->wwwroot.'/blocks/userinfo/pix/upload_image.png'));
			$this->content->text.= html_writer::tag('a',$icon,array('href'=> $CFG->wwwroot.'/local/upload_picture/index.php?id='.$USER->id));
			//$this->content->text.=  html_writer::tag('a',get_string('edit_picture','block_userinfo'),array('href'=> $CFG->wwwroot.'/user/edit.php?id='.$USER->id));
			
			$this->content->text.=  html_writer::end_tag('div',array('class'=>'profile_row_left'));
			$this->content->text.=  html_writer::start_tag('div',array('class'=>'profile_row_center'));
			$icon = html_writer::empty_tag('img', array('title' => 'Message', 'alt' => 'Message', 'src' => $CFG->wwwroot.'/blocks/userinfo/pix/message.png'));
			$this->content->text.= html_writer::tag('a',$icon,array('href'=> $CFG->wwwroot.'/local/mail/view.php?t='));
			//$this->content->text.=  html_writer::tag('a',get_string('messages','block_userinfo'),array('href'=> $CFG->wwwroot.'/local/mail/view.php?t='));
			$this->content->text.=  html_writer::end_tag('div',array('class'=>'profile_row_center'));
			
			$this->content->text.= html_writer::start_tag('div',array('class'=>'profile_row_right'));
			$icon = html_writer::empty_tag('img', array('title' => 'My private files', 'alt' => 'My private files', 'src' => $CFG->wwwroot.'/blocks/userinfo/pix/myprivatefiles.png'));
			$this->content->text.= html_writer::tag('a',$icon,array('href'=> $CFG->wwwroot.'/user/files.php'));
			$this->content->text.= html_writer::end_tag('div',array('class'=>'profile_row_right'));
			
			$this->content->text.=  html_writer::end_tag('div',array('class'=>'profile_icon'));
			$this->content->text.= '</div>';
		} else{
			$this->content->text.= '<div class="userinfoblock">';
			$data =  block_profile_view();
			$this->content->text.= $data;
			$this->content->text.= '</div>';
		}
        $this->content->footer = '';
        return $this->content;
    }
 public function get_content()
 {
     global $COURSE, $DB, $PAGE;
     if ($this->content !== null) {
         return $this->content;
     }
     if (!empty($this->config->text)) {
         $this->content->text = $this->config->text;
     }
     //Texto que aparece en el bloque
     $this->content = new stdClass();
     $this->content->text = 'The content of our SimpleHTML block!';
     $context = context_course::instance($COURSE->id);
     if (has_capability('block/simplehtml:managepages', $context)) {
         $url = new moodle_url('/blocks/simplehtml/view.php', array('blockid' => $this->instance->id, 'courseid' => $COURSE->id));
         $this->content->footer = html_writer::link($url, get_string('addpage', 'block_simplehtml'));
     } else {
         $this->content->footer = '';
     }
     // Check to see if we are in editing mode and that we can manage pages.
     $canmanage = has_capability('block/simplehtml:managepages', $context) && $PAGE->user_is_editing($this->instance->id);
     $canview = has_capability('block/simplehtml:viewpages', $context);
     if ($simplehtmlpages = $DB->get_records('block_simplehtml', array('blockid' => $this->instance->id))) {
         $this->content->text .= html_writer::start_tag('ul');
         foreach ($simplehtmlpages as $simplehtmlpage) {
             if ($canmanage) {
                 $pageparam = array('blockid' => $this->instance->id, 'courseid' => $COURSE->id, 'id' => $simplehtmlpage->id);
                 $editurl = new moodle_url('/blocks/simplehtml/view.php', $pageparam);
                 $editpicurl = new moodle_url('/pix/t/edit.png');
                 $edit = html_writer::link($editurl, html_writer::tag('img', '', array('src' => $editpicurl, 'alt' => get_string('edit'))));
                 //delete
                 $deleteparam = array('id' => $simplehtmlpage->id, 'courseid' => $COURSE->id);
                 $deleteurl = new moodle_url('/blocks/simplehtml/delete.php', $deleteparam);
                 $deletepicurl = new moodle_url('/pix/t/delete.png');
                 $delete = html_writer::link($deleteurl, html_writer::tag('img', '', array('src' => $deletepicurl, 'alt' => get_string('delete'))));
             } else {
                 $edit = '';
                 $delete = '';
             }
             $pageurl = new moodle_url('/blocks/simplehtml/view.php', array('blockid' => $this->instance->id, 'courseid' => $COURSE->id, 'id' => $simplehtmlpage->id, 'viewpage' => true));
             $this->content->text .= html_writer::start_tag('li');
             if ($canview) {
                 $this->content->text .= html_writer::link($pageurl, $simplehtmlpage->pagetitle);
             } else {
                 $this->content->text .= html_writer::tag('div', $simplehtmlpage->pagetitle);
             }
             $this->content->text .= '  ';
             $this->content->text .= $edit;
             $this->content->text .= '  ';
             $this->content->text .= $delete;
             $this->content->text .= html_writer::end_tag('li');
         }
         $this->content->text .= html_writer::end_tag('ul');
     }
     return $this->content;
 }
Exemple #25
0
 function filter($text, array $options = array())
 {
     if (!($courseid = get_courseid_from_context($this->context))) {
         return $text;
     }
     // Initialise/invalidate our trivial cache if dealing with a different course
     if (!isset(self::$cachedcourseid) || self::$cachedcourseid !== (int) $courseid) {
         self::$activitylist = null;
     }
     self::$cachedcourseid = (int) $courseid;
     /// It may be cached
     if (is_null(self::$activitylist)) {
         self::$activitylist = array();
         $modinfo = get_fast_modinfo($courseid);
         if (!empty($modinfo->cms)) {
             self::$activitylist = array();
             /// We will store all the activities here
             //Sort modinfo by name length
             $sortedactivities = fullclone($modinfo->cms);
             usort($sortedactivities, 'filter_activitynames_comparemodulenamesbylength');
             foreach ($sortedactivities as $cm) {
                 //Exclude labels, hidden activities and activities for group members only
                 if ($cm->visible and empty($cm->groupmembersonly) and $cm->has_view()) {
                     $title = s(trim(strip_tags($cm->name)));
                     $currentname = trim($cm->name);
                     $entitisedname = s($currentname);
                     /// Avoid empty or unlinkable activity names
                     if (!empty($title)) {
                         $href_tag_begin = html_writer::start_tag('a', array('class' => 'autolink', 'title' => $title, 'href' => $cm->get_url()));
                         self::$activitylist[$cm->id] = new filterobject($currentname, $href_tag_begin, '</a>', false, true);
                         if ($currentname != $entitisedname) {
                             /// If name has some entity (&amp; &quot; &lt; &gt;) add that filter too. MDL-17545
                             self::$activitylist[$cm->id . '-e'] = new filterobject($entitisedname, $href_tag_begin, '</a>', false, true);
                         }
                     }
                 }
             }
         }
     }
     $filterslist = array();
     if (self::$activitylist) {
         $cmid = $this->context->instanceid;
         if ($this->context->contextlevel == CONTEXT_MODULE && isset(self::$activitylist[$cmid])) {
             // remove filterobjects for the current module
             $filterslist = array_diff_key(self::$activitylist, array($cmid => 1, $cmid . '-e' => 1));
         } else {
             $filterslist = self::$activitylist;
         }
     }
     if ($filterslist) {
         return $text = filter_phrases($text, $filterslist);
     } else {
         return $text;
     }
 }
 public function get_content()
 {
     global $CFG;
     if ($this->content !== null) {
         return $this->content;
     }
     if (empty($this->instance)) {
         $this->content = '';
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->items = array();
     $this->content->icons = array();
     $this->content->footer = '';
     $this->content->text = '';
     // The user/index.php expect course context, so get one if page has module context.
     $currentcontext = $this->page->context->get_course_context(false);
     if (empty($currentcontext)) {
         return $this->content;
     }
     if ($this->page->course->id == SITEID) {
         $courses = self::get_featured_courses();
         require_once $CFG->libdir . '/coursecatlib.php';
         $chelper = new coursecat_helper();
         foreach ($courses as $course) {
             $course = new course_in_list($course);
             $this->content->text .= '<div class="container-fluid coursebox">';
             $content = '';
             $coursename = $chelper->get_course_formatted_name($course);
             $coursenamelink = html_writer::link(new moodle_url('/course/view.php', array('id' => $course->id)), $coursename, array('class' => $course->visible ? '' : 'dimmed'));
             $content .= html_writer::tag('div', $coursenamelink, array('class' => 'coursename'));
             if ($course->has_summary()) {
                 $content .= html_writer::start_tag('div', array('class' => 'summary'));
                 $content .= $chelper->get_course_formatted_summary($course, array('overflowdiv' => true, 'noclean' => true, 'para' => false));
                 $content .= html_writer::end_tag('div');
             }
             // Display course overview files.
             $contentimages = $contentfiles = '';
             foreach ($course->get_course_overviewfiles() as $file) {
                 $isimage = $file->is_valid_image();
                 $url = file_encode_url("{$CFG->wwwroot}/pluginfile.php", '/' . $file->get_contextid() . '/' . $file->get_component() . '/' . $file->get_filearea() . $file->get_filepath() . $file->get_filename(), !$isimage);
                 if ($isimage) {
                     $contentimages .= html_writer::tag('div', html_writer::empty_tag('img', array('src' => $url, 'style' => 'max-height: 150px')), array('class' => 'courseimage'));
                 } else {
                     $image = $this->output->pix_icon(file_file_icon($file, 24), $file->get_filename(), 'moodle');
                     $filename = html_writer::tag('span', $image, array('class' => 'fp-icon')) . html_writer::tag('span', $file->get_filename(), array('class' => 'fp-filename'));
                     $contentfiles .= html_writer::tag('span', html_writer::link($url, $filename), array('class' => 'coursefile fp-filename-icon'));
                 }
             }
             $content .= $contentimages . $contentfiles;
             $this->content->text .= $content . '</div>';
         }
     }
     return $this->content;
 }
 /**
  * Print out a set of answers as a table.
  */
 static function print_answers_as_table($question_text, $possible_answers, $cols = 1, $pragmas = array())
 {
     //initalize a new output buffer
     $output = '';
     //and start a new column count
     $col = -1;
     //make sure we can never have more columns than answers
     $cols = min($cols, count($possible_answers));
     //if a pdf_pragma exists overriding the number of columns, accept it
     if (array_key_exists('cols', $pragmas)) {
         $cols = $pragmas['cols'];
     }
     //if a style pragma was provided, use it
     if (array_key_exists('answerstyle', $pragmas)) {
         $style_pragma = $pragmas['answerstyle'];
     } else {
         $style_pragma = '';
     }
     //calculate the correct column width for each item, reserving 2% for the identifiers
     $col_width = floor(self::QUESTION_MAXIMUM_WIDTH / $cols) - 2;
     //start the table
     $output .= "\n" . html_writer::start_tag('table', array('class' => 'fullwidth', 'style' => 'width: 95%;'));
     //output the question
     $output .= "\n" . html_writer::start_tag('tr');
     $output .= "\n" . html_writer::tag('td', $question_text, array('colspan' => $cols * 2, 'width' => '95%'));
     $output .= "\n" . html_writer::end_tag('tr');
     //for each of the possible answers
     foreach ($possible_answers as $possible_answer) {
         //calculate the current column number, and set newcol if we should start a new column
         $col = ($col + 1) % $cols;
         //if this is the first element in a column,
         if ($col === 0) {
             $output .= "\n" . html_writer::start_tag('tr');
         }
         //TODO: weight column width by content?
         //(leads to better layout, but columns will no longer line up)
         //render the possible answer
         $output .= "\n" . html_writer::tag('td', $possible_answer['identifier'], array('class' => 'identifier', 'width' => '2%'));
         $output .= "\n" . html_writer::tag('td', $possible_answer['text'], array('style' => 'width: ' . $col_width . '%; padding-left: 10px; vertical-align: middle;' . $style_pragma));
         //if we've reached the maximum amount of columns, end the row
         if ($col == $cols - 1) {
             $output .= "\n" . html_writer::end_tag('tr');
         }
     }
     //if our row is unfinished, finish it
     if ($col < $cols - 1) {
         //insert a column as wide as there are rows remaining
         $output .= "\n" . html_writer::tag('td', '&nbsp;', array('colspan' => $cols - $col - 1));
         //and close the row
         $output .= "\n" . html_writer::end_tag('tr');
     }
     //end the table
     $output .= "\n" . html_writer::end_tag('table');
     return $output;
 }
Exemple #28
0
 public function render_course_enrolment_users_table(course_enrolment_users_table $table, moodleform $mform)
 {
     $table->initialise_javascript();
     // Added for the Bootstrap theme. Make this table responsive.
     $table->attributes['class'] .= ' table table-responsive';
     $buttons = $table->get_manual_enrol_buttons();
     $buttonhtml = '';
     if (count($buttons) > 0) {
         $buttonhtml .= html_writer::start_tag('div', array('class' => 'enrol_user_buttons'));
         foreach ($buttons as $button) {
             $buttonhtml .= $this->render($button);
         }
         $buttonhtml .= html_writer::end_tag('div');
     }
     $content = '';
     if (!empty($buttonhtml)) {
         $content .= $buttonhtml;
     }
     $content .= $mform->render();
     $content .= $this->output->render($table->get_paging_bar());
     // Check if the table has any bulk operations. If it does we want to wrap the table in a
     // form so that we can capture and perform any required bulk operations.
     if ($table->has_bulk_user_enrolment_operations()) {
         $content .= html_writer::start_tag('form', array('action' => new moodle_url('/enrol/bulkchange.php'), 'method' => 'post'));
         foreach ($table->get_combined_url_params() as $key => $value) {
             if ($key == 'action') {
                 continue;
             }
             $content .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => $key, 'value' => $value));
         }
         $content .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'action', 'value' => 'bulkchange'));
         $content .= html_writer::table($table);
         $content .= html_writer::start_tag('div', array('class' => 'singleselect bulkuserop'));
         $content .= html_writer::start_tag('select', array('name' => 'bulkuserop'));
         $content .= html_writer::tag('option', get_string('withselectedusers', 'enrol'), array('value' => ''));
         $options = array('' => get_string('withselectedusers', 'enrol'));
         foreach ($table->get_bulk_user_enrolment_operations() as $operation) {
             $content .= html_writer::tag('option', $operation->get_title(), array('value' => $operation->get_identifier()));
         }
         $content .= html_writer::end_tag('select');
         $content .= html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('go')));
         $content .= html_writer::end_tag('div');
         $content .= html_writer::end_tag('form');
     } else {
         // Added for the Bootstrap theme, a no-overflow wrapper.
         $content .= html_writer::start_tag('div', array('class' => 'no-overflow'));
         $content .= html_writer::table($table);
         $content .= html_writer::end_tag('div');
     }
     $content .= $this->output->render($table->get_paging_bar());
     if (!empty($buttonhtml)) {
         $content .= $buttonhtml;
     }
     return $content;
 }
Exemple #29
-1
 /**
  * Gets the block contents.
  *
  * If we can avoid it better not check the server status here as connecting
  * to the server will slow down the whole page load.
  *
  * @return string The block HTML.
  */
 public function get_content()
 {
     global $OUTPUT;
     if ($this->content !== null) {
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->footer = '';
     if (\core_search\manager::is_global_search_enabled() === false) {
         $this->content->text = get_string('globalsearchdisabled', 'search');
         return $this->content;
     }
     $url = new moodle_url('/search/index.php');
     $this->content->footer .= html_writer::link($url, get_string('advancedsearch', 'search'));
     $this->content->text = html_writer::start_tag('div', array('class' => 'searchform'));
     $this->content->text .= html_writer::start_tag('form', array('action' => $url->out()));
     $this->content->text .= html_writer::start_tag('fieldset', array('action' => 'invisiblefieldset'));
     // Input.
     $this->content->text .= html_writer::tag('label', get_string('search', 'search'), array('for' => 'searchform_search', 'class' => 'accesshide'));
     $inputoptions = array('id' => 'searchform_search', 'name' => 'q', 'type' => 'text', 'size' => '15');
     $this->content->text .= html_writer::empty_tag('input', $inputoptions);
     // Search button.
     $this->content->text .= html_writer::tag('button', get_string('search', 'search'), array('id' => 'searchform_button', 'type' => 'submit', 'title' => 'globalsearch'));
     $this->content->text .= html_writer::end_tag('fieldset');
     $this->content->text .= html_writer::end_tag('form');
     $this->content->text .= html_writer::end_tag('div');
     return $this->content;
 }
Exemple #30
-2
 function attendance_alerts($userid)
 {
     global $DB;
     $sessions_sql = "SELECT ff.*, fsd.*, ffs.id AS sessid\n                           FROM {facetoface} as ff\n                           JOIN {facetoface_sessions} as ffs\n                             ON ffs.facetoface = ff.id\n                           JOIN {facetoface_sessions_dates} as fsd\n                             ON fsd.sessionid = ffs.id\n                          WHERE ff.trainerid = :traineeid\n                            AND ffs.attendence_status = :status\n                          LIMIT 5\n                        ";
     $sessions = $DB->get_records_sql($sessions_sql, array('traineeid' => $userid, 'status' => 0));
     if (empty($sessions)) {
         return get_string('nosessions', 'block_attendance');
     } else {
         $table = new html_table();
         $table->id = 'trainerfeedbak_batches';
         $table->width = '100%';
         $table->head = array(get_string('sessiondetails', 'block_attendance'), '');
         foreach ($sessions as $session) {
             $row = array();
             $sess_data = html_writer::start_tag('ul');
             $sess_data .= html_writer::tag('li', $session->name);
             $session_date = date('d/m/y', $session->timestart) . ' - ' . date('d/m/y', $session->timefinish);
             $sess_data .= html_writer::tag('li', $session_date);
             $sess_data .= html_writer::end_tag('ul');
             $row[] = $sess_data;
             $session_url = new moodle_url('/mod/facetoface/attendence.php', array('s' => $session->sessid));
             $row[] = html_writer::link($session_url, get_string('view'));
             $table->data[] = $row;
         }
         return html_writer::table($table);
     }
 }