Ejemplo n.º 1
0
 /**
  * called when the element is saved
  * * // @TODO this wont work for j1.6 - need to test it
  */
 function onSave($data)
 {
     $params = json_decode($data['params']);
     if (!$this->isJoin()) {
         $element = $this->getElement();
         //load join based on this element id
         $join =& FabTable::getInstance('Join', 'FabrikTable');
         $key = array('element_id' => $data['id']);
         $join->load($key);
         if ($join->element_id == 0) {
             $join->element_id = $this->_id;
         }
         $join->table_join = $params->join_db_name;
         $join->join_type = 'left';
         $join->group_id = $data['group_id'];
         $join->table_key = str_replace('`', '', $element->name);
         $join->table_join_key = $params->join_key_column;
         $join->join_from_table = '';
         $o = new stdClass();
         $l = 'join-label';
         $o->{$l} = $params->join_val_column;
         $o->type = 'element';
         $join->params = json_encode($o);
         $join->store();
     }
     return parent::onSave();
 }
Ejemplo n.º 2
0
 /**
  * Called when the element is saved
  *
  * @param   array  $data  posted element save data
  *
  * @return  bool  save ok or not
  */
 public function onSave($data)
 {
     $params = json_decode($data['params']);
     if (!$this->isJoin()) {
         $this->updateFabrikJoins($data, $this->getDbName(), $params->join_key_column, $params->join_val_column);
     }
     return parent::onSave();
 }