public function action_index() { $this->session = Session::instance(); if (!$this->session->get('tsuser')) { $this->request->redirect('user/login'); } $user_id = $this->session->get('tsuser'); $user = new Model_User($user_id); $nome = $user->NOME; $depto = $user->DEPTO; $this->session->set('tsdepto', $user->DEPTO); $cli = new Model_Client(); $clients = $cli->actives($user->DEPTO); $cli = new Model_Client(); $clients_all = $cli->where('SITUACAO', '=', 'A')->order_by('NOME')->find_all()->as_array('CODIGO', 'NOME'); $task = new Model_Task(); $tasks = $task->where('user_id', '=', $user->RECNO)->where('active', '=', 1)->find_all(); $pitDefault = $this->pitDef($user->DEPTO); $this->request->response = View::factory('timesheet.index')->bind('clients', $clients)->bind('tasks', $tasks)->bind('nome', $nome)->bind('depto', $depto)->bind('pitDefault', $pitDefault)->bind('clients_all', $clients_all)->bind('user', $user_id); }
public function get_tasks_completed($user_id = 0, $date = '') { $tasks = new Model_Task(); return $tasks->where('deleted', '=', FALSE)->where('complete', '=', TRUE)->where('list_id', '=', $this->id)->where('user_id', '=', (int) $user_id)->order_by('sequence', 'ASC')->where_date($date)->find_all(); }