当前位置: 首页>>代码示例>>PHP>>正文


PHP moodle_url::out方法代码示例

本文整理汇总了PHP中moodle_url::out方法的典型用法代码示例。如果您正苦于以下问题:PHP moodle_url::out方法的具体用法?PHP moodle_url::out怎么用?PHP moodle_url::out使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在moodle_url的用法示例。


在下文中一共展示了moodle_url::out方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: i_view_the_lightboxgallery_with_idnumber

 /**
  * Allow a gallery to be viewed just by knowing its idnumber.
  * This is a helper function to jump to a gallery without going throught
  * the course page, simulating the case where the user knows the URL but
  * can't go through the course (ispublic flag is set).
  *
  * @Given /^I view the lightboxgallery with idnumber "(?P<lightboxgallery_idnumber>(?:[^"]|\\")*)"$/
  * @param string $idnumber
  */
 public function i_view_the_lightboxgallery_with_idnumber($idnumber)
 {
     global $DB;
     $sql = "SELECT cm.id\n                FROM {course_modules} cm\n                JOIN {modules} m ON m.id = cm.module\n                WHERE m.name = 'lightboxgallery' AND cm.idnumber = ?";
     $cm = $DB->get_record_sql($sql, [$idnumber]);
     $href = new moodle_url('/mod/lightboxgallery/view.php', ['id' => $cm->id]);
     $this->getSession()->visit($href->out());
 }
开发者ID:netspotau,项目名称:moodle-mod_lightboxgallery,代码行数:17,代码来源:behat_mod_lightboxgallery.php

示例2: qcreate_question_action_icons

/**
 * Function that can be used in various parts of the quiz code.
 * @param object $quiz
 * @param integer $cmid
 * @param object $question
 * @param string $returnurl url to return to after action is done.
 * @return string html for a number of icons linked to action pages for a
 * question - preview and edit / view icons depending on user capabilities.
 */
