本文整理汇总了PHP中coursecat::can_create_course方法的典型用法代码示例。如果您正苦于以下问题:PHP coursecat::can_create_course方法的具体用法?PHP coursecat::can_create_course怎么用?PHP coursecat::can_create_course使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类coursecat
的用法示例。
在下文中一共展示了coursecat::can_create_course方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: course_listing_actions
/**
* Renderers actions for the course listing.
*
* Not to be confused with course_listitem_actions which renderers the actions for individual courses.
*
* @param coursecat $category
* @param course_in_list $course The currently selected course.
* @param int $perpage
* @return string
*/
public function course_listing_actions(coursecat $category, course_in_list $course = null, $perpage = 20)
{
$actions = array();
if ($category->can_create_course()) {
$url = new moodle_url('/course/edit.php', array('category' => $category->id, 'returnto' => 'catmanage'));
$actions[] = html_writer::link($url, get_string('createnewcourse'));
}
if ($category->can_request_course()) {
// Request a new course.
$url = new moodle_url('/course/request.php', array('return' => 'management'));
$actions[] = html_writer::link($url, get_string('requestcourse'));
}
if ($category->can_resort_courses()) {
$params = $this->page->url->params();
$params['action'] = 'resortcourses';
$params['sesskey'] = sesskey();
$baseurl = new moodle_url('/course/management.php', $params);
$fullnameurl = new moodle_url($baseurl, array('resort' => 'fullname'));
$shortnameurl = new moodle_url($baseurl, array('resort' => 'shortname'));
$idnumberurl = new moodle_url($baseurl, array('resort' => 'idnumber'));
$menu = new action_menu(array(new action_menu_link_secondary($fullnameurl, null, get_string('resortbyfullname')), new action_menu_link_secondary($shortnameurl, null, get_string('resortbyshortname')), new action_menu_link_secondary($idnumberurl, null, get_string('resortbyidnumber'))));
$menu->set_menu_trigger(get_string('resortcourses'));
$actions[] = $this->render($menu);
}
$strall = get_string('all');
$menu = new action_menu(array(new action_menu_link_secondary(new moodle_url($this->page->url, array('perpage' => 5)), null, 5), new action_menu_link_secondary(new moodle_url($this->page->url, array('perpage' => 10)), null, 10), new action_menu_link_secondary(new moodle_url($this->page->url, array('perpage' => 20)), null, 20), new action_menu_link_secondary(new moodle_url($this->page->url, array('perpage' => 50)), null, 50), new action_menu_link_secondary(new moodle_url($this->page->url, array('perpage' => 100)), null, 100), new action_menu_link_secondary(new moodle_url($this->page->url, array('perpage' => 999)), null, $strall)));
if ((int) $perpage === 999) {
$perpage = $strall;
}
$menu->attributes['class'] .= ' courses-per-page';
$menu->set_menu_trigger(get_string('perpagea', 'moodle', $perpage));
$actions[] = $this->render($menu);
return html_writer::div(join(' | ', $actions), 'listing-actions course-listing-actions');
}