本文整理汇总了PHP中student::count_enroled方法的典型用法代码示例。如果您正苦于以下问题:PHP student::count_enroled方法的具体用法?PHP student::count_enroled怎么用?PHP student::count_enroled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类student
的用法示例。
在下文中一共展示了student::count_enroled方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validation
/**
* make sure the start time is before the end time and the start date is before the end date for the class
* @param array $data
* @param mixed $files
* @return array
*/
function validation($data, $files)
{
global $CURMAN;
$errors = parent::validation($data, $files);
if ($CURMAN->db->record_exists_select(CLSTABLE, "idnumber = '{$data['idnumber']}'" . ($data['id'] ? " AND id != {$data['id']}" : ''))) {
$errors['idnumber'] = get_string('idnumber_already_used', 'block_curr_admin');
}
if ($data['starttime'] > $data['endtime']) {
$errors['starttime'] = get_string('error_duration', 'block_curr_admin');
}
if (!empty($data['startdate']) && !empty($data['enddate']) && !empty($data['disablestart']) && !empty($data['disableend'])) {
if ($data['startdate'] > $data['enddate']) {
$errors['start'] = get_string('error_date_range', 'block_curr_admin');
}
}
if (!empty($this->_customdata['obj']) && !empty($this->_customdata['obj']->maxstudents)) {
if ($data['maxstudents'] < $this->_customdata['obj']->maxstudents && $data['maxstudents'] < student::count_enroled($this->_customdata['obj']->id)) {
$context = get_context_instance(CONTEXT_SYSTEM);
if (!has_capability('block/curr_admin:overrideclasslimit', $context)) {
$errors['maxstudents'] = get_string('error_n_overenrol', 'block_curr_admin');
}
}
}
return $errors;
}
示例2: delete
/**
* Perform all necessary tasks to remove a student enrolment from the system.
*/
function delete()
{
/// Remove any grade records for this enrolment.
$result = student_grade::delete_for_user_and_class($this->userid, $this->classid);
/// Unenrol them from the Moodle class.
if (!empty($this->classid) && !empty($this->userid) && ($moodlecourseid = get_field('crlm_class_moodle', 'moodlecourseid', 'classid', $this->classid)) && ($muserid = cm_get_moodleuserid($this->userid))) {
$context = get_context_instance(CONTEXT_COURSE, $moodlecourseid);
if ($context && $context->id) {
role_unassign(0, $muserid, 0, $context->id);
}
}
$result = $result && $this->data_delete_record();
if ($this->completestatusid == STUSTATUS_NOTCOMPLETE) {
$cmclass = new cmclass($this->classid);
if (empty($cmclass->maxstudents) || $cmclass->maxstudents > student::count_enroled($cmclass->id)) {
$wlst = waitlist::get_next($this->classid);
if (!empty($wlst)) {
$wlst->enrol();
}
}
}
return $result;
}
示例3: get_item_display_options
function get_item_display_options($column, $class)
{
$classobj = new pmclass($class);
if (!$classobj->is_enrollable()) {
return get_string('notenrollable', 'enrol');
}
if (student::count_enroled($class->id) < $class->maxstudents || empty($class->maxstudents)) {
$action = 'savenew';
} else {
$action = 'confirmwaitlist';
}
return '<a href="index.php?s=crscat&section=curr&clsid=' . "{$class->id}&action={$action}\">" . get_string('choose') . '</a>';
}
示例4: check_autoenrol_after_course_completion
public static function check_autoenrol_after_course_completion($enrolment)
{
if ($enrolment->completestatusid != STUSTATUS_NOTCOMPLETE) {
$pmclass = new pmclass($enrolment->classid);
$pmclass->load();
if ((empty($pmclass->maxstudents) || $pmclass->maxstudents > student::count_enroled($pmclass->id)) && !empty($pmclass->enrol_from_waitlist)) {
$wlst = waitlist::get_next($enrolment->classid);
if (!empty($wlst)) {
$crsid = $pmclass->course->id;
foreach ($pmclass->course->curriculumcourse as $curcrs) {
if ($curcrs->courseid == $crsid && $curcrs->prerequisites_satisfied($wlst->userid)) {
$wlst->enrol();
}
}
}
}
}
return true;
}
示例5: validation
/**
* make sure the start time is before the end time and the start date is before the end date for the class
* @param array $data
* @param mixed $files
* @return array
*/
function validation($data, $files)
{
global $DB;
$errors = parent::validation($data, $files);
$sql = 'idnumber = ?';
$params = array($data['idnumber']);
if ($data['id']) {
$sql .= ' AND id != ?';
$params[] = $data['id'];
}
if ($DB->record_exists_select(pmclass::TABLE, $sql, $params)) {
$errors['idnumber'] = get_string('idnumber_already_used', 'local_elisprogram');
}
if (isset($data['starttime']) && isset($data['endtime'])) {
if ($data['starttime'] > $data['endtime']) {
$errors['starttime'] = get_string('error_duration', 'local_elisprogram');
}
if (!empty($data['startdate']) && !empty($data['enddate']) && !empty($data['disablestart']) && !empty($data['disableend'])) {
if ($data['startdate'] > $data['enddate']) {
$errors['start'] = get_string('error_date_range', 'local_elisprogram');
}
}
}
if (!empty($this->_customdata['obj']) && !empty($this->_customdata['obj']->maxstudents)) {
if ($data['maxstudents'] < $this->_customdata['obj']->maxstudents && $data['maxstudents'] < student::count_enroled($this->_customdata['obj']->id)) {
$context = context_system::instance();
if (!has_capability('local/elisprogram:overrideclasslimit', $context)) {
$errors['maxstudents'] = get_string('error_n_overenrol', 'local_elisprogram');
}
}
}
$errors += parent::validate_custom_fields($data, 'class');
return $errors;
}
示例6: check_autoenrol_after_course_completion
public function check_autoenrol_after_course_completion($enrolment)
{
if ($enrolment->completestatusid != STUSTATUS_NOTCOMPLETE) {
$cmclass = new cmclass($enrolment->classid);
if ((empty($cmclass->maxstudents) || $cmclass->maxstudents > student::count_enroled($cmclass->id)) && !empty($cmclass->enrol_from_waitlist)) {
$wlst = waitlist::get_next($enrolment->classid);
if (!empty($wlst)) {
$wlst->enrol();
}
}
}
return true;
}