public function execute() { $this->_sql($this->getVersion()); set_time_limit(0); $query = new Daq_Db_Query(); $query->select()->from("Wpjb_Model_Job t")->joinLeft("t.search s")->where("is_active = 1")->where("s.job_id IS NULL"); foreach ($query->execute() as $job) { Wpjb_Model_JobSearch::createFrom($job); } $db = Daq_Db::getInstance(); $wpdb = $db->getDb(); $config = Wpjb_Project::getInstance(); $config->setConfigParam("front_template", "twentyten"); $config->saveConfig(); if (!Wpjb_Project::getInstance()->conf("link_jobs")) { $jId = wp_insert_post(array('post_type' => 'page', 'post_status' => 'publish', 'post_title' => 'Jobs', 'comment_status' => 'closed', 'ping_status' => 'closed')); $config->setConfigParam("link_jobs", $jId); $config->saveConfig(); } if (!Wpjb_Project::getInstance()->conf("link_resumes")) { $rId = wp_insert_post(array('post_type' => 'page', 'post_status' => 'publish', 'post_title' => 'Resumes', 'comment_status' => 'closed', 'ping_status' => 'closed')); $config->setConfigParam("link_resumes", $rId); $config->saveConfig(); } return; }
public function execute() { $query = new Daq_Db_Query(); $result = $query->select("*")->from("Wpjb_Model_Job t")->execute(); foreach ($result as $job) { Wpjb_Model_JobSearch::createFrom($job); } }
public function save() { $isNew = true; if ($this->getId()) { $isNew = false; } $m1 = (bool) $this->_fields["job_country"]["modified"]; $m2 = (bool) $this->_fields["job_state"]["modified"]; $m3 = (bool) $this->_fields["job_zip_code"]["modified"]; $m4 = (bool) $this->_fields["job_location"]["modified"]; if ($m1 || $m2 || $m3 || $m4) { // reset geolocation $this->geo_status = self::GEO_UNSET; $this->geo_longitude = 0; $this->geo_latitude = 0; } $id = parent::save(); if ($isNew) { Wpjb_Utility_Messanger::send(1, $this); } if ($id && $this->_approve) { $this->_approve(); $this->_approve = false; } Wpjb_Model_JobSearch::createFrom($this); $employer = new Wpjb_Model_Employer($this->employer_id); if ($employer->getId() > 0 && $isNew) { $employer->jobs_posted++; $employer->save(); } Wpjb_Project::scheduleEvent(); return $id; }