當前位置: 首頁>>代碼示例>>PHP>>正文


PHP html_writer::tag方法代碼示例

本文整理匯總了PHP中html_writer::tag方法的典型用法代碼示例。如果您正苦於以下問題:PHP html_writer::tag方法的具體用法?PHP html_writer::tag怎麽用?PHP html_writer::tag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在html_writer的用法示例。


在下文中一共展示了html_writer::tag方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: get_replacements

 /**
  *
  */
 public function get_replacements(array $patterns, $entry = null, array $options = array())
 {
     global $CFG, $OUTPUT;
     $replacements = parent::get_replacements($patterns, $entry, $options);
     $view = $this->_view;
     $df = $view->get_df();
     $filter = $view->get_filter();
     $baseurl = new moodle_url($view->get_baseurl());
     $baseurl->param('sesskey', sesskey());
     foreach ($patterns as $pattern) {
         switch ($pattern) {
             case '##exportall##':
                 $actionurl = new moodle_url($baseurl, array('pdfexportall' => true));
                 $label = html_writer::tag('span', get_string('exportall', 'dataformview_pdf'));
                 $replacements[$pattern] = html_writer::link($actionurl, $label, array('class' => 'actionlink exportall'));
                 break;
             case '##exportpage##':
                 $actionurl = new moodle_url($baseurl, array('pdfexportpage' => true));
                 $label = html_writer::tag('span', get_string('exportpage', 'dataformview_pdf'));
                 $replacements[$pattern] = html_writer::link($actionurl, $label, array('class' => 'actionlink exportpage'));
                 break;
             case '##pagebreak##':
                 $replacements[$pattern] = $view::PAGE_BREAK;
                 break;
         }
     }
     return $replacements;
 }
開發者ID:itamart,項目名稱:moodle-dataformview_pdf,代碼行數:31,代碼來源:patterns.php

示例2: render_section_links

 /**
  * 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;
 }
開發者ID:evltuma,項目名稱:moodle,代碼行數:41,代碼來源:renderer.php

示例3: commenthtmlform

 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;
      }
開發者ID:anilch,項目名稱:Personel,代碼行數:32,代碼來源:renderer.php

示例4: facetoface_send_admin_upgrade_msg

/**
 *
 * 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);
}
開發者ID:CWRTP,項目名稱:facetoface-2.0,代碼行數:32,代碼來源:upgrade.php

示例5: question

 /**
  * 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;
 }
開發者ID:advancingdesign,項目名稱:moodle-theme_pdf,代碼行數:50,代碼來源:core_question_pdf_renderer.php

示例6: get_submission_status

 /**
  * Search a list of modules.
  *
  * @param $modulecode
  * @return array [string]
  * @throws \invalid_parameter_exception
  */
 public static function get_submission_status($submissionid)
 {
     global $DB, $USER;
     $params = self::validate_parameters(self::get_submission_status_parameters(), array('submissionid' => $submissionid));
     $submissionid = $params['submissionid'];
     $submission = $DB->get_record('turnitintooltwo_submissions', array('id' => $submissionid));
     if (!$submission) {
         return array('status' => 'error');
     }
     // Grab more data.
     $turnitintooltwo = $DB->get_record('turnitintooltwo', array('id' => $submission->turnitintooltwoid));
     list($course, $cm) = get_course_and_cm_from_instance($turnitintooltwo, 'turnitintooltwo');
     // Check this is our submission.
     if ($USER->id !== $submission->userid && !has_capability('mod/turnitintooltwo:grade', \context_module::instance($cm->id))) {
         return array('status' => 'nopermission');
     }
     // What is the status?
     $status = $DB->get_record('turnitintooltwo_sub_status', array('submissionid' => $submissionid));
     if (!$status) {
         return array('status' => 'queued');
     }
     // Decode the receipt.
     $digitalreceipt = (array) json_decode($status->receipt);
     // Woo!
     if ($status->status == \mod_turnitintooltwo\task\submit_assignment::STATUS_SUCCESS) {
         $turnitintooltwoview = new \turnitintooltwo_view();
         $digitalreceipt = $turnitintooltwoview->show_digital_receipt($digitalreceipt);
         $digitalreceipt = \html_writer::tag("div", $digitalreceipt, array("id" => "box_receipt"));
         return array('status' => 'success', 'message' => $digitalreceipt);
     }
     return array('status' => 'failed', 'message' => \html_writer::tag("div", $digitalreceipt["message"], array("class" => "alert alert-danger")));
 }
