public function indexAction($id)
 {
     $userInfo = $this->permissions->getUserInformation('user_id');
     $user_id_log = $userInfo->user_id;
     $user = new \modules\users\models\Users();
     $user->user_id = $id;
     $user->_select = "user_id, fullname, email, password, image, gender, birthdate";
     $phones = new \modules\users\models\User_phones();
     $phones->_select = "user_phone_id, phone, user_id , `primary`";
     $phones->user_id = $id;
     $res = $phones->get();
     $user_phone_id = $res[0]->user_phone_id;
     $phones->user_phone_id = $user_phone_id;
     $address = new modules\users\models\User_addresses();
     $address->select = 'user_address_id ,user_id';
     $address->user_id = $id;
     $add = $address->get();
     $patient = $this->Database->query("SELECT users.*, `user_addresses`.`address`, `user_phones`.`phone`" . "FROM `users` " . "LEFT JOIN `user_addresses` ON `user_addresses`.`user_id`=`users`.`user_id`" . "LEFT JOIN `user_phones` ON `user_phones`.`user_id`=`users`.`user_id`" . "WHERE `users`.`user_id`='{$id}'" . "")->row();
     if (!$patient) {
         Brightery::error404();
     }
     $diseases = $this->Database->query("SELECT clinic_patient_diseases.*, `clinic_disease_templates`.`title`" . "FROM `clinic_patient_diseases` " . "JOIN `clinic_disease_templates` ON `clinic_disease_templates`.`clinic_disease_template_id`=`clinic_patient_diseases`.`clinic_disease_template_id`" . "JOIN `users` ON `users`.`user_id`=`clinic_patient_diseases`.`user_id`" . "WHERE `clinic_patient_diseases`.`user_id`='{$id}'" . "")->result();
     $notes = $this->Database->query("SELECT clinic_patients_notes.*, (SELECT fullname FROM users WHERE clinic_doctors.user_id = users.user_id ) as doctor_name" . " FROM clinic_patients_notes " . " LEFT JOIN clinic_doctors ON clinic_doctors.clinic_doctor_id = clinic_patients_notes.clinic_doctor_id " . "WHERE clinic_patients_notes.user_id = '{$id}'")->result();
     $xrays = $this->Database->query("SELECT clinic_xray_negative.*" . " FROM clinic_xray_negative " . "WHERE clinic_xray_negative.user_id = '{$id}'")->result();
     return $this->render('clinic_user_profile/index', ['item' => $user->get(), 'phones' => $res, 'address' => $add, 'patient' => $patient, 'diseases' => $diseases, 'notes' => $notes, 'xrays' => $xrays, 'id' => $id, 'idlog' => $user_id_log]);
 }
 public function detailsAction($id = null)
 {
     $this->permission('index');
     if (!$id) {
         return Brightery::error404();
     }
     $this->language->load("clinic_patients");
     $patient = $this->Database->query("SELECT users.*, `user_addresses`.`address`, `user_phones`.`phone`" . "FROM `users` " . "LEFT JOIN `user_addresses` ON `user_addresses`.`user_id`=`users`.`user_id`" . "LEFT JOIN `user_phones` ON `user_phones`.`user_id`=`users`.`user_id`" . "WHERE `users`.`user_id`='{$id}'" . "")->row();
     if (!$patient) {
         Brightery::error404();
     }
     $phones = new \modules\users\models\User_phones();
     $phones->_select = "user_phone_id, phone, user_id , `primary`";
     $phones->user_id = $id;
     $res = $phones->get();
     $user_phone_id = $res[0]->user_phone_id;
     $phones->user_phone_id = $user_phone_id;
     $address = new modules\users\models\User_addresses();
     $address->select = 'user_address_id ,user_id';
     $address->user_id = $id;
     $add = $address->get();
     $info = $this->Database->query("SELECT clinic_patient_diseases.*, `clinic_disease_templates`.`title`" . "FROM `clinic_patient_diseases` " . "JOIN `clinic_disease_templates` ON `clinic_disease_templates`.`clinic_disease_template_id`=`clinic_patient_diseases`.`clinic_disease_template_id`" . "JOIN `users` ON `users`.`user_id`=`clinic_patient_diseases`.`user_id`" . "WHERE `clinic_patient_diseases`.`user_id`='{$id}'" . "")->result();
     $notes = $this->Database->query("SELECT clinic_patients_notes.*, (SELECT fullname FROM users WHERE clinic_doctors.user_id = users.user_id ) as doctor_name" . " FROM clinic_patients_notes " . " LEFT JOIN clinic_doctors ON clinic_doctors.clinic_doctor_id = clinic_patients_notes.clinic_doctor_id " . "WHERE clinic_patients_notes.user_id = '{$id}'")->result();
     $xrays = $this->Database->query("SELECT clinic_xray_negative.*" . " FROM clinic_xray_negative " . "WHERE clinic_xray_negative.user_id = '{$id}'")->result();
     return $this->render('clinic_patients/details', ['patient' => $patient, 'diseases' => $info, 'phones' => $res, 'address' => $add, 'notes' => $notes, 'xrays' => $xrays, 'id' => $id]);
 }
 public function addAction($id = false)
 {
     if (!$id) {
         return Brightery::error404();
     }
     $this->layout = 'ajax';
     $this->cart->add($id);
     return json_encode(['total' => $this->cart->getItemsCount()]);
 }
 public function portfolio_itemAction($seo = null)
 {
     if (!$seo) {
         return Brightery::error404();
     }
     $portfolio_item = new \modules\portfolio\models\Portfolio();
     $portfolio_item->seo = $seo;
     print_r($portfolio_item->get());
     return $this->render('portfolio_item', ['item' => $portfolio_item->get()]);
 }
 public function addAction($id = false)
 {
     if (!$id) {
         return Brightery::error404();
     }
     $this->layout = 'ajax';
     $userInfo = $this->permissions->getUserInformation();
     $this->database->insert('commerce_wishlist', ['commerce_product_id' => $id, 'user_id' => $userInfo->user_id]);
     return json_encode(['sucess' => 1]);
 }
 public function get_layoutsAction($interface = false, $style = false)
 {
     if (!$interface || !$style) {
         return Brightery::error404();
     }
     $this->layout = 'ajax';
     $model = new \modules\settings\models\Settings();
     foreach ($model->getAvailableLayouts($interface, $style) as $key => $value) {
         echo "<option value=\"{$key}\">" . $value . "</option>";
     }
 }
 public function deleteAction($id = false)
 {
     $this->permission('delete');
     if (!$id) {
         return Brightery::error404();
     }
     $notes = new \modules\clinic\models\Clinic_patients_notes();
     $notes->clinic_patient_note_id = $id;
     if ($sid = $notes->delete()) {
         return json_encode(['sucess' => 1]);
     }
 }
 public function deleteAction($id = false)
 {
     $this->permission('delete');
     if (!$id) {
         return Brightery::error404("The page you requested is not found.");
     }
     $model = new \modules\pm\models\Pm_priorities();
     $model->pm_priority_id = $id;
     if ($model->delete()) {
         Uri_helper::redirect("management/pm_priorities");
     }
 }
 public function deleteAction($id = false)
 {
     $this->permission('delete');
     if (!$id) {
         return Brightery::error404();
     }
     $classfied = new \modules\classfied\models\Classfied_currencies();
     $classfied->classfied_currency_id = $id;
     if ($classfied->delete()) {
         Uri_helper::redirect("management/classfied_currencies");
     }
 }
 public function deleteAction($id = false)
 {
     $this->permission('delete');
     if (!$id) {
         return Brightery::error404();
     }
     $pm_issue_statues = new \modules\pm\models\Pm_issue_statues();
     $pm_issue_statues->pm_issue_statues_id = $id;
     if ($pm_issue_statues->delete()) {
         Uri_helper::redirect("management/pm_issue_statues");
     }
 }
 public function deleteAction($id = false)
 {
     $this->permission('delete');
     if (!$id) {
         return Brightery::error404();
     }
     $model = new \modules\pages\models\Pages();
     $model->page_id = $id;
     if ($model->delete()) {
         Uri_helper::redirect("management/pages");
     }
 }
 public function deleteAction($id = false)
 {
     $this->permission('delete');
     if (!$id) {
         return Brightery::error404();
     }
     $commerce_product_attributes = new \modules\commerce\models\Commerce_product_attributes();
     $commerce_product_attributes->commerce_product_attribute_id = $id;
     if ($commerce_product_attributes->delete()) {
         Uri_helper::redirect("management/commerce_product_attributes");
     }
 }
 public function deleteAction($id = false)
 {
     $this->permission('delete');
     if (!$id) {
         return Brightery::error404();
     }
     $commerce_payment_method = new \modules\commerce\models\Commerce_payment_method();
     $commerce_payment_method->commerce_payment_method_id = $id;
     if ($commerce_payment_method->delete()) {
         Uri_helper::redirect("management/commerce_payment_method");
     }
 }
 public function deleteAction($id = false)
 {
     $this->permission('delete');
     if (!$id) {
         return Brightery::error404();
     }
     $xrays = new \modules\clinic\models\Clinic_xray_negative();
     $xrays->clinic_xray_negative_id = $id;
     if ($sid = $xrays->delete()) {
         return json_encode(['sucess' => 1]);
     }
 }
 public function deleteAction($id = false)
 {
     $this->permission('delete');
     if (!$id) {
         return Brightery::error404();
     }
     $model = new \modules\clinic\models\Clinic_doctor_reviews();
     $model->clinic_doctor_review_id = $id;
     if ($model->delete()) {
         Uri_helper::redirect("management/clinic_doctor_reviews");
     }
 }
 public function deleteAction($id = false)
 {
     $this->permission('delete');
     if (!$id) {
         return Brightery::error404();
     }
     $model = new \modules\classfied\models\Classfied_cities();
     $model->classfied_city_id = $id;
     $city = $model->get();
     $model->classfied_country_id = $city->classfied_country_id;
     if ($model->delete()) {
         Uri_helper::redirect("management/classfied_cities/index/{$city->classfied_country_id}");
     }
 }
