Beispiel #1
0
 /**
  * Store changes to this offering
  *
  * @param     boolean $check Perform data validation check?
  * @return    boolean False if error, True on success
  */
 public function store($check = true)
 {
     $isNew = $this->get('id') ? false : true;
     $value = parent::store($check);
     $this->importPlugin('courses')->trigger('onAfterSaveSection', array($this, $isNew));
     if ($isNew) {
         $this->log($this->get('id'), $this->_scope, 'create');
     }
     return $value;
 }
Beispiel #2
0
 /**
  * Store changes to this entry
  *
  * @param   boolean $check Perform data validation check?
  * @return  boolean False if error, True on success
  */
 public function store($check = true)
 {
     $value = parent::store($check);
     if ($value && $this->get('section_id')) {
         $dt = new Tables\SectionDate($this->_db);
         $dt->load($this->get('id'), $this->_scope, $this->get('section_id'));
         $dt->set('publish_up', $this->get('publish_up'));
         $dt->set('publish_down', $this->get('publish_down'));
         if (!$dt->get('id')) {
             $dt->set('section_id', $this->get('section_id'));
             $dt->set('scope', $this->_scope);
             $dt->set('scope_id', $this->get('id'));
             $dt->set('created', Date::toSql());
             $dt->set('created_by', User::get('id'));
         }
         if (!$dt->store()) {
             $this->setError($dt->getError());
         }
     }
     if ($value) {
         $this->importPlugin('courses')->trigger('onUnitSave', array($this));
     }
     return $value;
 }
 /**
  * Store record in the database
  *
  * @param   boolean $check Perform data validation?
  * @return  boolean
  */
 public function store($check = true)
 {
     if (is_object($this->get('properties'))) {
         $this->set('properties', json_encode($this->get('properties')));
     }
     return parent::store($check);
 }
Beispiel #4
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);
 }
Beispiel #5
0
 /**
  * Store changes to this entry
  *
  * @param   boolean $check Perform data validation check?
  * @return  boolean False if error, True on success
  */
 public function store($check = true)
 {
     $value = parent::store($check);
     if ($value && $this->get('section_id')) {
         $dt = new Tables\SectionDate($this->_db);
         $dt->load($this->get('id'), $this->_scope, $this->get('section_id'));
         $dt->set('publish_up', $this->get('publish_up'));
         $dt->set('publish_down', $this->get('publish_down'));
         if (!$dt->store()) {
             $this->setError($dt->getError());
         }
     }
     $properties = get_object_vars($this->_tbl);
     foreach ($properties as $k => $v) {
         $kname = substr($k, 2);
         if (!empty($kname) && array_key_exists($kname, self::$_aux_tablekeys)) {
             $key = $kname;
             $key = str_replace('_', ' ', $key);
             $key = ucwords($key);
             $key = str_replace(' ', '', $key);
             $tbl = "Components\\Courses\\Tables\\{$key}";
             $tbl = new $tbl($this->_db);
             if ($v == 'delete') {
                 $aux = array();
                 foreach (self::$_aux_tablekeys[$kname] as $item) {
                     $k = $item;
                     if ($item == 'id') {
                         $k = $this->_scope . '_' . $item;
                     }
                     $aux[$k] = $this->get((string) $item);
                 }
                 $tbl->load($aux);
                 $tbl->delete();
             } else {
                 $tbl->save($v);
             }
         }
     }
     return $value;
 }