• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP optional_param函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中optional_param函数的典型用法代码示例。如果您正苦于以下问题:PHP optional_param函数的具体用法?PHP optional_param怎么用?PHP optional_param使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: __construct

 /**
  * Constructor
  *
  * @param int $tagcollid
  */
 public function __construct($tagcollid)
 {
     global $USER, $CFG, $PAGE;
     parent::__construct('tag-management-list-' . $USER->id);
     $this->tagcollid = $tagcollid;
     $perpage = optional_param('perpage', DEFAULT_PAGE_SIZE, PARAM_INT);
     $page = optional_param('page', 0, PARAM_INT);
     $baseurl = new moodle_url('/tag/manage.php', array('tc' => $tagcollid, 'perpage' => $perpage, 'page' => $page));
     $tablecolumns = array('select', 'name', 'fullname', 'count', 'flag', 'timemodified', 'tagtype', 'controls');
     $tableheaders = array(get_string('select', 'tag'), get_string('name', 'tag'), get_string('owner', 'tag'), get_string('count', 'tag'), get_string('flag', 'tag'), get_string('timemodified', 'tag'), get_string('officialtag', 'tag'), '');
     $this->define_columns($tablecolumns);
     $this->define_headers($tableheaders);
     $this->define_baseurl($baseurl);
     $this->column_class('select', 'mdl-align col-select');
     $this->column_class('name', 'col-name');
     $this->column_class('owner', 'col-owner');
     $this->column_class('count', 'mdl-align col-count');
     $this->column_class('flag', 'mdl-align col-flag');
     $this->column_class('timemodified', 'col-timemodified');
     $this->column_class('tagtype', 'mdl-align col-tagtype');
     $this->column_class('controls', 'mdl-align col-controls');
     $this->sortable(true, 'flag', SORT_DESC);
     $this->no_sorting('select');
     $this->no_sorting('controls');
     $this->set_attribute('cellspacing', '0');
     $this->set_attribute('id', 'tag-management-list');
     $this->set_attribute('class', 'admintable generaltable tag-management-table');
     $totalcount = "SELECT COUNT(id)\n            FROM {tag}\n            WHERE tagcollid = :tagcollid";
     $params = array('tagcollid' => $this->tagcollid);
     $this->set_count_sql($totalcount, $params);
     $this->set_sql('', '', '', $params);
     $this->collapsible(true);
     $PAGE->requires->js_call_amd('core/tag', 'init_manage_page', array());
 }
开发者ID:bewanyk,项目名称:moodle,代码行数:39,代码来源:manage_table.php


示例2: display

 function display()
 {
     global $CFG;
     $formatoptions = new object();
     $formatoptions->noclean = true;
     /// Are we displaying the course blocks?
     if ($this->resource->options == 'showblocks') {
         parent::display_course_blocks_start();
         if (trim(strip_tags($this->resource->alltext))) {
             echo format_text($this->resource->alltext, FORMAT_MOODLE, $formatoptions, $this->course->id);
         }
         parent::display_course_blocks_end();
     } else {
         /// Set up generic stuff first, including checking for access
         parent::display();
         /// Set up some shorthand variables
         $cm = $this->cm;
         $course = $this->course;
         $resource = $this->resource;
         $pagetitle = strip_tags($course->shortname . ': ' . format_string($resource->name));
         $inpopup = optional_param('inpopup', '', PARAM_BOOL);
         if ($resource->popup) {
             if ($inpopup) {
                 /// Popup only
                 add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id);
                 print_header();
                 print_simple_box(format_text($resource->alltext, $resource->reference, $formatoptions, $course->id), "center", "", "", "20");
                 print_footer($course);
             } else {
                 /// Make a page and a pop-up window
                 $navigation = build_navigation($this->navlinks, $cm);
                 print_header($pagetitle, $course->fullname, $navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm));
                 echo "\n<script type=\"text/javascript\">";
                 echo "\n//<![CDATA[\n";
                 echo "openpopup('/mod/resource/view.php?inpopup=true&id={$cm->id}','resource{$resource->id}','{$resource->popup}');\n";
                 echo "\n//]]>\n";
                 echo '</script>';
                 if (trim(strip_tags($resource->summary))) {
                     print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $course->id), "center");
                 }
                 $link = "<a href=\"{$CFG->wwwroot}/mod/resource/view.php?inpopup=true&amp;id={$cm->id}\" onclick=\"this.target='resource{$resource->id}'; return openpopup('/mod/resource/view.php?inpopup=true&amp;id={$cm->id}', 'resource{$resource->id}','{$resource->popup}');\">" . format_string($resource->name, true) . "</a>";
                 echo '<div class="popupnotice">';
                 print_string('popupresource', 'resource');
                 echo '<br />';
                 print_string('popupresourcelink', 'resource', $link);
                 echo '</div>';
                 print_footer($course);
             }
         } else {
             /// not a popup at all
             add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id);
             $navigation = build_navigation($this->navlinks, $cm);
             print_header($pagetitle, $course->fullname, $navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm));
             print_simple_box(format_text($resource->alltext, $resource->reference, $formatoptions, $course->id), "center", "", "", "20");
             $strlastmodified = get_string("lastmodified");
             echo "<div class=\"modified\">{$strlastmodified}: " . userdate($resource->timemodified) . "</div>";
             print_footer($course);
         }
     }
 }
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:60,代码来源:resource.class.php


