本文整理汇总了PHP中coursecat::can_move_courses_into方法的典型用法代码示例。如果您正苦于以下问题:PHP coursecat::can_move_courses_into方法的具体用法?PHP coursecat::can_move_courses_into怎么用?PHP coursecat::can_move_courses_into使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类coursecat
的用法示例。
在下文中一共展示了coursecat::can_move_courses_into方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: course_listing
/**
* Renders a course listing.
*
* @param coursecat $category The currently selected category. This is what the listing is focused on.
* @param course_in_list $course The currently selected course.
* @param int $page The page being displayed.
* @param int $perpage The number of courses to display per page.
* @return string
*/
public function course_listing(coursecat $category = null, course_in_list $course = null, $page = 0, $perpage = 20)
{
if ($category === null) {
$html = html_writer::start_div('select-a-category');
$html .= html_writer::tag('h3', get_string('courses'));
$html .= $this->output->notification(get_string('selectacategory'), 'notifymessage');
$html .= html_writer::end_div();
return $html;
}
$page = max($page, 0);
$perpage = max($perpage, 2);
$totalcourses = $category->coursecount;
$totalpages = ceil($totalcourses / $perpage);
if ($page > $totalpages - 1) {
$page = $totalpages - 1;
}
$options = array('offset' => $page * $perpage, 'limit' => $perpage);
$courseid = isset($course) ? $course->id : null;
$class = '';
if ($page === 0) {
$class .= ' firstpage';
}
if ($page + 1 === (int) $totalpages) {
$class .= ' lastpage';
}
$html = html_writer::start_div('course-listing' . $class, array('data-category' => $category->id, 'data-page' => $page, 'data-totalpages' => $totalpages, 'data-totalcourses' => $totalcourses, 'data-canmoveoutof' => $category->can_move_courses_out_of() && $category->can_move_courses_into()));
$html .= html_writer::tag('h3', $category->get_formatted_name());
$html .= $this->course_listing_actions($category, $course, $perpage);
$html .= $this->listing_pagination($category, $page, $perpage);
$html .= html_writer::start_tag('ul', array('class' => 'ml'));
foreach ($category->get_courses($options) as $listitem) {
$html .= $this->course_listitem($category, $listitem, $courseid);
}
$html .= html_writer::end_tag('ul');
$html .= $this->listing_pagination($category, $page, $perpage, true);
$html .= $this->course_bulk_actions($category);
$html .= html_writer::end_div();
return $html;
}