開發者ID:SkylarKelty,項目名稱:moodle-mod_turnitintooltwo,代碼行數:39,代碼來源:external.php

示例7: formatNameForDisplay

 /**
  * Method to ensure that all names within the module
  * are outputted in the same manner
  * @global object $CFG Moodle config object
  * @param string $firstname First name
  * @param string $lastname Last name
  * @param string $username Username (where applicable)
  * @param string $company Name of company/institution (where applicable)
  * @param int $userId If user ID is present, usernames will become profile links
  * @param string $phoneNumber Phone number (where applicable)
  * @return string Formatted display string
  * @version 2012100401
  * @since 2011011401
  */
 public static final function formatNameForDisplay($firstname, $lastname, $username = null, $company = null, $userId = 0, $phoneNumber = null)
 {
     global $CFG;
     if ($firstname == '') {
         $firstname = get_string('fragunknownname', 'block_moodletxt');
     }
     if ($lastname == '') {
         $lastname = get_string('fragunknownname', 'block_moodletxt');
     }
     $displayName = $lastname . ', ' . $firstname;
     if ($company !== null) {
         $displayName .= ' (' . $company . ')';
     }
     if ($phoneNumber !== null) {
         $displayName .= ' (' . $phoneNumber . ')';
     }
     if ($username !== null) {
         if ($userId > 0) {
             $displayName .= ' ' . html_writer::tag('a', '(' . $username . ')', array('href' => $CFG->wwwroot . '/user/view.php?id=' . $userId));
         } else {
             $displayName .= ' (' . $username . ')';
         }
     }
     return $displayName;
 }
開發者ID:educacionbe,項目名稱:campus,代碼行數:39,代碼來源:MoodletxtStringHelper.php

示例8: definition

 /**
  * Form element definition
  */
 public function definition()
 {
     $form = $this->_form;
     $form->addElement('hidden', 'areaid');
     $form->setType('areaid', PARAM_INT);
     $form->addElement('hidden', 'returnurl');
     $form->setType('returnurl', PARAM_LOCALURL);
     // name
     $form->addElement('text', 'name', get_string('name', 'gradingform_rubric'), array('size' => 52, 'aria-required' => 'true'));
     $form->addRule('name', get_string('required'), 'required', null, 'client');
     $form->setType('name', PARAM_TEXT);
     // description
     $options = gradingform_rubric_controller::description_form_field_options($this->_customdata['context']);
     $form->addElement('editor', 'description_editor', get_string('description', 'gradingform_rubric'), null, $options);
     $form->setType('description_editor', PARAM_RAW);
     // rubric completion status
     $choices = array();
     $choices[gradingform_controller::DEFINITION_STATUS_DRAFT] = html_writer::tag('span', get_string('statusdraft', 'core_grading'), array('class' => 'status draft'));
     $choices[gradingform_controller::DEFINITION_STATUS_READY] = html_writer::tag('span', get_string('statusready', 'core_grading'), array('class' => 'status ready'));
     $form->addElement('select', 'status', get_string('rubricstatus', 'gradingform_rubric'), $choices)->freeze();
     // rubric editor
     $element = $form->addElement('rubriceditor', 'rubric', get_string('rubric', 'gradingform_rubric'));
     $form->setType('rubric', PARAM_RAW);
     $buttonarray = array();
     $buttonarray[] =& $form->createElement('submit', 'saverubric', get_string('saverubric', 'gradingform_rubric'));
     if ($this->_customdata['allowdraft']) {
         $buttonarray[] =& $form->createElement('submit', 'saverubricdraft', get_string('saverubricdraft', 'gradingform_rubric'));
     }
     $editbutton =& $form->createElement('submit', 'editrubric', ' ');
     $editbutton->freeze();
     $buttonarray[] =& $editbutton;
     $buttonarray[] =& $form->createElement('cancel');
     $form->addGroup($buttonarray, 'buttonar', '', array(' '), false);
     $form->closeHeaderBefore('buttonar');
 }
開發者ID:rushi963,項目名稱:moodle,代碼行數:38,代碼來源:edit_form.php

