public function _filter() { $info = wp_get_current_user(); $isAdmin = true; if (!isset($info->wp_capabilities) || !$info->wp_capabilities['administrator']) { $isAdmin = false; } if (Wpjb_Model_Employer::current()->isEmployer()) { $this->view->is_employee = false; } else { $this->view->is_employee = true; } if ($info->ID > 0) { $this->view->is_loggedin = true; } else { $this->view->is_loggedin = false; } }
protected static function _canBrowse() { $can_browse = true; $employer = Wpjb_Model_Employer::current(); if (Wpjb_Project::getInstance()->conf("cv_access") == 2) { if ($employer->is_active != Wpjb_Model_Employer::ACCOUNT_FULL_ACCESS) { $can_browse = false; } } elseif (Wpjb_Project::getInstance()->conf("cv_access") == 3) { if (strtotime($employer->access_until) < time()) { $can_browse = false; } } elseif (Wpjb_Project::getInstance()->conf("cv_access") == 4) { if (!wp_get_current_user()->ID) { $can_browse = false; } } else { // grant to all } if (wp_get_current_user()->has_cap("administrator")) { $can_browse = true; } return $can_browse; }
protected function _activeUntil() { $activeUntil = Wpjb_Model_Employer::current()->access_until; $activeUntil = strtotime($activeUntil); if ($activeUntil < time()) { $activeUntil = time(); } $extend = Wpjb_Project::getInstance()->conf("cv_extend") * 3600 * 24; return $activeUntil + $extend; }
private function _getEmployerId() { if (!is_user_logged_in()) { return null; } $company = Wpjb_Model_Employer::current(); return $company->getId(); }
public function accessAction() { $object = Wpjb_Model_Employer::current(); $access = Wpjb_Project::getInstance()->conf("cv_access"); if ($access == 2) { $this->_register(); } elseif ($access == 3) { $this->_premium(); } $this->view->access = $access; }
<p> Each purchase cost <strong><?php echo $payment; ?> </strong> and extends your access for next <strong><?php echo Wpjb_Project::getInstance()->conf("cv_extend"); ?> days</strong>. Until <?php echo date("Y-m-d", $active_until); ?> </p> <?php $employer = Wpjb_Model_Employer::current(); ?> <?php $time = strtotime($employer->access_until); ?> <?php if ($time !== false) { ?> <ul> <?php if ($time > time()) { ?> <li><?php _e("Your access expires on", WPJB_DOMAIN); ?> :
public function myresumeAction() { $this->_setTitle(Wpjb_Project::getInstance()->conf("seo_resume_my_resume", __("My resume details", WPJB_DOMAIN))); if (!$this->_isEnabled()) { return false; } $object = Wpjb_Model_Resume::current(); if ($object->id < 1) { $this->view->_flash->addError(__("You need to be logged in to access this page.", WPJB_DOMAIN)); return false; } if (Wpjb_Model_Employer::current()->isEmployer()) { $this->view->_flash->addError(__("You need to be registered as Candidate in order to access this page. Your current account type is Employer.", WPJB_DOMAIN)); return false; } if ($this->_request->post("remove_image") == 1) { $this->view->_flash->addInfo(__("Image removed.", WPJB_DOMAIN)); $object->deleteImage(); $object->save(); } $form = new Wpjb_Form_Resume($object->getId()); if ($this->isPost() && !$this->_request->post("remove_image")) { $isValid = $form->isValid($this->_request->getAll()); if ($isValid) { $this->view->_flash->addInfo(__("Your resume has been saved.", WPJB_DOMAIN)); $form->save(); } else { $this->view->_flash->addError(__("Cannot save your resume. There are errors in your form.", WPJB_DOMAIN)); } } $this->view->resume = $form->getObject(); $this->view->form = $form; return "my-resume"; }
public function previewAction() { if (!$this->_canPost()) { wp_redirect($this->_stepAdd); } $this->view->current_step = 2; $accept = array("company_name", "company_email", "company_website", "job_type", "job_category", "job_country", "job_state", "job_zip_code", "job_location", "job_title", "job_description"); $form = new Wpjb_Form_AddJob(); $request = $this->getRequest(); $request->setSessionParam("wpjb.job_id", null); $jobArr = $request->session("wpjb.job", array()); if ($this->isPost()) { if ($request->post("wpjb_preview", false)) { $jobArr = $request->getAll(); $request->setSessionParam("wpjb.job", $jobArr); } if ($request->post("wpjb_reset", false)) { $request->setSessionParam("wpjb.job", null); $request->setSessionParam("wpjb.reset_job", true); wp_redirect($this->_stepAdd); } } if (!$form->isValid($jobArr)) { wp_redirect($this->_stepAdd); } else { if ($form->hasElement("company_logo")) { $file = $form->getElement("company_logo"); if ($file->fileSent()) { $file->setDestination(Wpjb_List_Path::getPath("tmp_images")); $file->upload("temp_" . session_id() . "." . $file->getExt()); $request->setSessionParam("wpjb.job_logo_ext", $file->getExt()); } } $mock = new Wpjb_Model_JobMock(); $values = $form->getValues(); $arr = array(); foreach ($form->getElements() as $f) { /* @var $f Daq_Form_Element */ if (stripos($f->getName(), "field_") !== 0) { continue; } $class = new Wpjb_Model_FieldMock(); $class->id = str_replace("field_", "", $f->getName()); $class->is_required = $f->isRequired(); $class->hint = $f->getHint(); $class->type = $f->getType(); $class->label = $f->getLabel(); $class->value = $f->getValue(); if ($f->isMultiOption()) { foreach ((array) $f->getOptions() as $opt) { if ($opt["key"] == $f->getValue()) { $class->value = $opt["desc"]; break; } } } $arr[] = $class; } foreach ($accept as $field) { $mock->set($field, $values[$field]); } $mock->set("job_created_at", date("Y-m-d H:i:s")); $mock->set("company_logo_ext", $request->session("wpjb.job_logo_ext", null)); $mock->setType(new Wpjb_Model_JobType($values["job_type"])); $mock->setCategory(new Wpjb_Model_Category($values["job_category"])); $mock->setAdditionalFields($arr); $text = Wpjb_Project::getInstance()->conf("seo_single", __("{job_title}", WPJB_DOMAIN)); $param = array('job_title' => $values["job_title"], 'id' => 0); $this->_setTitle($text, $param); $this->view->job = $mock; $company = Wpjb_Model_Employer::current(); if ($company->getId() > 0) { $this->view->company = $company; } } }