public function action_form() { $cli = new Model_Client(); $clients = $cli->where('SITUACAO', '=', 'A')->order_by('NOME')->find_all()->as_array('CODIGO', 'NOME'); $users = ORM::factory('user')->where('INATIVO', 'IS', NULL)->or_where('INATIVO', '=', 0)->order_by('USUARIO')->find_all()->as_array('RECNO', 'USUARIO'); $this->request->response = View::factory('report.form')->bind('clients', $clients)->bind('users', $users); }
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); }