function qcreate_question_action_icons($cmid, $question, $returnurl)
{
    global $CFG, $COURSE;
    static $stredit = null;
    static $strview = null;
    static $strpreview = null;
    static $strdelete = null;
    if ($stredit === null) {
        $stredit = get_string('edit');
        $strview = get_string('view');
        $strpreview = get_string('preview', 'quiz');
        $strdelete = get_string("delete");
    }
    $html = '';
    if ($question->qtype != 'random') {
        if (question_has_capability_on($question, 'use', $question->cid)) {
            $html .= link_to_popup_window('/question/preview.php?id=' . $question->id . '&amp;courseid=' . $COURSE->id, 'questionpreview', "<img src=\"{$CFG->pixpath}/t/preview.gif\" class=\"iconsmall\" alt=\"{$strpreview}\" />", 0, 0, $strpreview, QUESTION_PREVIEW_POPUP_OPTIONS, true);
        }
    }
    $questionparams = array('returnurl' => $returnurl, 'cmid' => $cmid, 'id' => $question->id);
    $questionurl = new moodle_url("{$CFG->wwwroot}/question/question.php", $questionparams);
    if (question_has_capability_on($question, 'edit', $question->cid) || question_has_capability_on($question, 'move', $question->cid)) {
        $html .= "<a title=\"{$stredit}\" href=\"" . $questionurl->out() . "\">" . "<img src=\"{$CFG->pixpath}/t/edit.gif\" class=\"iconsmall\" alt=\"{$stredit}\" />" . "</a>";
    } elseif (question_has_capability_on($question, 'view', $question->cid)) {
        $html .= "<a title=\"{$strview}\" href=\"" . $questionurl->out(false, array('id' => $question->id)) . "\">" . "<img src=\"{$CFG->pixpath}/i/info.gif\" alt=\"{$strview}\" />" . "</a>";
    }
    if (question_has_capability_on($question, 'edit', $question->cid)) {
        $html .= "<a title=\"{$strdelete}\" href=\"" . $returnurl . "&amp;delete={$question->id}\">" . "<img src=\"{$CFG->pixpath}/t/delete.gif\" alt=\"{$strdelete}\" /></a>";
    }
    return $html;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:40,代码来源:locallib.php

示例3: array

 function build_editform($item, $feedback, $cm)
 {
     global $DB;
     $editurl = new moodle_url('/mod/feedback/edit.php', array('id' => $cm->id));
     //ther are no settings for recaptcha
     if (isset($item->id) and $item->id > 0) {
         notice(get_string('there_are_no_settings_for_recaptcha', 'feedback'), $editurl->out());
         exit;
     }
     //only one recaptcha can be in a feedback
     if ($DB->record_exists('feedback_item', array('feedback' => $feedback->id, 'typ' => $this->type))) {
         notice(get_string('only_one_captcha_allowed', 'feedback'), $editurl->out());
         exit;
     }
     $this->item = $item;
     $this->feedback = $feedback;
     $this->item_form = true;
     //dummy
     $lastposition = $DB->count_records('feedback_item', array('feedback' => $feedback->id));
     $this->item->feedback = $feedback->id;
     $this->item->template = 0;
     $this->item->name = get_string('captcha', 'feedback');
     $this->item->label = get_string('captcha', 'feedback');
     $this->item->presentation = '';
     $this->item->typ = $this->type;
     $this->item->hasvalue = $this->get_hasvalue();
     $this->item->position = $lastposition + 1;
     $this->item->required = 1;
     $this->item->dependitem = 0;
     $this->item->dependvalue = '';
     $this->item->options = '';
 }
开发者ID:esyacelga,项目名称:sisadmaca,代码行数:32,代码来源:lib.php

示例4: definition

 public function definition()
 {
     global $USER, $OUTPUT, $CFG;
     $mform = $this->_form;
     $instance = $this->_customdata;
     $this->instance = $instance;
     $plugin = enrol_get_plugin('boleto');
     $heading = $plugin->get_instance_name($instance);
     $mform->addElement('header', 'boletoheader', $heading);
     if ($instance->password) {
         // Change the id of boleto enrolment key input as there can be multiple boleto enrolment methods.
         $mform->addElement('passwordunmask', 'enrolpassword', get_string('password', 'enrol_boleto'), array('id' => 'enrolpassword_' . $instance->id));
         $context = context_course::instance($this->instance->courseid);
         $keyholders = get_users_by_capability($context, 'enrol/boleto:holdkey', user_picture::fields('u'));
         $keyholdercount = 0;
         foreach ($keyholders as $keyholder) {
             $keyholdercount++;
             if ($keyholdercount === 1) {
                 $mform->addElement('static', 'keyholder', '', get_string('keyholder', 'enrol_boleto'));
             }
             $keyholdercontext = context_user::instance($keyholder->id);
             if ($USER->id == $keyholder->id || has_capability('moodle/user:viewdetails', context_system::instance()) || has_coursecontact_role($keyholder->id)) {
                 $profilelink = '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $keyholder->id . '&amp;course=' . $this->instance->courseid . '">' . fullname($keyholder) . '</a>';
             } else {
                 $profilelink = fullname($keyholder);
             }
             $profilepic = $OUTPUT->user_picture($keyholder, array('size' => 35, 'courseid' => $this->instance->courseid));
             $mform->addElement('static', 'keyholder' . $keyholdercount, '', $profilepic . $profilelink);
         }
     }
     $boletourl = new moodle_url('/enrol/boleto/boleto.php', array('instanceid' => $this->instance->id));
     $mform->addElement('static', 'info', '', get_string('boletoprintandpayinfo', 'enrol_boleto'));
     // customint8 == avista.
     if ($this->instance->customint8) {
         $mform->addElement('static', 'info', '', get_string('boletoprintandpayinfodirectlinks', 'enrol_boleto', $boletourl->out(false)));
     } else {
         $mform->addElement('static', 'info', '', get_string('boletoprintandpayinfoparceladolink0', 'enrol_boleto', $boletourl->out(false)));
         $boletourl->param('parcela', 1);
         $mform->addElement('static', 'info', '', get_string('boletoprintandpayinfoparceladolink1', 'enrol_boleto', $boletourl->out(false)));
         $boletourl->param('parcela', 2);
         $mform->addElement('static', 'info', '', get_string('boletoprintandpayinfoparceladolink2', 'enrol_boleto', $boletourl->out(false)));
     }
     $this->add_action_buttons(false, get_string('enrolme', 'enrol_boleto'));
     $mform->addElement('hidden', 'id');
     $mform->setType('id', PARAM_INT);
     $mform->setDefault('id', $instance->courseid);
     $mform->addElement('hidden', 'instance');
     $mform->setType('instance', PARAM_INT);
     $mform->setDefault('instance', $instance->id);
 }
开发者ID:josenorberto,项目名称:moodle-enrol_boleto,代码行数:50,代码来源:locallib.php

示例5: __construct

 /**
  * Constructor.
  * @param Command $command The Command to link to the form.
  * @param int $mode The form mode.
  */
 public function __construct(Command $command, $mode)
 {
     // Checking command.
     if (is_null($command)) {
         throw new Command_Exception('commandformnotlinked');
     }
     // Linking the command and her category.
     $this->command = $command;
     // Setting configuration.
     $this->mode = $mode;
     // Setting form action.
     switch ($mode) {
         case self::MODE_COMMAND_CHOICE:
             $url = new moodle_url('/local/vmoodle/view.php', array('view' => 'sadmin', 'what' => 'validateassistedcommand'));
             break;
         case self::MODE_RETRIEVE_PLATFORM:
             $url = new moodle_url('/local/vmoodle/view.php', array('view' => 'sadmin', 'what' => 'gettargetbyvalue'));
             break;
         case self::MODE_DISPLAY_COMMAND:
             $url = new moodle_url('/local/vmoodle/view.php', array('view' => 'targetchoice'));
             break;
         default:
             throw new Command_Exception('badformmode');
             break;
     }
     // Calling parent's constructor.
     parent::__construct($url->out());
 }
开发者ID:gabrielrosset,项目名称:moodle-local_vmoodle,代码行数:33,代码来源:Command_Form.php

示例6: ajax_get_lib

/**
 * Get the path to a JavaScript library.
 * @param $libname - the name of the library whose path we need.
 * @return string
 */
function ajax_get_lib($libname)
{
    global $CFG, $HTTPSPAGEREQUIRED;
    $libpath = '';
    $translatelist = array('yui_yahoo' => '/lib/yui/yahoo/yahoo-min.js', 'yui_animation' => '/lib/yui/animation/animation-min.js', 'yui_autocomplete' => '/lib/yui/autocomplete/autocomplete-min.js', 'yui_button' => '/lib/yui/button/button-min.js', 'yui_calendar' => '/lib/yui/calendar/calendar-min.js', 'yui_charts' => '/lib/yui/charts/charts-experimental-min.js', 'yui_colorpicker' => '/lib/yui/colorpicker/colorpicker-min.js', 'yui_connection' => '/lib/yui/connection/connection-min.js', 'yui_container' => '/lib/yui/container/container-min.js', 'yui_cookie' => '/lib/yui/cookie/cookie-min.js', 'yui_datasource' => '/lib/yui/datasource/datasource-min.js', 'yui_datatable' => '/lib/yui/datatable/datatable-min.js', 'yui_dom' => '/lib/yui/dom/dom-min.js', 'yui_dom-event' => '/lib/yui/yahoo-dom-event/yahoo-dom-event.js', 'yui_dragdrop' => '/lib/yui/dragdrop/dragdrop-min.js', 'yui_editor' => '/lib/yui/editor/editor-min.js', 'yui_element' => '/lib/yui/element/element-beta-min.js', 'yui_event' => '/lib/yui/event/event-min.js', 'yui_get' => '/lib/yui/get/get-min.js', 'yui_history' => '/lib/yui/history/history-min.js', 'yui_imagecropper' => '/lib/yui/imagecropper/imagecropper-beta-min.js', 'yui_imageloader' => '/lib/yui/imageloader/imageloader-min.js', 'yui_json' => '/lib/yui/json/json-min.js', 'yui_layout' => '/lib/yui/layout/layout-min.js', 'yui_logger' => '/lib/yui/logger/logger-min.js', 'yui_menu' => '/lib/yui/menu/menu-min.js', 'yui_profiler' => '/lib/yui/profiler/profiler-min.js', 'yui_profilerviewer' => '/lib/yui/profilerviewer/profilerviewer-beta-min.js', 'yui_resize' => '/lib/yui/resize/resize-min.js', 'yui_selector' => '/lib/yui/selector/selector-beta-min.js', 'yui_simpleeditor' => '/lib/yui/editor/simpleeditor-min.js', 'yui_slider' => '/lib/yui/slider/slider-min.js', 'yui_tabview' => '/lib/yui/tabview/tabview-min.js', 'yui_treeview' => '/lib/yui/treeview/treeview-min.js', 'yui_uploader' => '/lib/yui/uploader/uploader-experimental-min.js', 'yui_utilities' => '/lib/yui/utilities/utilities.js', 'yui_yuiloader' => '/lib/yui/yuiloader/yuiloader-min.js', 'yui_yuitest' => '/lib/yui/yuitest/yuitest-min.js', 'ajaxcourse_blocks' => '/lib/ajax/block_classes.js', 'ajaxcourse_sections' => '/lib/ajax/section_classes.js', 'ajaxcourse' => '/lib/ajax/ajaxcourse.js');
    if (!empty($HTTPSPAGEREQUIRED)) {
        $wwwroot = $CFG->httpswwwroot;
    } else {
        $wwwroot = $CFG->wwwroot;
    }
    if (array_key_exists($libname, $translatelist)) {
        $libpath = $wwwroot . $translatelist[$libname];
    } else {
        $libpath = $libname;
    }
    // query strings break file_exists so remove it
    $url = new moodle_url($libpath);
    $modifiedlibpath = $url->out(true);
    $testpath = str_replace($wwwroot, $CFG->dirroot, $modifiedlibpath);
    if (stripos($libpath, $CFG->wwwroot) === false && stripos($libpath, $CFG->dirroot) === false) {
        // offsite so just link it
    } elseif (!file_exists($testpath)) {
        error('require_js: ' . $libpath . ' - file not found.');
    }
    return $libpath;
}
开发者ID:NextEinstein,项目名称:riverhills,代码行数:31,代码来源:ajaxlib.php

示例7: mform_autocomplete

 /**
  * Add autocomplete to a form text field
  *
  * @param MoodleQuickForm $mform Moodle form
  * @param array|moodle_url $options Array of autocomplete options, if $hiddenfieldname is
  *                       passed, array indexes are considered record IDs
  * @param string $textfieldname The text field's name
  * @param string $hiddenfieldname The hidden field's name.  If passed,
  *                                the option index will be set to this hidden
  *                                value when its option value is selected in
  *                                the text field
  * @param string $width The pixel width of the text field (Due to YUI, must
  *                      use width instead of size)
  * @return void
  * @link http://developer.yahoo.com/yui/examples/autocomplete/ac_basic_array.html What you get with no $hiddenfieldname
  * @link http://developer.yahoo.com/yui/examples/autocomplete/ac_itemselect.html What you get with $hiddenfieldname
  */
 public function mform_autocomplete($mform, $options, $textfieldname, $hiddenfieldname = '', $width = '300')
 {
     global $PAGE;
     $url = NULL;
     $data = NULL;
     // Generate data source
     if ($options instanceof moodle_url) {
         $url = $options->out(false);
     } else {
         $data = array();
         foreach ($options as $optionid => $option) {
             if (empty($hiddenfieldname)) {
                 $data[] = $option;
             } else {
                 $data[] = (object) array('text' => $option, 'id' => $optionid);
             }
         }
     }
     $fields = array('text');
     if (!empty($hiddenfieldname)) {
         $fields[] = 'id';
     }
     $module = array('name' => 'local_mr_framework', 'fullpath' => '/local/mr/framework/assets/javascript.js', 'requires' => array('yui2-yahoo', 'yui2-dom', 'yui2-event', 'yui2-datasource', 'yui2-json', 'yui2-connection', 'yui2-get', 'yui2-animation', 'yui2-autocomplete'));
     $arguments = array((object) array('fieldname' => $textfieldname, 'hiddenfieldname' => $hiddenfieldname, 'width' => $width, 'url' => $url, 'data' => $data, 'fields' => $fields));
     $PAGE->requires->js_init_call('M.local_mr.init_mr_html_autocomplete', $arguments, true, $module);
     // $PAGE->requires->css('/lib/yui/2.8.1/build/autocomplete/assets/autocomplete-core.css');
     // $PAGE->requires->css('/lib/yui/2.8.1/build/autocomplete/assets/skins/sam/autocomplete.css');
     // Update form - need to force some attributes and add the javascript
     $mform->updateElementAttr($textfieldname, array('autocomplete' => 'off', 'style' => "width: {$width}px;"));
     // Add ID to hidden field so javascript can find it
     if (!empty($hiddenfieldname)) {
         $mform->updateElementAttr($hiddenfieldname, array('id' => "id_{$hiddenfieldname}"));
     }
 }
开发者ID:bgao-ca,项目名称:moodle-local_mr,代码行数:51,代码来源:html.php

示例8: __construct

 /**
  * Constructor of dropbox plugin
  *
  * @param int $repositoryid
  * @param stdClass $context
  * @param array $options
  */
 public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array())
 {
     global $CFG;
     $options['page'] = optional_param('p', 1, PARAM_INT);
     parent::__construct($repositoryid, $context, $options);
     $this->setting = 'dropbox_';
     $this->dropbox_key = $this->get_option('dropbox_key');
     $this->dropbox_secret = $this->get_option('dropbox_secret');
     // one day
     $this->cachedfilettl = 60 * 60 * 24;
     if (isset($options['access_key'])) {
         $this->access_key = $options['access_key'];
     } else {
         $this->access_key = get_user_preferences($this->setting . '_access_key', '');
     }
     if (isset($options['access_secret'])) {
         $this->access_secret = $options['access_secret'];
     } else {
         $this->access_secret = get_user_preferences($this->setting . '_access_secret', '');
     }
     if (!empty($this->access_key) && !empty($this->access_secret)) {
         $this->logged = true;
     }
     $callbackurl = new moodle_url($CFG->wwwroot . '/repository/repository_callback.php', array('callback' => 'yes', 'repo_id' => $repositoryid));
     $args = array('oauth_consumer_key' => $this->dropbox_key, 'oauth_consumer_secret' => $this->dropbox_secret, 'oauth_callback' => $callbackurl->out(false), 'api_root' => 'https://www.dropbox.com/1/oauth');
     $this->dropbox = new dropbox($args);
 }
