Пример #1
0
 /**
  * Module statistic
  *
  * @return array of stats
  */
 public function Stats()
 {
     if (!($stats = Cache::GetArrayCache('stats'))) {
         $vac_all = $this->dbase->SelectOne('job_vacancies', array('count' => 'COUNT(*)'));
         $vac_on_site = $this->dbase->SelectOne('job_vacancies', array('count' => 'COUNT(*)'), array('allow_site' => 1));
         $this->dbase->SetWhere('add_date', $this->dbase->timer->cur_time - 24 * 60 * 60, ">");
         $vac_today = $this->dbase->SelectOne('job_vacancies', array('count' => 'COUNT(*)'));
         $this->dbase->SetBeginBlockWhere();
         $this->dbase->SetWhere("date_exp", $this->dbase->timer->cur_time, '>');
         $this->dbase->SetWhere("vac_", '', "=", 'job_vacancies', 'OR');
         $this->dbase->SetEndBlockWhere();
         $vac_no_moder = $this->dbase->SelectOne("job_vacancies", array("count" => "COUNT(*)"), array('allow_site' => 0));
         $vac_max = $this->dbase->SelectOne('job_vacancies', array('max' => 'MAX(id)'));
         $res_all = $this->dbase->SelectOne('job_resumes', array('count' => 'COUNT(*)'));
         $res_on_site = $this->dbase->SelectOne('job_resumes', array('count' => 'COUNT(*)'), array('allow_site' => 1));
         $this->dbase->SetWhere('add_date', $this->dbase->timer->cur_time - 24 * 60 * 60, ">");
         $res_today = $this->dbase->SelectOne('job_resumes', array('count' => 'COUNT(*)'));
         $this->dbase->SetBeginBlockWhere();
         $this->dbase->SetWhere("date_exp", $this->dbase->timer->cur_time, '>');
         $this->dbase->SetWhere("vac_", '', "=", 'job_resumes', 'OR');
         $this->dbase->SetEndBlockWhere();
         $res_no_moder = $this->dbase->SelectOne("job_resumes", array("count" => "COUNT(*)"), array('allow_site' => 0));
         $res_max = $this->dbase->SelectOne('job_resumes', array('max' => "MAX(id)"));
         $comp_all = $this->dbase->SelectOne('job_companies', array('count' => 'COUNT(*)'));
         $this->dbase->SetWhere('add_date', $this->dbase->timer->cur_time - 24 * 60 * 60, ">");
         $comp_today = $this->dbase->SelectOne('job_companies', array('count' => 'COUNT(*)'));
         $stats = array('vacancy_all' => $vac_all['count'], 'vacancy_today' => $vac_today['count'], 'vacancy_on_site' => $vac_on_site['count'], 'vacancy_no_noder' => $vac_no_moder['count'], 'vacancy_max' => $vac_max['max'], 'resume_all' => $res_all['count'], 'resume_today' => $res_today['count'], 'resume_on_site' => $res_on_site['count'], 'resume_no_moder' => $res_no_moder['count'], 'resume_max' => $res_max['max'], 'company_all' => $comp_all['count'], 'company_today' => $comp_today['count']);
         Cache::SetArrayCache('stats', $stats);
     }
     return $stats;
 }
Пример #2
0
 /**
  * 
  * @param integer $id
  * @return array
  */
 public function GetField($id)
 {
     $field = $this->_db->SelectOne('job_fields', array('*'), array('id' => $id));
     if (!$field) {
         throw new ExceptionAllError('Field not founf');
     }
     switch ($field['type']) {
         case 'select':
             $data = unserialize($field['data']);
             $field['data'] = implode("\n", $data);
             break;
         default:
             break;
     }
     return $field;
 }
Пример #3
0
 public function DelPhoto($auto_id, $photo_id)
 {
     if (!$photo_id) {
         return;
     }
     if (!(int) $auto_id) {
         $auto_id = 0;
     }
     $allow_del = false;
     if ($auto_id) {
         $this->old_values = $this->base->SelectOne('auto_autos', array("photo", "photo_count", "author_id"), array('id' => $auto_id));
         if (!$this->old_values) {
             return 'denied';
         }
         if (in_array($this->member['group'], $this->config['general_moderator']) || ($this->old_values['author_id'] && $this->member['id'] == $this->old_values['author_id'] || $this->old_values['guest_session'] && $this->old_values['guest_session'] == $this->guest_session) && in_array($this->member['group'], $this->config['user_int_allow_edit'])) {
             $allow_del = true;
         }
     } else {
         $allow_del = true;
     }
     if ($allow_del) {
         $photo = $this->base->SelectOne('auto_images', array("*"), array("id" => $photo_id, "auto_id" => $auto_id));
         @unlink(ROOT_DIR . "/uploads/auto_foto/" . $photo['model_id'] . "/" . $photo['image_name']);
         @unlink(ROOT_DIR . "/uploads/auto_foto/" . $photo['model_id'] . "/thumbs/" . $photo['image_name']);
         $this->base->Delete('auto_images', array('id' => $photo['id']));
         if (--$this->old_values['photo_count'] <= 0 && $auto_id) {
             $this->base->Update('auto_autos', array("photo" => 0, "photo_count" => 0), array("id" => $auto_id));
         } else {
             if ($auto_id) {
                 if ($photo_id == $this->old_values['photo']) {
                     $id = $this->base->SelectOne('auto_images', array("id"), array('auto_id' => $auto_id), array("add_date" => "DESC"));
                     if (!$id['id']) {
                         $id['id'] = 0;
                     }
                     $this->base->Update('auto_autos', array("photo" => $id['id'], "photo_count" => $this->old_values['photo_count']), array("id" => $auto_id));
                 } else {
                     $this->base->Update('auto_autos', array("photo_count" => $this->old_values['photo_count']), array("id" => $auto_id));
                 }
             }
         }
         return "ok";
     } else {
         return 'denied';
     }
 }