コード例 #1
0
ファイル: Resume.php プロジェクト: robjcordes/nexnewwp
 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();
     }
 }
コード例 #2
0
ファイル: Employer.php プロジェクト: robjcordes/nexnewwp
 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();
     }
 }
コード例 #3
0
ファイル: Index.php プロジェクト: robjcordes/nexnewwp
 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";
 }
コード例 #4
0
/**
 * Saves candidate in DB
 * 
 * This function is executed in "init" action.
 * 
 * Validates and saves resume in database. This action is executed only if
 * there is $_POST["_wpjb_action"] == reg_candidate_alt.
 * 
 * @since 1.0
 * @return void
 */
function full_candidate_register_action()
{
    $form = new Wpjb_Form_Resume_Alt();
    $request = Daq_Request::getInstance();
    $flash = new Wpjb_Utility_Session();
    if ($request->post("_wpjb_action") != "reg_candidate_alt") {
        return;
    }
    $isValid = $form->isValid($request->getAll());
    if (!$isValid) {
        return;
    }
    $form->save();
    $url = wpjr_link_to("login");
    $password = $form->value("user_password");
    $email = $form->value("user_email");
    $username = $form->value("user_login");
    if (empty($username)) {
        $username = $email;
    }
    $mail = Wpjb_Utility_Message::load("notify_canditate_register");
    $mail->setTo($email);
    $mail->assign("username", $username);
    $mail->assign("password", $password);
    $mail->assign("login_url", $url);
    $mail->send();
    do_action("wpjb_user_registered", "candidate");
    $form = new Wpjb_Form_Resumes_Login();
    if ($form->hasElement("recaptcha_response_field")) {
        $form->removeElement("recaptcha_response_field");
    }
    $form->isValid(array("user_login" => $username, "user_password" => $password, "remember" => 0));
    $flash->addInfo(__("You have been registered.", "wpjobboard"));
    $flash->save();
    wp_redirect(wpjr_link_to("myresume_home"));
    exit;
}