Example #17
0
 public function deleteAction($id = false)
 {
     $this->permission('delete');
     if (!$id) {
         return Brightery::error404();
     }
     $this->model_instance->{$this->model_instance->getPrimaryKey()} = $id;
     if (!$this->model_instance->get()) {
         return Brightery::error404();
     }
     if ($this->model_instance->delete()) {
         Uri_helper::redirect("management/" . $this->_controller);
     }
 }
 public function indexAction($page = null)
 {
     if (!$page) {
         Brightery::error404();
     }
     $model = new \modules\pages\models\Pages();
     $model->language_id = $this->language->getDefaultLanguage();
     $model->seo = $page;
     $res = $model->get();
     if (!$res) {
         Brightery::error404();
     }
     return $this->render('pages/index', ['item' => $res]);
 }
 public function deleteAction($id = false)
 {
     $this->permission('delete');
     if (!$id) {
         return Brightery::error404();
     }
     $model = new \modules\usergroups\models\Usergroups();
     $model_user_group = new \modules\usergroups\models\Usergroup_zones();
     $model->usergroup_id = $id;
     $model_user_group->usergroup_id = $id;
     if ($model_user_group->delete() && $model->delete()) {
         Uri_helper::redirect("management/usergroups");
     }
 }
 public function deleteAction($id = false)
 {
     $this->permission('delete');
     if (!$id) {
         return Brightery::error404("The page you requested is not found.");
     }
     $model = new \modules\pm\models\Pm_roles();
     $model->pm_role_id = $id;
     if ($sid = $model->delete()) {
         return json_encode(['sucess' => 1]);
     }
     //        if ($model->delete())
     //            Uri_helper::redirect("management/pm_roles");
 }
 public function deleteAction($id = false)
 {
     $this->permission('delete');
     $this->layout = 'ajax';
     if (!$id) {
         return Brightery::error404("The page you requested is not found.");
     }
     $model = new \modules\pm\models\pm_comments();
     $model->pm_comment_id = $id;
     if ($model->delete()) {
         return json_encode(['status' => 'success']);
     } else {
         return json_encode(['status' => 'faild']);
     }
 }
 public function indexAction($id = false)
 {
     if (!$id) {
         return Brightery::error404();
     }
     $this->permission('index');
     $users = new \modules\users\models\Users();
     $users->_select = "user_id,fullname,image,status,\n          (SELECT  usergroups.name FROM usergroups WHERE usergroups.usergroup_id = users.usergroup_id) AS usergroup\n       ";
     $users->user_id = $id;
     $teams = new \modules\pm\models\Pm_team_users();
     $teams->_select = "pm_team_users_id, user_id,\n          (SELECT  pm_teams.title FROM pm_teams WHERE pm_teams.pm_team_id = Pm_team_users.pm_team_id) AS team,\n          (SELECT  pm_roles.title FROM pm_roles WHERE pm_roles.pm_role_id = Pm_team_users.pm_role_id) AS role\n       ";
     $teams->user_id = $id;
     $project_count = $this->database->query("SELECT COUNT(*) AS projects\n               FROM (\n                   SELECT DISTINCT  `pm_projects`.`pm_project_id`\n            FROM   `brighterycms`.`pm_projects`\n                RIGHT JOIN  `brighterycms`.`pm_teams_projects`ON (`pm_teams_projects`.`pm_project_id` = `pm_projects`.`pm_project_id`)\n                INNER JOIN `brighterycms`.`pm_teams`  ON (`pm_teams_projects`.`pm_team_id` = `pm_teams`.`pm_team_id`)\n                INNER JOIN `brighterycms`.`pm_team_users` ON (`pm_team_users`.`pm_team_id` = `pm_teams`.`pm_team_id`)\n            WHERE (`pm_team_users`.`user_id` = {$id})\n            ) t;")->row();
     $issue_count = $this->database->query("SELECT COUNT(*) AS issues\n              FROM (\n                SELECT pm_history.pm_issue_id\n                 FROM\n                `brighterycms`.`pm_history`\n                INNER JOIN `brighterycms`.`pm_issues`\n                    ON (`pm_history`.`pm_issue_id` = `pm_issues`.`pm_issue_id`)\n                 WHERE (`pm_history`.`actions` ='assign' AND `pm_history`.`to_user_id` = {$id})\n              ) s;")->row();
     $assign = $this->database->query("SELECT pm_issues.title AS issue_title ,pm_issues.pm_issue_id, actions = 'assign' AS assign ,\n            DATETIME AS assigned_date , NAME AS priority , pm_priorities.color AS p_color , pm_issue_statues.`title` AS statues , pm_issue_statues.`color` AS s_color\n            FROM pm_issues JOIN  pm_history\n            ON pm_issues.`pm_issue_id`= pm_history.`pm_issue_id`\n            JOIN users\n            ON users.user_id = pm_history.to_user_id\n            JOIN pm_priorities\n            ON pm_priorities.`pm_priority_id` = pm_issues.`pm_priority_id`\n            JOIN pm_issue_statues\n            ON pm_issue_statues.`pm_issue_statues_id` = pm_issues.`pm_issue_statues_id`\n            WHERE pm_history.to_user_id = {$id}")->result();
     $actions = $this->database->query("SELECT *, 'Infraction' AS actions , (SELECT pm_issues.`title` FROM pm_issues WHERE pm_issues.`pm_issue_id` = pm_infractions.`pm_issue_id`) AS issue_title FROM `pm_infractions`\n            WHERE pm_infractions.`user_id` = {$id}\n            UNION\n            SELECT *, 'Reputation' AS actions , (SELECT pm_issues.`title` FROM pm_issues WHERE pm_issues.`pm_issue_id` = pm_reputations.`pm_issue_id`) AS issue_title FROM `pm_reputations`\n            WHERE pm_reputations.`user_id` = {$id}")->result();
     return $this->render('pm_user_profile/index', ['item' => $users->get(), 'teams' => $teams->get(), 'assign' => $assign, 'actions' => $actions, 'project_count' => $project_count, 'issue_count' => $issue_count]);
 }
 function indexAction($id = false)
 {
     if (!$id) {
         return Brightery::error404();
     }
     $this->permission('index');
     $projects = new \modules\pm\models\Pm_projects();
     $projects->_select = "pm_project_id,title,about,deadline," . " (SELECT users.fullname FROM users WHERE users.user_id " . "= pm_projects.pm_supervisor_id) AS supervisor";
     $projects->pm_project_id = $id;
     $issues = new \modules\pm\models\Pm_issues();
     $issues->_select = "pm_issue_id,title";
     $issues->pm_project_id = $id;
     $team_result = $this->database->query("SELECT title,pm_teams.`pm_team_id` AS id\n                FROM pm_teams_projects JOIN pm_teams\n                ON pm_teams_projects.`pm_team_id` = pm_teams.`pm_team_id`\n                where pm_teams_projects.pm_project_id= {$id} ")->result();
     $member_result = [];
     foreach ($team_result as $value) {
         $member_result[] = ['team' => $value->title, 'member' => $this->database->query("SELECT  fullname , title\n                             FROM pm_team_users JOIN users\n                             ON pm_team_users.`user_id` = users.`user_id`                                                        \n                             JOIN pm_roles\n                             ON pm_team_users.`pm_role_id` = pm_roles.`pm_role_id`\n                             WHERE pm_team_users.pm_team_id={$value->id}\n                         ")->result()];
     }
     return $this->render('pm_project_details/index', ['item' => $projects->get(), 'issues' => $issues->get(), 'team_results' => $team_result, 'member_results' => $member_result]);
 }
