Exemplo n.º 1
0
 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     // renders the view file 'protected/views/site/index.php'
     // using the default layout 'protected/views/layouts/main.php'
     $cache_name = 'oprecx:Recruitment:active10';
     if (($recs = O::app()->cache->get($cache_name)) == false) {
         $recs = Recruitment::model()->findAll(array('condition' => 'reg_time_begin <= CURRENT_TIMESTAMP AND reg_time_end >= CURRENT_TIMESTAMP', 'order' => 'reg_time_end DESC', 'limit' => 10));
         O::app()->cache->set($cache_name, $recs);
     }
     $this->render('index', array('recs' => $recs));
 }
 public function init()
 {
     $params = $this->actionParams;
     if (isset($params['rec_name'])) {
         $this->_rec = Recruitment::model()->findByName($params['rec_name']);
         // Organizations::model()->findByAttributes(array('name' => $params['org']));
         if (null == $this->_rec) {
             throw new CHttpException(404, O::t('oprecx', 'Recruitment {rec} Not Found.', array('{rec}' => $params['rec_name'])));
         }
         try {
             $timezone = $this->_rec->timezone;
             O::app()->setTimeZone($timezone);
         } catch (Exception $e) {
             O::log('Setting timezone failed');
         }
     } else {
         throw new CHttpException(404, O::t('oprecx', 'Page Not Found "{action}".'));
     }
     //$this->isWizard = isset($params['wiz']) && $params['wiz'] == 1;
     //var_dump($this->actionParams);
 }
Exemplo n.º 3
0
 /**
  * 
  * @return Recruitment[]
  */
 public function getMyRecruitments($limit = FALSE)
 {
     return Recruitment::model()->populateRecords(CDbCommandEx::create()->select('o.id, o.name, o.full_name')->from(TableNames::RECRUITMENT_as('o'))->join(TableNames::REC_ADMIN . ' oa', 'oa.rec_id = $o.id')->where('$oa.user_id = :user_id', array('user_id' => O::app()->user->id))->order('o.updated DESC')->queryAll());
 }