Ejemplo n.º 1
0
 /**
  * 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;
 }
Ejemplo n.º 2
0
 /**
  * Render a tag cloud
  *
  * @param   string   $rtrn     Format to render
  * @param   array    $filters  Filters to apply
  * @param   boolean  $clear    Clear cached data?
  * @return  string
  */
 public function render($rtrn = 'html', $filters = array(), $clear = false)
 {
     switch (strtolower($rtrn)) {
         case 'string':
             if (!isset($this->_cache['tags.string']) || $clear) {
                 $tags = array();
                 foreach ($this->tags('list', $filters, $clear) as $tag) {
                     $tags[] = $tag->get('raw_tag');
                 }
                 $this->_cache['tags.string'] = implode(', ', $tags);
             }
             return $this->_cache['tags.string'];
             break;
         case 'array':
             $tags = array();
             foreach ($this->tags('list', $filters, $clear) as $tag) {
                 $tags[] = $tag->get('tag');
             }
             return $tags;
             break;
         case 'cloud':
         case 'html':
         default:
             if (!isset($this->_cache['tags.cloud']) || $clear) {
                 $view = new View(array('base_path' => PATH_CORE . '/components/com_tags/site', 'name' => 'tags', 'layout' => '_cloud'));
                 $view->set('config', $this->_config)->set('tags', $this->tags('list', $filters, $clear));
                 $this->_cache['tags.cloud'] = $view->loadTemplate();
             }
             return $this->_cache['tags.cloud'];
             break;
     }
 }