示例3: print_filter

 function print_filter(&$mform)
 {
     $filter_searchtext = optional_param('filter_searchtext', '', PARAM_RAW);
     $mform->addElement('text', 'filter_searchtext', get_string('filter'));
     $mform->setType('filter_searchtext', PARAM_RAW);
     $mform->setDefault('filter_searchtext', $filter_searchtext);
 }
开发者ID:parksandwildlife,项目名称:learning,代码行数:7,代码来源:plugin.class.php


示例4: get_content

 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;
 }
开发者ID:e-rasvet,项目名称:groupreg,代码行数:34,代码来源:block_groupreg.php


示例5: pages_pagesetup

function pages_pagesetup()
{
    // backward compatibilty
    global $CFG, $PAGE;
    // menu keyword
    $CFG->templates->variables_substitute['pagesmenu'][] = 'pages_tplkw_menu';
    $CFG->templates->variables_substitute['page'][] = 'pages_tplkw_page';
    $CFG->templates->variables_substitute['sysadminemail'][] = 'pages_tplkw_sysadminemail';
    if (defined('context') && context == 'pages' || defined('pages_external')) {
        if (pages_enabled() && permissions_check('pages::edit', page_owner())) {
            $page_name = optional_param('page');
            $do_action = optional_param('do');
            if ($do_action != 'edit') {
                // new page link
                pages_submenu_add('pages:edit', __gettext('New page'), pages_url('New_page', 'pages::edit', page_owner()), 0);
                // edit this page link
                pages_submenu_add('pages:edit', __gettext('Edit this page'), pages_url($page_name, 'pages::edit', page_owner()), 1);
            }
        }
    }
    if (!PAGES_DISABLE_USERS && isloggedin()) {
        pages_menu_add('pages', __gettext('Your Content'), get_url($_SESSION['userid'], 'pages::'));
    }
    if (pages_enabled()) {
        // not show main site pages on sidebar
        sidebar_add(25, 'pages_sidebar', null, true, __gettext('Your Content'));
    }
}
开发者ID:BackupTheBerlios,项目名称:tulipan-svn,代码行数:28,代码来源:lib.php


示例6: execute_users

 private function execute_users($finalelements, $data)
 {
     global $remotedb, $CFG;
     $filter_fuserfield = optional_param('filter_fuserfield_' . $data->field, 0, PARAM_RAW);
     if ($filter_fuserfield) {
         // addslashes is done in clean param
         $filter = clean_param(base64_decode($filter_fuserfield), PARAM_CLEAN);
         if (strpos($data->field, 'profile_') === 0) {
             if ($fieldid = $remotedb->get_field('user_info_field', 'id', array('shortname' => str_replace('profile_', '', $data->field)))) {
                 list($usql, $params) = $remotedb->get_in_or_equal($finalelements);
                 $sql = "fieldid = ? AND data LIKE ? AND userid {$usql}";
                 $params = array_merge(array($fieldid, "%{$filter}%"), $params);
                 if ($infodata = $remotedb->get_records_select('user_info_data', $sql, $params)) {
                     $finalusersid = array();
                     foreach ($infodata as $d) {
                         $finalusersid[] = $d->userid;
                     }
                     return $finalusersid;
                 }
             }
         } else {
             list($usql, $params) = $remotedb->get_in_or_equal($finalelements);
             $sql = "{$data->field} LIKE ? AND id {$usql}";
             $params = array_merge(array("%{$filter}%"), $params);
             if ($elements = $remotedb->get_records_select('user', $sql, $params)) {
                 $finalelements = array_keys($elements);
             }
         }
     }
     return $finalelements;
 }
