Esempio n. 1
0
 /**
  * Overrides the database connector insert method
  *
  * @return	mixed	Database connector return value
  */
 public function insert($table, $data, $quote = true)
 {
     if (!$this->isTableTranslatable($table)) {
         $ret = parent::insert($table, $data, $quote);
         $this->_last_insert_id = $this->_object->insertid();
         return $ret;
     }
     $this->_lang_syncing = true;
     //turn on lang syncing
     $result = parent::insert($table, $data, $quote);
     $this->_lang_syncing = false;
     //turn off lang syncing (default)
     if ($result !== false) {
         //Get the primary key and value
         $unique_column = $this->_avail_tables[$table]->unique_column;
         $title_column = $this->_avail_tables[$table]->title_column;
         $data[$unique_column] = $this->_object->insertid();
         $user = KFactory::get('lib.joomla.user');
         // insert in the nodes table
         $node_data = array('iso_code' => $this->_lang_active, 'table_name' => $table, 'row_id' => $data[$unique_column], 'title' => $data[$title_column], 'created' => $this->getNow(), 'created_by' => $user->id, 'modified' => $this->getNow(), 'modified_by' => $user->id, 'status' => Nooku::STATUS_COMPLETED, 'original' => 1);
         $nodes = KFactory::get('admin::com.nooku.table.nodes');
         $nodes->insert($node_data);
         foreach (array_keys($this->_languages) as $language) {
             if ($language == $this->_lang_active) {
                 continue;
             }
             // insert in the log
             $node_data['iso_code'] = $language;
             $node_data['status'] = Nooku::STATUS_MISSING;
             $node_data['original'] = 0;
             $nodes->insert($node_data);
         }
         $this->_last_insert_id = $data[$unique_column];
     }
     return $result;
 }