开发者ID:nmicha,项目名称:moodle,代码行数:34,代码来源:lib.php

示例9: question_setup

 /**
  * Set up the columns and headers and other properties of the table and then
  * call flexible_table::setup() method.
  *
  * @param moodle_url $reporturl the URL to redisplay this report.
  * @param object $question a question with a _stats field
  * @param bool $hassubqs
  */
 public function question_setup($reporturl, $questiondata, offlinequiz_statistics_response_analyser $responsestats)
 {
     $this->questiondata = $questiondata;
     $this->define_baseurl($reporturl->out());
     $this->collapsible(false);
     $this->set_attribute('class', 'generaltable generalbox boxaligncenter');
     // Define the table columns.
     $columns = array();
     $headers = array();
     $columns[] = 'part';
     $headers[] = '';
     $columns[] = 'response';
     $headers[] = get_string('response', 'offlinequiz_statistics');
     $columns[] = 'fraction';
     $headers[] = get_string('optiongrade', 'offlinequiz_statistics');
     $columns[] = 'count';
     $headers[] = get_string('count', 'offlinequiz_statistics');
     $columns[] = 'frequency';
     $headers[] = get_string('frequency', 'offlinequiz_statistics');
     $this->define_columns($columns);
     $this->define_headers($headers);
     $this->sortable(false);
     $this->column_class('fraction', 'numcol');
     $this->column_class('count', 'numcol');
     $this->column_class('frequency', 'numcol');
     $this->column_suppress('part');
     $this->column_suppress('responseclass');
     parent::setup();
 }
