当前位置: 首页>>代码示例>>PHP>>正文


PHP api::is_enabled方法代码示例

本文整理汇总了PHP中core_competency\api::is_enabled方法的典型用法代码示例。如果您正苦于以下问题:PHP api::is_enabled方法的具体用法?PHP api::is_enabled怎么用?PHP api::is_enabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在core_competency\api的用法示例。


在下文中一共展示了api::is_enabled方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 /**
  * Do the job.
  */
 public function execute()
 {
     if (!api::is_enabled()) {
         return;
     }
     $records = plan::get_recordset_for_due_and_incomplete();
     foreach ($records as $record) {
         $plan = new plan(0, $record);
         api::complete_plan($plan);
     }
     $records->close();
 }
开发者ID:evltuma,项目名称:moodle,代码行数:15,代码来源:complete_plans_task.php

示例2: execute

 /**
  * Do the job.
  */
 public function execute()
 {
     if (!api::is_enabled()) {
         return;
     }
     $missingplans = template_cohort::get_all_missing_plans(self::get_last_run_time());
     foreach ($missingplans as $missingplan) {
         foreach ($missingplan['userids'] as $userid) {
             try {
                 api::create_plan_from_template($missingplan['template'], $userid);
             } catch (\Exception $e) {
                 debugging(sprintf('Exception caught while creating plan for user %d from template %d. Message: %s', $userid, $missingplan['template']->get_id(), $e->getMessage()), DEBUG_DEVELOPER);
             }
         }
     }
 }
开发者ID:gabrielrosset,项目名称:moodle,代码行数:19,代码来源:sync_plans_from_template_cohorts_task.php

示例3: course_get_user_navigation_options

/**
 * Return an object with the list of navigation options in a course that are avaialable or not for the current user.
 * This function also handles the frontpage course.
 *
 * @param  stdClass $context context object (it can be a course context or the system context for frontpage settings)
 * @param  stdClass $course  the course where the settings are being rendered
 * @return stdClass          the navigation options in a course and their availability status
 * @since  Moodle 3.2
 */
function course_get_user_navigation_options($context, $course = null)
{
    global $CFG;
    $isloggedin = isloggedin();
    $isguestuser = isguestuser();
    $isfrontpage = $context->contextlevel == CONTEXT_SYSTEM;
    if ($isfrontpage) {
        $sitecontext = $context;
    } else {
        $sitecontext = context_system::instance();
    }
    // Sets defaults for all options.
    $options = (object) ['badges' => false, 'blogs' => false, 'calendar' => false, 'competencies' => false, 'grades' => false, 'notes' => false, 'participants' => false, 'search' => false, 'tags' => false];
    $options->blogs = !empty($CFG->enableblogs) && ($CFG->bloglevel == BLOG_GLOBAL_LEVEL || ($CFG->bloglevel == BLOG_SITE_LEVEL and ($isloggedin and !$isguestuser))) && has_capability('moodle/blog:view', $sitecontext);
    $options->notes = !empty($CFG->enablenotes) && has_any_capability(array('moodle/notes:manage', 'moodle/notes:view'), $context);
    // Frontpage settings?
    if ($isfrontpage) {
        if ($course->id == SITEID) {
            $options->participants = has_capability('moodle/site:viewparticipants', $sitecontext);
        } else {
            $options->participants = has_capability('moodle/course:viewparticipants', context_course::instance($course->id));
        }
        $options->badges = !empty($CFG->enablebadges) && has_capability('moodle/badges:viewbadges', $sitecontext);
        $options->tags = !empty($CFG->usetags) && $isloggedin;
        $options->search = !empty($CFG->enableglobalsearch) && has_capability('moodle/search:query', $sitecontext);
        $options->calendar = $isloggedin;
    } else {
        $options->participants = has_capability('moodle/course:viewparticipants', $context);
        $options->badges = !empty($CFG->enablebadges) && !empty($CFG->badges_allowcoursebadges) && has_capability('moodle/badges:viewbadges', $context);
        // Add view grade report is permitted.
        $grades = false;
        if (has_capability('moodle/grade:viewall', $context)) {
            $grades = true;
        } else {
            if (!empty($course->showgrades)) {
                $reports = core_component::get_plugin_list('gradereport');
                if (is_array($reports) && count($reports) > 0) {
                    // Get all installed reports.
                    arsort($reports);
                    // User is last, we want to test it first.
                    foreach ($reports as $plugin => $plugindir) {
                        if (has_capability('gradereport/' . $plugin . ':view', $context)) {
                            // Stop when the first visible plugin is found.
                            $grades = true;
                            break;
                        }
                    }
                }
            }
        }
        $options->grades = $grades;
    }
    if (\core_competency\api::is_enabled()) {
        $capabilities = array('moodle/competency:coursecompetencyview', 'moodle/competency:coursecompetencymanage');
        $options->competencies = has_any_capability($capabilities, $context);
    }
    return $options;
}
开发者ID:Chocolate-lightning,项目名称:moodle,代码行数:67,代码来源:lib.php

示例4: __construct

 /**
  * backup_competencies_setting constructor.
  */
 public function __construct()
 {
     $defaultvalue = false;
     $visibility = base_setting::HIDDEN;
     $status = base_setting::LOCKED_BY_CONFIG;
     if (\core_competency\api::is_enabled()) {
         $defaultvalue = true;
         $visibility = base_setting::VISIBLE;
         $status = base_setting::NOT_LOCKED;
     }
     parent::__construct('competencies', base_setting::IS_BOOLEAN, $defaultvalue, $visibility, $status);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:15,代码来源:backup_settingslib.php


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