Esempio n. 1
0
 protected function _notifyJob($id)
 {
     $job = new Wpjb_Model_Job($id);
     $mod = Wpjb_Project::getInstance()->conf("posting_moderation");
     if (!$mod) {
         $job->is_active = 1;
         $job->is_approved = 1;
         Wpjb_Utility_Messanger::send(2, $job);
     }
     $job->payment_paid = $this->getRequest()->post("mc_gross");
     $job->save();
 }
Esempio n. 2
0
 private function _approve()
 {
     if ($this->job_source == 3) {
         // do not redistribute imported jobs
         return;
     }
     try {
         if ($this->job_source == 1) {
             if ($this->payment_amount > 0) {
                 Wpjb_Utility_Messanger::send(4, $this);
             } else {
                 Wpjb_Utility_Messanger::send(3, $this);
             }
         }
         $this->_useCouponCode();
         // Send alerts
         $query = new Daq_Db_Query();
         $result = $query->select()->from("Wpjb_Model_Alert t")->where("is_active = 1")->where("LOCATE(keyword, ?)>0", $this->job_title)->limit(100)->execute();
         foreach ($result as $r) {
             $param = array("hash" => md5($r->id . $r->email));
             $url = Wpjb_Project::getInstance()->router()->linkTo("alertdelete", $r, $param);
             $append = array('alert_keyword' => $r->keyword, 'alert_email' => $r->email, 'alert_unsubscribe_url' => Wpjb_Project::getInstance()->getUrl() . "/" . $url);
             Wpjb_Utility_Messanger::send(7, $this, $append);
         }
         if (Wpjb_Project::getInstance()->conf("posting_tweet")) {
             Wpjb_Service_Twitter::tweet($this);
         }
     } catch (Exception $e) {
         //echo $e->getMessage();
     }
 }
Esempio n. 3
0
 public function applyAction()
 {
     $text = Wpjb_Project::getInstance()->conf("seo_apply", __("Apply for position: {job_title} (ID: {id})", WPJB_DOMAIN));
     $param = array('job_title' => $this->getObject()->job_title, 'id' => $this->getObject()->id);
     $this->_setTitle($text, $param);
     $job = $this->getObject();
     $this->view->job = $job;
     if (!$this->isMember() && Wpjb_Project::getInstance()->conf("front_apply_members_only", false)) {
         $this->view->members_only = true;
         $this->view->_flash->addError(__("Only registered members can apply for jobs.", WPJB_DOMAIN));
         return;
     }
     if ($job->job_source == 3) {
         wp_redirect($job->company_website);
     }
     $form = new Wpjb_Form_Apply();
     if ($this->isPost()) {
         if ($form->isValid($this->getRequest()->getAll())) {
             // send
             $var = $form->getValues();
             $job = $this->getObject();
             $form->setJobId($job->getId());
             $form->setUserId(Wpjb_Model_Resume::current()->user_id);
             $form->save();
             $files = $form->getFiles();
             $application = $form->getObject();
             $mail = new Wpjb_Model_Email(6);
             $append = array("applicant_email" => $var['email'], "applicant_cv" => $var['resume'], "applicant_name" => $var['applicant_name']);
             list($title, $body) = Wpjb_Utility_Messanger::parse($mail, $job, $append);
             $add = $form->getAdditionalText();
             if (!empty($add)) {
                 $body .= "\r\n--- --- ---\r\n";
             }
             foreach ($add as $field) {
                 if (!$form->hasElement($field)) {
                     continue;
                 }
                 $opt = $form->getElement($field)->getOptions();
                 if (!empty($opt)) {
                     foreach ($opt as $o) {
                         if ($o["value"] == $form->getElement($field)->getValue()) {
                             $fValue = $o["desc"];
                         }
                     }
                 } else {
                     $fValue = $form->getElement($field)->getValue();
                 }
                 $body .= $form->getElement($field)->getLabel() . ": ";
                 $body .= $fValue . "\r\n";
             }
             $headers = "From: " . $var["applicant_name"] . " <" . $var["email"] . ">\r\n";
             $email = $var["email"];
             $title = trim($title);
             if (empty($title)) {
                 $title = __("[Application] ", WPJB_DOMAIN) . $var["name"];
             }
             if (apply_filters("wpjb_job_apply", $form) !== true) {
                 wp_mail($job->company_email, $title, $body, $headers, $files);
             }
             $form->reinit();
             $job->stat_apply++;
             $job->save();
             $this->view->application_sent = true;
             $this->view->_flash->addInfo(__("Your application has been sent.", WPJB_DOMAIN));
             Wpjb_Utility_Messanger::send(8, $job, array('applicant_email' => $var['email']));
         } else {
             $this->view->_flash->addError(__("There are errors in your form.", WPJB_DOMAIN));
         }
     } elseif (Wpjb_Model_Resume::current()->id > 0) {
         $resume = Wpjb_Model_Resume::current();
         if ($form->hasElement("email")) {
             $form->getElement("email")->setValue($resume->email);
         }
         if ($form->hasElement("applicant_name")) {
             $form->getElement("applicant_name")->setValue($resume->firstname . " " . $resume->lastname);
         }
     }
     $this->view->form = $form;
 }