예제 #1
0
 protected function _delete()
 {
     extract($this->_virtual[__FUNCTION__]);
     if ($this->isPost() && $this->hasParam("delete")) {
         $id = $this->_request->post("id", 0);
         try {
             $model = new $model($id);
             $job = new Wpjb_Model_Job($model->job_id);
             $model->delete();
             $job->stat_apply--;
             $job->save();
             $this->_addInfo($info);
         } catch (Exception $e) {
             $this->_addError($e->getMessage());
             // @todo: logging
         }
     }
 }
예제 #2
0
 public function editAction()
 {
     $id = $this->_request->get("id");
     $job = new Wpjb_Model_Job($id);
     if ($job->employer_id != Wpjb_Model_Employer::current()->getId()) {
         $this->_addError(__("You do not have access to this page.", WPJB_DOMAIN));
         $this->view->revoke_access = true;
         return;
     }
     if (!Wpjb_Project::getInstance()->conf("front_allow_edition")) {
         $this->_addError(__("Administrator does not allow job postings edition.", WPJB_DOMAIN));
         $this->view->revoke_access = true;
         return;
     }
     if ($this->_request->post("remove_image") == 1) {
         $job->deleteImage();
         $job->save();
         $form = new Wpjb_Form_Admin_AddJob($id);
         $this->view->form = $form;
     } else {
         parent::editAction();
     }
 }
예제 #3
0
 protected static function _insertIndeedJob($job)
 {
     $request = Daq_Request::getInstance();
     $category = new Wpjb_Model_Category($request->post("category_id"));
     $sTime = strtotime(date("Y-m-d H:i:s"));
     $eTime = strtotime("now +30 day");
     $visible = (int) (($eTime - $sTime) / (24 * 3600));
     if (count(explode(",", (string) $job->jobType)) > 0) {
         $type = explode(",", (string) $job->jobType);
         $jobTypeId = self::_getJobTypeId($type[0]);
     } else {
         $jobTypeId = self::_getJobTypeId((string) $job->jobType);
     }
     $import = new Wpjb_Model_Job();
     $import->company_name = (string) $job->company;
     $import->company_website = (string) $job->url;
     $import->company_email = "";
     $import->company_logo_ext = "";
     $import->job_category = $category->getId();
     $import->job_type = $jobTypeId;
     $import->job_source = 3;
     $country = Wpjb_List_Country::getByAlpha2((string) $job->country);
     $import->job_country = $country['code'];
     $import->job_state = (string) $job->state;
     $import->job_zip_code = "";
     $import->job_location = (string) $job->city;
     $import->job_limit_to_country = 0;
     $import->job_title = (string) $job->jobtitle;
     $import->job_slug = self::_getUniqueSlug((string) $job->jobtitle);
     $import->job_description = html_entity_decode((string) $job->snippet, ENT_NOQUOTES, "UTF-8");
     $import->job_visible = $visible;
     $import->job_created_at = date("Y-m-d H:i:s");
     $import->job_modified_at = date("Y-m-d H:i:s");
     $import->job_expires_at = date("Y-m-d H:i:s", strtotime("now +{$visible} days"));
     $import->is_approved = 1;
     $import->is_active = 1;
     $import->is_filled = 0;
     $import->payment_sum = 0;
     $import->payment_paid = 0;
     $import->payment_currency = 0;
     $import->payment_discount = 0;
     $import->save();
     /*
             $log = new Wpjb_Model_CareerBuilderLog();
             $log->did = $job->Job->DID;
             $log->save();
     *
     */
 }
