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


PHP course_enrolment_manager::has_instance方法代码示例

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


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

示例1: get_manual_enrol_button

 /**
  * Returns a button to enrol a cohort or its users through the manual enrolment plugin.
  *
  * This function also adds a quickenrolment JS ui to the page so that users can be enrolled
  * via AJAX.
  *
  * @param course_enrolment_manager $manager
  * @return enrol_user_button
  */
 public function get_manual_enrol_button(course_enrolment_manager $manager)
 {
     $course = $manager->get_course();
     if (!$this->can_add_new_instances($course->id)) {
         return false;
     }
     $cohorturl = new moodle_url('/enrol/cohort/edit.php', array('courseid' => $course->id));
     $button = new enrol_user_button($cohorturl, get_string('enrolcohort', 'enrol'), 'get');
     $button->class .= ' enrol_cohort_plugin';
     $button->strings_for_js(array('enrol', 'synced', 'enrolcohort', 'enrolcohortusers'), 'enrol');
     $button->strings_for_js(array('ajaxmore', 'cohortsearch'), 'enrol_cohort');
     $button->strings_for_js('assignroles', 'role');
     $button->strings_for_js('cohort', 'cohort');
     $button->strings_for_js('users', 'moodle');
     // No point showing this at all if the user cant manually enrol users.
     $hasmanualinstance = has_capability('enrol/manual:enrol', $manager->get_context()) && $manager->has_instance('manual');
     $modules = array('moodle-enrol_cohort-quickenrolment', 'moodle-enrol_cohort-quickenrolment-skin');
     $function = 'M.enrol_cohort.quickenrolment.init';
     $arguments = array('courseid' => $course->id, 'ajaxurl' => '/enrol/cohort/ajax.php', 'url' => $manager->get_moodlepage()->url->out(false), 'manualEnrolment' => $hasmanualinstance);
     $button->require_yui_module($modules, $function, array($arguments));
     return $button;
 }
开发者ID:masaterutakeno,项目名称:MoodleMobile,代码行数:31,代码来源:lib.php


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