Exemple #1
0
 public static function getAll()
 {
     if (!empty(self::$_list)) {
         return self::$_list;
     }
     $file = "country_list.ini";
     $default = Wpjb_List_Path::getPath("app_config") . "/" . $file;
     $user = Wpjb_List_Path::getPath("user_config") . "/" . $file;
     if (is_file($user)) {
         self::$_list = Daq_Config::parseIni($user, null, true);
     } else {
         self::$_list = Daq_Config::parseIni($default, null, true);
     }
     return self::$_list;
 }
Exemple #2
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);
     }
 }
Exemple #3
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();
 }
Exemple #4
0
 public function init()
 {
     $this->addGroup("auth", __("User Account", WPJB_DOMAIN));
     $this->addGroup("default", __("Company", WPJB_DOMAIN));
     $this->addGroup("location", __("Location", WPJB_DOMAIN));
     $e = new Daq_Form_Element("user_login", Daq_Form_Element::TYPE_TEXT);
     $e->setLabel(__("Username", WPJB_DOMAIN));
     $e->setRequired(true);
     $e->addFilter(new Daq_Filter_Trim());
     $e->addFilter(new Daq_Filter_WP_SanitizeUser());
     $e->addValidator(new Daq_Validate_WP_Username());
     $this->addElement($e, "auth");
     $e = new Daq_Form_Element("user_password", Daq_Form_Element::TYPE_PASSWORD);
     $e->setLabel(__("Password", WPJB_DOMAIN));
     $e->addFilter(new Daq_Filter_Trim());
     $e->addValidator(new Daq_Validate_StringLength(4, 32));
     $e->addValidator(new Daq_Validate_PasswordEqual("user_password2"));
     $e->setRequired(true);
     $this->addElement($e, "auth");
     $e = new Daq_Form_Element("user_password2", Daq_Form_Element::TYPE_PASSWORD);
     $e->setLabel(__("Password (repeat)", WPJB_DOMAIN));
     $e->setRequired(true);
     $this->addElement($e, "auth");
     $e = new Daq_Form_Element("user_email", Daq_Form_Element::TYPE_TEXT);
     $e->setLabel(__("E-mail", WPJB_DOMAIN));
     $e->addFilter(new Daq_Filter_Trim());
     $e->addValidator(new Daq_Validate_WP_Email());
     $e->setRequired(true);
     $this->addElement($e, "auth");
     $e = new Daq_Form_Element("company_name");
     $e->setLabel(__("Company name", WPJB_DOMAIN));
     $e->setRequired(true);
     $e->addFilter(new Daq_Filter_Trim());
     $this->addElement($e, "default");
     $e = new Daq_Form_Element("company_website");
     $e->setLabel(__("Company website", WPJB_DOMAIN));
     $e->addValidator(new Daq_Validate_Url());
     $e->addFilter(new Daq_Filter_WP_Url());
     $e->addFilter(new Daq_Filter_Trim());
     $this->addElement($e, "default");
     $e = new Daq_Form_Element_File("company_logo", Daq_Form_Element::TYPE_FILE);
     $e->setLabel(__("Company Logo", WPJB_DOMAIN));
     $e->setHint(__("Max. file size 30 kB. Image size 300x100 px. File formats *.jpg; *.gif; *.png .", WPJB_DOMAIN));
     $e->addValidator(new Daq_Validate_File_Default());
     $e->addValidator(new Daq_Validate_File_Ext("jpg,jpeg,gif,png"));
     $e->addValidator(new Daq_Validate_File_Size(30000));
     $e->addValidator(new Daq_Validate_File_ImageSize(300, 100));
     //$this->addElement($e, "default");
     $e = new Daq_Form_Element("company_info", Daq_Form_Element::TYPE_TEXTAREA);
     $e->setLabel(__("Company info", WPJB_DOMAIN));
     $e->setRequired(true);
     $e->addFilter(new Daq_Filter_Trim());
     $this->addElement($e, "default");
     $e = new Daq_Form_Element("is_public", Daq_Form_Element::TYPE_CHECKBOX);
     $e->setLabel(__("Publish Profile", WPJB_DOMAIN));
     $e->addOption(1, 1, __("Allow job seekers to view company profile", WPJB_DOMAIN));
     $e->setValue($this->_object->is_public);
     $e->addFilter(new Daq_Filter_Int());
     $this->addElement($e, "default");
     $def = wpjb_locale();
     $e = new Daq_Form_Element("company_country", Daq_Form_Element::TYPE_SELECT);
     $e->setLabel(__("Company Country", WPJB_DOMAIN));
     $e->setValue($this->_object->company_country ? $this->_object->company_country : $def);
     foreach (Wpjb_List_Country::getAll() as $listing) {
         $e->addOption($listing['code'], $listing['code'], $listing['name']);
     }
     $e->addClass("wpjb-location-country");
     $this->addElement($e, "location");
     $e = new Daq_Form_Element("company_state");
     $e->setLabel(__("Company State", WPJB_DOMAIN));
     $e->setValue($this->_object->company_state);
     $e->addClass("wpjb-location-state");
     $this->addElement($e, "location");
     $e = new Daq_Form_Element("company_zip_code");
     $e->setLabel(__("Company Zip-Code", WPJB_DOMAIN));
     $e->addValidator(new Daq_Validate_StringLength(null, 20));
     $e->setValue($this->_object->company_zip_code);
     $this->addElement($e, "location");
     $e = new Daq_Form_Element("company_location");
     $e->setLabel(__("Company Location", WPJB_DOMAIN));
     $e->setValue($this->_object->company_location);
     $e->addClass("wpjb-location-city");
     $this->addElement($e, "location");
     apply_filters("wpjb_form_init_register", $this);
 }
 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();
     *
     */
 }