예제 #4
0
 public function _panel($browse)
 {
     if (!$this->_isLoggedIn()) {
         $this->view->_flash->addError(__("You are not allowed to access this page.", WPJB_DOMAIN));
         return false;
     }
     $filled = $this->_request->getParam("filled", null);
     if ($filled) {
         $job = new Wpjb_Model_Job($filled);
         $job->is_filled = 1;
         $job->save();
         $this->view->_flash->addInfo(__("Job status has been changed", WPJB_DOMAIN));
     }
     $filled = $this->_request->getParam("notfilled", null);
     if ($filled) {
         $job = new Wpjb_Model_Job($filled);
         $job->is_filled = 0;
         $job->save();
         $this->view->_flash->addInfo(__("Job status has been changed", WPJB_DOMAIN));
     }
     $this->view->browse = $browse;
     // count jobs;
     $page = $this->_request->getParam("page", 1);
     $emp = Wpjb_Model_Employer::current();
     $query = new Daq_Db_Query();
     $query = $query->select("*");
     $query->from("Wpjb_Model_Job t1");
     $query->where("t1.is_active = 1");
     $query->where("employer_id = ?", $emp->getId());
     $query->order("job_expires_at ASC");
     // count expired jobs
     $qCount = clone $query;
     $qCount->where("t1.job_expires_at < ?", date("Y-m-d 23:59:59"));
     $qCount->select("COUNT(*) AS cnt");
     $this->view->expiredCount = (int) $qCount->fetchColumn();
     // count active jobs
     $qCount = clone $query;
     $qCount->where("t1.job_expires_at >= ?", date("Y-m-d 23:59:59"));
     $qCount->select("COUNT(*) AS cnt");
     $this->view->activeCount = (int) $qCount->fetchColumn();
     if ($browse == "expired") {
         $query->where("t1.job_expires_at < ?", date("Y-m-d 23:59:59"));
     } else {
         $query->where("t1.job_expires_at >= ?", date("Y-m-d 23:59:59"));
     }
     $qCount = clone $query;
     $qCount->select("COUNT(*) AS cnt");
     $jobCount = $qCount->fetchColumn();
     $this->view->jobCount = ceil($jobCount / 20);
     $query->limitPage($page, 20);
     $result = $query->execute();
     $this->view->jobList = $result;
     $this->view->jobPage = $page;
     return "company-panel";
 }
예제 #5
0
파일: Job.php 프로젝트: robjcordes/nexnewwp
 protected function _multiApprove($id)
 {
     $object = new Wpjb_Model_Job($id);
     $object->is_approved = 1;
     $object->save();
     return true;
 }
예제 #6
0
 protected function _import($xml)
 {
     $id = null;
     if ($xml->id > 0) {
         $id = (int) $xml->id;
     }
     $job = new Wpjb_Model_Job($id);
     $job->company_name = (string) $xml->company_name;
     $job->company_email = (string) $xml->company_email;
     $job->company_website = (string) $xml->company_website;
     $job->job_title = (string) $xml->job_title;
     $job->job_description = (string) $xml->job_description;
     $job->job_slug = $this->_getUniqueSlug($job->job_title);
     if (strlen($xml->company_logo_ext) >= 3) {
         $job->company_logo_ext = (string) $xml->company_logo_ext;
         $logo = base64_decode((string) $xml->company_logo);
     }
     $job->job_category = $this->_getCategoryId($xml->category);
     $job->job_type = $this->_getJobTypeId($xml->job_type);
     $c = Wpjb_List_Country::getByAlpha2((string) $xml->job_country);
     $job->job_country = $c["code"];
     $job->job_state = (string) $xml->job_state;
     $job->job_zip_code = (string) $xml->job_zip_code;
     $job->job_location = (string) $xml->job_location;
     $job->job_created_at = (string) $xml->job_created_at;
     if (!(string) $xml->job_modified_at) {
         $job->job_modified_at = (string) $xml->job_modified_at;
     } else {
         $job->job_modified_at = (string) $xml->job_created_at;
     }
     $job->job_visible = (int) $xml->job_visible;
     $stt = "{$job->job_created_at} +{$job->job_visible} DAYS";
     $job->job_expires_at = date("Y-m-d H:i:s", strtotime($stt));
     $job->is_approved = (int) $xml->is_approved;
     $job->is_active = (int) $xml->is_approved;
     $job->is_featured = (int) $xml->is_featured;
     $job->is_filled = (int) $xml->is_filled;
     $job->payment_sum = (double) $xml->payment_sum;
     $job->payment_paid = (double) $xml->payment_paid;
     $job->payment_currency = (double) $xml->payment_currency;
     $job->payment_discount = (double) $xml->payment_discount;
     $job->save();
     if ($logo) {
         $baseDir = Wpjb_Project::getInstance()->getProjectBaseDir();
         $baseDir = "/environment/images/job_" . $job->getId() . "." . $job->company_logo_ext;
         file_put_contents($baseDir, $file);
     }
 }