|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00003 // This file is part of Moodle - http://moodle.org/ 00004 // 00005 // Moodle is free software: you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation, either version 3 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // Moodle is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 00017 00026 class completion_criteria_unenrol extends completion_criteria { 00027 00032 public $criteriatype = COMPLETION_CRITERIA_TYPE_UNENROL; 00033 00041 public static function fetch($params) { 00042 $params['criteriatype'] = COMPLETION_CRITERIA_TYPE_UNENROL; 00043 return self::fetch_helper('course_completion_criteria', __CLASS__, $params); 00044 } 00045 00053 public function config_form_display(&$mform, $data = null) { 00054 $mform->addElement('checkbox', 'criteria_unenrol', get_string('completiononunenrolment','completion')); 00055 00056 if ($this->id) { 00057 $mform->setDefault('criteria_unenrol', 1); 00058 } 00059 } 00060 00067 public function update_config(&$data) { 00068 if (!empty($data->criteria_unenrol)) { 00069 $this->course = $data->id; 00070 $this->insert(); 00071 } 00072 } 00073 00081 public function review($completion, $mark = true) { 00082 // Check enrolment 00083 return false; 00084 } 00085 00091 public function get_title() { 00092 return get_string('unenrol', 'enrol'); 00093 } 00094 00100 public function get_title_detailed() { 00101 return $this->get_title(); 00102 } 00103 00109 public function get_type_title() { 00110 return get_string('unenrol', 'enrol'); 00111 } 00112 00119 public function get_details($completion) { 00120 $details = array(); 00121 $details['type'] = get_string('unenrolment', 'completion'); 00122 $details['criteria'] = get_string('unenrolment', 'completion'); 00123 $details['requirement'] = get_string('unenrolingfromcourse', 'completion'); 00124 $details['status'] = ''; 00125 00126 return $details; 00127 } 00128 }