Exemple #6
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);
 }
Exemple #7
0
 public function init()
 {
     $this->addGroup("default", __("Company", WPJB_DOMAIN));
     $this->addGroup("location", __("Location", WPJB_DOMAIN));
     $e = new Daq_Form_Element("company_name");
     $e->setLabel(__("Company Name", WPJB_DOMAIN));
     $e->setRequired(true);
     $e->setValue($this->_object->company_name);
     $this->addElement($e, "default");
     $e = new Daq_Form_Element_File("company_logo", Daq_Form_Element::TYPE_FILE);
     $e->setLabel(__("Company Logo", WPJB_DOMAIN));
     $e->setHint(__("Max. file size 30 kB. Image size 300x100 px. File formats *.jpg; *.gif; *.png .", WPJB_DOMAIN));
     $e->addValidator(new Daq_Validate_File_Default());
     $e->addValidator(new Daq_Validate_File_Ext("jpg,jpeg,gif,png"));
     $e->addValidator(new Daq_Validate_File_Size(30000));
     $e->addValidator(new Daq_Validate_File_ImageSize(300, 100));
     $this->addElement($e, "default");
     $e = new Daq_Form_Element("company_website");
     $e->setLabel(__("Company Website", WPJB_DOMAIN));
     $e->addValidator(new Daq_Validate_Url());
     $e->addFilter(new Daq_Filter_WP_Url());
     $e->setValue($this->_object->company_website);
     $this->addElement($e, "default");
     $e = new Daq_Form_Element("company_info", Daq_Form_Element::TYPE_TEXTAREA);
     $e->setLabel(__("Company Info", WPJB_DOMAIN));
     $eDesc = str_replace('{tags}', '<p><a><b><strong><em><i><ul><li><h3><h4><br>', __("Use this field to describe your company profile (what you do, company size etc). Only {tags} HTML tags are allowed", WPJB_DOMAIN));
     $e->setHint($eDesc);
     $e->setValue($this->_object->company_info);
     $this->addElement($e, "default");
     $def = wpjb_locale();
     $e = new Daq_Form_Element("company_country", Daq_Form_Element::TYPE_SELECT);
     $e->setLabel(__("Company Country", WPJB_DOMAIN));
     $e->setValue($this->_object->company_country ? $this->_object->company_country : $def);
     foreach (Wpjb_List_Country::getAll() as $listing) {
         $e->addOption($listing['code'], $listing['code'], $listing['name']);
     }
     $e->addClass("wpjb-location-country");
     $this->addElement($e, "location");
     $e = new Daq_Form_Element("company_state");
     $e->setLabel(__("Company State", WPJB_DOMAIN));
     $e->setValue($this->_object->company_state);
     $e->addClass("wpjb-location-state");
     $this->addElement($e, "location");
     $e = new Daq_Form_Element("company_zip_code");
     $e->setLabel(__("Company Zip-Code", WPJB_DOMAIN));
     $e->addValidator(new Daq_Validate_StringLength(null, 20));
     $e->setValue($this->_object->company_zip_code);
     $this->addElement($e, "location");
     $e = new Daq_Form_Element("company_location");
     $e->setLabel(__("Company Location", WPJB_DOMAIN));
     $e->setValue($this->_object->company_location);
     $e->addClass("wpjb-location-city");
     $this->addElement($e, "location");
     $e = new Daq_Form_Element("is_public", Daq_Form_Element::TYPE_CHECKBOX);
     $e->setLabel(__("Publish Profile", WPJB_DOMAIN));
     $e->addOption(1, 1, __("Allow job seekers to view company profile", WPJB_DOMAIN));
     $e->setValue($this->_object->is_public);
     $e->addFilter(new Daq_Filter_Int());
     $this->addElement($e, "default");
     if ($this->_mode != self::MODE_ADMIN) {
         return;
     }
     $e = new Daq_Form_Element("slug");
     $e->setRequired(true);
     $e->setValue($this->_object->slug);
     $e->setLabel("Company Slug");
     $e->setHint("The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.");
     $e->addValidator(new Daq_Validate_Slug());
     $e->addValidator(new Daq_Validate_Db_NoRecordExists("Wpjb_Model_Employer", "slug", $this->_exclude()));
     //$this->addElement($e, "manage");
     $e = new Daq_Form_Element("is_active", Daq_Form_Element::TYPE_CHECKBOX);
     $e->setLabel(__("Is Active", WPJB_DOMAIN));
     $e->setHint(__("Activates company account", WPJB_DOMAIN));
     $e->addOption(1, 1, __("Yes", WPJB_DOMAIN));
     $e->setValue($this->_object->is_active);
     $e->addFilter(new Daq_Filter_Int());
     $this->addElement($e, "default");
     apply_filters("wpja_form_init_company", $this);
 }
