Ejemplo n.º 1
0
 public function save($item_params = '*')
 {
     $db = Zend_Registry::get('db');
     $mapper = new SxModule_Pageform_Field_Mapper();
     $field = new SxModule_Pageform_Field();
     $field->setTsl($this);
     $item = $mapper->toArray($field, 'tsl');
     if (is_array($item_params)) {
         $item = $mapper->fromInput($item, $item_params);
     }
     if ($this->getId()) {
         $item['pfft_date_updated'] = new Zend_Db_Expr('NOW()');
         $db->update($this->_tablename(), $item, $this->_primary_key() . ' = ' . (int) $this->getId());
     } else {
         $item['pfft_date_created'] = new Zend_Db_Expr('NOW()');
         $item['pfft_date_updated'] = '0000-00-00 00:00:00';
         $config = Zend_Registry::get('config');
         foreach ($config->system->language as $lng => $slng) {
             $item['pfft_language'] = $lng;
             $db->insert($this->_tablename(), $item);
         }
     }
     return $this;
 }
Ejemplo n.º 2
0
 public function save($item_params = '*')
 {
     $db = Zend_Registry::get('db');
     $mapper = new SxModule_Pageform_Field_Mapper();
     $item = $mapper->toArray($this, 'item');
     if (is_array($item_params)) {
         $item = $mapper->fromInput($item, $item_params);
     }
     if ($this->getId()) {
         $item['pff_date_updated'] = new Zend_Db_Expr('NOW()');
         $db->update($this->_tablename(), $item, $this->_primary_key() . ' = ' . (int) $this->getId());
     } else {
         $item['pff_date_created'] = new Zend_Db_Expr('NOW()');
         $item['pff_date_updated'] = '0000-00-00 00:00:00';
         $db->insert($this->_tablename(), $item);
         $this->setId($db->lastInsertId());
     }
     return $this;
 }