• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP get_courses_wmanagers函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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');
        }
    }
}
开发者ID:numbas,项目名称:moodle,代码行数:46,代码来源:lib.php


示例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>';
        }
    }
}
开发者ID:arshanam,项目名称:Moodle-ITScholars-LMS,代码行数:39,代码来源:lib.php


示例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('&amp;', '&', $files);
    return $files;
}
开发者ID:ajv,项目名称:Offline-Caching,代码行数:66,代码来源:lib.php


示例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);
}
开发者ID:stepsgithub,项目名称:moodle-block_pick_students,代码行数:26,代码来源:course.php



注:本文中的get_courses_wmanagers函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_cover函数代码示例发布时间:2022-05-15
下一篇:
PHP get_courses_search函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap