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


PHP url_select::set_help_icon方法代码示例

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


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

示例1: print_section_add_menus

/**
 * Prints the menus to add activities and resources.
 */
function print_section_add_menus($course, $section, $modnames, $vertical = false, $return = false)
{
    global $CFG, $OUTPUT;
    // check to see if user can add menus
    if (!has_capability('moodle/course:manageactivities', get_context_instance(CONTEXT_COURSE, $course->id))) {
        return false;
    }
    // Retrieve all modules with associated metadata
    $modules = get_module_metadata($course, $modnames);
    // We'll sort resources and activities into two lists
    $resources = array();
    $activities = array();
    // We need to add the section section to the link for each module
    $sectionlink = '&section=' . $section;
    foreach ($modules as $module) {
        if (isset($module->types)) {
            // This module has a subtype
            // NOTE: this is legacy stuff, module subtypes are very strongly discouraged!!
            $subtypes = array();
            foreach ($module->types as $subtype) {
                $subtypes[$subtype->link . $sectionlink] = $subtype->title;
            }
            // Sort module subtypes into the list
            if (!empty($module->title)) {
                // This grouping has a name
                if ($module->archetype == MOD_CLASS_RESOURCE) {
                    $resources[] = array($module->title => $subtypes);
                } else {
                    $activities[] = array($module->title => $subtypes);
                }
            } else {
                // This grouping does not have a name
                if ($module->archetype == MOD_CLASS_RESOURCE) {
                    $resources = array_merge($resources, $subtypes);
                } else {
                    $activities = array_merge($activities, $subtypes);
                }
            }
        } else {
            // This module has no subtypes
            if ($module->archetype == MOD_ARCHETYPE_RESOURCE) {
                $resources[$module->link . $sectionlink] = $module->title;
            } else {
                if ($module->archetype === MOD_ARCHETYPE_SYSTEM) {
                    // System modules cannot be added by user, do not add to dropdown
                } else {
                    $activities[$module->link . $sectionlink] = $module->title;
                }
            }
        }
    }
    $straddactivity = get_string('addactivity');
    $straddresource = get_string('addresource');
    $output = '<div class="section_add_menus">';
    if (!$vertical) {
        $output .= '<div class="horizontal">';
    }
    if (!empty($resources)) {
        $select = new url_select($resources, '', array('' => $straddresource), "ressection{$section}");
        $select->set_help_icon('resources');
        $output .= $OUTPUT->render($select);
    }
    if (!empty($activities)) {
        $select = new url_select($activities, '', array('' => $straddactivity), "section{$section}");
        $select->set_help_icon('activities');
        $output .= $OUTPUT->render($select);
    }
    if (!$vertical) {
        $output .= '</div>';
    }
    $output .= '</div>';
    if ($return) {
        return $output;
    } else {
        echo $output;
    }
}
开发者ID:numbas,项目名称:moodle,代码行数:80,代码来源:lib.php

示例2: print_section_add_menus

/**
 * Prints the menus to add activities and resources.
 */
