Esempio n. 1
0
 /**
  * Constructor
  *
  * @param      integer $id  Resource ID or alias
  * @param      object  $course
  * @return     void
  */
 public function __construct($oid = null, $course = null)
 {
     // Save course for quick reference
     $this->course = $course;
     parent::__construct($oid);
 }
Esempio n. 2
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;
 }
Esempio n. 3
0
 /**
  * Store
  *
  * @param      bool $check
  * @return     void
  */
 public function store($check = true)
 {
     // See if we should save criteria text as well
     if ($this->get('criteria_text_new')) {
         // We'll always save a new entry if the text is changing
         $criteria = new Tables\SectionBadgeCriteria($this->_db);
         $criteria->set('text', $this->get('criteria_text_new'));
         $criteria->set('section_badge_id', $this->get('id'));
         $criteria->store();
         $this->set('criteria_id', $criteria->get('id'));
     }
     return parent::store($check);
 }
Esempio n. 4
0
 /**
  * Delete an entry and associated data
  *
  * @return  boolean True on success, false on error
  */
 public function delete()
 {
     // Remove all children
     foreach ($this->assetgroups() as $group) {
         if (!$group->delete()) {
             $this->setError($group->getError());
         }
     }
     // Remove all assets
     foreach ($this->assets() as $asset) {
         if (!$asset->delete()) {
             $this->setError($asset->getError());
         }
     }
     // Remove dates
     if ($this->get('section_id')) {
         $dt = new Tables\SectionDate($this->_db);
         $dt->load($this->get('id'), $this->_scope, $this->get('section_id'));
         if (!$dt->delete()) {
             $this->setError($dt->getError());
         }
     }
     $this->importPlugin('courses')->trigger('onUnitDelete', array($this));
     // Remove this record from the database and log the event
     return parent::delete();
 }
Esempio n. 5
0
 /**
  * Delete an entry and associated data
  *
  * @return     boolean True on success, false on error
  */
 public function delete()
 {
     $this->importPlugin('courses')->trigger('onCourseDelete', array($this));
     return parent::delete();
 }
Esempio n. 6
0
 /**
  * Delete a certificate
  * 
  * @return  boolean True on success, false on error
  */
 public function delete()
 {
     // Remove files
     $path = $this->path('system');
     if (is_dir($path)) {
         // Attempt to delete the file
         if (!\Filesystem::deleteDirectory($path)) {
             $this->setError(Lang::txt('Unable to remove upload directory and files for certificate.'));
             return false;
         }
     }
     // Remove this record from the database and log the event
     return parent::delete();
 }
Esempio n. 7
0
 /**
  * Delete an entry and associated data
  *
  * @return  boolean True on success, false on error
  */
 public function delete()
 {
     // Remove gradebook information
     return parent::delete();
 }
Esempio n. 8
0
 /**
  * Delete an entry and associated data
  *
  * @return     boolean True on success, false on error
  */
 public function delete()
 {
     // Remove pages
     foreach ($this->pages(array('active' => array(0, 1)), true) as $page) {
         if (!$page->delete()) {
             $this->setError($page->getError());
         }
     }
     // Remove announcements
     foreach ($this->announcements(array('section_id' => -1, 'state' => -1)) as $announcement) {
         if (!$announcement->delete()) {
             $this->setError($announcement->getError());
         }
     }
     // Remove any units
     foreach ($this->units(array('section_id' => -1), true) as $unit) {
         if (!$unit->delete()) {
             $this->setError($unit->getError());
         }
     }
     // Remove sections
     // Each section will also remove any students in that section
     foreach ($this->sections() as $section) {
         if (!$section->delete()) {
             $this->setError($section->getError());
         }
     }
     $value = parent::delete();
     $this->importPlugin('courses')->trigger('onOfferingDelete', array($this));
     return $value;
 }
Esempio n. 9
0
 /**
  * Delete an asset
  *   Deleted asset_associations until there is only one
  *   association left, then it deletes the association,
  *   the asset record, and asset file(s)
  *
  * @return  boolean True on success, false on error
  */
 public function delete()
 {
     // Remove dates
     if ($this->get('section_id')) {
         $dt = new Tables\SectionDate($this->_db);
         $dt->load($this->get('id'), $this->_scope, $this->get('section_id'));
         if (!$dt->delete()) {
             $this->setError($dt->getError());
         }
     }
     // Remove this record from the database and log the event
     return parent::delete();
 }