Beispiel #1
0
 function save($block_name, $data, $children)
 {
     PC::SAVING($data);
     $page_path = $this->BuilderEngine->get_page_path();
     PC::debug("blocks::save() looking for pending version of page path {$page_path}");
     if ($this->is_block_global($block_name)) {
         $pending_version = $this->versions->get_or_create_pending_version("layout");
     } else {
         $pending_version = $this->versions->get_or_create_pending_version($page_path);
     }
     $update_data = array('data' => $data);
     PC::debug("Saving block with version {$pending_version}");
     $this->db->where('name', $block_name);
     $this->db->where('version', $pending_version);
     //echo "Updating block $block_name with version $pending_version";
     $this->db->update('blocks', $update_data);
     $this->db->where('parent', $block_name);
     $this->db->where('version', $pending_version);
     $this->db->delete('block_relations');
     foreach ($children as $key => $childname) {
         $insert = array("parent" => $block_name, "child" => $childname, "version" => $pending_version, "sort_order" => $key);
         $this->db->insert('block_relations', $insert);
     }
 }