开发者ID:frankkoch,项目名称:moodle-mod_offlinequiz,代码行数:37,代码来源:statistics_question_table.php

示例10: display

 function display()
 {
     $search = trim(optional_param('search', '', PARAM_TEXT));
     $alpha = optional_param('alpha', '', PARAM_ALPHA);
     // TODO: with a little more work, we could keep the previously selected sort here
     $params = $_GET;
     unset($params['page']);
     // We want to go back to the first page
     unset($params['search']);
     // And clear the search
     $target = $this->page->get_new_page($params);
     echo "<table class=\"searchbox\" style=\"margin-left:auto;margin-right:auto\" cellpadding=\"10\"><tr><td>";
     echo "<form action=\"" . $target->get_url() . "\" method=\"post\">";
     echo "<fieldset class=\"invisiblefieldset\">";
     echo "<input type=\"text\" name=\"search\" value=\"" . s($search, true) . "\" size=\"20\" />";
     echo '<input type="submit" value="' . get_string('search') . '" />';
     //remove the "bare" parameter to prevent from loading only part of the page
     $moodleurl = new moodle_url($target->get_url());
     $moodleurl->remove_params('mode');
     if ($search) {
         echo "<input type=\"button\" onclick=\"document.location='" . $moodleurl->out() . "';\" " . "value=\"Show all items\" />";
     }
     echo "</fieldset></form>";
     echo "</td></tr></table>";
 }
