public function addAction() { $this->view->current_step = 1; $canPost = $this->_canPost(); if (!$canPost) { return false; } if (!is_user_logged_in() && Wpjb_Project::getInstance()->conf("posting_encourage_reg")) { $eUrl = wpjb_link_to("employer_new"); $m = __("<b>Quick Tip</b>: If you login before posting a job, you will be able to manage all your jobs from <a href=\"{url}\">employer account</a>.", WPJB_DOMAIN); $m = str_replace("{url}", $eUrl, $m); $this->view->_flash->addInfo($m); } $query = new Daq_Db_Query(); $l = $query->select("*")->from("Wpjb_Model_Listing t")->execute(); $listing = array(); foreach ($l as $li) { $listing[$li->getId()] = $li; } $this->view->listing = $listing; $form = new Wpjb_Form_AddJob(); $request = $this->getRequest(); $request->setSessionParam("wpjb.job_id", null); $job = new Wpjb_Model_Job($this->getRequest()->get("republish", null)); $empId = Wpjb_Model_Employer::current()->getId(); $arr = array(); if ($request->session("wpjb.reset_job", false)) { $ext = $request->session("wpjb.job_logo_ext"); $request->setSessionParam("wpjb.job", null); $request->setSessionParam("wpjb.reset_job", null); $request->setSessionParam("wpjb.job_logo_ext", null); $file = Wpjb_List_Path::getPath("tmp_images") . "/temp_" . session_id() . "." . $ext; if (is_file($file)) { unlink($file); } } elseif ($empId > 0 && $job->employer_id == $empId || current_user_can("manage_options")) { $arr = $job->allToArray(); if ($job->hasImage()) { $ext = $job->company_logo_ext; $path = Wpjb_List_Path::getPath("tmp_images"); copy($job->getImagePath(), $path . "/temp_" . session_id() . "." . $ext); $request->setSessionParam("wpjb.job_logo_ext", $ext); } } elseif ($empId > 0 && wp_get_current_user()->ID > 0 && $request->session("wpjb.job") == null) { $emp = Wpjb_Model_Employer::current(); $arr = $emp->toArray(); $arr['company_email'] = wp_get_current_user()->user_email; $arr['job_location'] = $emp->company_location; $arr['job_country'] = $emp->company_country; $arr['job_state'] = $emp->company_state; $arr['job_zip_code'] = $emp->company_zip_code; $m = __("<b>Note</b>: Data from your company profile is being used to fill 'Company Information' fields.", WPJB_DOMAIN); $this->view->_flash->addInfo($m); if ($emp->hasImage()) { $ext = $emp->company_logo_ext; $path = Wpjb_List_Path::getPath("tmp_images"); copy($emp->getImagePath(), $path . "/temp_" . session_id() . "." . $ext); $request->setSessionParam("wpjb.job_logo_ext", $ext); } } $jobArr = $request->session("wpjb.job", null); if (is_array($jobArr)) { if (!$form->isValid($jobArr)) { $this->view->_flash->addError(__("There are errors in your form. Please correct them before proceeding", WPJB_DOMAIN)); } } else { $form->setDefaults($arr); } $this->view->form = $form; }