本文整理匯總了PHP中coursecat::can_request_course方法的典型用法代碼示例。如果您正苦於以下問題:PHP coursecat::can_request_course方法的具體用法?PHP coursecat::can_request_course怎麽用?PHP coursecat::can_request_course使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類coursecat
的用法示例。
在下文中一共展示了coursecat::can_request_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');
}