示例#1
0
 protected function _multiDelete($id)
 {
     $query = new Daq_Db_Query();
     $total = $query->select("COUNT(*) AS cnt")->from("Wpjb_Model_Job")->where("job_category = ?", $id)->fetchColumn();
     if ($total > 0) {
         $err = __("Cannot delete category identified by ID #{id}. There are still jobs in this category.", WPJB_DOMAIN);
         $err = str_replace("{id}", $id, $err);
         $this->view->_flash->addError($err);
         return false;
     }
     try {
         $model = new Wpjb_Model_Category($id);
         $model->delete();
         return true;
     } catch (Exception $e) {
         // log error
         return false;
     }
 }
示例#2
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();
     *
     */
 }
示例#3
0
 protected function _getCategoryId($category)
 {
     $title = (string) $category->title;
     $slug = (string) $category->slug;
     if (strlen($slug) < 1) {
         $slug = sanitize_title_with_dashes($title);
     }
     $query = new Daq_Db_Query();
     $result = $query->select("*")->from("Wpjb_Model_Category t")->where("t.title LIKE ?", "%" . $title . "%")->orWhere("t.slug LIKE ?", "%" . $slug . "%")->execute();
     if (count($result) > 0) {
         $category = $result[0];
         return $category->getId();
     } else {
         $category = new Wpjb_Model_Category();
         $category->title = $title;
         $category->slug = $slug;
         $category->save();
         return $category->getId();
     }
 }