コード例 #1
0
ファイル: user.class.php プロジェクト: remotelearner/elis.cm
 public function delete()
 {
     global $CFG;
     $result = false;
     $muser = cm_get_moodleuserid($this->id);
     if (empty($muser) || !is_primary_admin($muser)) {
         $level = context_level_base::get_custom_context_level('user', 'block_curr_admin');
         $result = attendance::delete_for_user($this->id);
         $result = $result && curriculumstudent::delete_for_user($this->id);
         $result = $result && instructor::delete_for_user($this->id);
         $result = $result && student::delete_for_user($this->id);
         $result = $result && student_grade::delete_for_user($this->id);
         $result = $result && usertrack::delete_for_user($this->id);
         $result = $result && usercluster::delete_for_user($this->id);
         $result = $result && clusterassignment::delete_for_user($this->id);
         $result = $result && waitlist::delete_for_user($this->id);
         $result = $result && delete_context($level, $this->id);
         // Delete Moodle user.
         if ($muser = get_record('user', 'idnumber', $this->idnumber, 'mnethostid', $CFG->mnet_localhost_id, 'deleted', 0)) {
             $result = $result && delete_user($muser);
         }
         $result = $result && parent::delete();
     }
     return $result;
 }