示例9: get_details

 /**
  * Get criteria details for displaying to users
  *
  * @return string
  */
 public function get_details($short = '')
 {
     global $DB, $OUTPUT;
     $output = array();
     foreach ($this->params as $p) {
         $coursename = $DB->get_field('course', 'fullname', array('id' => $p['course']));
         if (!$coursename) {
             $str = $OUTPUT->error_text(get_string('error:nosuchcourse', 'badges'));
         } else {
             $str = html_writer::tag('b', '"' . $coursename . '"');
             if (isset($p['bydate'])) {
                 $str .= get_string('criteria_descr_bydate', 'badges', userdate($p['bydate'], get_string('strftimedate', 'core_langconfig')));
             }
             if (isset($p['grade'])) {
                 $str .= get_string('criteria_descr_grade', 'badges', $p['grade']);
             }
         }
         $output[] = $str;
     }
     if ($short) {
         return implode(', ', $output);
     } else {
         return html_writer::alist($output, array(), 'ul');
     }
 }
開發者ID:Jtgadbois,項目名稱:Pedadida,代碼行數:30,代碼來源:award_criteria_courseset.php

示例10: toolbar

 /**
  * Return the toolbar
  *
  * @param bool $show_new whether show "New round" button
  * return alist of links
  */
 public function toolbar($show_new = true)
 {
     $output = '';
     $toolbuttons = array();
     //  Print next/prev round bar
     if ($this->hotquestion->get_prev_round() != null) {
         $url = new moodle_url('/mod/hotquestion/view.php', array('id' => $this->hotquestion->cm->id, 'round' => $this->hotquestion->get_prev_round()->id));
         $toolbuttons[] = html_writer::link($url, $this->pix_icon('t/collapsed_rtl', get_string('previousround', 'hotquestion')), array('class' => 'toolbutton'));
     } else {
         $toolbuttons[] = html_writer::tag('span', $this->pix_icon('t/collapsed_empty_rtl', ''), array('class' => 'dis_toolbutton'));
     }
     if ($this->hotquestion->get_next_round() != null) {
         $url = new moodle_url('/mod/hotquestion/view.php', array('id' => $this->hotquestion->cm->id, 'round' => $this->hotquestion->get_next_round()->id));
         $toolbuttons[] = html_writer::link($url, $this->pix_icon('t/collapsed', get_string('nextround', 'hotquestion')), array('class' => 'toolbutton'));
     } else {
         $toolbuttons[] = html_writer::tag('span', $this->pix_icon('t/collapsed_empty', ''), array('class' => 'dis_toolbutton'));
     }
     // Print new round bar
     if ($show_new) {
         $options = array();
         $options['id'] = $this->hotquestion->cm->id;
         $options['action'] = 'newround';
         $url = new moodle_url('/mod/hotquestion/view.php', $options);
         $toolbuttons[] = html_writer::link($url, $this->pix_icon('t/add', get_string('newround', 'hotquestion')), array('class' => 'toolbutton'));
     }
     // Print refresh button
     $url = new moodle_url('/mod/hotquestion/view.php', array('id' => $this->hotquestion->cm->id));
     $toolbuttons[] = html_writer::link($url, $this->pix_icon('t/reload', get_string('reload')), array('class' => 'toolbutton'));
     // return all available toolbuttons
     $output .= html_writer::alist($toolbuttons, array('id' => 'toolbar'));
     return $output;
 }
開發者ID:hit-moodle,項目名稱:moodle-mod_hotquestion,代碼行數:38,代碼來源:renderer.php

示例11: h

 public static function h($tag, $text = null, $options = array(), $escape_text = false) {
     $tag = htmlentities($tag);
     if(!empty($text) && $escape_text) {
             $text = htmlentities($text);
         }
     return html_writer::tag($tag, $text, $options);
 }
開發者ID:JP-Git,項目名稱:moodle,代碼行數:7,代碼來源:utils.php

示例12: definition_inner

 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));
 }
開發者ID:Kathrin84,項目名稱:moodle-qtype_easyoselectjs,代碼行數:31,代碼來源:edit_easyoselectjs_form.php

示例13: subquestion

 public function subquestion(question_attempt $qa, question_display_options $options, qtype_combined_combinable_base $subq, $placeno)
 {
     $question = $subq->question;
     $place = $placeno + 1;
     $group = $question->places[$place];
     $fieldname = $subq->step_data_name($question->field($place));
     $value = $qa->get_last_qt_var($fieldname);
     $attributes = array('id' => str_replace(':', '_', $qa->get_qt_field_name($fieldname)));
     if ($options->readonly) {
         $attributes['disabled'] = 'disabled';
     }
     $orderedchoices = $question->get_ordered_choices($group);
     $selectoptions = array();
     foreach ($orderedchoices as $orderedchoicevalue => $orderedchoice) {
         $selectoptions[$orderedchoicevalue] = $orderedchoice->text;
     }
     $feedbackimage = '';
     if ($options->correctness) {
         $response = $qa->get_last_qt_data();
         if (array_key_exists($fieldname, $response)) {
             $fraction = (int) ($response[$fieldname] == $question->get_right_choice_for($place));
             $attributes['class'] = $this->feedback_class($fraction);
             $feedbackimage = $this->feedback_image($fraction);
         }
     }
     $selecthtml = html_writer::select($selectoptions, $qa->get_qt_field_name($fieldname), $value, get_string('choosedots'), $attributes) . ' ' . $feedbackimage;
     return html_writer::tag('span', $selecthtml, array('class' => 'control'));
 }