Exemple #8
0
 public function init()
 {
     $this->addGroup("default", __("Personal Information", WPJB_DOMAIN));
     $this->addGroup("resume", __("Resume", WPJB_DOMAIN));
     $this->addGroup("fields", __("Additional Fields", WPJB_DOMAIN));
     $e = new Daq_Form_Element("firstname");
     $e->setLabel(__("First Name", WPJB_DOMAIN));
     $e->setRequired(true);
     $e->setValue($this->_object->firstname);
     $this->addElement($e, "default");
     $e = new Daq_Form_Element("lastname");
     $e->setLabel(__("Last Name", WPJB_DOMAIN));
     $e->setRequired(true);
     $e->setValue($this->_object->lastname);
     $this->addElement($e, "default");
     $e = new Daq_Form_Element("country", Daq_Form_Element::TYPE_SELECT);
     $e->setLabel(__("Country", WPJB_DOMAIN));
     $e->setValue($this->_object->country ? $this->_object->country : wpjb_locale());
     foreach (Wpjb_List_Country::getAll() as $listing) {
         $e->addOption($listing['code'], $listing['code'], $listing['name']);
     }
     $this->addElement($e, "default");
     $e = new Daq_Form_Element("address");
     $e->setValue($this->_object->address);
     $e->setLabel(__("Address", WPJB_DOMAIN));
     $e->addValidator(new Daq_Validate_StringLength(null, 250));
     $this->addElement($e, "default");
     $e = new Daq_Form_Element("email");
     $e->setRequired(true);
     $e->setLabel(__("Email Address", WPJB_DOMAIN));
     $e->setHint(__('This field will be shown only to registered employers.', WPJB_DOMAIN));
     $e->addValidator(new Daq_Validate_Email());
     $e->setValue($this->_object->email);
     $this->addElement($e, "default");
     $e = new Daq_Form_Element("phone");
     $e->setLabel(__("Phone Number", WPJB_DOMAIN));
     $e->setHint(__('This field will be shown only to registered employers.', WPJB_DOMAIN));
     $e->setValue($this->_object->phone);
     $this->addElement($e, "default");
     $e = new Daq_Form_Element("website");
     $e->setLabel(__("Website", WPJB_DOMAIN));
     $e->setHint(__('This field will be shown only to registered employers.', WPJB_DOMAIN));
     $e->addValidator(new Daq_Validate_Url());
     $e->setValue($this->_object->website);
     $this->addElement($e, "default");
     $e = new Daq_Form_Element("is_active", Daq_Form_Element::TYPE_CHECKBOX);
     $e->setLabel(__("Is Resume Active", WPJB_DOMAIN));
     $e->setHint(__("If resume is inactive employers won't find you search results.", WPJB_DOMAIN));
     $e->addOption(1, 1, __("Yes", WPJB_DOMAIN));
     $e->setValue($this->_object->is_active);
     $e->addFilter(new Daq_Filter_Int());
     $this->addElement($e, "default");
     $e = new Daq_Form_Element_File("image", Daq_Form_Element::TYPE_FILE);
     $e->setLabel(__("Your Photo", WPJB_DOMAIN));
     $e->setHint(__("Max. file size 30 kB. Image size 100x100 px. File formats *.jpg; *.gif; *.png .", WPJB_DOMAIN));
     $e->addValidator(new Daq_Validate_File_Default());
     $e->addValidator(new Daq_Validate_File_Ext("jpg,jpeg,gif,png"));
     $e->addValidator(new Daq_Validate_File_Size(30000));
     $e->addValidator(new Daq_Validate_File_ImageSize(100, 100));
     $this->addElement($e, "default");
     $e = new Daq_Form_Element_File("file", Daq_Form_Element::TYPE_FILE);
     $e->setLabel(__("File", WPJB_DOMAIN));
     $e->setHint(__("Allowed Formats: pdf; doc; docx; rtf; txt.", WPJB_DOMAIN));
     $e->addValidator(new Daq_Validate_File_Default());
     $e->addValidator(new Daq_Validate_File_Ext("pdf,doc,docx,rtf,txt"));
     $this->addElement($e, "default");
     $e = new Daq_Form_Element("title");
     $e->setLabel(__("Professional Headline", WPJB_DOMAIN));
     $e->setHint(__("Describe yourself in few words, for example: Experienced Web Developer", WPJB_DOMAIN));
     $e->addValidator(new Daq_Validate_StringLength(1, 120));
     $e->setValue($this->_object->title);
     $this->addElement($e, "resume");
     $e = new Daq_Form_Element("category_id", Daq_Form_Element::TYPE_SELECT);
     $e->setLabel(__("Category", WPJB_DOMAIN));
     $e->setValue($this->_object->category_id);
     $e->addValidator(new Daq_Validate_Db_RecordExists("Wpjb_Model_Category", "id"));
     foreach ($this->_getCategoryArr() as $category) {
         $e->addOption($category->id, $category->id, $category->title);
     }
     $this->addElement($e, "resume");
     $e = new Daq_Form_Element("headline", Daq_Form_Element::TYPE_TEXTAREA);
     $e->setLabel(__("Profile Summary", WPJB_DOMAIN));
     $e->setHint(__("Use this field to list your skills, specialities, experience or goals", WPJB_DOMAIN));
     $e->setValue($this->_object->headline);
     $this->addElement($e, "resume");
     $e = new Daq_Form_Element("years_experience", Daq_Form_Element::TYPE_SELECT);
     $e->setLabel(__("Experience Summary", WPJB_DOMAIN));
     $e->setValue($this->_object->years_experience);
     foreach (self::getExperience() as $k => $v) {
         $e->addOption($k, $k, $v);
     }
     $this->addElement($e, "resume");
     $e = new Daq_Form_Element("experience", Daq_Form_Element::TYPE_TEXTAREA);
     $e->setLabel(__("Experience", WPJB_DOMAIN));
     $e->setHint(__("List companies you worked for (remember to include: company name, time period, your position and job description)", WPJB_DOMAIN));
     $e->setValue($this->_object->experience);
     $this->addElement($e, "resume");
     $e = new Daq_Form_Element("degree", Daq_Form_Element::TYPE_SELECT);
     $e->setLabel(__("Degree", WPJB_DOMAIN));
     $e->setValue($this->_object->degree);
     foreach (self::getDegrees() as $k => $v) {
         $e->addOption($k, $k, $v);
     }
     $this->addElement($e, "resume");
     $e = new Daq_Form_Element("education", Daq_Form_Element::TYPE_TEXTAREA);
     $e->setLabel(__("Education", WPJB_DOMAIN));
     $e->setHint(__("Your education, describe schools you attended, time period, degree and fields of study", WPJB_DOMAIN));
     $e->setValue($this->_object->education);
     $this->addElement($e, "resume");
     if (self::$mode == self::MODE_ADMIN) {
         $e = new Daq_Form_Element("is_approved", Daq_Form_Element::TYPE_SELECT);
         $e->setLabel(__("Resume Status", WPJB_DOMAIN));
         $e->addOption(Wpjb_Model_Resume::RESUME_PENDING, Wpjb_Model_Resume::RESUME_PENDING, __("Pending Approval", WPJB_DOMAIN));
         $e->addOption(Wpjb_Model_Resume::RESUME_DECLINED, Wpjb_Model_Resume::RESUME_DECLINED, __("Declined", WPJB_DOMAIN));
         $e->addOption(Wpjb_Model_Resume::RESUME_APPROVED, Wpjb_Model_Resume::RESUME_APPROVED, __("Approved", WPJB_DOMAIN));
         $e->setValue($this->_object->is_approved);
         $e->addFilter(new Daq_Filter_Int());
         $this->addElement($e, "admin");
     }
     $this->_additionalFields();
     apply_filters("wpja_form_init_resume", $this);
     $this->setModifiedScheme(Wpjb_Project::getInstance()->conf("form_admin_resume", true));
 }
