/** * Jobs List * * @return void */ public function displayTask() { $this->view->filters = array('limit' => Request::getState($this->_option . '.' . $this->_controller . '.limit', 'limit', Config::get('list_limit'), 'int'), 'start' => Request::getState($this->_option . '.' . $this->_controller . '.limitstart', 'limitstart', 0, 'int'), 'sortby' => Request::getState($this->_option . '.' . $this->_controller . '.sortby', 'filter_order', 'added'), 'sortdir' => Request::getState($this->_option . '.' . $this->_controller . '.sortdir', 'filter_order_Dir', 'DESC'), 'category' => Request::getState($this->_option . '.' . $this->_controller . 'category', 'category', 'all'), 'filterby' => '', 'search' => urldecode(Request::getState($this->_option . '.' . $this->_controller . 'search', 'search', ''))); // Get data $obj = new Job($this->database); $this->view->rows = $obj->get_openings($this->view->filters, User::get('id'), 1); $this->view->total = $obj->get_openings($this->view->filters, User::get('id'), 1, '', 1); $this->view->config = $this->config; // Output the HTML $this->view->display(); }
/** * Introductory page/ Jobs list * * @return void */ public function displayTask() { // Incoming $subscriptionCode = Request::getVar('employer', ''); $action = Request::getVar('action', ''); // Push some styles to the template $this->css('introduction.css', 'system'); $this->css(); // Push some scripts to the template $this->js(); // Set page title $this->_buildTitle(); // Set the pathway $this->_buildPathway(); $model = new Employer($this->database); $employer = $subscriptionCode ? $model->getEmployer(0, $subscriptionCode) : ''; // Login? if ($action == 'login' && User::isGuest()) { $this->_msg = Lang::txt('COM_JOBS_MSG_PLEASE_LOGIN_OPTIONS'); $this->login(); return; } if (!User::isGuest() && ($this->_task == 'browse' or !$this->_allowSubscriptions)) { // save incoming prefs $this->_updatePrefs('job'); // get stored preferences $this->_getPrefs('job'); } // Get filters $filters = $this->_getFilters($this->_admin, 0, 1, 1); $filters['active'] = 1; // only show jobs that have open/unexpired search close date // Get data $obj = new Job($this->database); // Get jobs $adminoptions = $this->_task != 'browse' && $this->_allowSubscriptions ? 0 : $this->_admin; $jobs = $obj->get_openings($filters, User::get('id'), $adminoptions, $subscriptionCode); $total = $obj->get_openings($filters, User::get('id'), $adminoptions, $subscriptionCode, 1); // Initiate paging $jtotal = $this->_task != 'browse' && $this->_allowSubscriptions ? count($jobs) : $total; $pageNav = new \Hubzero\Pagination\Paginator($jtotal, $filters['start'], $filters['limit']); // Output HTML if ($this->_task != 'browse' && $this->_allowSubscriptions) { // Component introduction $view = new View(array('name' => 'intro')); $view->title = $this->_title; $view->config = $this->config; $view->option = $this->_option; $view->emp = $this->_emp; $view->admin = $this->_admin; $view->pageNav = $pageNav; $view->msg = $this->_msg; $view->display(); // Show latest jobs $view = new View(array('name' => 'jobs', 'layout' => 'latest')); $view->set('option', $this->_option)->set('filters', $filters)->set('config', $this->config)->set('task', $this->_task)->set('emp', $this->_emp)->set('jobs', $jobs)->set('admin', $this->admin)->display(); } else { // Jobs list $view = new View(array('base_path' => PATH_CORE . DS . 'components' . DS . 'com_jobs' . DS . 'site', 'name' => 'jobs', 'layout' => 'default')); $view->title = $this->_title; $view->config = $this->config; $view->option = $this->_option; $view->emp = $this->_emp; $view->admin = $this->_admin; $view->total = $jtotal; $view->pageNav = $pageNav; $view->jobs = $jobs; $view->mini = 0; $view->filters = $filters; $view->subscriptionCode = $subscriptionCode; $view->employer = $employer; $view->task = $this->_task; $view->display(); } return; }