/** * set new status (saves in database) * @param status new status key to save * @param uid user ID, if not provided uses current user's ID */ public function set_status($status, $uid = null, $info = null) { if (is_null($uid)) { $uid = get_current_user_id(); } $obj = new tfk_project_status(); $obj->set('project_id', $this->get_uid()); $obj->set('log_date', 'NOW'); $obj->set('action_code', $status); $obj->set_object('user', $uid); if (!is_null($info)) { $obj->set('info', $info); } return $obj->insert('ignore'); }