public function updateMenu(DtoMenu $m) { $subof = null; if ($m->getSubof() != '') { $subof = $m->getSubof(); } $data = array('title' => $m->getTitle(), 'linkto' => $m->getLinkto(), 'ordering' => $m->getOrdering(), 'subof' => $subof); $this->db->where('menuid', $m->getMenuid()); return $this->db->update('MENUS', $data); }
public function updateMenu(DtoMenu $menus) { $this->db->trans_begin(); $menuid = $menus->getMenuid(); // UPDATE MENU $menu = array("ordering" => $menus->getOrdering(), "linkto" => $menus->getLinkto(), "level" => $menus->getLevel() == "" ? '0' : $menus->getLevel(), "subof" => $menus->getSubof() == "" ? null : $menus->getSubof()); $this->db->where('menuid', $menuid); $this->db->update('MENUS', $menu); // UDPDATE MAIN MENU foreach ($menus->getMenuDetails() as $menuDetails) { $this->db->where('menuid', $menuid); $this->db->where('languageid', $menuDetails['languageid']); $this->db->update('MENUDETAIL', $menuDetails); } if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); return FALSE; } else { $this->db->trans_commit(); return TRUE; } }