Esempio n. 1
0
 public function save()
 {
     $this->db->trans_start();
     $children = array();
     foreach ($this->blocks as $child) {
         array_push($children, $child->name);
     }
     if ($this->is_new_block) {
         $data['name'] = $this->name;
         $data['global'] = $this->global ? 'yes' : 'no';
         $data['type'] = $this->type;
         $data['data'] = json_encode($this->data, JSON_HEX_QUOT | JSON_HEX_TAG);
         PC::SavingData($data['data']);
         $data['children'] = $children;
         $this->layout_system->blocks->create($data);
         $this->is_new_block = false;
     } else {
         PC::SavingData(json_encode($this->data, JSON_HEX_QUOT | JSON_HEX_TAG));
         $this->layout_system->blocks->save($this->name, json_encode($this->data, JSON_HEX_QUOT | JSON_HEX_TAG), $children);
     }
     $this->db->trans_complete();
 }