public function execute() { $errors = array(); $field_errors = array(); $tp = SJB_System::getTemplateProcessor(); $loggedIn = SJB_UserManager::isUserLoggedIn(); $current_user_sid = SJB_UserManager::getCurrentUserSID(); $controller = new SJB_SendListingInfoController($_REQUEST); $isDataSubmitted = false; $jobInfo = SJB_ListingManager::getListingInfoBySID($controller->getListingID()); if ($controller->isListingSpecified()) { if ($controller->isDataSubmitted()) { if (SJB_Captcha::getInstance($tp, $_REQUEST)->isValid($errors)) { // получим уникальный id для файла в uploaded_files $file_id_current = 'application_' . md5(microtime()); $upload_manager = new SJB_UploadFileManager(); $upload_manager->setFileGroup('files'); $upload_manager->setUploadedFileID($file_id_current); $file_name = $upload_manager->uploadFile('file_tmp'); $id_file = $upload_manager->fileId; $post = $controller->getData(); $listingId = 0; $post['submitted_data']['questionnaire'] = ''; if (isset($post['submitted_data']['id_resume'])) { $listingId = $post['submitted_data']['id_resume']; } $mimeType = isset($_FILES['file_tmp']['type']) ? $_FILES['file_tmp']['type'] : ''; if (isset($_FILES['file_tmp']['size']) && $file_name != '' && $_FILES['file_tmp']['size'] == 0) { $errors['FILE_IS_EMPTY'] = 'The uploaded file should not be blank'; } if (!empty($_FILES['file_tmp']['name'])) { $fileFormats = explode(',', SJB_System::getSettingByName('file_valid_types')); $fileInfo = pathinfo($_FILES['file_tmp']['name']); if (!isset($fileInfo['extension']) || !in_array(strtolower($fileInfo['extension']), $fileFormats)) { $errors['NOT_SUPPORTED_FILE_FORMAT'] = strtolower($fileInfo['extension']) . ' ' . SJB_I18N::getInstance()->gettext(null, 'is not in an acceptable file format'); } } if ($file_name == '' && $listingId == 0) { $canAppplyWithoutResume = false; SJB_Event::dispatch('CanApplyWithoutResume', $canAppplyWithoutResume); if (!$canAppplyWithoutResume) { $errors['APPLY_INPUT_ERROR'] = 'Please select file or resume'; } } else { if (SJB_Applications::isApplied($post['submitted_data']['listing_id'], $current_user_sid) && !is_null($current_user_sid)) { $errors['APPLY_APPLIED_ERROR'] = 'You already applied'; } } $res = false; $listing_info = ''; $notRegisterUserData = $_POST; $score = 0; // для зарегестрированного пользователя получим поля email и name // для незарегестрированных - поля name и email приходят с формы if ($loggedIn === true) { $userData = SJB_UserManager::getCurrentUserInfo(); $post['submitted_data']['username'] = isset($userData['username']) ? $userData['username'] : ''; $post['submitted_data']['LastName'] = isset($userData['LastName']) ? $userData['LastName'] : ''; $post['submitted_data']['FirstName'] = isset($userData['FirstName']) ? $userData['FirstName'] : ''; $post['submitted_data']['name'] = $post['submitted_data']['FirstName'] . ' ' . $post['submitted_data']['LastName']; $post['submitted_data']['email'] = $userData['email']; } if (!empty($jobInfo['screening_questionnaire'])) { $questions = new SJB_Questions($_REQUEST, $jobInfo['screening_questionnaire']); $add_form = new SJB_Form($questions); $add_form->registerTags($tp); $add_form->isDataValid($field_errors); $tp->assign('field_errors', $field_errors); if (!$field_errors) { $result = array(); $properties = $questions->getProperties(); $countAnswers = 0; foreach ($properties as $key => $val) { if ($val->type->property_info['type'] == 'boolean') { switch ($val->value) { case 0: $val->value = 'No'; break; case 1: $val->value = 'Yes'; break; } } $result[$val->caption] = $val->value; if (isset($val->type->property_info['list_values'])) { foreach ($val->type->property_info['list_values'] as $list_values) { if (is_array($val->value)) { foreach ($val->value as $value) { if ($value == $list_values['id'] && $list_values['score'] != 'no') { $score += $list_values['score']; $countAnswers++; } } } else { if ($val->value == $list_values['id'] && $list_values['score'] != 'no') { $score += $list_values['score']; $countAnswers++; } } } } } if ($countAnswers === 0) { $score = 0.0; } else { $score = round($score / $countAnswers, 2); } $post['submitted_data']['questionnaire'] = serialize($result); } } if (count($errors) == 0 && count($field_errors) == 0) { $res = SJB_Applications::create($post['submitted_data']['listing_id'], $current_user_sid, isset($post['submitted_data']['id_resume']) ? $post['submitted_data']['id_resume'] : '', $post['submitted_data']['comments'], $file_name, $mimeType, $id_file, isset($post['submitted_data']['anonymous']) ? $post['submitted_data']['anonymous'] : '0', $notRegisterUserData, $post['submitted_data']['questionnaire'], $score); if ($res) { SJB_Statistics::addStatistics('apply', $post['submitted_data']['listing_id'], $res); } if (isset($post['submitted_data']['id_resume']) && $post['submitted_data']['id_resume'] != 0) { $listing_info = SJB_ListingManager::getListingInfoBySID($post['submitted_data']['id_resume']); $emp_sid = SJB_ListingManager::getUserSIDByListingSID($post['submitted_data']['listing_id']); $accessible = SJB_ListingManager::isListingAccessableByUser($post['submitted_data']['id_resume'], $emp_sid); if (!$accessible) { SJB_ListingManager::setListingAccessibleToUser($post['submitted_data']['id_resume'], $emp_sid); } } if (!empty($file_name)) { $file_name = 'files/files/' . $file_name; } SJB_Notifications::sendApplyNow($post, $file_name, $listing_info, $current_user_sid, $notRegisterUserData, $score); if (!empty($jobInfo['screening_questionnaire'])) { $questionnaire = SJB_ScreeningQuestionnaires::getInfoBySID($jobInfo['screening_questionnaire']); if ($questionnaire) { $passing_score = 0; switch ($questionnaire['passing_score']) { case 'acceptable': $passing_score = 1; break; case 'good': $passing_score = 2; break; case 'very_good': $passing_score = 3; break; case 'excellent': $passing_score = 4; break; } } if ($score >= $passing_score && $questionnaire['send_auto_reply_more'] == 1) { if (!empty($questionnaire['email_text_more'])) { SJB_Notifications::userAutoReply($jobInfo, $current_user_sid, $questionnaire['email_text_more'], $notRegisterUserData); } } elseif ($score < $passing_score && $questionnaire['send_auto_reply_less'] == 1) { if (!empty($questionnaire['email_text_less'])) { SJB_Notifications::userAutoReply($jobInfo, $current_user_sid, $questionnaire['email_text_less'], $notRegisterUserData); } } } } if ($res === false) { $errors['APPLY_ERROR'] = 'Cannot apply'; } $isDataSubmitted = true; } } if (!empty($jobInfo['screening_questionnaire'])) { $questions = new SJB_Questions($_REQUEST, $jobInfo['screening_questionnaire']); $add_form = new SJB_Form($questions); $add_form->registerTags($tp); $form_fields = $add_form->getFormFieldsInfo(); $tp->assign('form_fields', $form_fields); $tp->assign('questionsObject', $questions); } if ($loggedIn) { $listing_type_sid = SJB_ListingTypeManager::getListingTypeSIDByID('Resume'); $wait_approve = SJB_ListingTypeManager::getWaitApproveSettingByListingType($listing_type_sid); $approve_status = ''; if ($wait_approve) { $approve_status = "AND `l`.`status` = 'approved'"; } $result = SJB_DB::query("SELECT `l`.`sid` , `l`.`Title` FROM `listings` as `l`\n\t\t\t\tLEFT JOIN `listing_types` as `lt` ON (`lt`.`sid` = `l`.`listing_type_sid`)\n\t\t\t\tWHERE `lt`.`id` = 'Resume' {$approve_status} AND `l`.`user_sid` = {$current_user_sid} AND `l`.`active`"); $resume = array(); foreach ($result as $val) { $resume[$val['sid']] = $val['Title']; } $tp->assign('resume', $resume); } $tp->assign('listing', $jobInfo); } else { $errors['UNDEFINED_LISTING_ID'] = true; } $tp->assign('request', $_REQUEST); $tp->assign('errors', $errors); $tp->assign('listing_id', $controller->getListingID()); $tp->assign('is_data_submitted', $isDataSubmitted); $tp->display('apply_now.tpl'); }
public static function sendApplyNow($info, $file = '', $data_resume = array(), $current_user_sid = false, $notRegisterUserData = false, $score = false) { if ($current_user_sid) { $user_info = SJB_UserManager::getUserInfoBySID($current_user_sid); $sender_email_address = $user_info['email']; } else { $sender_email_address = $notRegisterUserData['email']; } $application_email = SJB_Applications::getApplicationEmailbyListingId($info['listing']['id']); $email_address = !empty($application_email) ? $application_email : $info['listing']['user']['email']; $questionnaire = !empty($info['submitted_data']['questionnaire']) ? unserialize($info['submitted_data']['questionnaire']) : ''; $questionnaireInfo = array(); if ($questionnaire) { $listingInfo = SJB_ListingManager::getListingInfoBySID($info['listing']['id']); $questSID = isset($listingInfo['screening_questionnaire']) ? $listingInfo['screening_questionnaire'] : 0; $questionnaireInfo = SJB_ScreeningQuestionnaires::getInfoBySID($questSID); $passing_score = 0; switch ($questionnaireInfo['passing_score']) { case 'acceptable': $passing_score = 1; break; case 'good': $passing_score = 2; break; case 'very_good': $passing_score = 3; break; case 'excellent': $passing_score = 4; break; } if ($score >= $passing_score) { $questionnaireInfo['passing_score'] = 'Passed'; } else { $questionnaireInfo['passing_score'] = 'Not passed'; } } if (!empty($info['listing']['subuser']['sid'])) { $subUserInfo = SJB_UserManager::getUserInfoBySID($info['listing']['subuser']['sid']); if (!empty($subUserInfo)) { $email_address = $subUserInfo['email']; } } $data = array('user' => SJB_Array::getPath($info, 'listing/user'), 'listing' => $info['listing'], 'applicant_request' => $info['submitted_data'], 'data_resume' => $data_resume, 'questionnaire' => $questionnaire, 'score' => $score, 'questionnaire_info' => $questionnaireInfo); $email = SJB_EmailTemplateEditor::getEmail($email_address, self::SEND_APPLY_NOW_SID, $data); $email->setReplyTo($sender_email_address); if ($file != '') { $email->setFile($file); } return $email->send('Apply Now'); }
public function execute() { $tp = SJB_System::getTemplateProcessor(); $appsPerPage = SJB_Request::getVar('appsPerPage', 10); $this->currentPage = SJB_Request::getVar('page', 1); $currentUser = SJB_UserManager::getCurrentUser(); $appJobId = SJB_Request::getVar('appJobId', false, null, 'int'); $score = SJB_Request::getVar('score', false); $orderBy = SJB_Request::getVar('orderBy', 'date'); $order = SJB_Request::getVar('order', 'desc'); $displayTemplate = "view.tpl"; $errors = array(); // не бум пускать незарегенных if (SJB_UserManager::isUserLoggedIn() === false) { $tp->assign("ERROR", "NOT_LOGIN"); $tp->display("../miscellaneous/error.tpl"); return; } $filename = SJB_Request::getVar('filename', false); if ($filename) { $appsID = SJB_Request::getVar('appsID', false); if ($appsID) { $file = SJB_UploadFileManager::openApplicationFile($filename, $appsID); if (!$file) { $errors['NO_SUCH_FILE'] = true; } } else { $errors['NO_SUCH_APPS'] = true; } } if (!is_numeric($this->currentPage) || $this->currentPage < 1) { $this->currentPage = 1; } if (!is_numeric($appsPerPage) || $appsPerPage < 1) { $appsPerPage = 10; } if ($order != 'asc' && $order != 'desc') { $order = 'desc'; } if (!empty($score) && $score != 'passed' && $score != 'not_passed') { $score = false; } $tp->assign("orderBy", $orderBy); $tp->assign("order", $order); if (isset($orderBy) && isset($order) && $orderBy != "") { switch ($orderBy) { case "date": $orderInfo = array('sorting_field' => 'date', 'sorting_order' => $order); break; case "title": $orderInfo = array('sorting_field' => 'Title', 'sorting_order' => $order, 'inner_join' => array('table' => 'listings', 'field1' => 'sid', 'field2' => 'listing_id')); break; case "applicant": $orderInfo = false; $sortByUsername = true; break; case "status": $orderInfo = array('sorting_field' => 'status', 'sorting_order' => $order); break; case "score": $orderInfo = array('sorting_field' => 'score', 'sorting_order' => $order); break; case "company": $orderInfo = array('sorting_field' => 'CompanyName', 'sorting_order' => $order, 'inner_join' => array('table' => 'listings', 'field1' => 'sid', 'field2' => 'listing_id'), 'inner_join2' => array('table1' => 'users', 'table2' => 'listings', 'field1' => 'sid', 'field2' => 'user_sid')); break; default: $orderInfo = array('sorting_field' => 'date', 'sorting_order' => $order); } } if ($currentUser->getUserGroupSID() == 41) { // Работадатель switch (SJB_Request::getVar('action', '')) { case "approve": $applications = SJB_Request::getVar('applications', ''); if (!empty($applications)) { if (is_array($applications)) { foreach ($applications as $key => $value) { $this->approveApplication($key); } } else { $this->approveApplication($applications); } } break; case "reject": $applications = SJB_Request::getVar('applications', ''); if (!empty($applications)) { if (is_array($applications)) { foreach ($applications as $key => $value) { $this->rejectApplication($key); } } else { $this->rejectApplication($applications); } } break; case "delete": if (isset($_POST["applications"])) { foreach ($_POST["applications"] as $key => $value) { SJB_Applications::hideEmp($key); } } break; } $whereSubuser = ''; if (!empty($subuser)) { $whereSubuser = '******' . SJB_DB::quote($subuser); } $jobs = SJB_DB::query('select `Title` as `title`, `sid` as `id` from `listings` where `user_sid` = ?n' . $whereSubuser, $currentUser->sid); $listingTitle = null; foreach ($jobs as $job) { if ($job['id'] == $appJobId) { $listingTitle = $job['title']; } } $apps = $this->executeApplicationsForEmployer($appsPerPage, $appJobId, $currentUser, $score, $orderInfo, $listingTitle); if (empty($apps) && $this->currentPage > 1) { $this->currentPage = 1; $apps = $this->executeApplicationsForEmployer($appsPerPage, $appJobId, $currentUser, $score, $orderInfo, $listingTitle); } foreach ($apps as $i => $app) { $apps[$i]["job"] = SJB_ListingManager::getListingInfoBySID($apps[$i]["listing_id"]); if (!empty($apps[$i]["job"]['screening_questionnaire'])) { $screening_questionnaire = SJB_ScreeningQuestionnaires::getInfoBySID($apps[$i]["job"]['screening_questionnaire']); $passing_score = 0; switch ($screening_questionnaire['passing_score']) { case 'acceptable': $passing_score = 1; break; case 'good': $passing_score = 2; break; case 'very_good': $passing_score = 3; break; case 'excellent': $passing_score = 4; break; } if ($apps[$i]['score'] >= $passing_score) { $apps[$i]['passing_score'] = 'Passed'; } else { $apps[$i]['passing_score'] = 'Not passed'; } } if (isset($apps[$i]["resume"]) && !empty($apps[$i]["resume"])) { $apps[$i]["resumeInfo"] = SJB_ListingManager::getListingInfoBySID($apps[$i]["resume"]); } // если это анонимный соискатель - то возьмем имя из пришедшего поля 'username' if ($apps[$i]['jobseeker_id'] == 0) { $apps[$i]["user"]["FirstName"] = $apps[$i]['username']; } else { $apps[$i]["user"] = SJB_UserManager::getUserInfoBySID($apps[$i]["jobseeker_id"]); $apps[$i]['user']['stateInfo'] = SJB_StatesManager::getStateInfoBySID($apps[$i]['user']['Location_State']); if (isset($apps[$i]['user']['stateInfo']['state_code'])) { $apps[$i]['user']['Location']['State_Code'] = $apps[$i]['user']['stateInfo']['state_code']; } } } $tp->assign("appsPerPage", $appsPerPage); $tp->assign("currentPage", $this->currentPage); $tp->assign("pages", $this->pages); $tp->assign("totalPages", $this->totalPages); $tp->assign("appJobs", $jobs); $tp->assign("score", $score); $tp->assign("current_filter", $appJobId); $tp->assign("listing_title", $listingTitle); } else { // Соискатель if (SJB_Request::getVar('action', '', 'POST') == "delete") { foreach (SJB_Request::getVar('applications', array(), 'POST') as $key => $value) { SJB_Applications::hideJS($key); } } $apps = SJB_Applications::getByJobseeker($currentUser->sid, $orderInfo); for ($i = 0; $i < count($apps); ++$i) { $apps[$i]["job"] = SJB_ListingManager::getListingInfoBySID($apps[$i]["listing_id"]); $apps[$i]["company"] = SJB_UserManager::getUserInfoBySID($apps[$i]["job"]["user_sid"]); } $displayTemplate = "view_seeker.tpl"; } if (isset($sortByUsername)) { $sortKeys = array(); $order = $order == "desc" ? SORT_DESC : SORT_ASC; foreach ($apps as $key => $value) { if (!isset($apps[$key]["user"]["FirstName"])) { $apps[$key]["user"]["FirstName"] = ''; } if (!isset($apps[$key]["user"]["LastName"])) { $apps[$key]["user"]["LastName"] = ''; } $sortKeys[$key] = $apps[$key]["user"]["FirstName"] . " " . $apps[$key]["user"]["LastName"]; } array_multisort($sortKeys, $order, SORT_REGULAR, $apps); } if (empty($apps) && empty($errors['NOT_OWNER_OF_APPLICATIONS'])) { $errors['APPLICATIONS_NOT_FOUND'] = true; } $tp->assign("METADATA", SJB_Application::getApplicationMeta()); $tp->assign("applications", $apps); $tp->assign("errors", $errors); $tp->display($displayTemplate); }
public function execute() { $tp = SJB_System::getTemplateProcessor(); $action = SJB_Request::getVar('action', false); $sid = SJB_Request::getVar('sid', null, null, 'int'); $edit = SJB_Request::getVar('edit', false); if (isset($_REQUEST['passed_parameters_via_uri'])) { $passed_parameters_via_uri = SJB_UrlParamProvider::getParams(); $sid = isset($passed_parameters_via_uri[0]) ? $passed_parameters_via_uri[0] : null; $questionSID = isset($passed_parameters_via_uri[1]) ? $passed_parameters_via_uri[1] : false; } if (SJB_ScreeningQuestionnaires::isUserOwnerQuestionnaire(SJB_UserManager::getCurrentUserSID(), $sid)) { switch ($action) { case 'delete': if ($questionSID) { SJB_ScreeningQuestionnairesFieldManager::deleteQuestionBySID($questionSID); } SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/edit-questions/{$sid}/"); break; case 'move_up': $questionSID = SJB_Request::getVar('question', false); if ($questionSID) { SJB_ScreeningQuestionnairesFieldManager::moveUpFieldBySID($questionSID); } break; case 'move_down': $questionSID = SJB_Request::getVar('question', false); if ($questionSID) { SJB_ScreeningQuestionnairesFieldManager::moveDownFieldBySID($questionSID); } break; } $questionnaire_field = new SJB_ScreeningQuestionnairesField($_REQUEST); $questions = array(); if ($sid) { $questions = SJB_ScreeningQuestionnairesFieldManager::getFieldsInfoByQuestionnairesSID($sid); $tp->assign('questionnarieInfo', SJB_ScreeningQuestionnaires::getInfoBySID($sid)); } $add_questionnaire_field_form = new SJB_Form($questionnaire_field); $add_questionnaire_field_form->registerTags($tp); $form_is_submitted = SJB_Request::getVar('action', '') == 'add'; $errors = null; $answers = SJB_Request::getVar('answer', false); $score = SJB_Request::getVar('score', false); $answer_boolean = SJB_Request::getVar('answer_boolean', false); $score_boolean = SJB_Request::getVar('score_boolean', false); $type = SJB_Request::getVar('type', false); if (is_array($answers)) { foreach ($answers as $key => $val) { if ($key != 0 && $val == null) { unset($answers[$key]); } } } if ($form_is_submitted && $add_questionnaire_field_form->isDataValid($errors)) { $questionnaire_field->addProperty(array('id' => 'questionnaire_sid', 'type' => 'id', 'value' => $sid, 'is_system' => true)); $id = $questionnaire_field->getProperty('caption'); $questionnaire_field->addProperty(array('id' => 'id', 'type' => 'string', 'value' => md5($id->value), 'is_system' => true)); SJB_ScreeningQuestionnairesFieldManager::saveQuestion($questionnaire_field); if ($type == 'boolean') { $request['list_multiItem_value'] = $answer_boolean; $request['field_sid'] = $questionnaire_field->sid; $request['score'] = $score_boolean; $edit_list_controller = new SJB_ScreeningQuestionnairesListController($request); if ($edit_list_controller->isvalidFieldSID()) { $edit_list_controller->saveItem(true); } } elseif ($type != 'string') { $request['list_multiItem_value'] = $answers; $request['field_sid'] = $questionnaire_field->sid; $request['score'] = $score; $edit_list_controller = new SJB_ScreeningQuestionnairesListController($request); if ($edit_list_controller->isvalidFieldSID()) { $edit_list_controller->saveItem(true); } } $questionnaire_sid = $questionnaire_field->getSID(); SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/edit-questions/{$sid}/"); } else { switch ($type) { case 'boolean': $tp->assign('answer_boolean', $answer_boolean); $tp->assign('score_boolean', $score_boolean); break; case 'multilist': case 'list': $tp->assign('answers', $answers); $tp->assign('score', $score); break; } $tp->assign('edit', $edit); $tp->assign('sid', $sid); $tp->assign('questions', $questions); $tp->assign('action', 'edit'); $tp->assign('errors', $errors); $add_questionnaire_field_form->registerTags($tp); $tp->assign('form_fields', $add_questionnaire_field_form->getFormFieldsInfo()); $tp->display('edit_questions.tpl'); } } }
public function execute() { $tp = SJB_System::getTemplateProcessor(); $action = SJB_Request::getVar('action', 'add'); $submit = SJB_Request::getVar('submit', false); $template = SJB_Request::getVar('template_name', 'add_questionnaire.tpl'); $sid = SJB_Request::getVar('sid', null, null, 'int'); $edit = SJB_Request::getVar('edit', false); if (isset($_REQUEST['passed_parameters_via_uri'])) { $passed_parameters_via_uri = SJB_UrlParamProvider::getParams(); $sid = isset($passed_parameters_via_uri[0]) ? $passed_parameters_via_uri[0] : null; } $errors = array(); $questionnaireInfo = SJB_ScreeningQuestionnaires::getInfoBySID($sid); if (!empty($questionnaireInfo['sid']) && !SJB_ScreeningQuestionnaires::isUserOwnerQuestionnaire(SJB_UserManager::getCurrentUserSID(), $questionnaireInfo['sid'])) { SJB_FlashMessages::getInstance()->addError('NOT_OWNER'); } else { if (SJB_Acl::getInstance()->isAllowed('use_screening_questionnaires')) { $questionnaireInfo = $questionnaireInfo ? $questionnaireInfo : array(); $questionnaireInfo = array_merge($questionnaireInfo, $_REQUEST); $questionnaire = new SJB_ScreeningQuestionnaires($questionnaireInfo); if ($submit) { $questionnaire->addProperty(array('id' => 'user_sid', 'type' => 'id', 'value' => SJB_UserManager::getCurrentUserSID(), 'is_system' => true)); } if (isset($sid) && !is_null($sid)) { $questionnaire->setSID($sid); } $addForm = new SJB_Form($questionnaire); $addForm->registerTags($tp); switch ($submit) { case 'add': if ($addForm->isDataValid($errors)) { SJB_ScreeningQuestionnaires::save($questionnaire); SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/screening-questionnaires/add-questions/{$questionnaire->sid}/"); } else { $action = 'add'; $questionnaire->deleteProperty('user_sid'); $addForm = new SJB_Form($questionnaire); $addForm->registerTags($tp); } break; case 'edit': if ($addForm->isDataValid($errors)) { SJB_ScreeningQuestionnaires::save($questionnaire); SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/screening-questionnaires/edit/{$questionnaire->sid}/?edit=1"); } else { $tp->assign('sid', $_REQUEST['sid']); $questionnaire->deleteProperty('user_sid'); $addForm = new SJB_Form($questionnaire); $addForm->registerTags($tp); $action = 'edit'; } break; } $form_fields = $addForm->getFormFieldsInfo(); $tp->assign('form_fields', $form_fields); $metaDataProvider = SJB_ObjectMother::getMetaDataProvider(); $tp->assign('METADATA', array('form_fields' => $metaDataProvider->getFormFieldsMetadata($form_fields))); $tp->assign('edit', $edit); $tp->assign('request', $questionnaireInfo); $tp->assign('sid', $sid); $tp->assign('action', $action); $tp->assign('errors', $errors); $tp->display($template); } } }