本文整理匯總了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;
}