/** * Default view function * * @return void */ public function displayTask() { $filters = Filters::getFilters("{$this->_option}.{$this->_controller}"); $tasks = Task::all(); // Take filters and apply them to the tasks if ($filters['search']) { foreach ($filters['search'] as $term) { $tasks->where('name', 'LIKE', "%{$term}%"); } } if ($filters['q']) { foreach ($filters['q'] as $q) { $tasks->where($q['column'], $q['o'], $q['value']); } } // Display $this->view->filters = $filters; $this->view->tasks = $tasks->paginated()->ordered()->including('liaison', 'assignee', 'hub'); $this->view->display(); }
} ?> </select> </label> <label for="task_id"><?php echo Lang::txt('PLG_SUPPORT_TIME_TASK'); ?> : <select name="task_id" id="task_id"> <option value=""><?php echo Lang::txt('PLG_SUPPORT_TIME_NO_HUB_SELECTED'); ?> </option> <?php foreach ($tasks = Task::all()->order('name', 'asc') as $task) { ?> <option value="<?php echo $task->id; ?> "> <?php echo $task->name; ?> </option> <?php } ?> <?php if (!$tasks->count()) { ?>
} ?> </select> </div> <div class="grouping"> <label for="task_id"><?php echo Lang::txt('PLG_TIME_SUMMARY_TASK_NAME'); ?> : </label> <select name="task_id" id="task_id"> <option value=""><?php echo Lang::txt('PLG_TIME_SUMMARY_NO_TASK_SELECTED'); ?> </option> <?php $tasks = Task::all()->order('name', 'asc'); ?> <?php if ($this->hub_id) { $tasks->whereEquals('hub_id', $this->hub_id); } ?> <?php foreach ($tasks as $task) { ?> <?php if ($this->permissions->can('view.report', 'hub', $task->hub_id)) { ?> <option value="<?php echo $task->id; ?>
<?php echo Lang::txt('COM_TIME_OVERVIEW_TASK'); ?> : <span class="task-error error-message"><?php echo Lang::txt('COM_TIME_OVERVIEW_PLEASE_SELECT_TASK'); ?> </span> </label> <select name="task_id" id="task_id" tabindex="2"> <option value=""><?php echo Lang::txt('COM_TIME_RECORDS_NO_HUB_SELECTED'); ?> </option> <?php foreach ($tasks = Task::all()->ordered() as $task) { ?> <option value="<?php echo $task->id; ?> "> <?php echo $task->name; ?> </option> <?php } ?> <?php if (!$tasks->count()) { ?>
/** * Lists all applicable tasks * * @apiMethod GET * @apiUri /time/indexTasks * @apiParameter { * "name": "hid", * "description": "Hub id", * "type": "integer", * "required": false, * "default": null * } * @apiParameter { * "name": "pactive", * "description": "Task active status", * "type": "integer", * "required": false, * "default": null * } * @apiParameter { * "name": "limit", * "description": "Maximim number of tasks to return", * "type": "integer", * "required": false, * "default": 1000 * } * @apiParameter { * "name": "start", * "description": "Task index to start at (for pagination)", * "type": "integer", * "required": false, * "default": 0 * } * @apiParameter { * "name": "orderby", * "description": "Field by which to order results", * "type": "string", * "required": false, * "default": "id" * } * @apiParameter { * "name": "orderdir", * "description": "Direction by which to order results", * "type": "string", * "required": false, * "default": "asc" * } * @return void */ public function indexTasksTask() { // Require authentication and authorization $this->requiresAuthentication(); $this->authorizeOrFail(); $task = Task::all(); if ($hub_id = Request::getInt('hid', false)) { $task->whereEquals('hub_id', $hub_id); } if ($active = Request::getInt('pactive', false)) { $task->whereEquals('active', $active); } if ($limit = Request::getInt('limit', 1000)) { $task->limit($limit); } if ($start = Request::getInt('start', 0)) { $task->start($start); } if (($orderby = Request::getCmd('orderby', 'name')) && ($orderdir = Request::getCmd('orderdir', 'asc'))) { $task->order($orderby, $orderdir); } // Create object with tasks property $response = new stdClass(); $response->tasks = $task->rows()->toObject(); // Return object $this->send($response); }