开发者ID:parksandwildlife,项目名称:learning,代码行数:31,代码来源:plugin.class.php


示例7: definition

 /**
  * Definition method.
  */
 public function definition()
 {
     global $COURSE;
     $mform = $this->_form;
     if (isset($this->_customdata)) {
         // Hardcoding plugin names here is hacky.
         $features = $this->_customdata;
     } else {
         $features = array();
     }
     // Course id needs to be passed for auth purposes.
     $mform->addElement('hidden', 'id', optional_param('id', 0, PARAM_INT));
     $mform->setType('id', PARAM_INT);
     $mform->addElement('header', 'general', get_string('pluginname', 'gradeimport_direct'));
     // Data upload from copy/paste.
     $mform->addElement('textarea', 'userdata', 'Data', array('rows' => 10, 'class' => 'gradeimport_data_area'));
     $mform->addRule('userdata', null, 'required');
     $mform->setType('userdata', PARAM_RAW);
     $encodings = core_text::get_encodings();
     $mform->addElement('select', 'encoding', get_string('encoding', 'grades'), $encodings);
     if (!empty($features['verbosescales'])) {
         $options = array(1 => get_string('yes'), 0 => get_string('no'));
         $mform->addElement('select', 'verbosescales', get_string('verbosescales', 'grades'), $options);
     }
     $options = array('10' => 10, '20' => 20, '100' => 100, '1000' => 1000, '100000' => 100000);
     $mform->addElement('select', 'previewrows', get_string('rowpreviewnum', 'grades'), $options);
     $mform->setType('previewrows', PARAM_INT);
     $mform->addElement('hidden', 'groupid', groups_get_course_group($COURSE));
     $mform->setType('groupid', PARAM_INT);
     $this->add_action_buttons(false, get_string('uploadgrades', 'grades'));
 }
开发者ID:jtibbetts,项目名称:moodle,代码行数:34,代码来源:import_form.php


示例8: verify

 public static function verify($course, $id)
 {
     global $DB, $OUTPUT;
     $entry = self::get_one($id);
     $value = optional_param('key', null, PARAM_TEXT);
     $userid = optional_param('activator', null, PARAM_INT);
     $params = array('instance' => $course->id, 'value' => $value, 'userid' => $userid, 'script' => 'blocks/quickmail');
     $back_url = self::base_url($course->id);
     // Pass through already valid entries
     if ($entry->valid) {
         redirect($back_url);
     }
     // Verify key
     if (empty($value) or !($key = $DB->get_record('user_private_key', $params))) {
         $reactivate = self::base_url($course->id, array('id' => $id, 'action' => self::INFORMATION));
         $html = $OUTPUT->notification(quickmail::_s('entry_key_not_valid', $entry));
         $html .= $OUTPUT->continue_button($reactivate);
         return $html;
     }
     // One at a time...They can resend the link if they want
     delete_user_key('blocks/quickmail', $userid);
     $entry->valid = 1;
     $DB->update_record('block_quickmail_alternate', $entry);
     $entry->course = $course->fullname;
     $html = $OUTPUT->notification(quickmail::_s('entry_activated', $entry), 'notifysuccess');
     $html .= $OUTPUT->continue_button($back_url);
     return $html;
 }
开发者ID:krishreddy,项目名称:quickmail,代码行数:28,代码来源:alt_lib.php


