public function create_element($id_company, $panel, $type, $title, $ordering = 0) { $data = array('id_company' => $id_company, 'panel' => $panel, 'type' => $type, 'title' => $title, 'ordering' => $ordering); $id = parent::insert($data); return $id; }
public function create_notification($title, $message, $code = NULL, $category = NULL, $update = FALSE) { $category = is_null($category) ? 'Message' : $category; $code = is_null($code) ? 'ionize' : $code; $done = false; $where = array('title' => $title, 'category' => $category, 'code' => $code, 'read' => '0'); $data = array('date_creation' => date('Y-m-d H:i:s'), 'content' => $message); if ($update) { $existing = parent::get_row_array($where); if (!empty($existing)) { parent::update($where, $data); $done = TRUE; } } if (!$done) { $data = array_merge($where, $data); parent::insert($data); } }