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


PHP single_select::set_label方法代码示例

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


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

示例1: __construct

 /**
  * Constructor
  *
  * @param string|moodle_url $pageurl
  */
 public function __construct($pageurl)
 {
     global $OUTPUT;
     parent::__construct();
     $this->attributes['class'] = 'generaltable tag-areas-table';
     $this->head = array(get_string('tagareaname', 'core_tag'), get_string('component', 'tag'), get_string('tagareaenabled', 'core_tag'), get_string('tagcollection', 'tag'));
     $this->data = array();
     $this->rowclasses = array();
     $tagareas = core_tag_area::get_areas();
     $tagcollections = core_tag_collection::get_collections_menu(true);
     $tagcollectionsall = core_tag_collection::get_collections_menu();
     foreach ($tagareas as $itemtype => $it) {
         foreach ($it as $component => $record) {
             $areaname = core_tag_area::display_name($record->component, $record->itemtype);
             $baseurl = new moodle_url($pageurl, array('ta' => $record->id, 'sesskey' => sesskey()));
             if ($record->enabled) {
                 $enableurl = new moodle_url($baseurl, array('action' => 'areadisable'));
                 $enabled = html_writer::link($enableurl, $OUTPUT->pix_icon('i/hide', get_string('disable')));
             } else {
                 $enableurl = new moodle_url($baseurl, array('action' => 'areaenable'));
                 $enabled = html_writer::link($enableurl, $OUTPUT->pix_icon('i/show', get_string('enable')));
             }
             if ($record->enabled && empty($record->locked) && count($tagcollections) > 1) {
                 $changecollurl = new moodle_url($baseurl, array('action' => 'areasetcoll'));
                 $select = new single_select($changecollurl, 'areacollid', $tagcollections, $record->tagcollid, null);
                 $select->set_label(get_string('changetagcoll', 'core_tag', $areaname), array('class' => 'accesshide'));
                 $collectionselect = $OUTPUT->render($select);
             } else {
                 $collectionselect = $tagcollectionsall[$record->tagcollid];
             }
             $this->data[] = array($areaname, $record->component === 'core' || preg_match('/^core_/', $record->component) ? get_string('coresystem') : get_string('pluginname', $record->component), $enabled, $collectionselect);
             $this->rowclasses[] = $record->enabled ? '' : 'dimmed_text';
         }
     }
 }
开发者ID:bewanyk,项目名称:moodle,代码行数:40,代码来源:areas_table.php

