예제 #1
0
 /**
  * Store changes to this offering
  *
  * @param     boolean $check Perform data validation check?
  * @return    boolean False if error, True on success
  */
 public function delete()
 {
     // Remove associated date data
     $sd = new Tables\SectionDate($this->_db);
     if (!$sd->deleteBySection($this->get('id'))) {
         $this->setError($sd->getError());
         return false;
     }
     // Remove associated member data
     $sm = new Tables\Member($this->_db);
     if (!$sm->deleteBySection($this->get('id'))) {
         $this->setError($sm->getError());
         return false;
     }
     $value = parent::delete();
     $this->importPlugin('courses')->trigger('onAfterDeleteSection', array($this));
     return $value;
 }
예제 #2
0
 /**
  * Remove one or more users from the course manager list
  *
  * @return  void
  */
 public function updateTask()
 {
     // Check for request forgeries
     Request::checkToken();
     // Incoming member ID
     $id = Request::getInt('id', 0);
     if (!$id) {
         $this->setError(Lang::txt('COM_COURSES_ERROR_MISSING_COURSE'));
         $this->displayTask();
         return;
     }
     $model = Course::getInstance($id);
     $entries = Request::getVar('entries', array(0), 'post');
     require_once dirname(dirname(__DIR__)) . DS . 'tables' . DS . 'member.php';
     foreach ($entries as $key => $data) {
         // Retrieve user's account info
         $tbl = new Tables\Member($this->database);
         $tbl->load($data['user_id'], $data['course_id'], $data['offering_id'], $data['section_id'], 0);
         if ($tbl->role_id == $data['role_id']) {
             continue;
         }
         $tbl->role_id = $data['role_id'];
         if (!$tbl->store()) {
             $this->setError($tbl->getError());
         }
     }
     // Push through to the hosts view
     $this->displayTask();
 }