开发者ID:remotelearner,项目名称:elis.cm,代码行数:25,代码来源:cmsearchbox.class.php

示例11: stdClass

 function get_content()
 {
     global $CFG, $OUTPUT;
     if ($this->content !== NULL) {
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->items = array();
     $this->content->icons = array();
     $this->content->footer = '';
     if (!defined('FEEDBACK_BLOCK_LIB_IS_OK')) {
         $this->content->items = array(get_string('missing_feedback_module', 'block_feedback'));
         return $this->content;
     }
     $courseid = $this->page->course->id;
     if ($courseid <= 0) {
         $courseid = SITEID;
     }
     $icon = '<img src="' . $OUTPUT->pix_url('icon', 'feedback') . '" class="icon" alt="" />';
     if (empty($this->instance->pageid)) {
         $this->instance->pageid = SITEID;
     }
     if ($feedbacks = feedback_get_feedbacks_from_sitecourse_map($courseid)) {
         $baseurl = new moodle_url('/mod/feedback/view.php');
         foreach ($feedbacks as $feedback) {
             $url = new moodle_url($baseurl);
             $url->params(array('id' => $feedback->cmid, 'courseid' => $courseid));
             $this->content->items[] = '<a href="' . $url->out() . '">' . $icon . $feedback->name . '</a>';
         }
     }
     return $this->content;
 }
开发者ID:bobpuffer,项目名称:moodleUCLA-LUTH,代码行数:32,代码来源:block_feedback.php

示例12: badge

 /**
  * Render the badge element (message count)
  *
  * @param null $userid
  * @return string
  */
 public function badge($userid = null)
 {
     global $USER, $DB, $COURSE, $PAGE;
     // Only for logged in folks and when we are enabled.
     if (!isset($USER->message_badge_disabled)) {
         if (mr_off('badge', 'message') or !isloggedin() or isguestuser()) {
             $USER->message_badge_disabled = true;
         } else {
             $USER->message_badge_disabled = $DB->record_exists('message_processors', array('name' => 'badge', 'enabled' => 0));
         }
     }
     if ($USER->message_badge_disabled) {
         return '';
     }
     if ($this->is_mobile()) {
         return $this->mobile($userid);
     }
     $repo = new message_output_badge_repository_message();
     $forwardurl = new moodle_url('/message/output/badge/view.php', array('action' => 'forward', 'courseid' => $COURSE->id));
     $total = $repo->count_user_unread_messages($userid);
     $PAGE->requires->js_init_call('M.snap_message_badge.init_badge', array($forwardurl->out(false), $COURSE->id), false, $this->get_js_module());
     if (!empty($total)) {
         $countdiv = html_writer::tag('span', $total, array('id' => html_writer::random_id(), 'class' => 'message_badge_count'));
     } else {
         $countdiv = '';
     }
     return $countdiv;
 }
开发者ID:nadavkav,项目名称:moodle-theme_snap,代码行数:34,代码来源:message_badge_renderer.php

示例13: array

 /**
  * form_start
  *
  * @param xxx $hotpotscriptname
  * @param xxx $params
  * @param xxx $attributes (optional, default=array)
  * @return xxx
  */
 function form_start($hotpotscriptname, $params, $attributes = array())
 {
     $output = '';
     if (empty($attributes['method'])) {
         $attributes['method'] = 'post';
     }
     if (empty($attributes['action'])) {
         $url = new moodle_url('/mod/hotpot/' . $hotpotscriptname);
         $attributes['action'] = $url->out();
     }
     $output .= html_writer::start_tag('form', $attributes) . "\n";
     $hiddenfields = '';
     foreach ($params as $name => $value) {
         $hiddenfields .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => $name, 'value' => $value)) . "\n";
     }
     if ($hiddenfields) {
         // xhtml strict requires a container for the hidden input elements
         $output .= html_writer::start_tag('fieldset', array('style' => 'display:none')) . "\n";
         $output .= $hiddenfields;
         $output .= html_writer::end_tag('fieldset') . "\n";
     }
     // xhtml strict requires a container for the contents of the <form>
     $output .= html_writer::start_tag('div') . "\n";
     return $output;
 }