Exemple #9
0
 public function init()
 {
     $this->addGroup("company", __("Company Information", WPJB_DOMAIN));
     $this->addGroup("job", __("Job Information", WPJB_DOMAIN));
     $this->addGroup("fields", __("Additional Fields", WPJB_DOMAIN));
     $this->addGroup("location", __("Location", WPJB_DOMAIN));
     $this->addGroup("coupon", __("Coupon", WPJB_DOMAIN));
     $e = new Daq_Form_Element("company_name");
     $e->setRequired(true);
     $e->setLabel(__("Company Name", WPJB_DOMAIN));
     $e->setValue($this->_object->company_name);
     $this->addElement($e, "company");
     $e = new Daq_Form_Element("company_email");
     $e->setRequired(true);
     $e->setLabel(__("Company Email", WPJB_DOMAIN));
     $e->addValidator(new Daq_Validate_Email());
     $e->setValue($this->_object->company_email);
     $this->addElement($e, "company");
     $e = new Daq_Form_Element("company_website");
     $e->setLabel(__("Company Website", WPJB_DOMAIN));
     $e->addValidator(new Daq_Validate_Url());
     $e->addFilter(new Daq_Filter_WP_Url());
     $e->setValue($this->_object->company_website);
     $this->addElement($e, "company");
     $e = new Daq_Form_Element_File("company_logo", Daq_Form_Element::TYPE_FILE);
     $e->setLabel(__("Company Logo", WPJB_DOMAIN));
     $e->setHint(__("Max. file size 30 kB. Image size 300x100 px. File formats *.jpg; *.gif; *.png .", WPJB_DOMAIN));
     $e->addValidator(new Daq_Validate_File_Default());
     $e->addValidator(new Daq_Validate_File_Ext("jpg,jpeg,gif,png"));
     $e->addValidator(new Daq_Validate_File_Size(30000));
     $e->addValidator(new Daq_Validate_File_ImageSize(300, 100));
     $e->setRenderer("wpjb_form_helper_logo_upload");
     $this->addElement($e, "company");
     $e = new Daq_Form_Element("id", Daq_Form_Element::TYPE_HIDDEN);
     $e->setValue($this->_object->id);
     $e->addFilter(new Daq_Filter_Int());
     $this->addElement($e, "job");
     $e = new Daq_Form_Element("job_type", Daq_Form_Element::TYPE_SELECT);
     $e->setLabel(__("Job Type", WPJB_DOMAIN));
     $e->setValue($this->_object->job_type);
     $e->addValidator(new Daq_Validate_Db_RecordExists("Wpjb_Model_JobType", "id"));
     foreach ($this->_getTypeArr() as $type) {
         $e->addOption($type->id, $type->id, $type->title);
     }
     $this->addElement($e, "job");
     $e = new Daq_Form_Element("job_category", Daq_Form_Element::TYPE_SELECT);
     $e->setLabel(__("Job Category", WPJB_DOMAIN));
     $e->setValue($this->_object->job_category);
     $e->addValidator(new Daq_Validate_Db_RecordExists("Wpjb_Model_Category", "id"));
     foreach ($this->_getCategoryArr() as $category) {
         $e->addOption($category->id, $category->id, $category->title);
     }
     $this->addElement($e, "job");
     $e = new Daq_Form_Element("job_title");
     $e->setRequired(true);
     $e->setLabel(__("Job Title", WPJB_DOMAIN));
     $e->setValue($this->_object->job_title);
     $e->addValidator(new Daq_Validate_StringLength(1, 120));
     $this->addElement($e, "job");
     $e = new Daq_Form_Element("job_description", Daq_Form_Element::TYPE_TEXTAREA);
     $e->setRequired(true);
     $e->setLabel(__("Job Description", WPJB_DOMAIN));
     $eDesc = str_replace('{tags}', '<p><a><b><strong><em><i><ul><li><h3><h4><br>', __("Only {tags} HTML tags are allowed", WPJB_DOMAIN));
     $e->addClass("wpjb-textarea-wide");
     $e->setHint($eDesc);
     $e->setValue($this->_object->job_description);
     $this->addElement($e, "job");
     $def = wpjb_locale();
     $e = new Daq_Form_Element("job_country", Daq_Form_Element::TYPE_SELECT);
     $e->setLabel(__("Job Country", WPJB_DOMAIN));
     $e->setValue($this->_object->job_country ? $this->_object->job_country : $def);
     foreach (Wpjb_List_Country::getAll() as $listing) {
         $e->addOption($listing['code'], $listing['code'], $listing['name']);
     }
     $e->addClass("wpjb-location-country");
     $this->addElement($e, "location");
     $e = new Daq_Form_Element("job_state");
     $e->setLabel(__("Job State", WPJB_DOMAIN));
     $e->setValue($this->_object->job_state);
     $e->addClass("wpjb-location-state");
     $this->addElement($e, "location");
     $e = new Daq_Form_Element("job_zip_code");
     $e->setLabel(__("Job Zip-Code", WPJB_DOMAIN));
     $e->addValidator(new Daq_Validate_StringLength(null, 20));
     $e->setValue($this->_object->job_zip_code);
     $this->addElement($e, "location");
     $e = new Daq_Form_Element("job_location");
     $e->setValue($this->_object->job_location);
     $e->setRequired(true);
     $e->setLabel(__("Job City/Location", WPJB_DOMAIN));
     $e->setHint(__('For example: "Chicago", "London", "Anywhere" or "Telecommute".', WPJB_DOMAIN));
     $e->addValidator(new Daq_Validate_StringLength(null, 120));
     $e->addClass("wpjb-location-city");
     $this->addElement($e, "location");
     $this->_additionalFields();
 }
Exemple #10
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();
     }
 }
Exemple #11
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");
 }
Exemple #12
0
function wpjb_locale()
{
    list($lang, $cc) = explode("_", get_locale());
    $country = Wpjb_List_Country::getAll();
    if (isset($country[$cc])) {
        $r = $country[$cc]["code"];
    } else {
        $r = 840;
    }
    $r = apply_filters("wpjb_locale", $r);
    return $r;
}