本文整理汇总了PHP中coursecat::has_manage_capability方法的典型用法代码示例。如果您正苦于以下问题:PHP coursecat::has_manage_capability方法的具体用法?PHP coursecat::has_manage_capability怎么用?PHP coursecat::has_manage_capability使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类coursecat
的用法示例。
在下文中一共展示了coursecat::has_manage_capability方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: course_listitem
/**
* Renderers a course list item.
*
* This function will be called for every course being displayed by course_listing.
*
* @param coursecat $category The currently selected category and the category the course belongs to.
* @param course_in_list $course The course to produce HTML for.
* @param int $selectedcourse The id of the currently selected course.
* @return string
*/
public function course_listitem(coursecat $category, course_in_list $course, $selectedcourse)
{
$text = $course->get_formatted_name();
$attributes = array('class' => 'listitem listitem-course', 'data-id' => $course->id, 'data-selected' => $selectedcourse == $course->id ? '1' : '0', 'data-visible' => $course->visible ? '1' : '0');
$bulkcourseinput = array('type' => 'checkbox', 'name' => 'bc[]', 'value' => $course->id, 'class' => 'bulk-action-checkbox');
if (!$category->has_manage_capability()) {
// Very very hardcoded here.
$bulkcourseinput['style'] = 'visibility:hidden';
}
$viewcourseurl = new moodle_url($this->page->url, array('courseid' => $course->id));
$html = html_writer::start_tag('li', $attributes);
$html .= html_writer::start_div('clearfix');
if ($category->can_resort_courses()) {
// In order for dnd to be available the user must be able to resort the category children..
$html .= html_writer::div($this->output->pix_icon('i/dragdrop', get_string('dndcourse')), 'float-left drag-handle');
}
$html .= html_writer::start_div('ba-checkbox float-left');
$html .= html_writer::empty_tag('input', $bulkcourseinput) . ' ';
$html .= html_writer::end_div();
$html .= html_writer::link($viewcourseurl, $text, array('class' => 'float-left coursename'));
$html .= html_writer::start_div('float-right');
if ($course->idnumber) {
$html .= html_writer::tag('span', s($course->idnumber), array('class' => 'dimmed idnumber'));
}
$html .= $this->course_listitem_actions($category, $course);
$html .= html_writer::end_div();
$html .= html_writer::end_div();
$html .= html_writer::end_tag('li');
return $html;
}