开发者ID:hapaxapah,项目名称:moodle-mod_hotpot,代码行数:33,代码来源:renderer.php

示例14: htmllize_tree

    /**
     * Internal function - creates htmls structure suitable for YUI tree.
     */
    protected function htmllize_tree($tree, $dir) {
        global $CFG;

        if (empty($dir['subdirs']) and empty($dir['files'])) {
            return '';
        }
        $browser = get_file_browser();
        $result = '<ul>';
        foreach ($dir['subdirs'] as $subdir) {
            $image = $this->output->pix_icon(file_folder_icon(24), $subdir['dirname'], 'moodle');
            $filename = html_writer::tag('span', $image, array('class' => 'fp-icon')). html_writer::tag('span', s($subdir['dirname']), array('class' => 'fp-filename'));
            $filename = html_writer::tag('div', $filename, array('class' => 'fp-filename-icon'));
            $result .= html_writer::tag('li', $filename. $this->htmllize_tree($tree, $subdir));
        }
        foreach ($dir['files'] as $file) {
            $fileinfo = $browser->get_file_info($tree->context, $file->get_component(),
                    $file->get_filearea(), $file->get_itemid(), $file->get_filepath(), $file->get_filename());
            $url = $fileinfo->get_url(true);
            $filename = $file->get_filename();
            if ($imageinfo = $fileinfo->get_imageinfo()) {
                $fileurl = new moodle_url($fileinfo->get_url());
                $image = $fileurl->out(false, array('preview' => 'tinyicon', 'oid' => $fileinfo->get_timemodified()));
                $image = html_writer::empty_tag('img', array('src' => $image));
            } else {
                $image = $this->output->pix_icon(file_file_icon($file, 24), $filename, 'moodle');
            }
            $filename = html_writer::tag('span', $image, array('class' => 'fp-icon')). html_writer::tag('span', $filename, array('class' => 'fp-filename'));
            $filename = html_writer::tag('span', html_writer::link($url, $filename), array('class' => 'fp-filename-icon'));
            $result .= html_writer::tag('li', $filename);
        }
        $result .= '</ul>';

        return $result;
    }
开发者ID:nigeli,项目名称:moodle,代码行数:37,代码来源:renderer.php

示例15: list_boletos

 public function list_boletos($boletos, $course)
 {
     $boletourl = new moodle_url('/enrol/boleto/boleto.php');
     $content = html_writer::tag('h2', get_string('viewboleto', 'enrol_boleto'));
     $content .= html_writer::tag('p', get_string('viewandprintinfo', 'enrol_boleto'));
     if (count($boletos) > 1) {
         foreach ($boletos as $boleto) {
             $boletourl->param('id', $boleto->id);
             $content .= html_writer::tag('p', get_string('boletoprintandpayinfoparceladolink' . $boleto->parcela, 'enrol_boleto', $boletourl->out(false)));
         }
     } else {
         $boleto = array_pop($boletos);
         $boletourl->param('id', $boleto->id);
         $content .= html_writer::tag('p', get_string('boletoprintandpayinfodirectlink', 'enrol_boleto', $boletourl->out(false)));
     }
     return $content;
 }
开发者ID:josenorberto,项目名称:moodle-enrol_boleto,代码行数:17,代码来源:renderer.php


注:本文中的moodle_url::out方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。