Example #24
0
 /**
  * DETECT THE CURRENT ROUTE
  */
 public function detect()
 {
     // IT'S NOT THE DEFAULT ROUTE, FIND THE MENTIONED CONTROLLER
     $Route = $this->findController();
     if (!$Route) {
         return Brightery::error404();
     }
     if (preg_match("/" . str_replace(['/', '*'], ['\\' . '/', '([a-zA-Z0-9_-]+)'], $this->controllerPaths->modules) . "/", $Route['path'], $res)) {
         Brightery::$RunningModule = $res[1];
     }
     // MAKE INSTANCE
     require_once $Route['path'];
     $controllerInstance = new $Route['controller']();
     // GET ACTION TO RUN
     $method = isset($this->segments[$Route['method'] + 1]) ? $this->segments[$Route['method'] + 1] . "Action" : 'indexAction';
     if (!method_exists($controllerInstance, $method)) {
         return Brightery::error404();
     }
     // GET PARAMS
     $params = array_slice($this->segments, $Route['method'] + 2, count($this->segments) - 1);
     // RUN
     echo call_user_func_array([$controllerInstance, $method], $params);
     //        exit(200);
 }
Example #25
0
 public function postAction($seo = null)
 {
     if (!$seo) {
         return Brightery::error404();
     }
     $userInfo = $this->permissions->getUserInformation();
     $model = new \modules\blog\models\Blog_posts();
     $categories = new \modules\blog\models\Blog_categories();
     $comments = new \modules\blog\models\Blog_post_comments($userInfo ? 'registered' : 'unregistered');
     $comments->_joins = ['users' => ['users.user_id = blog_post_comments.user_id', 'left']];
     $model->seo = $seo;
     $item = $model->get();
     if (!$item) {
         return Brightery::error404();
     }
     if ($userInfo) {
         $comments->set(['name' => $userInfo->fullname, 'email' => $userInfo->email, 'user_id' => $userInfo->user_id, 'comment' => $this->input->post('comment'), 'datetime' => date('Y-m-d H:i:s')]);
     } else {
         $comments->set(['name' => $this->input->post('name'), 'email' => $this->input->post('email'), 'comment' => $this->input->post('comment'), 'datetime' => date('Y-m-d H:i:s')]);
     }
     $comments->blog_post_id = $item->blog_post_id;
     $comments->save();
     return $this->render('blog/post', ['item' => $item, 'categories' => $categories->get(), 'comments' => $comments->get(), 'comments_no' => $comments->get(1), 'user' => $userInfo]);
 }
 public function deleteAction($id = false)
 {
     $this->permission('delete');
     if (!$id) {
         return Brightery::error404();
     }
     $model = new \modules\users\models\Users();
     $model->user_id = $id;
     //
     //        $model_resume = new \modules\resumes\models\Resumes();
     //        $model_resume->_select = 'resume_id';
     //        $model_resume->user_id = $id;
     //        $resume = $model_resume->get();
     //        $resume_id = $resume[0]->resume_id;
     //        $model_resume->resume_id = $resume_id;
     //        $model_phone = new \modules\users\models\user_phones();
     //        $model_phone->user_id = $id;
     //        $model_activities = new modules\resumes\models\Resume_activities();
     //        $model_activities->resume_id = $resume_id;
     //        $model_contacts = new modules\resumes\models\Resume_contacts();
     //        $model_contacts->resume_id = $resume_id;
     //        $model_details = new modules\resumes\models\Resume_details();
     //        $model_details->resume_id = $resume_id;
     //        $model_education = new modules\resumes\models\Resume_education();
     //        $model_education->resume_id = $resume_id;
     //        $model_hobbies = new modules\resumes\models\Resume_hobbies();
     //        $model_hobbies->resume_id = $resume_id;
     //        $model_languages = new modules\resumes\models\Resume_languages();
     //        $model_languages->resume_id = $resume_id;
     //        $model_locations = new modules\resumes\models\Resume_locations();
     //        $model_locations->resume_id = $resume_id;
     //        $model_skills = new modules\resumes\models\Resume_skills();
     //        $model_skills->resume_id = $resume_id;
     //        $model_work = new modules\resumes\models\Resume_work_history();
     //        $model_work->resume_id = $resume_id;
     if ($model->delete()) {
         //            $model_resume->delete();
         //            $model_activities->delete();
         //            $model_contacts->delete();
         //            $model_details->delete();
         //            $model_education->delete();
         //            $model_hobbies->delete();
         //            $model_languages->delete();
         //            $model_locations->delete();
         //            $model_skills->delete();
         //            $model_work->delete();
         //            $model_phone->delete();
         Uri_helper::redirect("management/users");
     }
 }
 public function deleteAction($id = false)
 {
     $this->permission('delete');
     if (!$id) {
         return Brightery::error404();
     }
     $model_schedules = new \modules\clinic\models\Clinic_schedules();
     $model_schedules->clinic_doctor_id = $id;
     $model_exceptions = new modules\clinic\models\Clinic_schedule_exceptions();
     $model_exceptions->clinic_doctor_id = $id;
     $model = new \modules\clinic\models\Clinic_doctors();
     $model->clinic_doctor_id = $id;
     $model_resevration_type = new \modules\clinic\models\Clinic_doctor_reservation_types();
     $model_resevration_type->clinic_doctor_id = $id;
     $model_reservation = new \modules\clinic\models\Clinic_reservations();
     $model_reservation->clinic_doctor_id = $id;
     if ($model->delete() && $model_exceptions->delete() && $model_schedules->delete() && $model_resevration_type->delete() && $model_reservation->delete()) {
         Uri_helper::redirect("management/clinic_doctors");
     }
 }
 public function approveAction($id = false)
 {
     if (!$id) {
         return Brightery::error404();
     }
     echo 'iuui';
     $classfied = new \modules\classfied\models\Classfied_jobs(null);
     $classfied->where('classfied_job_id', $id);
     $classfied->set('is_active', '1');
     if ($classfied->save()) {
         Uri_helper::redirect("management/classfied_jobs");
     }
 }
 public function indexAction()
 {
     $model = new \modules\classfied\models\Classfied_jobs();
     $model->set('classfied_type_id', $this->input->post('classfied_type_id'));
     $model->set('classfied_category_id', $this->input->post('classfied_category_id'));
     $model->set('title', $this->input->post('title'));
     $model->set('description', $this->input->post('description'));
     $model->set('company', $this->input->post('company'));
     $model->set('classfied_city_id', $this->input->post('classfied_city_id'));
     $model->set('classfied_area_id', $this->input->post('classfied_area_id'));
     $model->set('classfied_country_id', $this->input->post('classfied_country_id'));
     $model->set('url', $this->input->post('url'));
     $model->set('poster_email', $this->input->post('poster_email'));
     $model->set('salary_from', $this->input->post('salary_from'));
     $model->set('salary_to', $this->input->post('salary_to'));
     $model->set('classfied_currency_id', $this->input->post('classfied_currency_id'));
     $model->set('is_hidden_num', $this->input->post('is_hidden_num') ? 1 : 0);
     $model->set('phone_num', $this->input->post('phone_num'));
     $model->set('classfied_experience_id', $this->input->post('classfied_experience_id'));
     $model->set('candidate_location', $this->input->post('candidate_location'));
     $categories = Form_helper::queryToDropdown('classfied_categories', 'classfied_category_id', 'name');
     $types = Form_helper::queryToDropdown('classfied_types', 'classfied_type_id', 'name');
     //        $cities = Form_helper::queryToDropdown('classfied_cities', 'classfied_city_id', 'name');
     $cities = ['' => $this->language->phrase('select_city')];
     $experiences = Form_helper::queryToDropdown('classfied_experience', 'classfied_experience_id', 'name');
     $currenies = Form_helper::queryToDropdown('classfied_currencies', 'classfied_currency_id', 'name', ['' => $this->language->phrase('select_currency')]);
     //        $areas = Form_helper::queryToDropdown('classfied_areas', 'classfied_area_id', 'name');
     $areas = ['' => $this->language->phrase('select_area')];
     $countries = Form_helper::queryToDropdown('classfied_countries', 'classfied_country_id', 'name', ['' => $this->language->phrase('select_country')]);
     if ($model->validate()) {
         if ($this->input->post('confirm') == 1) {
             $model->set('classfied_type_id', $this->input->post('classfied_type_id'));
             $model->set('classfied_category_id', $this->input->post('classfied_category_id'));
             $model->set('title', $this->input->post('title'));
             $model->set('description', $this->input->post('description'));
             $model->set('company', $this->input->post('company'));
             $model->set('classfied_city_id', $this->input->post('classfied_city_id'));
             $model->set('classfied_country_id', $this->input->post('classfied_country_id'));
             $model->set('classfied_area_id', $this->input->post('classfied_area_id'));
             $model->set('url', $this->input->post('url'));
             $model->set('poster_email', $this->input->post('poster_email'));
             $model->set('salary_from', $this->input->post('salary_from'));
             $model->set('salary_to', $this->input->post('salary_to'));
             $model->set('classfied_currency_id', $this->input->post('classfied_currency_id'));
             $model->set('is_hidden_num', $this->input->post('is_hidden_num'));
             $model->set('phone_num', $this->input->post('phone_num'));
             $model->set('classfied_experience_id', $this->input->post('classfied_experience_id'));
             $model->set('candidate_location', $this->input->post('candidate_location'));
             $model->set('created_on', date("Y-m-d"));
             if ($model->save()) {
                 return $this->render('classfied_thankyou');
             } else {
                 return Brightery::error404();
             }
         }
         $categories = $categories[$this->input->post('classfied_category_id')];
         $types = $types[$this->input->post('classfied_type_id')];
         $experiences = $experiences[$this->input->post('classfied_experience_id')];
         $currenies = $currenies[$this->input->post('classfied_currency_id')];
         $cities = Form_helper::queryToDropdown('classfied_cities', 'classfied_city_id', 'name', null, 'WHERE classfied_city_id= "' . $this->input->post('classfied_city_id') . '"')[$this->input->post('classfied_city_id')];
         $areas = Form_helper::queryToDropdown('classfied_areas', 'classfied_area_id', 'name', null, 'WHERE classfied_area_id= "' . $this->input->post('classfied_area_id') . '"')[$this->input->post('classfied_area_id')];
         $countries = $countries[$this->input->post('classfied_country_id')];
         //            $candidate = Form_helper::queryToDropdown('countries', 'classfied_country_id', 'name', null, 'WHERE classfied_country_id= "' . $this->input->post('condidate_location') . '"')[$this->input->post('condidate_location')];
         return $this->render('classfied_review_job', ['categories' => $categories, 'cities' => $cities, 'types' => $types, 'experiences' => $experiences, 'currenies' => $currenies, 'areas' => $areas, 'countries' => $countries]);
     } else {
         return $this->render('classfied_post_job', ['categories' => $categories, 'cities' => $cities, 'types' => $types, 'experiences' => $experiences, 'currenies' => $currenies, 'areas' => $areas, 'countries' => $countries]);
     }
 }
 public function product_imagesAction($id = null)
 {
     $this->permission('index');
     if (!$id) {
         return Brightery::error404();
     }
     $product_images = $this->Database->query("SELECT commerce_product_images.*, `commerce_products`.`commerce_product_id`" . "FROM `commerce_product_images` " . "LEFT JOIN `commerce_products` ON `commerce_products`.`commerce_product_id`=`commerce_product_images`.`commerce_product_id`" . "WHERE `commerce_products`.`commerce_product_id`='{$id}'" . "")->result();
     return $this->render('commerce_products/product_images', ['items' => $product_images, 'id' => $id]);
 }