本文整理汇总了PHP中get_courses_wmanagers函数的典型用法代码示例。如果您正苦于以下问题:PHP get_courses_wmanagers函数的具体用法?PHP get_courses_wmanagers怎么用?PHP get_courses_wmanagers使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_courses_wmanagers函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: print_courses
/**
* Category is 0 (for all courses) or an object
*/
function print_courses($category)
{
global $CFG, $OUTPUT;
if (!is_object($category) && $category == 0) {
$categories = get_child_categories(0);
// Parent = 0 ie top-level categories only
if (is_array($categories) && count($categories) == 1) {
$category = array_shift($categories);
$courses = get_courses_wmanagers($category->id, 'c.sortorder ASC', array('summary', 'summaryformat'));
} else {
$courses = get_courses_wmanagers('all', 'c.sortorder ASC', array('summary', 'summaryformat'));
}
unset($categories);
} else {
$courses = get_courses_wmanagers($category->id, 'c.sortorder ASC', array('summary', 'summaryformat'));
}
if ($courses) {
echo html_writer::start_tag('ul', array('class' => 'unlist'));
foreach ($courses as $course) {
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
if ($course->visible == 1 || has_capability('moodle/course:viewhiddencourses', $coursecontext)) {
echo html_writer::start_tag('li');
print_course($course);
echo html_writer::end_tag('li');
}
}
echo html_writer::end_tag('ul');
} else {
echo $OUTPUT->heading(get_string("nocoursesyet"));
$context = get_context_instance(CONTEXT_SYSTEM);
if (has_capability('moodle/course:create', $context)) {
$options = array();
if (!empty($category->id)) {
$options['category'] = $category->id;
} else {
$options['category'] = $CFG->defaultrequestcategory;
}
echo html_writer::start_tag('div', array('class' => 'addcoursebutton'));
echo $OUTPUT->single_button(new moodle_url('/course/edit.php', $options), get_string("addnewcourse"));
echo html_writer::end_tag('div');
}
}
}
示例2: print_courses
function print_courses($category)
{
/// Category is 0 (for all courses) or an object
global $CFG;
if (!is_object($category) && $category == 0) {
$categories = get_child_categories(0);
// Parent = 0 ie top-level categories only
if (is_array($categories) && count($categories) == 1) {
$category = array_shift($categories);
$courses = get_courses_wmanagers($category->id, 'c.sortorder ASC', array('password', 'summary', 'currency'));
} else {
$courses = get_courses_wmanagers('all', 'c.sortorder ASC', array('password', 'summary', 'currency'));
}
unset($categories);
} else {
$courses = get_courses_wmanagers($category->id, 'c.sortorder ASC', array('password', 'summary', 'currency'));
}
if ($courses) {
echo '<ul class="unlist">';
foreach ($courses as $course) {
if ($course->visible == 1 || has_capability('moodle/course:viewhiddencourses', $course->context)) {
echo '<li>';
print_course($course);
echo "</li>\n";
}
}
echo "</ul>\n";
} else {
print_heading(get_string("nocoursesyet"));
$context = get_context_instance(CONTEXT_SYSTEM);
if (has_capability('moodle/course:create', $context)) {
$options = array();
$options['category'] = $category->id;
echo '<div class="addcoursebutton">';
print_single_button($CFG->wwwroot . '/course/edit.php', $options, get_string("addnewcourse"));
echo '</div>';
}
}
}
示例3: offline_get_dynamic_files
/**
* Retrieve all dynamic files
*
* @return string[] The array of dynamic files
*/
function offline_get_dynamic_files()
{
global $CFG, $COURSE, $USER, $DB;
require_once $CFG->dirroot . '/course/lib.php';
// Include homepage and accessible course pages
$files = array('.', $CFG->wwwroot . '/', $CFG->wwwroot . '/index.php', $CFG->wwwroot . '/lib/offline/go_offline.js', $CFG->wwwroot . '/user/editadvanced.php?id=' . $USER->id);
// get all accessible courses
if (isloggedin() and !has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)) and !isguest() and empty($CFG->disablemycourses)) {
$courses = get_my_courses($USER->id, 'visible DESC,sortorder ASC', array('summary'));
} else {
if (!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)) and !isguest() or $DB->count_records('course') <= FRONTPAGECOURSELIMIT) {
$categories = get_child_categories(0);
if (is_array($categories) && count($categories) == 1) {
$category = array_shift($categories);
$courses = get_courses_wmanagers($category->id, 'c.sortorder ASC', array('password', 'summary', 'currency'));
} else {
$courses = get_courses_wmanagers('all', 'c.sortorder ASC', array('password', 'summary', 'currency'));
}
unset($categories);
}
}
// make sure the course is visible and retrieve other modules and main course pages
foreach ($courses as $course) {
if ($course->visible == 1 || has_capability('moodle/course:viewhiddencourses', $course->context)) {
$files[] = $CFG->wwwroot . '/course/view.php?id=' . $course->id;
//Get all the module main pages
foreach (get_list_of_plugins() as $module) {
if ($module != 'label') {
$files[] = $CFG->wwwroot . '/mod/' . $module . '/index.php?id=' . $course->id;
}
}
//Get all the relevant forums
require_once $CFG->dirroot . '/mod/forum/lib.php';
$forums = forum_get_readable_forums($USER->id, $course->id);
foreach ($forums as $forum) {
$files[] = $CFG->wwwroot . '/mod/forum/view.php?f=' . $forum->id;
}
$modinfo =& get_fast_modinfo($course);
get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused);
foreach ($mods as $mod) {
if ($mod->modname == 'forum') {
$files[] = $CFG->wwwroot . '/mod/forum/view.php?id=' . $mod->id;
$cm = get_coursemodule_from_id('forum', $mod->id);
$discussions = forum_get_discussions($cm);
foreach ($discussions as $d) {
$files[] = $CFG->wwwroot . '/mod/forum/discuss.php?d=' . $d->discussion;
}
}
}
//Get all the relevant assignments
foreach ($modinfo->instances['assignment'] as $cm) {
if (!$cm->uservisible) {
continue;
}
$files[] = $CFG->wwwroot . '/mod/assignment/view.php?id=' . $cm->id;
}
}
}
$files = str_replace('&', '&', $files);
return $files;
}
示例4: require_login
<?php
require_once '../../config.php';
require_once 'lib/eip.php';
require_login();
$category = optional_param('category', '', PARAM_RAW);
$assign_course = optional_param('assign_course', 0, PARAM_INT);
$capabilitycourse = get_user_capability_course('moodle/role:assign');
$categorycourses = get_courses_wmanagers($category);
$capabilitycategorycourse = array();
foreach ($capabilitycourse as $cc) {
//$capabilitycategorycourse[] = $categorycourses[$cc->id];
if ($cc->id != SITEID) {
if (array_key_exists($cc->id, $categorycourses)) {
$std = $categorycourses[$cc->id];
$capabilitycategorycourse[$cc->id] = $std->fullname;
}
}
}
if ($assign_course) {
$context = get_context_instance(CONTEXT_COURSE, $assign_course);
$assignableroles = get_assignable_roles($context, ROLENAME_BOTH);
echo renderoptions($assignableroles);
} else {
echo renderoptions($capabilitycategorycourse);
}