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


PHP core_collator::asort方法代码示例

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


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

示例1: get_list_of_timezones

 /**
  * Returns a localised list of timezones.
  * @param string $currentvalue
  * @param bool $include99 should the server timezone info be included?
  * @return array
  */
 public static function get_list_of_timezones($currentvalue = null, $include99 = false)
 {
     self::init_zones();
     // Localise first.
     $timezones = array();
     foreach (self::$goodzones as $tzkey => $ignored) {
         $timezones[$tzkey] = self::get_localised_timezone($tzkey);
     }
     core_collator::asort($timezones);
     // Add '99' if requested.
     if ($include99 or $currentvalue == 99) {
         $timezones['99'] = self::get_localised_timezone('99');
     }
     if (!isset($currentvalue) or isset($timezones[$currentvalue])) {
         return $timezones;
     }
     if (is_numeric($currentvalue)) {
         // UTC offset.
         $modifier = $currentvalue > 0 ? '+' : '';
         $a = 'UTC' . $modifier . number_format($currentvalue, 1);
         $timezones[$currentvalue] = get_string('timezoneinvalid', 'core_admin', $a);
     } else {
         // Some string we don't recognise.
         $timezones[$currentvalue] = get_string('timezoneinvalid', 'core_admin', $currentvalue);
     }
     return $timezones;
 }
开发者ID:alanaipe2015,项目名称:moodle,代码行数:33,代码来源:date.php

示例2: get_javascript_init_params

 protected function get_javascript_init_params($course, \cm_info $cm = null, \section_info $section = null)
 {
     global $DB, $CFG;
     require_once $CFG->libdir . '/gradelib.php';
     require_once $CFG->dirroot . '/course/lib.php';
     // Get grades as basic associative array.
     $gradeoptions = array();
     $items = \grade_item::fetch_all(array('courseid' => $course->id));
     // For some reason the fetch_all things return null if none.
     $items = $items ? $items : array();
     foreach ($items as $id => $item) {
         // Don't include the grade item if it's linked with a module that is being deleted.
         if (course_module_instance_pending_deletion($item->courseid, $item->itemmodule, $item->iteminstance)) {
             continue;
         }
         // Do not include grades for current item.
         if ($cm && $cm->instance == $item->iteminstance && $cm->modname == $item->itemmodule && $item->itemtype == 'mod') {
             continue;
         }
         $gradeoptions[$id] = $item->get_name(true);
     }
     \core_collator::asort($gradeoptions);
     // Change to JS array format and return.
     $jsarray = array();
     foreach ($gradeoptions as $id => $name) {
         $jsarray[] = (object) array('id' => $id, 'name' => $name);
     }
     return array($jsarray);
 }
开发者ID:lucaboesch,项目名称:moodle,代码行数:29,代码来源:frontend.php

示例3: definition

 /**
  * Form definition.
  *
  * @return void
  */
 function definition()
 {
     global $CFG;
     $mform =& $this->_form;
     $mform->disable_form_change_checker();
     $mform->addElement('header', 'search', get_string('search', 'search'));
     // Help info depends on the selected search engine.
     $mform->addElement('text', 'q', get_string('enteryoursearchquery', 'search'));
     $mform->addHelpButton('q', 'searchinfo', $this->_customdata['searchengine']);
     $mform->setType('q', PARAM_TEXT);
     $mform->addRule('q', get_string('required'), 'required', null, 'client');
     $mform->addElement('header', 'filtersection', get_string('filterheader', 'search'));
     $mform->setExpanded('filtersection', false);
     $mform->addElement('text', 'title', get_string('title', 'search'));
     $mform->setType('title', PARAM_TEXT);
     $search = \core_search\manager::instance();
     $searchareas = \core_search\manager::get_search_areas_list(true);
     $areanames = array();
     foreach ($searchareas as $areaid => $searcharea) {
         $areanames[$areaid] = $searcharea->get_visible_name();
     }
     // Sort the array by the text.
     \core_collator::asort($areanames);
     $options = array('multiple' => true, 'noselectionstring' => get_string('allareas', 'search'));
     $mform->addElement('autocomplete', 'areaids', get_string('searcharea', 'search'), $areanames, $options);
     $options = array('multiple' => true, 'limittoenrolled' => !is_siteadmin(), 'noselectionstring' => get_string('allcourses', 'search'));
     $mform->addElement('course', 'courseids', get_string('courses', 'core'), $options);
     $mform->setType('courseids', PARAM_INT);
     $mform->addElement('date_time_selector', 'timestart', get_string('fromtime', 'search'), array('optional' => true));
     $mform->setDefault('timestart', 0);
     $mform->addElement('date_time_selector', 'timeend', get_string('totime', 'search'), array('optional' => true));
     $mform->setDefault('timeend', 0);
     $this->add_action_buttons(false, get_string('search', 'search'));
 }