function print_section_add_menus($course, $section, $modnames, $vertical = false, $return = false)
{
    global $CFG, $OUTPUT;
    // check to see if user can add menus
    if (!has_capability('moodle/course:manageactivities', get_context_instance(CONTEXT_COURSE, $course->id))) {
        return false;
    }
    // Retrieve all modules with associated metadata
    $modules = get_module_metadata($course, $modnames);
    // We'll sort resources and activities into two lists
    $resources = array();
    $activities = array();
    // We need to add the section section to the link for each module
    $sectionlink = '&section=' . $section;
    foreach ($modules as $module) {
        if (isset($module->types)) {
            // This module has a subtype
            // NOTE: this is legacy stuff, module subtypes are very strongly discouraged!!
            $subtypes = array();
            foreach ($module->types as $subtype) {
                $subtypes[$subtype->link . $sectionlink] = $subtype->title;
            }
            // Sort module subtypes into the list
            if (!empty($module->title)) {
                // This grouping has a name
                if ($module->archetype == MOD_CLASS_RESOURCE) {
                    $resources[] = array($module->title => $subtypes);
                } else {
                    $activities[] = array($module->title => $subtypes);
                }
            } else {
                // This grouping does not have a name
                if ($module->archetype == MOD_CLASS_RESOURCE) {
                    $resources = array_merge($resources, $subtypes);
                } else {
                    $activities = array_merge($activities, $subtypes);
                }
            }
        } else {
            // This module has no subtypes
            if ($module->archetype == MOD_ARCHETYPE_RESOURCE) {
                $resources[$module->link . $sectionlink] = $module->title;
            } else {
                if ($module->archetype === MOD_ARCHETYPE_SYSTEM) {
                    // System modules cannot be added by user, do not add to dropdown
                } else {
                    $activities[$module->link . $sectionlink] = $module->title;
                }
            }
        }
    }
    $straddactivity = get_string('addactivity');
    $straddresource = get_string('addresource');
    $output = html_writer::start_tag('div', array('class' => 'section_add_menus', 'id' => 'add_menus-section-' . $section));
    if (!$vertical) {
        $output .= html_writer::start_tag('div', array('class' => 'horizontal'));
    }
    if (!empty($resources)) {
        $select = new url_select($resources, '', array('' => $straddresource), "ressection{$section}");
        $select->set_help_icon('resources');
        $output .= $OUTPUT->render($select);
    }
    if (!empty($activities)) {
        $select = new url_select($activities, '', array('' => $straddactivity), "section{$section}");
        $select->set_help_icon('activities');
        $output .= $OUTPUT->render($select);
    }
    if (!$vertical) {
        $output .= html_writer::end_tag('div');
    }
    $output .= html_writer::end_tag('div');
    if (course_ajax_enabled($course)) {
        $straddeither = get_string('addresourceoractivity');
        // The module chooser link
        $modchooser = html_writer::start_tag('div', array('class' => 'mdl-right'));
        $modchooser .= html_writer::start_tag('div', array('class' => 'section-modchooser'));
        $icon = $OUTPUT->pix_icon('t/add', $straddeither);
        $span = html_writer::tag('span', $straddeither, array('class' => 'section-modchooser-text'));
        $modchooser .= html_writer::link('#', $icon . $span, array('class' => 'section-modchooser-link'));
        $modchooser .= html_writer::end_tag('div');
        $modchooser .= html_writer::end_tag('div');
        // Wrap the normal output in a noscript div
        $usemodchooser = get_user_preferences('usemodchooser', 1);
        if ($usemodchooser) {
            $output = html_writer::tag('div', $output, array('class' => 'hiddenifjs addresourcedropdown'));
            $modchooser = html_writer::tag('div', $modchooser, array('class' => 'visibleifjs addresourcemodchooser'));
        } else {
            $output = html_writer::tag('div', $output, array('class' => 'visibleifjs addresourcedropdown'));
            $modchooser = html_writer::tag('div', $modchooser, array('class' => 'hiddenifjs addresourcemodchooser'));
        }
        $output = $modchooser . $output;
    }
    if ($return) {
        return $output;
    } else {
        echo $output;
    }
//.........这里部分代码省略.........
开发者ID:nmicha,项目名称:moodle,代码行数:101,代码来源:lib.php

示例3: array

 /**
  * Renders HTML for the menus to add activities and resources to the current course
  *
  * Note, if theme overwrites this function and it does not use modchooser,
  * see also {@link core_course_renderer::add_modchoosertoggle()}
  *
  * @param stdClass $course
  * @param int $section relative section number (field course_sections.section)
  * @param int $sectionreturn The section to link back to
  * @param array $displayoptions additional display options, for example blocks add
  *     option 'inblock' => true, suggesting to display controls vertically
  * @return string
  */
 function course_section_add_cm_control($course, $section, $sectionreturn = null, $displayoptions = array())
 {
     global $CFG;
     $vertical = !empty($displayoptions['inblock']);
     // check to see if user can add menus and there are modules to add
     if (!has_capability('moodle/course:manageactivities', context_course::instance($course->id)) || !$this->page->user_is_editing() || !($modnames = get_module_types_names()) || empty($modnames)) {
         return '';
     }
     // Retrieve all modules with associated metadata
     $modules = get_module_metadata($course, $modnames, $sectionreturn);
     $urlparams = array('section' => $section);
     // We'll sort resources and activities into two lists
     $activities = array(MOD_CLASS_ACTIVITY => array(), MOD_CLASS_RESOURCE => array());
     foreach ($modules as $module) {
         if (isset($module->types)) {
             // This module has a subtype
             // NOTE: this is legacy stuff, module subtypes are very strongly discouraged!!
             $subtypes = array();
             foreach ($module->types as $subtype) {
                 $link = $subtype->link->out(true, $urlparams);
                 $subtypes[$link] = $subtype->title;
             }
             // Sort module subtypes into the list
             $activityclass = MOD_CLASS_ACTIVITY;
             if ($module->archetype == MOD_CLASS_RESOURCE) {
                 $activityclass = MOD_CLASS_RESOURCE;
             }
             if (!empty($module->title)) {
                 // This grouping has a name
                 $activities[$activityclass][] = array($module->title => $subtypes);
             } else {
                 // This grouping does not have a name
                 $activities[$activityclass] = array_merge($activities[$activityclass], $subtypes);
             }
         } else {
             // This module has no subtypes
             $activityclass = MOD_CLASS_ACTIVITY;
             if ($module->archetype == MOD_ARCHETYPE_RESOURCE) {
                 $activityclass = MOD_CLASS_RESOURCE;
             } else {
                 if ($module->archetype === MOD_ARCHETYPE_SYSTEM) {
                     // System modules cannot be added by user, do not add to dropdown
                     continue;
                 }
             }
             $link = $module->link->out(true, $urlparams);
             $activities[$activityclass][$link] = $module->title;
         }
     }
     $straddactivity = get_string('addactivity');
     $straddresource = get_string('addresource');
     $sectionname = get_section_name($course, $section);
     $strresourcelabel = get_string('addresourcetosection', null, $sectionname);
     $stractivitylabel = get_string('addactivitytosection', null, $sectionname);
     $output = html_writer::start_tag('div', array('class' => 'section_add_menus', 'id' => 'add_menus-section-' . $section));
     if (!$vertical) {
         $output .= html_writer::start_tag('div', array('class' => 'horizontal'));
     }
     if (!empty($activities[MOD_CLASS_RESOURCE])) {
         $select = new url_select($activities[MOD_CLASS_RESOURCE], '', array('' => $straddresource), "ressection{$section}");
         $select->set_help_icon('resources');
         $select->set_label($strresourcelabel, array('class' => 'accesshide'));
         $output .= $this->output->render($select);
     }
     if (!empty($activities[MOD_CLASS_ACTIVITY])) {
         $select = new url_select($activities[MOD_CLASS_ACTIVITY], '', array('' => $straddactivity), "section{$section}");
         $select->set_help_icon('activities');
         $select->set_label($stractivitylabel, array('class' => 'accesshide'));
         $output .= $this->output->render($select);
     }
     if (!$vertical) {
         $output .= html_writer::end_tag('div');
     }
     $output .= html_writer::end_tag('div');
     if (course_ajax_enabled($course) && $course->id == $this->page->course->id) {
         // modchooser can be added only for the current course set on the page!
         $straddeither = get_string('addresourceoractivity');
         // The module chooser link
         $modchooser = html_writer::start_tag('div', array('class' => 'mdl-right'));
         $modchooser .= html_writer::start_tag('div', array('class' => 'section-modchooser'));
         $icon = $this->output->pix_icon('t/add', '');
         $span = html_writer::tag('span', $straddeither, array('class' => 'section-modchooser-text'));
         $modchooser .= html_writer::tag('span', $icon . $span, array('class' => 'section-modchooser-link'));
         $modchooser .= html_writer::end_tag('div');
         $modchooser .= html_writer::end_tag('div');
         // Wrap the normal output in a noscript div
         $usemodchooser = get_user_preferences('usemodchooser', $CFG->modchooserdefault);
//.........这里部分代码省略.........
开发者ID:rushi963,项目名称:moodle,代码行数:101,代码来源:renderer.php

示例4: print_section_add_menus

/**
 * Prints the menus to add activities and resources.
 */
function print_section_add_menus($course, $section, $modnames, $vertical = false, $return = false)
{
    global $CFG, $OUTPUT;
    // check to see if user can add menus
    if (!has_capability('moodle/course:manageactivities', get_context_instance(CONTEXT_COURSE, $course->id))) {
        return false;
    }
    $urlbase = "/course/mod.php?id={$course->id}&section={$section}&sesskey=" . sesskey() . '&add=';
    $resources = array();
    $activities = array();
    foreach ($modnames as $modname => $modnamestr) {
        if (!course_allowed_module($course, $modname)) {
            continue;
        }
        $libfile = "{$CFG->dirroot}/mod/{$modname}/lib.php";
        if (!file_exists($libfile)) {
            continue;
        }
        include_once $libfile;
        $gettypesfunc = $modname . '_get_types';
        if (function_exists($gettypesfunc)) {
            // NOTE: this is legacy stuff, module subtypes are very strongly discouraged!!
            if ($types = $gettypesfunc()) {
                $menu = array();
                $atype = null;
                $groupname = null;
                foreach ($types as $type) {
                    if ($type->typestr === '--') {
                        continue;
                    }
                    if (strpos($type->typestr, '--') === 0) {
                        $groupname = str_replace('--', '', $type->typestr);
                        continue;
                    }
                    $type->type = str_replace('&amp;', '&', $type->type);
                    if ($type->modclass == MOD_CLASS_RESOURCE) {
                        $atype = MOD_CLASS_RESOURCE;
                    }
                    $menu[$urlbase . $type->type] = $type->typestr;
                }
                if (!is_null($groupname)) {
                    if ($atype == MOD_CLASS_RESOURCE) {
                        $resources[] = array($groupname => $menu);
                    } else {
                        $activities[] = array($groupname => $menu);
                    }
                } else {
                    if ($atype == MOD_CLASS_RESOURCE) {
                        $resources = array_merge($resources, $menu);
                    } else {
                        $activities = array_merge($activities, $menu);
                    }
                }
            }
        } else {
            $archetype = plugin_supports('mod', $modname, FEATURE_MOD_ARCHETYPE, MOD_ARCHETYPE_OTHER);
            if ($archetype == MOD_ARCHETYPE_RESOURCE) {
                $resources[$urlbase . $modname] = $modnamestr;
            } else {
                // all other archetypes are considered activity
                $activities[$urlbase . $modname] = $modnamestr;
            }
        }
    }
    $straddactivity = get_string('addactivity');
    $straddresource = get_string('addresource');
    $output = '<div class="section_add_menus">';
    if (!$vertical) {
        $output .= '<div class="horizontal">';
    }
    if (!empty($resources)) {
        $select = new url_select($resources, '', array('' => $straddresource), "ressection{$section}");
        $select->set_help_icon('resources');
        $output .= $OUTPUT->render($select);
    }
    if (!empty($activities)) {
        $select = new url_select($activities, '', array('' => $straddactivity), "section{$section}");
        $select->set_help_icon('activities');
        $output .= $OUTPUT->render($select);
    }
    if (!$vertical) {
        $output .= '</div>';
    }
    $output .= '</div>';
    if ($return) {
        return $output;
    } else {
        echo $output;
    }
}
开发者ID:hitphp,项目名称:moodle,代码行数:93,代码来源:lib.php


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