Beispiel #1
0
 public function save()
 {
     if (Wpjb_Project::getInstance()->conf("cv_approval") == 1) {
         $e = new Daq_Form_Element("is_approved");
         $e->setValue(Wpjb_Model_Resume::RESUME_PENDING);
         $this->addElement($e);
     }
     $e = new Daq_Form_Element("updated_at");
     $e->setValue(date("Y-m-d H:i:s"));
     $this->addElement($e);
     parent::save();
     if (Wpjb_Project::getInstance()->conf("cv_approval") == 1) {
         $url = rtrim(site_url(), "/");
         $url .= "/wp-admin/admin.php?page=wpjb/resumes&action=edit/id/";
         $url .= $this->getObject()->id;
         $mail = new Wpjb_Utility_Message(11);
         $mail->setParams($this->getObject()->toArray());
         $mail->setParam("resume_admin_url", $url);
         $mail->setTo($mail->getTemplate()->mail_from);
         $mail->send();
     }
 }
Beispiel #2
0
 protected function _accessRequest()
 {
     // request employer account
     $object = $this->_employer();
     $this->view->object = $object;
     if ($object->is_active == Wpjb_Model_Employer::ACCOUNT_REQUEST) {
         $this->view->already_requested = true;
         $this->view->_flash->addInfo(__("You already requested employer account.", WPJB_DOMAIN));
         return;
     } elseif ($object->is_active == Wpjb_Model_Employer::ACCOUNT_INACTIVE) {
         $this->view->already_requested = true;
         $this->view->_flash->addError(__("Your employer account has been deactivated. Contact Administrator for more information.", WPJB_DOMAIN));
         return;
     } else {
         $this->view->already_requested = false;
     }
     if ($object->is_active == Wpjb_Model_Employer::ACCOUNT_DECLINED) {
         $this->view->_flash->addError(__("Your request has been declined, please update your profile and re-submit request", WPJB_DOMAIN));
     }
     if ($this->_request->getParam("request_employer")) {
         $object->is_active = 2;
         $object->save();
         $this->view->request_sent = true;
         $this->_setTitle(__("Request has been sent", WPJB_DOMAIN));
         $url = rtrim(site_url(), "/");
         $url .= "/wp-admin/admin.php?page=wpjb/employers&action=edit/id/";
         $url .= $object->id;
         $mail = new Wpjb_Utility_Message(12);
         $mail->setParams($object->toArray());
         $mail->setParam("company_admin_url", $url);
         $mail->setTo($mail->getTemplate()->mail_from);
         $mail->send();
     }
 }
Beispiel #3
0
 public function registerAction()
 {
     if (!get_option('users_can_register')) {
         $this->view->_flash->addError(__("User registration is disabled.", WPJB_DOMAIN));
         return false;
     }
     $object = Wpjb_Model_Resume::current();
     if ($object->id > 0) {
         wp_redirect(wpjr_link_to("myresume"));
     }
     $this->_setTitle(__("Register", WPJB_DOMAIN));
     $form = new Wpjb_Form_Resumes_Register();
     $this->view->errors = array();
     if ($this->isPost()) {
         $isValid = $form->isValid($this->getRequest()->getAll());
         if ($isValid) {
             $username = $form->getElement("user_login")->getValue();
             $password = $form->getElement("user_password")->getValue();
             $email = $form->getElement("user_email")->getValue();
             $id = wp_create_user($username, $password, $email);
             $instance = Wpjb_Project::getInstance();
             $router = $instance->getApplication("resumes")->getRouter();
             /* @var $router Daq_Router */
             $url = $instance->getApplication("resumes")->getUrl();
             $url .= "/" . $router->linkTo("myresume");
             $mail = new Wpjb_Utility_Message(10);
             $mail->setTo($email);
             $mail->setParam("username", $username);
             $mail->setParam("password", $password);
             $mail->setParam("login_url", $url);
             $mail->send();
             $this->view->_flash->addInfo(__("You have been registered.", WPJB_DOMAIN));
             $form = new Wpjb_Form_Resumes_Login();
             $form->isValid(array("user_login" => $username, "user_password" => $password, "remember" => 0));
             $redirect = wpjr_link_to("myresume");
             wp_redirect($redirect);
             die;
         } else {
             $this->view->_flash->addError(__("There are errors in your form.", WPJB_DOMAIN));
         }
     }
     $this->view->form = $form;
     return "register";
 }