示例9: no_submit_button_pressed

 /**
  * Checks if button pressed is not for submitting the form
  *
  *   This overrides moodleform, and is a hack to fix the issue where recurring element buttons
  *     will be stored as an array, rather than a single item, in the url which causes a warning and causes our tests to fail
  *
  *   Most of the code was copied from moodleform, with the addition of the in_array check 
  *
  *
  * @staticvar bool $nosubmit keeps track of no submit button
  * @return bool
  */
 function no_submit_button_pressed()
 {
     static $nosubmit = null;
     // one check is enough
     if (!is_null($nosubmit)) {
         return $nosubmit;
     }
     $mform =& $this->_form;
     $nosubmit = false;
     if (!$this->is_submitted()) {
         return false;
     }
     foreach ($mform->_noSubmitButtons as $nosubmitbutton) {
         // Need to handle this specially, since will be an array
         if (in_array($nosubmitbutton, $this->_recurring_nosubmit_buttons)) {
             if (optional_param_array($nosubmitbutton, 0, PARAM_RAW)) {
                 $nosubmit = true;
                 break;
             }
         } else {
             if (optional_param($nosubmitbutton, 0, PARAM_RAW)) {
                 $nosubmit = true;
                 break;
             }
         }
     }
     return $nosubmit;
 }
开发者ID:MoodleMetaData,项目名称:MoodleMetaData,代码行数:40,代码来源:metadata_form.php


示例10: ent_installer_route_teacher_category

/**
 * Route teachers to their category if none is specified
 * Files fixed : 
 * course/index.php
 * 
 * @return bool Request has been marked for rerouting
 */
function ent_installer_route_teacher_category()
{
    global $CFG, $DB, $USER;
    // Exit if a category is already requested
    $categoryid = optional_param('categoryid', 0, PARAM_INT);
    if ($categoryid) {
        return false;
    }
    require_once $CFG->dirroot . '/user/profile/lib.php';
    $myuser = $DB->get_record('user', array('id' => $USER->id));
    profile_load_data($myuser);
    // Exit if current user is not a teacher
    if (!isset($myuser->profile_field_enseignant) || !$myuser->profile_field_enseignant) {
        return false;
    }
    $institutionid = get_config('local_ent_installer', 'institution_id');
    $teachercatidnum = $institutionid . '$' . $myuser->idnumber . '$CAT';
    $existingcategory = $DB->get_record('course_categories', array('idnumber' => $teachercatidnum));
    // Exit if category cannot be found
    if (!$existingcategory) {
        return false;
    }
    //Let Moodle core course index trust that this category is requested
    $_GET['categoryid'] = $existingcategory->id;
    return true;
}
开发者ID:OctaveBabel,项目名称:moodle-itop,代码行数:33,代码来源:function.php


示例11: process_form

 function process_form()
 {
     if (optional_param('index', '', PARAM_TEXT)) {
         return lightboxgallery_index_thumbnail($this->gallery->course, $this->gallery, $this->image);
     } else {
         if (optional_param('reset', '', PARAM_TEXT)) {
             $offsetx = 0;
             $offsety = 0;
         } else {
             $move = required_param('move', PARAM_INT);
             $offset = optional_param('offset', 20, PARAM_INT);
             switch ($move) {
                 case 1:
                     $offsetx = 0;
                     $offsety = -$offset;
                     break;
                 case 2:
                     $offsetx = 0;
                     $offsety = $offset;
                     break;
                 case 3:
                     $offsetx = -$offset;
                     $offsety = 0;
                     break;
                 case 4:
                     $offsetx = $offset;
                     $offsety = 0;
                     break;
             }
         }
     }
     $this->imageobj->create_thumbnail($offsetx, $offsety);
 }
开发者ID:itziko,项目名称:Moodle-jQuery-Lightbox-Gallery,代码行数:33,代码来源:thumbnail.class.php


示例12: execute

 function execute($finalelements, $data)
 {
     if ($this->report->type != 'sql') {
         return $finalelements;
     }
     $filter_starttime = optional_param('filter_starttime', 0, PARAM_RAW);
     $filter_endtime = optional_param('filter_endtime', 0, PARAM_RAW);
     if (!$filter_starttime || !$filter_endtime) {
         return $finalelements;
     }
     $filter_starttime = make_timestamp($filter_starttime['year'], $filter_starttime['month'], $filter_starttime['day']);
     $filter_endtime = make_timestamp($filter_endtime['year'], $filter_endtime['month'], $filter_endtime['day']);
     $operators = array('<', '>', '<=', '>=');
     if (preg_match("/%%FILTER_STARTTIME:([^%]+)%%/i", $finalelements, $output)) {
         list($field, $operator) = split(':', $output[1]);
         if (!in_array($operator, $operators)) {
             print_error('nosuchoperator');
         }
         $replace = ' AND ' . $field . ' ' . $operator . ' ' . $filter_starttime;
         $finalelements = str_replace('%%FILTER_STARTTIME:' . $output[1] . '%%', $replace, $finalelements);
     }
     if (preg_match("/%%FILTER_ENDTIME:([^%]+)%%/i", $finalelements, $output)) {
         list($field, $operator) = split(':', $output[1]);
         if (!in_array($operator, $operators)) {
             print_error('nosuchoperator');
         }
         $replace = ' AND ' . $field . ' ' . $operator . ' ' . $filter_endtime;
         $finalelements = str_replace('%%FILTER_ENDTIME:' . $output[1] . '%%', $replace, $finalelements);
     }
     $finalelements = str_replace('%STARTTIME%%', $filter_starttime, $finalelements);
     $finalelements = str_replace('%ENDTIME%%', $filter_endtime, $finalelements);
     return $finalelements;
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:33,代码来源:plugin.class.php


示例13: display

 public function display($quiz, $cm, $course)
 {
     global $CFG, $DB, $OUTPUT;
     // Initialise the required data.
     $this->mode = 'stack';
     $this->context = context_module::instance($cm->id);
     list($currentgroup, $students, $groupstudents, $allowed) = $this->load_relevant_students($cm, $course);
     $this->qubaids = quiz_statistics_qubaids_condition($quiz->id, $currentgroup, $groupstudents, true);
     $questionsused = $this->get_stack_questions_used_in_attempt($this->qubaids);
     $questionid = optional_param('questionid', 0, PARAM_INT);
     // Display the appropriate page.
     $this->print_header_and_tabs($cm, $course, $quiz);
     if (!$questionsused) {
         $this->display_no_stack_questions();
     } else {
         if (!$questionid) {
             $this->display_index($questionsused);
         } else {
             if (array_key_exists($questionid, $questionsused)) {
                 $this->display_analysis($questionsused[$questionid]);
             } else {
                 $this->display_unknown_question();
             }
         }
     }
 }
开发者ID:sanyaade-teachings,项目名称:quiz_stack,代码行数:26,代码来源:report.php


示例14: 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


示例15: print_filter

 function print_filter(&$mform)
 {
     global $DB, $CFG;
     $filter_categories = optional_param('filter_categories', 0, PARAM_INT);
     $reportclassname = 'report_' . $this->report->type;
     $reportclass = new $reportclassname($this->report);
     if ($this->report->type != 'sql') {
         $components = cr_unserialize($this->report->components);
         $conditions = $components['conditions'];
         $categorieslist = $reportclass->elements_by_conditions($conditions);
     } else {
         $categorieslist = array_keys($DB->get_records('course'));
     }
     $courseoptions = array();
     $courseoptions[0] = get_string('choose');
     if (!empty($categorieslist)) {
         list($usql, $params) = $DB->get_in_or_equal($categorieslist);
         $categories = $DB->get_records_select('course_categories', "id {$usql}", $params);
         foreach ($categories as $c) {
             $courseoptions[$c->id] = format_string($c->name);
         }
     }
     $mform->addElement('select', 'filter_categories', get_string('category'), $courseoptions);
     $mform->setType('filter_categories', PARAM_INT);
 }
开发者ID:nickkoeppen,项目名称:moodle-report_configreports,代码行数:25,代码来源:plugin.class.php


示例16: print_filter

    function print_filter(&$mform) {
        global $remoteDB, $CFG;

        $filter_yearnumeric = optional_param('filter_yearnumeric', 0, PARAM_INT);

        $reportclassname = 'report_' . $this->report->type;
        $reportclass = new $reportclassname($this->report);
        //$yearnumeric = array('2010'=>'2010','2011'=>'2011','2012'=>'2012','2013'=>'2013','2014'=>'2014','2015'=>'2015');
        foreach (explode(',', get_string('filteryearnumeric_list', 'block_cobalt_reports')) as $value) {
            $yearnumeric[$value] = $value;
        }

        if ($this->report->type != 'sql') {
            $components = cr_unserialize($this->report->components);
            $conditions = $components['conditions'];

            $yearnumericlist = $reportclass->elements_by_conditions($conditions);
        } else {
            $yearnumericlist = array_keys($yearnumeric);
        }

        $yearnumericoptions = array();
        $yearnumericoptions[0] = get_string('filter_all', 'block_cobalt_reports');

        if (!empty($yearnumericlist)) {
            // todo: check that keys of yearnumeric array items are available
            foreach ($yearnumeric as $key => $year) {
                $yearnumericoptions[$key] = $year;
            }
        }

        $mform->addElement('select', 'filter_yearnumeric', get_string('filteryearnumeric', 'block_cobalt_reports'), $yearnumericoptions);
        $mform->setType('filter_yearnumeric', PARAM_INT);
    }
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:34,代码来源:plugin.class.php


示例17: __construct

 public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array())
 {
     parent::__construct($repositoryid, $context, $options);
     $this->keyword = optional_param('merlot_keyword', '', PARAM_RAW);
     $this->author = optional_param('merlot_author', '', PARAM_RAW);
     $this->licensekey = trim(get_config('merlot', 'licensekey'));
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:7,代码来源:lib.php


示例18: print_filter

 function print_filter(&$mform)
 {
     global $CFG;
     $filter_categories = optional_param('filter_categories', 0, PARAM_INT);
     $reportclassname = 'report_' . $this->report->type;
     $reportclass = new $reportclassname($this->report);
     if ($this->report->type != 'sql') {
         $components = cr_unserialize($this->report->components);
         $conditions = $components['conditions'];
         $categorieslist = $reportclass->elements_by_conditions($conditions);
     } else {
         $categorieslist = array_keys(get_records('course'));
     }
     $courseoptions = array();
     $courseoptions[0] = get_string('choose');
     if (!empty($categorieslist)) {
         $categories = get_records_select('course_categories', 'id in (' . implode(',', $categorieslist) . ')');
         foreach ($categories as $c) {
             $courseoptions[$c->id] = format_string($c->name);
         }
     }
     $select =& $mform->addElement('select', 'filter_categories', get_string('category'), $courseoptions);
     $select->setMultiple(true);
     $mform->setType('filter_categories', PARAM_INT);
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:25,代码来源:plugin.class.php


示例19: add_table_header

 function add_table_header()
 {
     $sort = optional_param('sort', null, PARAM_ALPHA);
     $dir = optional_param('dir', 'ASC', PARAM_ALPHA);
     $id = optional_param('id', null, PARAM_INT);
     global $CFG;
     if ($sort === null) {
         $sort = $this->get_default_sort_column();
     }
     // Set HTML for table columns (URL, column name, sort icon)
     foreach ($this->columns as $column => $cdesc) {
         if ($this->is_sortable($column)) {
             if ($sort != $column) {
                 $columnicon = "";
                 $columndir = "ASC";
             } else {
                 $columndir = $dir == "ASC" ? "DESC" : "ASC";
                 $columnicon = $dir == "ASC" ? "down" : "up";
                 $columnicon = " <img src=\"{$CFG->pixpath}/t/{$columnicon}.gif\" alt=\"\" />";
             }
             // Only include the id parameter if we received one
             $params = array('sort' => $column, 'dir' => $columndir);
             if ($id != null) {
                 $params['id'] = $id;
             }
             $this->table->head[] = '<a href="' . $this->pageurl->out(false, $params) . '">' . $cdesc . '</a>' . $columnicon;
         } else {
             $this->table->head[] = $cdesc;
         }
         $this->table->align[] = $this->get_column_align($column);
         $this->table->wrap[] = !$this->is_column_wrapped($column);
     }
 }
开发者ID:remotelearner,项目名称:elis.cm,代码行数:33,代码来源:table.class.php


示例20: __construct

 public function __construct()
 {
     $this->onlyused = optional_param('onlyused', 0, PARAM_INT);
     if ($this->onlyused != self::ONLYANY) {
         $this->init();
     }
 }
开发者ID:actXc,项目名称:moodle_local_unusedquestions,代码行数:7,代码来源:lib.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP optional_param_array函数代码示例发布时间:2022-05-15
下一篇:
PHP optional函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap