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


PHP course_enrolment_manager::get_course方法代码示例

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


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

示例1: initialise_javascript

 public function initialise_javascript()
 {
     if (has_capability('moodle/role:assign', $this->manager->get_context())) {
         $this->moodlepage->requires->strings_for_js(array('assignroles', 'confirmunassign', 'confirmunassigntitle', 'confirmunassignyes', 'confirmunassignno'), 'role');
         $modules = array('moodle-enrol-rolemanager', 'moodle-enrol-rolemanager-skin');
         $function = 'M.enrol.rolemanager.init';
         $arguments = array('containerId' => $this->id, 'userIds' => array_keys($this->users), 'courseId' => $this->manager->get_course()->id, 'otherusers' => isset($this->otherusers));
         $this->moodlepage->requires->yui_module($modules, $function, array($arguments));
     }
 }
开发者ID:nfreear,项目名称:moodle,代码行数:10,代码来源:renderer.php

示例2: 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

示例3: get_manual_enrol_button

 /**
  * Returns a button to manually enrol users through the manual enrolment plugin.
  *
  * By default the first manual enrolment plugin instance available in the course is used.
  * If no manual enrolment instances exist within the course then false is returned.
  *
  * 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)
 {
     global $CFG;
     require_once $CFG->dirroot . '/cohort/lib.php';
     $instance = null;
     $instances = array();
     foreach ($manager->get_enrolment_instances() as $tempinstance) {
         if ($tempinstance->enrol == 'manual') {
             if ($instance === null) {
                 $instance = $tempinstance;
             }
             $instances[] = array('id' => $tempinstance->id, 'name' => $this->get_instance_name($tempinstance));
         }
     }
     if (empty($instance)) {
         return false;
     }
     if (!($manuallink = $this->get_manual_enrol_link($instance))) {
         return false;
     }
     $button = new enrol_user_button($manuallink, get_string('enrolusers', 'enrol_manual'), 'get');
     $button->class .= ' enrol_manual_plugin';
     $startdate = $manager->get_course()->startdate;
     if (!($defaultstart = get_config('enrol_manual', 'enrolstart'))) {
         // Default to now if there is no system setting.
         $defaultstart = 4;
     }
     $startdateoptions = array();
     $dateformat = get_string('strftimedatefullshort');
     if ($startdate > 0) {
         $startdateoptions[2] = get_string('coursestart') . ' (' . userdate($startdate, $dateformat) . ')';
     }
     $now = time();
     $today = make_timestamp(date('Y', $now), date('m', $now), date('d', $now), 0, 0, 0);
     $startdateoptions[3] = get_string('today') . ' (' . userdate($today, $dateformat) . ')';
     $startdateoptions[4] = get_string('now', 'enrol_manual') . ' (' . userdate($now, get_string('strftimedatetimeshort')) . ')';
     $defaultduration = $instance->enrolperiod > 0 ? $instance->enrolperiod / 86400 : '';
     $modules = array('moodle-enrol_manual-quickenrolment', 'moodle-enrol_manual-quickenrolment-skin');
     $arguments = array('instances' => $instances, 'courseid' => $instance->courseid, 'ajaxurl' => '/enrol/manual/ajax.php', 'url' => $manager->get_moodlepage()->url->out(false), 'optionsStartDate' => $startdateoptions, 'defaultRole' => $instance->roleid, 'defaultDuration' => $defaultduration, 'defaultStartDate' => (int) $defaultstart, 'disableGradeHistory' => $CFG->disablegradehistory, 'recoverGradesDefault' => '', 'cohortsAvailable' => cohort_get_available_cohorts($manager->get_context(), COHORT_WITH_NOTENROLLED_MEMBERS_ONLY, 0, 1) ? true : false);
     if ($CFG->recovergradesdefault) {
         $arguments['recoverGradesDefault'] = ' checked="checked"';
     }
     $function = 'M.enrol_manual.quickenrolment.init';
     $button->require_yui_module($modules, $function, array($arguments));
     $button->strings_for_js(array('ajaxoneuserfound', 'ajaxxusersfound', 'ajaxnext25', 'enrol', 'enrolmentoptions', 'enrolusers', 'enrolxusers', 'errajaxfailedenrol', 'errajaxsearch', 'foundxcohorts', 'none', 'usersearch', 'unlimitedduration', 'startdatetoday', 'durationdays', 'enrolperiod', 'finishenrollingusers', 'recovergrades'), 'enrol');
     $button->strings_for_js(array('browseusers', 'browsecohorts'), 'enrol_manual');
     $button->strings_for_js('assignroles', 'role');
     $button->strings_for_js('startingfrom', 'moodle');
     return $button;
 }
开发者ID:pzhu2004,项目名称:moodle,代码行数:62,代码来源:lib.php


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