Example #1
0
 public static function createFrom(Wpjb_Model_Job $job)
 {
     $query = new Daq_Db_Query();
     $object = $query->select()->from(__CLASS__ . " t")->where("job_id = ?", $job->getId())->limit(1)->execute();
     if (empty($object)) {
         $object = new self();
     } else {
         $object = $object[0];
     }
     $country = Wpjb_List_Country::getByCode($job->job_country);
     $location = array($country['iso2'], $country['iso3'], $country['name'], $job->job_state, $job->job_location, $job->job_zip_code);
     $object->job_id = $job->getId();
     $object->title = $job->job_title;
     $object->description = strip_tags($job->job_description);
     $object->company = $job->company_name;
     $object->location = join(" ", $location);
     $object->save();
 }
Example #2
0
 public function locationToString()
 {
     $arr = array();
     $country = Wpjb_List_Country::getByCode($this->company_country);
     $country = trim($country['name']);
     if (strlen(trim($this->company_location)) > 0) {
         $arr[] = $this->company_location;
     }
     if ($this->company_country == 840 && strlen(trim($this->company_state)) > 0) {
         $arr[] = $this->company_state;
     } else {
         if (strlen($country) > 0) {
             $arr[] = $country;
         }
     }
     return implode(", ", $arr);
 }
Example #3
0
 protected function _locate($asyncSave = false)
 {
     $country = Wpjb_List_Country::getByCode($this->job_country);
     $country = trim($country['name']);
     $addr = array($this->job_location, $this->job_zip_code, $this->job_state, $country);
     $query = http_build_query(array("address" => join(", ", $addr), "sensor" => "false"));
     $url = "http://maps.googleapis.com/maps/api/geocode/json?" . $query;
     $response = wp_remote_get($url);
     if ($response instanceof WP_Error) {
         $geo = null;
     } else {
         $geo = json_decode($response["body"]);
     }
     if (!$geo || $geo->status != "OK") {
         $this->geo_status = self::GEO_MISSING;
         $this->geo_latitude = 0;
         $this->geo_longitude = 0;
     } elseif ($geo->status == "OK") {
         $this->geo_status = self::GEO_FOUND;
         $this->geo_latitude = $geo->results[0]->geometry->location->lat;
         $this->geo_longitude = $geo->results[0]->geometry->location->lng;
     }
     if ($this->id > 0 && $asyncSave) {
         $job = new Wpjb_Model_Job($this->id);
         $job->geo_status = $this->geo_status;
         $job->geo_latitude = $this->geo_latitude;
         $job->geo_longitude = $this->geo_longitude;
         $job->_saveGeo();
     }
 }
Example #4
0
 private function _juju()
 {
     header("Content-type: application/xml");
     echo '<?xml version="1.0" encoding="UTF-8" ?>';
     echo '<positionfeed
         xmlns="http://www.job-search-engine.com/employers/positionfeed-namespace/"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://www.job-search-engine.com/employers/positionfeed-namespace/ http://www.job-search-engine.com/employers/positionfeed.xsd" version="2006-04">';
     $url = Wpjb_Project::getInstance()->getUrl();
     $router = Wpjb_Project::getInstance()->router();
     $this->_tag("source", Wpjb_Project::getInstance()->conf("seo_job_board_title"));
     $this->_tag("sourcurl", $url);
     $this->_tag("feeddate", date(DATE_ISO8601));
     $jobs = $this->_jobs();
     $jobs->join("t1.category t2")->join("t1.type t3");
     foreach ($jobs->execute() as $job) {
         $code = Wpjb_List_Country::getByCode($job->job_country);
         $code = $code['iso2'];
         $this->_open("job", array("id" => $job->id));
         $this->_tag("employer", $job->company_name);
         $this->_tag("title", $job->job_title);
         $this->_tagC("description", $this->_substr($job->job_description));
         $this->_tag("postingdate", date(DATE_ISO8601, $job->job_created_at));
         $this->_tag("joburl", $url . "/" . $router->linkTo("job", $job));
         $this->_open("location");
         $this->_tag("nation", $code);
         $this->_tagIf("state", $job->job_state);
         $this->_tagIf("zip", $job->job_zip_code);
         $this->_tagIf("city", $job->job_location);
         $this->_close("location");
         $this->_close("job");
     }
     $this->_close("positionfeed");
 }