開發者ID:antoniorodrigues,項目名稱:redes-digitais,代碼行數:28,代碼來源:renderer.php

示例14: execute

    function execute($data, $row, $user, $courseid, $starttime = 0, $endtime = 0) {
        global $DB, $CFG;

        require_once("{$CFG->libdir}/completionlib.php");

        $course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);

        $info = new completion_info($course);

        // Is course complete?
        $coursecomplete = $info->is_course_complete($row->id);

        // Load course completion.
        $params = array(
            'userid' => $row->id,
            'course' => $course->id
        );
        $ccompletion = new completion_completion($params);

        // Has this user completed any criteria?
        $criteriacomplete = $info->count_course_user_data($row->id);

        $content = "";
        if ($coursecomplete) {
            $content .= get_string('complete');
        } else if (!$criteriacomplete && !$ccompletion->timestarted) {
            $content .= html_writer::tag('i', get_string('notyetstarted', 'completion'));
        } else {
            $content .= html_writer::tag('i', get_string('inprogress', 'completion'));
        }
        return $content;
    }
開發者ID:narasimhaeabyas,項目名稱:tataaiapro,代碼行數:32,代碼來源:plugin.class.php

示例15: definition_inner

 protected function definition_inner($mform)
 {
     global $PAGE, $CFG;
     $PAGE->requires->js('/question/type/jme/jme_script.js');
     $PAGE->requires->css('/question/type/jme/styles.css');
     $mform->addElement('hidden', 'usecase', 1);
     $mform->setType('usecase', PARAM_INT);
     $optionscript = 'onClick = "setJSMEoptions()"';
     $label = get_string('jmeoptions', 'qtype_jme');
     $editoroptions[] = $mform->createElement('text', 'jmeoptions', '', array('size' => 50));
     $editoroptions[] = $mform->createElement('button', 'setoptions', get_string('setoptions', 'qtype_jme'), $optionscript);
     $mform->addElement('group', 'editoroptions', $label, $editoroptions, null, false);
     $mform->setDefault('jmeoptions', $CFG->qtype_jme_options);
     $mform->setType('jmeoptions', PARAM_RAW);
     $mform->addHelpButton('editoroptions', 'jmeoptions', 'qtype_jme');
     $mform->addElement('text', 'width', get_string('width', 'qtype_jme'), array('size' => 6));
     $mform->setDefault('width', QTYPE_JME_APPLET_WIDTH);
     $mform->setType('width', PARAM_INT);
     $mform->addElement('text', 'height', get_string('height', 'qtype_jme'), array('size' => 6));
     $mform->setDefault('height', QTYPE_JME_APPLET_HEIGHT);
     $mform->setType('height', PARAM_INT);
     $mform->addElement('static', 'answersinstruct', get_string('correctanswers', 'qtype_jme'), get_string('filloutoneanswer', 'qtype_jme'));
     $mform->addElement('html', html_writer::tag('div', get_string('enablejavascript', 'qtype_jme'), array('class' => 'jme_applet', 'code' => 'JME.class', 'id' => 'jme1', 'name' => 'JME1', 'archive' => 'JME.jar', 'width' => '360', 'height' => '315', 'style' => 'margin: 1.5em auto')));
     $mform->closeHeaderBefore('answersinstruct');
     $this->add_per_answer_fields($mform, get_string('answerno', 'qtype_jme', '{no}'), question_bank::fraction_options());
     $this->add_interactive_settings();
     // Include JSME loader script as an html tag.
     $jsmescript = $CFG->wwwroot . '/question/type/jme/jsme/jsme.nocache.js';
     $mform->addElement('html', html_writer::tag('script', '', array('src' => $jsmescript)));
 }
開發者ID:uofr,項目名稱:moodle-qtype_jme,代碼行數:30,代碼來源:edit_jme_form.php


注:本文中的html_writer::tag方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。