开发者ID:evltuma,项目名称:moodle,代码行数:39,代码来源:search.php

示例4: choice_user_complete

/**
 * Callback for the "Complete" report - prints the activity summary for the given user
 *
 * @param object $course
 * @param object $user
 * @param object $mod
 * @param object $choice
 */
function choice_user_complete($course, $user, $mod, $choice)
{
    global $DB;
    if ($answers = $DB->get_records('choice_answers', array("choiceid" => $choice->id, "userid" => $user->id))) {
        $info = [];
        foreach ($answers as $answer) {
            $info[] = "'" . format_string(choice_get_option_text($choice, $answer->optionid)) . "'";
        }
        core_collator::asort($info);
        echo get_string("answered", "choice") . ": " . join(', ', $info) . ". " . get_string("updated", '', userdate($answer->timemodified));
    } else {
        print_string("notanswered", "choice");
    }
}
开发者ID:jackdaniels79,项目名称:moodle,代码行数:22,代码来源:lib.php

示例5: get_javascript_init_params

 protected function get_javascript_init_params($course, \cm_info $cm = null, \section_info $section = null)
 {
     // Standard user fields.
     $standardfields = array('firstname' => get_user_field_name('firstname'), 'lastname' => get_user_field_name('lastname'), 'email' => get_user_field_name('email'), 'city' => get_user_field_name('city'), 'country' => get_user_field_name('country'), 'url' => get_user_field_name('url'), 'icq' => get_user_field_name('icq'), 'skype' => get_user_field_name('skype'), 'aim' => get_user_field_name('aim'), 'yahoo' => get_user_field_name('yahoo'), 'msn' => get_user_field_name('msn'), 'idnumber' => get_user_field_name('idnumber'), 'institution' => get_user_field_name('institution'), 'department' => get_user_field_name('department'), 'phone1' => get_user_field_name('phone1'), 'phone2' => get_user_field_name('phone2'), 'address' => get_user_field_name('address'));
     \core_collator::asort($standardfields);
     // Custom fields.
     $customfields = array();
     $options = array('context' => \context_course::instance($course->id));
     foreach (condition::get_custom_profile_fields() as $field) {
         $customfields[$field->shortname] = format_string($field->name, true, $options);
     }
     \core_collator::asort($customfields);
     // Make arrays into JavaScript format (non-associative, ordered) and return.
     return array(self::convert_associative_array_for_js($standardfields, 'field', 'display'), self::convert_associative_array_for_js($customfields, 'field', 'display'));
 }
开发者ID:evltuma,项目名称:moodle,代码行数:15,代码来源:frontend.php

示例6: get_filter_options

 /**
  * Retrieve the list of available filter options.
  *
  * @return  array                   An array whose keys are the valid options
  *                                  And whose values are the values to display
  */
 public static function get_filter_options()
 {
     $allroles = role_get_names(null, ROLENAME_ALIAS);
     $roles = [];
     foreach ($allroles as $role) {
         if ($role->archetype === 'guest') {
             // No point in including the 'guest' role as it isn't possible to show tours to a guest.
             continue;
         }
         $roles[$role->shortname] = $role->localname;
     }
     // Add the Site Administrator pseudo-role.
     $roles[self::ROLE_SITEADMIN] = get_string('administrator', 'core');
     // Sort alphabetically too.
     \core_collator::asort($roles);
     return $roles;
 }
开发者ID:lucaboesch,项目名称:moodle,代码行数:23,代码来源:role.php

示例7: get_content

 function get_content()
 {
     global $CFG, $DB, $OUTPUT;
     if ($this->content !== NULL) {
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->items = array();
     $this->content->icons = array();
     $this->content->footer = '';
     $course = $this->page->course;
     require_once $CFG->dirroot . '/course/lib.php';
     $modinfo = get_fast_modinfo($course);
     $modfullnames = array();
     $archetypes = array();
     foreach ($modinfo->cms as $cm) {
         // Exclude activities which are not visible or have no link (=label)
         if (!$cm->uservisible or !$cm->has_view()) {
             continue;
         }
         if (array_key_exists($cm->modname, $modfullnames)) {
             continue;
         }
         if (!array_key_exists($cm->modname, $archetypes)) {
             $archetypes[$cm->modname] = plugin_supports('mod', $cm->modname, FEATURE_MOD_ARCHETYPE, MOD_ARCHETYPE_OTHER);
         }
         if ($archetypes[$cm->modname] == MOD_ARCHETYPE_RESOURCE) {
             if (!array_key_exists('resources', $modfullnames)) {
                 $modfullnames['resources'] = get_string('resources');
             }
         } else {
             $modfullnames[$cm->modname] = $cm->modplural;
         }
     }
     core_collator::asort($modfullnames);
     foreach ($modfullnames as $modname => $modfullname) {
         if ($modname === 'resources') {
             $icon = $OUTPUT->pix_icon('icon', '', 'mod_page', array('class' => 'icon'));
             $this->content->items[] = '<a href="' . $CFG->wwwroot . '/course/resources.php?id=' . $course->id . '">' . $icon . $modfullname . '</a>';
         } else {
             $icon = '<img src="' . $OUTPUT->pix_url('icon', $modname) . '" class="icon" alt="" />';
             $this->content->items[] = '<a href="' . $CFG->wwwroot . '/mod/' . $modname . '/index.php?id=' . $course->id . '">' . $icon . $modfullname . '</a>';
         }
     }
     return $this->content;
 }
开发者ID:bobpuffer,项目名称:moodleUCLA-LUTH,代码行数:46,代码来源:block_activity_modules.php

示例8: render_form_elements

 /**
  * This function renders the form elements when adding a customcert element.
  *
  * @param mod_customcert_edit_element_form $mform the edit_form instance
  */
 public function render_form_elements($mform)
 {
     // Get the user profile fields.
     $userfields = array('firstname' => get_user_field_name('firstname'), 'lastname' => get_user_field_name('lastname'), 'email' => get_user_field_name('email'), 'city' => get_user_field_name('city'), 'country' => get_user_field_name('country'), 'url' => get_user_field_name('url'), 'icq' => get_user_field_name('icq'), 'skype' => get_user_field_name('skype'), 'aim' => get_user_field_name('aim'), 'yahoo' => get_user_field_name('yahoo'), 'msn' => get_user_field_name('msn'), 'idnumber' => get_user_field_name('idnumber'), 'institution' => get_user_field_name('institution'), 'department' => get_user_field_name('department'), 'phone1' => get_user_field_name('phone1'), 'phone2' => get_user_field_name('phone2'), 'address' => get_user_field_name('address'));
     // Get the user custom fields.
     $arrcustomfields = \availability_profile\condition::get_custom_profile_fields();
     $customfields = array();
     foreach ($arrcustomfields as $key => $customfield) {
         $customfields[$customfield->id] = $key;
     }
     // Combine the two.
     $fields = $userfields + $customfields;
     core_collator::asort($fields);
     // Create the select box where the user field is selected.
     $mform->addElement('select', 'userfield', get_string('userfield', 'customcertelement_userfield'), $fields);
     $mform->setType('userfield', PARAM_ALPHANUM);
     $mform->addHelpButton('userfield', 'userfield', 'customcertelement_userfield');
     parent::render_form_elements($mform);
 }
开发者ID:rezaies,项目名称:moodle-mod_customcert,代码行数:24,代码来源:lib.php

示例9: get_import_export_formats

/**
 * Get list of available import or export formats
 * @param string $type 'import' if import list, otherwise export list assumed
 * @return array sorted list of import/export formats available
 */
function get_import_export_formats($type)
{
    global $CFG;
    require_once $CFG->dirroot . '/question/format.php';
    $formatclasses = core_component::get_plugin_list_with_class('qformat', '', 'format.php');
    $fileformatname = array();
    foreach ($formatclasses as $component => $formatclass) {
        $format = new $formatclass();
        if ($type == 'import') {
            $provided = $format->provide_import();
        } else {
            $provided = $format->provide_export();
        }
        if ($provided) {
            list($notused, $fileformat) = explode('_', $component, 2);
            $fileformatnames[$fileformat] = get_string('pluginname', $component);
        }
    }
    core_collator::asort($fileformatnames);
    return $fileformatnames;
}
开发者ID:tyleung,项目名称:CMPUT401MoodleExams,代码行数:26,代码来源:questionlib.php

示例10: test_asort

 /**
  * Tests the static asort method.
  */
 public function test_asort()
 {
     $arr = array('b' => 'ab', 1 => 'aa', 0 => 'cc');
     $result = core_collator::asort($arr);
     $this->assertSame(array('aa', 'ab', 'cc'), array_values($arr));
     $this->assertSame(array(1, 'b', 0), array_keys($arr));
     $this->assertTrue($result);
     $arr = array('b' => 'ab', 1 => 'aa', 0 => 'cc');
     $result = core_collator::asort($arr, core_collator::SORT_STRING);
     $this->assertSame(array('aa', 'ab', 'cc'), array_values($arr));
     $this->assertSame(array(1, 'b', 0), array_keys($arr));
     $this->assertTrue($result);
     $arr = array('b' => 'aac', 1 => 'Aac', 0 => 'cc');
     $result = core_collator::asort($arr, core_collator::SORT_STRING | core_collator::CASE_SENSITIVE);
     $this->assertSame(array('Aac', 'aac', 'cc'), array_values($arr));
     $this->assertSame(array(1, 'b', 0), array_keys($arr));
     $this->assertTrue($result);
     $arr = array('b' => 'a1', 1 => 'a10', 0 => 'a3b');
     $result = core_collator::asort($arr);
     $this->assertSame(array('a1', 'a10', 'a3b'), array_values($arr));
     $this->assertSame(array('b', 1, 0), array_keys($arr));
     $this->assertTrue($result);
     $arr = array('b' => 'a1', 1 => 'a10', 0 => 'a3b');
     $result = core_collator::asort($arr, core_collator::SORT_NATURAL);
     $this->assertSame(array('a1', 'a3b', 'a10'), array_values($arr));
     $this->assertSame(array('b', 0, 1), array_keys($arr));
     $this->assertTrue($result);
     $arr = array('b' => '1.1.1', 1 => '1.2', 0 => '1.20.2');
     $result = core_collator::asort($arr, core_collator::SORT_NATURAL);
     $this->assertSame(array_values($arr), array('1.1.1', '1.2', '1.20.2'));
     $this->assertSame(array_keys($arr), array('b', 1, 0));
     $this->assertTrue($result);
     $arr = array('b' => '-1', 1 => 1000, 0 => -1.2, 3 => 1, 4 => false);
     $result = core_collator::asort($arr, core_collator::SORT_NUMERIC);
     $this->assertSame(array(-1.2, '-1', false, 1, 1000), array_values($arr));
     $this->assertSame(array(0, 'b', 4, 3, 1), array_keys($arr));
     $this->assertTrue($result);
     $arr = array('b' => array(1), 1 => array(2, 3), 0 => 1);
     $result = core_collator::asort($arr, core_collator::SORT_REGULAR);
     $this->assertSame(array(1, array(1), array(2, 3)), array_values($arr));
     $this->assertSame(array(0, 'b', 1), array_keys($arr));
     $this->assertTrue($result);
     // Test sorting of array of arrays - first element should be used for actual comparison.
     $arr = array(0 => array('bb', 'z'), 1 => array('ab', 'a'), 2 => array('zz', 'x'));
     $result = core_collator::asort($arr, core_collator::SORT_REGULAR);
     $this->assertSame(array(1, 0, 2), array_keys($arr));
     $this->assertTrue($result);
     $arr = array('a' => 'áb', 'b' => 'ab', 1 => 'aa', 0 => 'cc', 'x' => 'Áb');
     $result = core_collator::asort($arr);
     $this->assertSame(array('aa', 'ab', 'áb', 'Áb', 'cc'), array_values($arr), $this->error);
     $this->assertSame(array(1, 'b', 'a', 'x', 0), array_keys($arr), $this->error);
     $this->assertTrue($result);
     $a = array(2 => 'b', 1 => 'c');
     $c =& $a;
     $b =& $a;
     core_collator::asort($b);
     $this->assertSame($a, $b);
     $this->assertSame($c, $b);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:62,代码来源:collator_test.php

示例11: get_course_activities

 private function get_course_activities()
 {
     // A copy of block_activity_modules.
     $course = $this->page->course;
     $modinfo = get_fast_modinfo($course);
     $course = course_get_format($course)->get_course();
     $modfullnames = array();
     $archetypes = array();
     foreach ($modinfo->get_section_info_all() as $section => $thissection) {
         if (!empty($course->numsections) and $section > $course->numsections or empty($modinfo->sections[$section])) {
             // This is a stealth section or is empty.
             continue;
         }
         foreach ($modinfo->sections[$thissection->section] as $modnumber) {
             $cm = $modinfo->cms[$modnumber];
             // Exclude activities which are not visible or have no link (=label).
             if (!$cm->uservisible or !$cm->has_view()) {
                 continue;
             }
             if (array_key_exists($cm->modname, $modfullnames)) {
                 continue;
             }
             if (!array_key_exists($cm->modname, $archetypes)) {
                 $archetypes[$cm->modname] = plugin_supports('mod', $cm->modname, FEATURE_MOD_ARCHETYPE, MOD_ARCHETYPE_OTHER);
             }
             if ($archetypes[$cm->modname] == MOD_ARCHETYPE_RESOURCE) {
                 if (!array_key_exists('resources', $modfullnames)) {
                     $modfullnames['resources'] = get_string('resources');
                 }
             } else {
                 $modfullnames[$cm->modname] = $cm->modplural;
             }
         }
     }
     \core_collator::asort($modfullnames);
     return $modfullnames;
 }
开发者ID:julenpardo,项目名称:moodle-theme_essential,代码行数:37,代码来源:core_renderer.php

示例12: definition

 function definition()
 {
     global $CFG, $COURSE, $DB;
     $mform =& $this->_form;
     //-------------------------------------------------------------------------------
     $mform->addElement('header', 'general', get_string('general', 'form'));
     $mform->addElement('text', 'name', get_string('forumname', 'forum'), array('size' => '64'));
     if (!empty($CFG->formatstringstriptags)) {
         $mform->setType('name', PARAM_TEXT);
     } else {
         $mform->setType('name', PARAM_CLEANHTML);
     }
     $mform->addRule('name', null, 'required', null, 'client');
     $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
     $this->standard_intro_elements(get_string('forumintro', 'forum'));
     $forumtypes = forum_get_forum_types();
     core_collator::asort($forumtypes, core_collator::SORT_STRING);
     $mform->addElement('select', 'type', get_string('forumtype', 'forum'), $forumtypes);
     $mform->addHelpButton('type', 'forumtype', 'forum');
     $mform->setDefault('type', 'general');
     // Attachments and word count.
     $mform->addElement('header', 'attachmentswordcounthdr', get_string('attachmentswordcount', 'forum'));
     $choices = get_max_upload_sizes($CFG->maxbytes, $COURSE->maxbytes, 0, $CFG->forum_maxbytes);
     $choices[1] = get_string('uploadnotallowed');
     $mform->addElement('select', 'maxbytes', get_string('maxattachmentsize', 'forum'), $choices);
     $mform->addHelpButton('maxbytes', 'maxattachmentsize', 'forum');
     $mform->setDefault('maxbytes', $CFG->forum_maxbytes);
     $choices = array(0 => 0, 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 20 => 20, 50 => 50, 100 => 100);
     $mform->addElement('select', 'maxattachments', get_string('maxattachments', 'forum'), $choices);
     $mform->addHelpButton('maxattachments', 'maxattachments', 'forum');
     $mform->setDefault('maxattachments', $CFG->forum_maxattachments);
     $mform->addElement('selectyesno', 'displaywordcount', get_string('displaywordcount', 'forum'));
     $mform->addHelpButton('displaywordcount', 'displaywordcount', 'forum');
     $mform->setDefault('displaywordcount', 0);
     // Subscription and tracking.
     $mform->addElement('header', 'subscriptionandtrackinghdr', get_string('subscriptionandtracking', 'forum'));
     $options = array();
     $options[FORUM_CHOOSESUBSCRIBE] = get_string('subscriptionoptional', 'forum');
     $options[FORUM_FORCESUBSCRIBE] = get_string('subscriptionforced', 'forum');
     $options[FORUM_INITIALSUBSCRIBE] = get_string('subscriptionauto', 'forum');
     $options[FORUM_DISALLOWSUBSCRIBE] = get_string('subscriptiondisabled', 'forum');
     $mform->addElement('select', 'forcesubscribe', get_string('subscriptionmode', 'forum'), $options);
     $mform->addHelpButton('forcesubscribe', 'subscriptionmode', 'forum');
     $options = array();
     $options[FORUM_TRACKING_OPTIONAL] = get_string('trackingoptional', 'forum');
     $options[FORUM_TRACKING_OFF] = get_string('trackingoff', 'forum');
     if ($CFG->forum_allowforcedreadtracking) {
         $options[FORUM_TRACKING_FORCED] = get_string('trackingon', 'forum');
     }
     $mform->addElement('select', 'trackingtype', get_string('trackingtype', 'forum'), $options);
     $mform->addHelpButton('trackingtype', 'trackingtype', 'forum');
     $default = $CFG->forum_trackingtype;
     if (!$CFG->forum_allowforcedreadtracking && $default == FORUM_TRACKING_FORCED) {
         $default = FORUM_TRACKING_OPTIONAL;
     }
     $mform->setDefault('trackingtype', $default);
     if ($CFG->enablerssfeeds && isset($CFG->forum_enablerssfeeds) && $CFG->forum_enablerssfeeds) {
         //-------------------------------------------------------------------------------
         $mform->addElement('header', 'rssheader', get_string('rss'));
         $choices = array();
         $choices[0] = get_string('none');
         $choices[1] = get_string('discussions', 'forum');
         $choices[2] = get_string('posts', 'forum');
         $mform->addElement('select', 'rsstype', get_string('rsstype'), $choices);
         $mform->addHelpButton('rsstype', 'rsstype', 'forum');
         if (isset($CFG->forum_rsstype)) {
             $mform->setDefault('rsstype', $CFG->forum_rsstype);
         }
         $choices = array();
         $choices[0] = '0';
         $choices[1] = '1';
         $choices[2] = '2';
         $choices[3] = '3';
         $choices[4] = '4';
         $choices[5] = '5';
         $choices[10] = '10';
         $choices[15] = '15';
         $choices[20] = '20';
         $choices[25] = '25';
         $choices[30] = '30';
         $choices[40] = '40';
         $choices[50] = '50';
         $mform->addElement('select', 'rssarticles', get_string('rssarticles'), $choices);
         $mform->addHelpButton('rssarticles', 'rssarticles', 'forum');
         $mform->disabledIf('rssarticles', 'rsstype', 'eq', '0');
         if (isset($CFG->forum_rssarticles)) {
             $mform->setDefault('rssarticles', $CFG->forum_rssarticles);
         }
     }
     $mform->addElement('header', 'discussionlocking', get_string('discussionlockingheader', 'forum'));
     $options = [0 => get_string('discussionlockingdisabled', 'forum'), 1 * DAYSECS => get_string('numday', 'core', 1), 1 * WEEKSECS => get_string('numweek', 'core', 1), 2 * WEEKSECS => get_string('numweeks', 'core', 2), 30 * DAYSECS => get_string('nummonth', 'core', 1), 60 * DAYSECS => get_string('nummonths', 'core', 2), 90 * DAYSECS => get_string('nummonths', 'core', 3), 180 * DAYSECS => get_string('nummonths', 'core', 6), 1 * YEARSECS => get_string('numyear', 'core', 1)];
     $mform->addElement('select', 'lockdiscussionafter', get_string('lockdiscussionafter', 'forum'), $options);
     $mform->addHelpButton('lockdiscussionafter', 'lockdiscussionafter', 'forum');
     $mform->disabledIf('lockdiscussionafter', 'type', 'eq', 'single');
     //-------------------------------------------------------------------------------
     $mform->addElement('header', 'blockafterheader', get_string('blockafter', 'forum'));
     $options = array();
     $options[0] = get_string('blockperioddisabled', 'forum');
     $options[60 * 60 * 24] = '1 ' . get_string('day');
     $options[60 * 60 * 24 * 2] = '2 ' . get_string('days');
//.........这里部分代码省略.........
开发者ID:gabrielrosset,项目名称:moodle,代码行数:101,代码来源:mod_form.php

示例13: view_grading_table

 /**
  * View the grading table of all submissions for this assignment.
  *
  * @return string
  */
 protected function view_grading_table()
 {
     global $USER, $CFG;
     // Include grading options form.
     require_once $CFG->dirroot . '/mod/assign/gradingoptionsform.php';
     require_once $CFG->dirroot . '/mod/assign/quickgradingform.php';
     require_once $CFG->dirroot . '/mod/assign/gradingbatchoperationsform.php';
     $o = '';
     $cmid = $this->get_course_module()->id;
     $links = array();
     if (has_capability('gradereport/grader:view', $this->get_course_context()) && has_capability('moodle/grade:viewall', $this->get_course_context())) {
         $gradebookurl = '/grade/report/grader/index.php?id=' . $this->get_course()->id;
         $links[$gradebookurl] = get_string('viewgradebook', 'assign');
     }
     if ($this->is_any_submission_plugin_enabled() && $this->count_submissions()) {
         $downloadurl = '/mod/assign/view.php?id=' . $cmid . '&action=downloadall';
         $links[$downloadurl] = get_string('downloadall', 'assign');
     }
     if ($this->is_blind_marking() && has_capability('mod/assign:revealidentities', $this->get_context())) {
         $revealidentitiesurl = '/mod/assign/view.php?id=' . $cmid . '&action=revealidentities';
         $links[$revealidentitiesurl] = get_string('revealidentities', 'assign');
     }
     foreach ($this->get_feedback_plugins() as $plugin) {
         if ($plugin->is_enabled() && $plugin->is_visible()) {
             foreach ($plugin->get_grading_actions() as $action => $description) {
                 $url = '/mod/assign/view.php' . '?id=' . $cmid . '&plugin=' . $plugin->get_type() . '&pluginsubtype=assignfeedback' . '&action=viewpluginpage&pluginaction=' . $action;
                 $links[$url] = $description;
             }
         }
     }
     // Sort links alphabetically based on the link description.
     core_collator::asort($links);
     $gradingactions = new url_select($links);
     $gradingactions->set_label(get_string('choosegradingaction', 'assign'));
     $gradingmanager = get_grading_manager($this->get_context(), 'mod_assign', 'submissions');
     $perpage = get_user_preferences('assign_perpage', 10);
     $filter = get_user_preferences('assign_filter', '');
     $markerfilter = get_user_preferences('assign_markerfilter', '');
     $workflowfilter = get_user_preferences('assign_workflowfilter', '');
     $controller = $gradingmanager->get_active_controller();
     $showquickgrading = empty($controller);
     $quickgrading = get_user_preferences('assign_quickgrading', false);
     $showonlyactiveenrolopt = has_capability('moodle/course:viewsuspendedusers', $this->context);
     $markingallocation = $this->get_instance()->markingallocation && has_capability('mod/assign:manageallocations', $this->context);
     // Get markers to use in drop lists.
     $markingallocationoptions = array();
     if ($markingallocation) {
         $markers = get_users_by_capability($this->context, 'mod/assign:grade');
         $markingallocationoptions[''] = get_string('filternone', 'assign');
         foreach ($markers as $marker) {
             $markingallocationoptions[$marker->id] = fullname($marker);
         }
     }
     $markingworkflow = $this->get_instance()->markingworkflow;
     // Get marking states to show in form.
     $markingworkflowoptions = array();
     if ($markingworkflow) {
         $notmarked = get_string('markingworkflowstatenotmarked', 'assign');
         $markingworkflowoptions[''] = get_string('filternone', 'assign');
         $markingworkflowoptions[ASSIGN_MARKING_WORKFLOW_STATE_NOTMARKED] = $notmarked;
         $markingworkflowoptions = array_merge($markingworkflowoptions, $this->get_marking_workflow_states_for_current_user());
     }
     // Print options for changing the filter and changing the number of results per page.
     $gradingoptionsformparams = array('cm' => $cmid, 'contextid' => $this->context->id, 'userid' => $USER->id, 'submissionsenabled' => $this->is_any_submission_plugin_enabled(), 'showquickgrading' => $showquickgrading, 'quickgrading' => $quickgrading, 'markingworkflowopt' => $markingworkflowoptions, 'markingallocationopt' => $markingallocationoptions, 'showonlyactiveenrolopt' => $showonlyactiveenrolopt, 'showonlyactiveenrol' => $this->show_only_active_users());
     $classoptions = array('class' => 'gradingoptionsform');
     $gradingoptionsform = new mod_assign_grading_options_form(null, $gradingoptionsformparams, 'post', '', $classoptions);
     $batchformparams = array('cm' => $cmid, 'submissiondrafts' => $this->get_instance()->submissiondrafts, 'duedate' => $this->get_instance()->duedate, 'attemptreopenmethod' => $this->get_instance()->attemptreopenmethod, 'feedbackplugins' => $this->get_feedback_plugins(), 'context' => $this->get_context(), 'markingworkflow' => $markingworkflow, 'markingallocation' => $markingallocation);
     $classoptions = array('class' => 'gradingbatchoperationsform');
     $gradingbatchoperationsform = new mod_assign_grading_batch_operations_form(null, $batchformparams, 'post', '', $classoptions);
     $gradingoptionsdata = new stdClass();
     $gradingoptionsdata->perpage = $perpage;
     $gradingoptionsdata->filter = $filter;
     $gradingoptionsdata->markerfilter = $markerfilter;
     $gradingoptionsdata->workflowfilter = $workflowfilter;
     $gradingoptionsform->set_data($gradingoptionsdata);
     $actionformtext = $this->get_renderer()->render($gradingactions);
     $header = new assign_header($this->get_instance(), $this->get_context(), false, $this->get_course_module()->id, get_string('grading', 'assign'), $actionformtext);
     $o .= $this->get_renderer()->render($header);
     $currenturl = $CFG->wwwroot . '/mod/assign/view.php?id=' . $this->get_course_module()->id . '&action=grading';
     $o .= groups_print_activity_menu($this->get_course_module(), $currenturl, true);
     // Plagiarism update status apearring in the grading book.
     if (!empty($CFG->enableplagiarism)) {
         require_once $CFG->libdir . '/plagiarismlib.php';
         $o .= plagiarism_update_status($this->get_course(), $this->get_course_module());
     }
     // Load and print the table of submissions.
     if ($showquickgrading && $quickgrading) {
         $gradingtable = new assign_grading_table($this, $perpage, $filter, 0, true);
         $table = $this->get_renderer()->render($gradingtable);
         $quickformparams = array('cm' => $this->get_course_module()->id, 'gradingtable' => $table);
         $quickgradingform = new mod_assign_quick_grading_form(null, $quickformparams);
         $o .= $this->get_renderer()->render(new assign_form('quickgradingform', $quickgradingform));
     } else {
         $gradingtable = new assign_grading_table($this, $perpage, $filter, 0, false);
         $o .= $this->get_renderer()->render($gradingtable);
//.........这里部分代码省略.........
开发者ID:covex-nn,项目名称:moodle,代码行数:101,代码来源:locallib.php

示例14: array

$table->define_baseurl($CFG->wwwroot . '/' . $CFG->admin . '/blocks.php');
$table->set_attribute('class', 'admintable blockstable generaltable');
$table->set_attribute('id', 'compatibleblockstable');
$table->setup();
$tablerows = array();
// Sort blocks using current locale.
$blocknames = array();
foreach ($blocks as $blockid => $block) {
    $blockname = $block->name;
    if (file_exists("{$CFG->dirroot}/blocks/{$blockname}/block_{$blockname}.php")) {
        $blocknames[$blockid] = get_string('pluginname', 'block_' . $blockname);
    } else {
        $blocknames[$blockid] = $blockname;
    }
}
core_collator::asort($blocknames);
foreach ($blocknames as $blockid => $strblockname) {
    $block = $blocks[$blockid];
    $blockname = $block->name;
    $dbversion = get_config('block_' . $block->name, 'version');
    if (!file_exists("{$CFG->dirroot}/blocks/{$blockname}/block_{$blockname}.php")) {
        $blockobject = false;
        $strblockname = '<span class="notifyproblem">' . $strblockname . ' (' . get_string('missingfromdisk') . ')</span>';
        $plugin = new stdClass();
        $plugin->version = $dbversion;
    } else {
        $plugin = new stdClass();
        $plugin->version = '???';
        if (file_exists("{$CFG->dirroot}/blocks/{$blockname}/version.php")) {
            include "{$CFG->dirroot}/blocks/{$blockname}/version.php";
        }
开发者ID:gabrielrosset,项目名称:moodle,代码行数:31,代码来源:blocks.php

示例15: theme_bcu_get_course_activities

function theme_bcu_get_course_activities()
{
    global $CFG, $PAGE, $OUTPUT;
    // A copy of block_activity_modules.
    $course = $PAGE->course;
    $content = new stdClass();
    $modinfo = get_fast_modinfo($course);
    $modfullnames = array();
    $archetypes = array();
    foreach ($modinfo->cms as $cm) {
        // Exclude activities which are not visible or have no link (=label).
        if (!$cm->uservisible or !$cm->has_view()) {
            continue;
        }
        if (array_key_exists($cm->modname, $modfullnames)) {
            continue;
        }
        if (!array_key_exists($cm->modname, $archetypes)) {
            $archetypes[$cm->modname] = plugin_supports('mod', $cm->modname, FEATURE_MOD_ARCHETYPE, MOD_ARCHETYPE_OTHER);
        }
        if ($archetypes[$cm->modname] == MOD_ARCHETYPE_RESOURCE) {
            if (!array_key_exists('resources', $modfullnames)) {
                $modfullnames['resources'] = get_string('resources');
            }
        } else {
            $modfullnames[$cm->modname] = $cm->modplural;
        }
    }
    core_collator::asort($modfullnames);
    return $modfullnames;
}
开发者ID:JOANMM,项目名称:bcu,代码行数:31,代码来源:lib.php


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