當前位置: 首頁>>代碼示例>>PHP>>正文


PHP coursecat::can_resort_any方法代碼示例

本文整理匯總了PHP中coursecat::can_resort_any方法的典型用法代碼示例。如果您正苦於以下問題:PHP coursecat::can_resort_any方法的具體用法?PHP coursecat::can_resort_any怎麽用?PHP coursecat::can_resort_any使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在coursecat的用法示例。


在下文中一共展示了coursecat::can_resort_any方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: category_bulk_actions

 /**
  * Renders bulk actions for categories.
  *
  * @param coursecat $category The currently selected category if there is one.
  * @return string
  */
 public function category_bulk_actions(coursecat $category = null)
 {
     // Resort courses.
     // Change parent.
     $strgo = new lang_string('go');
     $html = html_writer::start_div('category-bulk-actions bulk-actions');
     if (coursecat::can_resort_any()) {
         $selectoptions = array('selectedcategories' => get_string('selectedcategories'), 'allcategories' => get_string('allcategories'));
         $form = html_writer::start_div();
         if ($category) {
             $selectoptions = array('thiscategory' => get_string('thiscategory')) + $selectoptions;
             $form .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'currentcategoryid', 'value' => $category->id));
         }
         $form .= html_writer::div(html_writer::select($selectoptions, 'selectsortby', 'selectedcategories', false));
         $form .= html_writer::div(html_writer::select(array('name' => get_string('sortcategoriesbyname'), 'idnumber' => get_string('sortcategoriesbyidnumber'), 'none' => get_string('dontsortcategories')), 'resortcategoriesby', 'name', false));
         $form .= html_writer::div(html_writer::select(array('fullname' => get_string('sortcoursesbyfullname'), 'shortname' => get_string('sortcoursesbyshortname'), 'idnumber' => get_string('sortcoursesbyidnumber'), 'none' => get_string('dontsortcourses')), 'resortcoursesby', 'fullname', false));
         $form .= html_writer::empty_tag('input', array('type' => 'submit', 'name' => 'bulksort', 'value' => get_string('sort')));
         $form .= html_writer::end_div();
         $html .= $this->detail_pair(get_string('sorting'), $form);
     }
     if (coursecat::can_change_parent_any()) {
         $options = array();
         if (has_capability('moodle/category:manage', context_system::instance())) {
             $options[0] = coursecat::get(0)->get_formatted_name();
         }
         $options += coursecat::make_categories_list('moodle/category:manage');
         $select = html_writer::select($options, 'movecategoriesto', '', array('' => 'choosedots'), array('aria-labelledby' => 'moveselectedcategoriesto'));
         $submit = array('type' => 'submit', 'name' => 'bulkmovecategories', 'value' => get_string('move'));
         $html .= $this->detail_pair(html_writer::span(get_string('moveselectedcategoriesto'), '', array('id' => 'moveselectedcategoriesto')), $select . html_writer::empty_tag('input', $submit));
     }
     $html .= html_writer::end_div();
     return $html;
 }
開發者ID:eamador,項目名稱:moodle-course-custom-fields,代碼行數:39,代碼來源:management_renderer.php

示例2: category_bulk_actions

 /**
  * Renders bulk actions for categories.
  *
  * @param coursecat $category The currently selected category if there is one.
  * @return string
  */
 public function category_bulk_actions(coursecat $category = null)
 {
     // Resort courses.
     // Change parent.
     if (!coursecat::can_resort_any() && !coursecat::can_change_parent_any()) {
         return '';
     }
     $strgo = new lang_string('go');
     $html = html_writer::start_div('category-bulk-actions bulk-actions');
     $html .= html_writer::div(get_string('categorybulkaction'), 'accesshide', array('tabindex' => '0'));
     if (coursecat::can_resort_any()) {
         $selectoptions = array('selectedcategories' => get_string('selectedcategories'), 'allcategories' => get_string('allcategories'));
         $form = html_writer::start_div();
         if ($category) {
             $selectoptions = array('thiscategory' => get_string('thiscategory')) + $selectoptions;
             $form .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'currentcategoryid', 'value' => $category->id));
         }
         $form .= html_writer::div(html_writer::select($selectoptions, 'selectsortby', 'selectedcategories', false, array('aria-label' => get_string('selectcategorysort'))));
         $form .= html_writer::div(html_writer::select(array('name' => get_string('sortbyx', 'moodle', get_string('categoryname')), 'namedesc' => get_string('sortbyxreverse', 'moodle', get_string('categoryname')), 'idnumber' => get_string('sortbyx', 'moodle', get_string('idnumbercoursecategory')), 'idnumberdesc' => get_string('sortbyxreverse', 'moodle', get_string('idnumbercoursecategory')), 'none' => get_string('dontsortcategories')), 'resortcategoriesby', 'name', false, array('aria-label' => get_string('selectcategorysortby'))));
         $form .= html_writer::div(html_writer::select(array('fullname' => get_string('sortbyx', 'moodle', get_string('fullnamecourse')), 'fullnamedesc' => get_string('sortbyxreverse', 'moodle', get_string('fullnamecourse')), 'shortname' => get_string('sortbyx', 'moodle', get_string('shortnamecourse')), 'shortnamedesc' => get_string('sortbyxreverse', 'moodle', get_string('shortnamecourse')), 'idnumber' => get_string('sortbyx', 'moodle', get_string('idnumbercourse')), 'idnumberdesc' => get_string('sortbyxreverse', 'moodle', get_string('idnumbercourse')), 'timecreated' => get_string('sortbyx', 'moodle', get_string('timecreatedcourse')), 'timecreateddesc' => get_string('sortbyxreverse', 'moodle', get_string('timecreatedcourse')), 'none' => get_string('dontsortcourses')), 'resortcoursesby', 'fullname', false, array('aria-label' => get_string('selectcoursesortby'))));
         $form .= html_writer::empty_tag('input', array('type' => 'submit', 'name' => 'bulksort', 'value' => get_string('sort')));
         $form .= html_writer::end_div();
         $html .= html_writer::start_div('detail-pair row yui3-g');
         $html .= html_writer::div(html_writer::span(get_string('sorting')), 'pair-key span3 yui3-u-1-4');
         $html .= html_writer::div($form, 'pair-value span9 yui3-u-3-4');
         $html .= html_writer::end_div();
     }
     if (coursecat::can_change_parent_any()) {
         $options = array();
         if (has_capability('moodle/category:manage', context_system::instance())) {
             $options[0] = coursecat::get(0)->get_formatted_name();
         }
         $options += coursecat::make_categories_list('moodle/category:manage');
         $select = html_writer::select($options, 'movecategoriesto', '', array('' => 'choosedots'), array('aria-labelledby' => 'moveselectedcategoriesto'));
         $submit = array('type' => 'submit', 'name' => 'bulkmovecategories', 'value' => get_string('move'));
         $html .= $this->detail_pair(html_writer::span(get_string('moveselectedcategoriesto'), '', array('id' => 'moveselectedcategoriesto')), $select . html_writer::empty_tag('input', $submit));
     }
     $html .= html_writer::end_div();
     return $html;
 }
開發者ID:evltuma,項目名稱:moodle,代碼行數:46,代碼來源:management_renderer.php


注:本文中的coursecat::can_resort_any方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。