本文整理汇总了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;
}
示例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;
}