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


PHP info::get_modinfo方法代码示例

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


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

示例1: is_available

 public function is_available($not, \core_availability\info $info, $grabthelot, $userid)
 {
     $context = \context_course::instance($info->get_course()->id);
     $allow = true;
     if (!has_capability('moodle/site:accessallgroups', $context, $userid)) {
         // If the activity has 'group members only' and you don't have accessallgroups...
         $groups = $info->get_modinfo()->get_groups($this->get_grouping_id($info));
         if (!$groups) {
             // ...and you don't belong to a group, then set it so you can't see/access it.
             $allow = false;
         }
         // The NOT condition applies before accessallgroups (i.e. if you
         // set something to be available to those NOT in grouping X,
         // people with accessallgroups can still access it even if
         // they are in grouping X).
         if ($not) {
             $allow = !$allow;
         }
     }
     return $allow;
 }
开发者ID:gwsd2015,项目名称:LogiClass,代码行数:21,代码来源:condition.php

示例2: is_available

 public function is_available($not, \core_availability\info $info, $grabthelot, $userid)
 {
     $course = $info->get_course();
     $context = \context_course::instance($course->id);
     $allow = true;
     if (!has_capability('moodle/site:accessallgroups', $context, $userid)) {
         // Get all groups the user belongs to.
         $groups = $info->get_modinfo()->get_groups();
         if ($this->groupid) {
             $allow = in_array($this->groupid, $groups);
         } else {
             // No specific group. Allow if they belong to any group at all.
             $allow = $groups ? true : false;
         }
         // The NOT condition applies before accessallgroups (i.e. if you
         // set something to be available to those NOT in group X,
         // people with accessallgroups can still access it even if
         // they are in group X).
         if ($not) {
             $allow = !$allow;
         }
     }
     return $allow;
 }
开发者ID:Keneth1212,项目名称:moodle,代码行数:24,代码来源:condition.php

示例3: get_description

 public function get_description($full, $not, \core_availability\info $info)
 {
     // Get name for module.
     $modinfo = $info->get_modinfo();
     if (!array_key_exists($this->cmid, $modinfo->cms)) {
         $modname = get_string('missing', 'availability_completion');
     } else {
         $modname = '<AVAILABILITY_CMNAME_' . $modinfo->cms[$this->cmid]->id . '/>';
     }
     // Work out which lang string to use.
     if ($not) {
         // Convert NOT strings to use the equivalent where possible.
         switch ($this->expectedcompletion) {
             case COMPLETION_INCOMPLETE:
                 $str = 'requires_' . self::get_lang_string_keyword(COMPLETION_COMPLETE);
                 break;
             case COMPLETION_COMPLETE:
                 $str = 'requires_' . self::get_lang_string_keyword(COMPLETION_INCOMPLETE);
                 break;
             default:
                 // The other two cases do not have direct opposites.
                 $str = 'requires_not_' . self::get_lang_string_keyword($this->expectedcompletion);
                 break;
         }
     } else {
         $str = 'requires_' . self::get_lang_string_keyword($this->expectedcompletion);
     }
     return get_string($str, 'availability_completion', $modname);
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:29,代码来源:condition.php

示例4: get_description

 public function get_description($full, $not, \core_availability\info $info)
 {
     // Get name for module.
     $modinfo = $info->get_modinfo();
     if (!isset($this->expectedpublicprivate)) {
         $modname = get_string('missing', 'availability_publicprivate');
     }
     //        // Work out which lang string to use.
     //        if ($not) {
     //            // Convert NOT strings to use the equivalent where possible.
     //            switch ($this->expectedpublicprivate) {
     //                case COMPLETION_INCOMPLETE:
     //                    $str = 'requires_' . self::get_lang_string_keyword(COMPLETION_COMPLETE);
     //                    break;
     //                case COMPLETION_COMPLETE:
     //                    $str = 'requires_' . self::get_lang_string_keyword(COMPLETION_INCOMPLETE);
     //                    break;
     //                default:
     //                    // The other two cases do not have direct opposites.
     //                    $str = 'requires_not_' . self::get_lang_string_keyword($this->expectedpublicprivate);
     //                    break;
     //            }
     //        } else {
     //            $str = 'requires_' . self::get_lang_string_keyword($this->expectedpublicprivate);
     //        }
     if ($this->expectedpublicprivate === PUBLICPRIVATE_PRIVATE) {
         $str = 'requires_private';
     } else {
         $str = 'requires_public';
     }
     return get_string($str, 'availability_publicprivate');
 }
开发者ID:rlorenzo,项目名称:availability_publicprivate,代码行数:32,代码来源:condition.php


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