示例2: html

 /**
  * Return the HTML for the page.
  *
  * @return string
  */
 public function html()
 {
     global $OUTPUT;
     $html = '';
     $types = gradereport_singleview::valid_screens();
     foreach ($types as $type) {
         $classname = "gradereport_singleview\\local\\screen\\{$type}";
         $screen = new $classname($this->courseid, null, $this->groupid);
         if (!$screen instanceof selectable_items) {
             continue;
         }
         $options = $screen->options();
         if (empty($options)) {
             continue;
         }
         $params = array('id' => $this->courseid, 'item' => $screen->item_type(), 'group' => $this->groupid);
         $url = new moodle_url('/grade/report/singleview/index.php', $params);
         $select = new \single_select($url, 'itemid', $options);
         $select->set_label($screen->description());
         $html .= $OUTPUT->render($select);
     }
     if (empty($html)) {
         $OUTPUT->notification(get_string('noscreens', 'gradereport_singleview'));
     }
     return $html;
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:31,代码来源:select.php

示例3: reader_selector

 /**
  * Prints/return reader selector
  *
  * @param report_log_renderable $reportlog log report.
  */
 public function reader_selector(report_log_renderable $reportlog)
 {
     $readers = $reportlog->get_readers(true);
     if (empty($readers)) {
         $readers = array(get_string('nologreaderenabled', 'report_log'));
     }
     $select = new single_select($reportlog->url, 'logreader', $readers, $reportlog->selectedlogreader, null);
     $select->set_label(get_string('selectlogreader', 'report_log'));
     echo $this->output->render($select);
 }
开发者ID:abhilash1994,项目名称:moodle,代码行数:15,代码来源:renderer.php

示例4: management_method_selector

 /**
  * Renders the active method selector at the grading method management screen
  *
  * @param grading_manager $gradingman
  * @param moodle_url $targeturl
  * @return string
  */
 public function management_method_selector(grading_manager $manager, moodle_url $targeturl)
 {
     $method = $manager->get_active_method();
     $methods = $manager->get_available_methods(false);
     $methods['none'] = get_string('gradingmethodnone', 'core_grading');
     $selector = new single_select(new moodle_url($targeturl, array('sesskey' => sesskey())), 'setmethod', $methods, empty($method) ? 'none' : $method, null, 'activemethodselector');
     $selector->set_label(get_string('changeactivemethod', 'core_grading'));
     $selector->set_help_icon('gradingmethod', 'core_grading');
     return $this->output->render($selector);
 }
开发者ID:JP-Git,项目名称:moodle,代码行数:17,代码来源:renderer.php

示例5: reader_selector

 /**
  * Prints/return reader selector
  *
  * @param report_loglive_renderable $reportloglive log report.
  *
  * @return string Returns rendered widget
  */
 public function reader_selector(report_loglive_renderable $reportloglive) {
     $readers = $reportloglive->get_readers(true);
     if (count($readers) <= 1) {
         // One or no readers found, no need of this drop down.
         return '';
     }
     $select = new single_select($reportloglive->url, 'logreader', $readers, $reportloglive->selectedlogreader, null);
     $select->set_label(get_string('selectlogreader', 'report_loglive'));
     return $this->output->render($select);
 }
开发者ID:rezaies,项目名称:moodle,代码行数:17,代码来源:renderer.php

示例6: report_stats_mode_menu

function report_stats_mode_menu($course, $mode, $time, $url)
{
    global $CFG, $OUTPUT;
    /*
    $reportoptions = stats_get_report_options($course->id, $mode);
    $timeoptions = report_stats_timeoptions($mode);
    if (empty($timeoptions)) {
        print_error('nostatstodisplay', '', $CFG->wwwroot.'/course/view.php?id='.$course->id);
    }
    */
    $options = array();
    $options[STATS_MODE_GENERAL] = get_string('statsmodegeneral');
    $options[STATS_MODE_DETAILED] = get_string('statsmodedetailed');
    if (has_capability('report/stats:view', context_system::instance())) {
        $options[STATS_MODE_RANKED] = get_string('reports');
    }
    $popupurl = $url . "?course={$course->id}&time={$time}";
    $select = new single_select(new moodle_url($popupurl), 'mode', $options, $mode, null);
    $select->set_label(get_string('reports'), array('class' => 'accesshide'));
    $select->formid = 'switchmode';
    return $OUTPUT->render($select);
}
开发者ID:tyleung,项目名称:CMPUT401MoodleExams,代码行数:22,代码来源:locallib.php

示例7: forum_print_mode_form

/**
 * Print the drop down that allows the user to select how they want to have
 * the discussion displayed.
 *
 * @param int $id forum id if $forumtype is 'single',
 *              discussion id for any other forum type
 * @param mixed $mode forum layout mode
 * @param string $forumtype optional
 */
function forum_print_mode_form($id, $mode, $forumtype='') {
    global $OUTPUT;
    if ($forumtype == 'single') {
        $select = new single_select(new moodle_url("/mod/forum/view.php", array('f'=>$id)), 'mode', forum_get_layout_modes(), $mode, null, "mode");
        $select->set_label(get_string('displaymode', 'forum'), array('class' => 'accesshide'));
        $select->class = "forummode";
    } else {
        $select = new single_select(new moodle_url("/mod/forum/discuss.php", array('d'=>$id)), 'mode', forum_get_layout_modes(), $mode, null, "mode");
        $select->set_label(get_string('displaymode', 'forum'), array('class' => 'accesshide'));
    }
    echo $OUTPUT->render($select);
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:21,代码来源:lib.php

示例8:

    
    if ($programid) {
        echo '<div style="margin-bottom: 10px;">';
        $modules = $hierarchy->get_records_cobaltselect_menu('local_module', "programid=$programid AND visible=1", null, '', 'id,fullname', 'Select Module',0,0,0);
        $select2 = new single_select(new moodle_url('/local/curriculum/assigncourses.php?id=' . $plan->id . '&mode=' . $mode . '&cid=' . $cid . '&pid=' . $programid . ''), 'moduleid', $modules, $moduleid, null, 'switchcategory');
        $select2->set_label(get_string('selectmodule', 'local_modules') . ':&nbsp&nbsp&nbsp&nbsp');
        echo $OUTPUT->render($select2);
        echo '</div>';     
        if(count($modules)<=1)
        echo $hierarchy->cobalt_navigation_msg(get_string('navigation_info','local_collegestructure'),get_string('createmodule', 'local_modules'),$CFG->wwwroot.'/local/modules/module.php');   
        
    }
    echo '</div>';
    echo '<div id="d" style="margin-bottom: 10px;' . $display2 . '">';
    $select3 = new single_select(new moodle_url('/local/curriculum/assigncourses.php?id=' . $plan->id . '&mode=' . $mode . '&cid=' . $cid . ''), 'did', $d, $departmentid, null, 'switchcategory');
    $select3->set_label(get_string('selectdepartment', 'local_cobaltcourses') . ':&nbsp&nbsp&nbsp&nbsp');
    echo $OUTPUT->render($select3);
 
    // navigation handling
    if(count($d)<=1){        
    echo $hierarchy->cobalt_navigation_msg(get_string('navigation_info','local_collegestructure'),get_string('create_department', 'local_departments'),$CFG->wwwroot.'/local/departments/departments.php');   
    } 
    echo '</div>';
    $checkcount = $cplan->course_count($id, $cid, $moduleid, $departmentid);
    $disable = ($checkcount) ? 'disabled="disabled"' : '';

//Display the list of courses in the module to assign.
    if ($moduleid || $departmentid) {
        //If all the courses are assigned to the plan, Disable the button.

        if ($moduleid)
开发者ID:anilch,项目名称:Personel,代码行数:30,代码来源:assigncourses.php

示例9: get_user_courses_select

 /**
  * Gets a list of courses where the current user can subscribe to rules as a dropdown.
  *
  * @param bool $choose A flag for whether to show the 'choose...' option in the select box.
  * @return \single_select|bool returns the list of courses, or false if the select box
  *      should not be displayed.
  */
 public function get_user_courses_select($choose = false)
 {
     $options = tool_monitor_get_user_courses();
     // If we have no options then don't create a select element.
     if (!$options) {
         return false;
     }
     $selected = $this->courseid;
     $nothing = array();
     if ($choose) {
         $selected = null;
         $nothing = array('choosedots');
     }
     $url = new \moodle_url('/admin/tool/monitor/index.php');
     $select = new \single_select($url, 'courseid', $options, $selected, $nothing);
     $select->set_label(get_string('selectacourse', 'tool_monitor'));
     return $select;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:25,代码来源:rules.php

示例10: block_add_block_ui

/**
 * Return a {@link block_contents} representing the add a new block UI, if
 * this user is allowed to see it.
 *
 * @return block_contents an appropriate block_contents, or null if the user
 * cannot add any blocks here.
 */
function block_add_block_ui($page, $output)
{
    global $CFG, $OUTPUT;
    if (!$page->user_is_editing() || !$page->user_can_edit_blocks()) {
        return null;
    }
    $bc = new block_contents();
    $bc->title = get_string('addblock');
    $bc->add_class('block_adminblock');
    $missingblocks = $page->blocks->get_addable_blocks();
    if (empty($missingblocks)) {
        $bc->content = get_string('noblockstoaddhere');
        return $bc;
    }
    $menu = array();
    foreach ($missingblocks as $block) {
        $blockobject = block_instance($block->name);
        if ($blockobject !== false && $blockobject->user_can_addto($page)) {
            $menu[$block->name] = $blockobject->get_title();
        }
    }
    collatorlib::asort($menu);
    $actionurl = new moodle_url($page->url, array('sesskey' => sesskey()));
    $select = new single_select($actionurl, 'bui_addblock', $menu, null, array('' => get_string('adddots')), 'add_block');
    $select->set_label(get_string('addblock'), array('class' => 'accesshide'));
    $bc->content = $OUTPUT->render($select);
    return $bc;
}
开发者ID:Burick,项目名称:moodle,代码行数:35,代码来源:blocklib.php

示例11: course_filter_selector

 /**
  * Displays a course filter selector
  *
  * @param moodle_url $returnurl The URL that the user should be taken too upon selecting a course.
  * @param string $label The label to use for the course select.
  * @return string
  */
 protected function course_filter_selector(moodle_url $returnurl, $label = null)
 {
     global $USER, $SESSION, $CFG;
     if (!isloggedin() or isguestuser()) {
         return '';
     }
     if (has_capability('moodle/calendar:manageentries', context_system::instance()) && !empty($CFG->calendar_adminseesall)) {
         $courses = get_courses('all', 'c.shortname', 'c.id,c.shortname');
     } else {
         $courses = enrol_get_my_courses();
     }
     unset($courses[SITEID]);
     $courseoptions = array();
     $courseoptions[SITEID] = get_string('fulllistofcourses');
     foreach ($courses as $course) {
         $coursecontext = context_course::instance($course->id);
         $courseoptions[$course->id] = format_string($course->shortname, true, array('context' => $coursecontext));
     }
     if ($this->page->course->id !== SITEID) {
         $selected = $this->page->course->id;
     } else {
         $selected = '';
     }
     $courseurl = new moodle_url($returnurl);
     $courseurl->remove_params('course');
     $select = new single_select($courseurl, 'course', $courseoptions, $selected, null);
     $select->class = 'cal_courses_flt';
     if ($label !== null) {
         $select->set_label($label);
     } else {
         $select->set_label(get_string('listofcourses'), array('class' => 'accesshide'));
     }
     return $this->output->render($select);
 }
开发者ID:abhilash1994,项目名称:moodle,代码行数:41,代码来源:renderer.php

示例12: print_category_edit

function print_category_edit($category, $displaylist, $parentslist, $depth = -1, $up = false, $down = false)
{
    /// Recursive function to print all the categories ready for editing
    global $CFG, $USER, $OUTPUT;
    static $str = NULL;
    if (is_null($str)) {
        $str = new stdClass();
        $str->edit = get_string('edit');
        $str->delete = get_string('delete');
        $str->moveup = get_string('moveup');
        $str->movedown = get_string('movedown');
        $str->edit = get_string('editthiscategory');
        $str->hide = get_string('hide');
        $str->show = get_string('show');
        $str->cohorts = get_string('cohorts', 'cohort');
        $str->spacer = $OUTPUT->spacer() . ' ';
    }
    if (!empty($category)) {
        if (!isset($category->context)) {
            $category->context = context_coursecat::instance($category->id);
        }
        echo '<tr><td align="left" class="name">';
        for ($i = 0; $i < $depth; $i++) {
            echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
        }
        $linkcss = $category->visible ? '' : ' class="dimmed" ';
        echo '<a ' . $linkcss . ' title="' . $str->edit . '" ' . ' href="category.php?id=' . $category->id . '&amp;categoryedit=on&amp;sesskey=' . sesskey() . '">' . format_string($category->name, true, array('context' => $category->context)) . '</a>';
        echo '</td>';
        echo '<td class="count">' . $category->coursecount . '</td>';
        echo '<td class="icons">';
        /// Print little icons
        if (has_capability('moodle/category:manage', $category->context)) {
            echo '<a title="' . $str->edit . '" href="editcategory.php?id=' . $category->id . '"><img' . ' src="' . $OUTPUT->pix_url('t/edit') . '" class="iconsmall" alt="' . $str->edit . '" /></a> ';
            echo '<a title="' . $str->delete . '" href="index.php?delete=' . $category->id . '&amp;sesskey=' . sesskey() . '"><img' . ' src="' . $OUTPUT->pix_url('t/delete') . '" class="iconsmall" alt="' . $str->delete . '" /></a> ';
            if (!empty($category->visible)) {
                echo '<a title="' . $str->hide . '" href="index.php?hide=' . $category->id . '&amp;sesskey=' . sesskey() . '"><img' . ' src="' . $OUTPUT->pix_url('t/hide') . '" class="iconsmall" alt="' . $str->hide . '" /></a> ';
            } else {
                echo '<a title="' . $str->show . '" href="index.php?show=' . $category->id . '&amp;sesskey=' . sesskey() . '"><img' . ' src="' . $OUTPUT->pix_url('t/show') . '" class="iconsmall" alt="' . $str->show . '" /></a> ';
            }
            if (has_capability('moodle/cohort:manage', $category->context) or has_capability('moodle/cohort:view', $category->context)) {
                echo '<a title="' . $str->cohorts . '" href="' . $CFG->wwwroot . '/cohort/index.php?contextid=' . $category->context->id . '"><img' . ' src="' . $OUTPUT->pix_url('i/cohort') . '" class="iconsmall" alt="' . $str->cohorts . '" /></a> ';
            }
            if ($up) {
                echo '<a title="' . $str->moveup . '" href="index.php?moveup=' . $category->id . '&amp;sesskey=' . sesskey() . '"><img' . ' src="' . $OUTPUT->pix_url('t/up') . '" class="iconsmall" alt="' . $str->moveup . '" /></a> ';
            } else {
                echo $str->spacer;
            }
            if ($down) {
                echo '<a title="' . $str->movedown . '" href="index.php?movedown=' . $category->id . '&amp;sesskey=' . sesskey() . '"><img' . ' src="' . $OUTPUT->pix_url('t/down') . '" class="iconsmall" alt="' . $str->movedown . '" /></a> ';
            } else {
                echo $str->spacer;
            }
        }
        echo '</td>';
        echo '<td align="left">';
        if (has_capability('moodle/category:manage', $category->context)) {
            $tempdisplaylist = $displaylist;
            unset($tempdisplaylist[$category->id]);
            foreach ($parentslist as $key => $parents) {
                if (in_array($category->id, $parents)) {
                    unset($tempdisplaylist[$key]);
                }
            }
            $popupurl = new moodle_url("index.php?move={$category->id}&sesskey=" . sesskey());
            $select = new single_select($popupurl, 'moveto', $tempdisplaylist, $category->parent, null, "moveform{$category->id}");
            $select->set_label(get_string('frontpagecategorynames'), array('class' => 'accesshide'));
            echo $OUTPUT->render($select);
        }
        echo '</td>';
        echo '</tr>';
    } else {
        $category = new stdClass();
        $category->id = '0';
    }
    if ($categories = get_categories($category->id)) {
        // Print all the children recursively
        $countcats = count($categories);
        $count = 0;
        $first = true;
        $last = false;
        foreach ($categories as $cat) {
            $count++;
            if ($count == $countcats) {
                $last = true;
            }
            $up = $first ? false : true;
            $down = $last ? false : true;
            $first = false;
            print_category_edit($cat, $displaylist, $parentslist, $depth + 1, $up, $down);
        }
    }
}
开发者ID:JP-Git,项目名称:moodle,代码行数:92,代码来源:index.php

示例13: array

echo $OUTPUT->single_button($continueurl, 'A disabled button', 'post', array('disabled' => true));
echo html_writer::tag('p', 'Or manually create object then render. Note this uses a confirm dialog, try pressing to see popup (needs styling)');
// render directly
$button = new single_button($continueurl, 'Manually rendered button', 'post');
$button->tooltip = 'This is the tooltip';
$button->formid = 'canbeset';
$button->class = 'classonbutton';
$button->add_confirm_action('This message appears to confirm when you push the button');
echo $OUTPUT->render($button);
echo html_writer::tag('p', 'A single select form. Quick way using a function:');
$url = new moodle_url('index.php', array('urlparams' => 'become', 'hidden' => 'fields'));
$options = array(1 => 'one', 2 => 'two', 3 => 'three', 4 => 'four');
echo $OUTPUT->single_select($url, 'youpicked', $options, '', array('' => 'choose'), 'formid');
echo html_writer::tag('p', 'A single select form. Manually rendered:');
$select = new single_select($url, 'youpicked', $options);
$select->set_label('This is a label for the select');
$select->tooltip = 'This is the tooltip';
//this doesn't seem to work - moodle bug?
//$select->add_confirm_action('Confirm you want to do this');
$select->set_help_icon('activities', 'moodle');
echo $OUTPUT->render($select);
echo html_writer::tag('p', 'A url select form. Typically used for navigation.');
$urls = array('/admin/tool/elementlibrary/' => 'Index', '/admin/tool/elementlibrary/common.php' => 'Common elements', '/admin/tool/elementlibrary/mform.php' => 'Moodle form elements', '/admin/tool/elementlibrary/tables.php' => 'Tables', '/admin/tool/elementlibrary/tabs.php' => 'Tabs');
echo $OUTPUT->url_select($urls, '', array('' => 'choose'), 'formid');
/*
* This never loads and isn't called this way anywhere else?
echo html_writer::tag('p', 'A stand-alone file picker:');
$options = new stdClass();
echo $OUTPUT->file_picker($options);
*/
// get any cmid to make this work
开发者ID:jeisc,项目名称:totara-element-library,代码行数:31,代码来源:forms.php

示例14: editing_bar_head

 public function editing_bar_head($max = 0)
 {
     global $OUTPUT, $USER;
     $output = $OUTPUT->box_start('notice');
     $options = array('0' => get_string('alwaysshowall', 'block_my_course_overview'));
     for ($i = 1; $i <= $max; $i++) {
         $options[$i] = $i;
     }
     $url = new moodle_url('/my/index.php');
     $select = new single_select($url, 'mynumber', $options, $USER->profile['mynumber'], array());
     $select->set_label(get_string('numtodisplay', 'block_my_course_overview'));
     $output .= $OUTPUT->render($select);
     $output .= $OUTPUT->box_end();
     return $output;
 }
开发者ID:netspotau,项目名称:moodle-block_my_course_overview,代码行数:15,代码来源:renderer.php

示例15: render_mr_html_paging

 /**
  * Render mr_html_paging
  *
  * @param mr_html_paging $paging mr_html_paging instance
  * @return string
  */
 public function render_mr_html_paging(mr_html_paging $paging)
 {
     $output = '';
     if ($paging->get_perpage()) {
         $output = $this->output->paging_bar($paging->get_total(), $paging->get_page(), $paging->get_perpage(), $paging->get_url(), $paging->REQUEST_PAGE);
     }
     if ($paging->get_perpageopts()) {
         $options = array();
         foreach ($paging->get_perpageopts() as $opt) {
             if ($opt == 'all') {
                 $options[10000] = get_string('all');
             } else {
                 $options[$opt] = $opt;
             }
         }
         $singleselect = new single_select($paging->get_url(), $paging->REQUEST_PERPAGE, $options, $paging->get_perpage(), array());
         $singleselect->set_label(get_string('rowsperpage', 'local_mr'), array('class' => 'accesshide'));
         $select = $this->output->render($singleselect);
         // Attempt to place it within the paging bar's div
         if (substr($output, strlen($output) - 6) == '</div>') {
             $output = substr($output, 0, -6) . "{$select}</div>";
         } else {
             $output .= $this->output->box($select, 'paging');
         }
         $output = html_writer::tag('div', $output, array('class' => 'mr_html_paging'));
     }
     return $output;
 }
开发者ID:bgao-ca,项目名称:moodle-local_mr,代码行数:34,代码来源:renderer.php


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