public function updatePage(DtoPage $p) { $data = array('title' => $p->getTitle(), 'body' => $p->getBody(), 'userid' => $p->getUserid(), 'seotitle' => $p->getSeotitle(), 'seodescription' => str_replace(array("\r", "\n"), " ", $p->getSeodescription())); $this->db->set('createddate', 'NOW()', FALSE); $this->db->where('pageid', $p->getPageid()); $this->db->update('PAGES', $data); }
public function addPage(DtoPage $pages) { $this->load->model("dto/Dtopage"); $this->db->trans_begin(); $page = array('userid' => $pages->getUserid(), 'seotitle' => $pages->getSeotitle(), 'seodescription' => $pages->getSeodescription()); $this->db->insert('PAGES', $page); $pageid = $this->db->insert_id(); foreach ($pages->getPagedetail() as $page) { $page["pageid"] = $pageid; $this->db->insert("PAGEDETAIL", $page); } if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); return FALSE; } else { $this->db->trans_commit(); return TRUE; } }