示例#1
0
 /**
  * the singleton pattern
  *
  * @return Courses_Controller
  */
 public static function getInstance()
 {
     if (self::$_instance === NULL) {
         self::$_instance = new Courses_Controller();
     }
     return self::$_instance;
 }
 /**
  * Deletes a set of records.
  * 
  * If one of the records could not be deleted, no record is deleted
  * 
  * @param   array array of record identifiers
  * @return  void
  * @throws Tinebase_Exception_NotFound|Tinebase_Exception
  */
 public function delete($_ids)
 {
     $courses = $this->getMultiple($_ids);
     $groupsToDelete = array();
     $usersToDelete = array();
     foreach ($courses as $course) {
         $groupsToDelete[] = $course->group_id;
         $usersToDelete = array_merge($usersToDelete, $this->_groupController->getGroupMembers($course->group_id));
     }
     Courses_Controller::getInstance()->suspendEvents();
     $this->_userController->delete(array_unique($usersToDelete));
     $this->_groupController->delete(array_unique($groupsToDelete));
     Courses_Controller::getInstance()->resumeEvents();
     parent::delete($_ids);
 }