/**
  * Services 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'), 'sort' => Request::getState($this->_option . '.' . $this->_controller . '.sort', 'filter_order', 'category'), 'sort_Dir' => Request::getState($this->_option . '.' . $this->_controller . '.sortdir', 'filter_order_Dir', 'ASC'));
     // get all available services
     $objS = new Service($this->database);
     $this->view->rows = $objS->getServices('', 1, '', $this->view->filters['sort'], $this->view->filters['sort_Dir'], '', 1);
     $this->view->total = $this->view->rows ? count($this->view->rows) : 0;
     // Set any errors
     foreach ($this->getErrors() as $error) {
         $this->view->setError($error);
     }
     // Output the HTML
     $this->view->display();
 }
Exemple #2
0
 /**
  * Subscription form
  *
  * @return     void
  */
 public function subscribeTask()
 {
     // Login required
     if (User::isGuest()) {
         \Notify::warning(Lang::txt('COM_JOBS_PLEASE_LOGIN_ACCESS_EMPLOYER'));
         $this->login();
         return;
     }
     // are we viewing other person's subscription? (admins only)
     $uid = Request::getInt('uid', 0);
     if ($uid && User::get('id') != $uid && !$this->_admin) {
         // not authorized
         App::abort(403, Lang::txt('COM_JOBS_ALERTNOTAUTH'));
     }
     $uid = $uid ? $uid : User::get('id');
     // Set page title
     $this->_buildTitle();
     // Set the pathway
     $this->_buildPathway();
     // Push some styles to the template
     $this->css();
     // Push some scripts to the template
     $this->js();
     // Get the member's info
     $profile = new \Hubzero\User\Profile();
     $profile->load($uid);
     // load Employer
     $employer = new Employer($this->database);
     if (!$employer->loadEmployer($uid)) {
         $employer = new Employer($this->database);
         $employer->uid = $uid;
         $employer->subscriptionid = 0;
         $employer->companyName = $profile->get('organization');
         $employer->companyLocation = $profile->get('countryresident');
         $employer->companyWebsite = $profile->get('url');
     }
     // do we have an active subscription already?
     $subscription = new Subscription($this->database);
     if (!$subscription->loadSubscription($employer->subscriptionid, '', '', $status = array(0, 1))) {
         $subscription = new Subscription($this->database);
         $subscription->uid = $uid;
         $subscription->serviceid = 0;
     }
     // get subscription options
     $objS = new Service($this->database);
     $specialgroup = $this->config->get('specialgroup', '');
     if ($specialgroup) {
         $sgroup = \Hubzero\User\Group::getInstance($specialgroup);
         if (!$sgroup) {
             $specialgroup = '';
         }
     }
     $services = $objS->getServices('jobs', 1, 1, 'ordering', 'ASC', $specialgroup);
     if (!$services) {
         // setup with default info
         $this->_setupServices();
     }
     // check available user funds (if paying with points)
     $BTL = new \Hubzero\Bank\Teller($this->database, $subscription->uid);
     $balance = $BTL->summary();
     $credit = $BTL->credit_summary();
     $funds = $balance;
     $funds = $funds > 0 ? $funds : '0';
     // Output HTML
     $this->view->title = $this->_title;
     $this->view->config = $this->config;
     $this->view->subscription = $subscription;
     $this->view->employer = $employer;
     $this->view->services = $services;
     $this->view->funds = $funds;
     $this->view->uid = $uid;
     $this->view->emp = $this->_emp;
     $this->view->admin = $this->_admin;
     $this->view->task = $this->_task;
     $this->view->option = $this->_option;
     // Set any errors
     if ($this->getError()) {
         \Notify::error($this->getError());
     }
     $this->view->setName('subscribe')->setLayout('default')->display();
 }