/** * Short description for 'getStats' * * Long description (if any) ... * * @param integer $itemid Job ID * @param string $category Job type * @param integer $admin Admin access? * @return mixed False if errors, Array upon success */ public function getStats($itemid = NULL, $category = 'employer', $admin = 0) { if ($itemid === NULL) { return false; } $stats = array('total_resumes' => 0, 'shortlisted' => 0, 'applied' => 0, 'bookmarked' => 0, 'total_viewed' => 0, 'total_shared' => 0, 'viewed_today' => 0, 'viewed_thisweek' => 0, 'viewed_thismonth' => 0, 'lastviewed' => ''); // get total resumes in the pool $row = new JobSeeker($this->_db); $filters = array('filterby' => 'all', 'sortby' => '', 'search' => '', 'category' => '', 'type' => ''); $stats['total_resumes'] = $row->countSeekers($filters); // get stats for employer if ($category == 'employer') { $filters['filterby'] = 'shortlisted'; $stats['shortlisted'] = $row->countSeekers($filters, $itemid); $filters['filterby'] = 'applied'; $itemid = $admin ? 1 : $itemid; $stats['applied'] = $row->countSeekers($filters, $itemid); } // get stats for seeker if ($category == 'seeker') { $stats['totalviewed'] = $this->getView($itemid, $category); $stats['viewed_today'] = $this->getView($itemid, $category, 'viewed', 'today'); $stats['viewed_thisweek'] = $this->getView($itemid, $category, 'viewed', 'thisweek'); $stats['viewed_thismonth'] = $this->getView($itemid, $category, 'viewed', 'thismonth'); $stats['shortlisted'] = $row->countShortlistedBy($itemid); } return $stats; }
/** * List of candidates * * @return void */ public function resumesTask() { // Push some styles to the template $this->css(); // Push some scripts to the template $this->js(); // Login required if (User::isGuest()) { \Notify::warning(Lang::txt('COM_JOBS_PLEASE_LOGIN_ACCESS_EMPLOYER')); $this->login(); return; } if ($this->_admin or $this->_emp) { // Set page title $this->_buildTitle(); // Set the pathway $this->_buildPathway(); // save incoming prefs $this->_updatePrefs(); // get stored preferences $this->_getPrefs(); // get filters $filters = self::_getFilters($this->_admin, $this->_emp); // get job types $jt = new JobType($this->database); $types = $jt->getTypes(); $types[0] = Lang::txt('COM_JOBS_TYPE_ANY'); // get job categories $jc = new JobCategory($this->database); $cats = $jc->getCats(); $cats[0] = Lang::txt('COM_JOBS_CATEGORY_ANY'); // get users with resumes $js = new JobSeeker($this->database); $seekers = $js->getSeekers($filters, User::get('id'), 0, $this->_masterAdmin); $total = $js->countSeekers($filters, User::get('id'), 0, $this->_masterAdmin); // Initiate paging $pageNav = new \Hubzero\Pagination\Paginator($total, $filters['start'], $filters['limit']); // Output HTML $this->view->config = $this->config; $this->view->admin = $this->_admin; $this->view->masterAdmin = $this->_masterAdmin; $this->view->title = $this->_title; $this->view->seekers = $seekers; $this->view->pageNav = $pageNav; $this->view->cats = $cats; $this->view->types = $types; $this->view->filters = $filters; $this->view->emp = $this->_emp; $this->view->option = $this->_option; $this->view->setName('resumes')->setLayout('default')->display(); } else { if ($this->_allowSubscriptions) { // need to subscribe first $employer = new Employer($this->database); if ($employer->loadEmployer(User::get('id'))) { //do we have a pending subscription? $subscription = new Subscription($this->database); if ($subscription->loadSubscription($employer->subscriptionid, User::get('id'), '', $status = array(0))) { App::redirect(Route::url('index.php?option=com_jobs&task=dashboard'), Lang::txt('COM_JOBS_WARNING_SUBSCRIPTION_PENDING'), 'warning'); return; } } // send to subscription page App::redirect(Route::url('index.php?option=com_jobs&task=subscribe')); } else { App::redirect(Route::url('index.php?option=com_jobs')); } } }