public function manageAction($op = null, $id = null)
 {
     if (!$id and !$op) {
         return Brightery::error404();
     }
     $this->layout = 'ajax';
     $this->permission('manage');
     $this->language->load('clinic_patients');
     $diseases = new \modules\clinic\models\Clinic_patient_diseases();
     if ($op == 'add') {
         $diseases->attributes['user_id'] = $id;
     } else {
         if ($op == 'edit') {
             $diseases->clinic_patient_disease_id = $id;
             $data['disease'] = $diseases->get();
         }
     }
     $diseases->attributes['clinic_disease_template_id'] = $this->input->post('clinic_disease_template_id');
     $diseases->attributes['note'] = $this->input->post('note');
     $data['op'] = $op;
     $data['id'] = $id;
     $data['disease'] = Form_helper::queryToDropdown('clinic_disease_templates', 'clinic_disease_template_id', 'title');
     if (!$_POST) {
         return $this->render('clinic_patients/diseases', $data);
     } else {
         if ($sid = $diseases->save()) {
             return json_encode(['sucess' => 1, 'id' => $sid, 'disease' => $this->input->post('clinic_disease_template_id'), 'note' => $this->input->post('note')]);
         } else {
             return json_encode(['sucess' => 0, 'errors' => $this->validation->errors()]);
         }
     }
 }
 public function indexAction($offset = 0)
 {
     $this->language->load("clinic_reservations");
     $branches = Form_helper::queryToDropdown('clinic_branches', 'clinic_branch_id', 'clinic_branch');
     $specification = Form_helper::queryToDropdown('clinic_specifications', 'clinic_specification_id', 'specification');
     $doctors = new \modules\clinic\models\Clinic_doctors();
     $doctors->_select = "clinic_doctor_id,(SELECT users.fullname FROM users WHERE users.user_id = clinic_doctors.user_id)\n         AS doctor_name";
     $users = ['' => 'select..'];
     foreach ($doctors->get() as $item) {
         $users[$item->clinic_doctor_id] = $item->doctor_name;
     }
     $doctors->_select = "users.fullname,users.image,specification,clinic_branch,clinic_doctor_id";
     $doctors->_joins = ['users' => ['clinic_doctors.`user_id` = users.`user_id`'], 'clinic_specification_branches' => ['clinic_doctors.`clinic_specification_id` = clinic_specification_branches.`clinic_specification_id`'], 'clinic_specifications' => ['clinic_specifications.`clinic_specification_id` = clinic_doctors.`clinic_specification_id`'], 'clinic_branches' => ['clinic_branches.`clinic_branch_id` =`clinic_specification_branches`.`clinic_branch_id`']];
     $doctors->_group_by = [['clinic_doctors.`clinic_doctor_id`']];
     $doctors->_order_by = false;
     if ($this->input->get('clinic_branch_id')) {
         $doctors->where('clinic_branches.`clinic_branch_id` ', $this->input->get('clinic_branch_id'));
     }
     if ($this->input->get('specification_id')) {
         $doctors->where('clinic_specifications.`clinic_specification_id`', $this->input->get('specification_id'));
     }
     if ($this->input->get('clinic_doctor_id')) {
         $doctors->where('clinic_doctors.`clinic_doctor_id`', $this->input->get('clinic_doctor_id'));
     }
     $this->load->library('pagination');
     $doctors->_limit = $this->config->get('limit');
     $doctors->_offset = $offset;
     $config = ['url' => Uri_helper::url('clinic_reservation/index'), 'doctors' => $doctors->get(true), 'limit' => $doctors->_limit, 'offset' => $doctors->_offset];
     return $this->render('clinic_reservations/clinic_reservations', ['branches' => $branches, 'specification' => $specification, 'doctors' => $doctors->get(), 'users' => $users, 'pagination' => $this->Pagination->generate($config)]);
 }
 public function manageAction($id = false)
 {
     if ($id) {
         $this->permission('edit');
     } else {
         $this->permission('add');
     }
     $commerce_orders = new \modules\commerce\models\Commerce_orders();
     if ($_POST) {
         $commerce_orders->attributes = ['subtotal' => $this->input->post('subtotal'), 'total' => $this->input->post('total'), 'commerce_payment_method_id' => $this->input->post('commerce_payment_method_id'), 'user_id' => $this->input->post('user_id'), 'billing_address' => $this->input->post('billing_address'), 'shipping_address' => $this->input->post('shipping_address')];
     }
     if ($id) {
         $commerce_orders->commerce_order_id = $id;
     }
     if (!$id) {
         $commerce_orders->created = date("Y-m-d H:i:s");
     }
     $users = Form_helper::queryToDropdown('users', 'user_id', 'fullname');
     $paymet_method = Form_helper::queryToDropdown('commerce_payment_method', 'commerce_payment_method_id', 'name');
     if ($commerce_orders->save()) {
         Uri_helper::redirect("management/commerce_orders");
     } else {
         return $this->render('commerce_orders/manage', ['item' => $commerce_orders->get(), 'users' => $users, 'payment_method' => $paymet_method]);
     }
 }
 public function manageAction($id = false)
 {
     $this->permission('manage');
     $userInfo = $this->permissions->getUserInformation();
     if ($id) {
         $model = new \modules\blog\models\Blog_posts('edit');
         $model->blog_post_id = $id;
     } else {
         $model = new \modules\blog\models\Blog_posts('add');
         $model->created = date("Y-m-d H:i:s");
         $model->user_id = $userInfo->user_id;
         $model->language_id = $this->language->getDefaultLanguage();
     }
     $model->set('title', $this->Input->post('title'));
     $model->set('seo', $this->Input->post('seo'));
     $model->set('short_content', $this->Input->post('short_content'));
     $model->set('content', $this->Input->post('content'));
     $model->set('blog_category_id', $this->Input->post('blog_category_id'));
     $model->set('language_id', $this->Input->post('language_id'));
     $blog_category = Form_helper::queryToDropdown('blog_categories', 'blog_category_id', 'title');
     if ($model->save()) {
         Uri_helper::redirect("management/blog_posts");
     } else {
         return $this->render('blog_posts/manage', ['item' => $id ? $model->get() : null, 'blog_category' => $blog_category]);
     }
 }
 public function manageAction($id = false)
 {
     $this->permission('manage');
     $model = new \modules\pm\models\Pm_projects();
     $user = new \modules\users\models\Users();
     $team_project = new \modules\pm\models\Pm_teams_projects(false);
     $model->attributes = $this->input->post();
     if ($id) {
         $model->pm_project_id = $id;
     }
     if (!$id) {
         $model->created = date("Y-m-d H:i:s");
     }
     $users = [];
     foreach ($user->get() as $item) {
         $users[$item->user_id] = $item->fullname;
     }
     if ($id) {
         $model->pm_project_id = $id;
     }
     $team_project->_select = "pm_team_project_id, pm_team_id, pm_project_id";
     $teams = Form_helper::queryToDropdown('pm_teams', 'pm_team_id', 'title');
     if ($pid = $model->save()) {
         foreach ($this->input->post('pm_teams') as $teamproject) {
             $team_project->pm_team_id = $teamproject;
             $team_project->pm_project_id = $pid;
             $team_project->save();
         }
         Uri_helper::redirect("management/pm_projects");
     } else {
         return $this->render('pm_projects/manage', ['item' => $id ? $model->get() : null, 'team' => $teams, 'user' => $users, 'team_project' => $id ? $team_project->get() : null]);
     }
 }
 public function manageAction($id = null)
 {
     $this->permission('manage');
     $this->language->load("clinic_doctors");
     $model = new \modules\clinic\models\Clinic_doctors();
     $specifications = Form_helper::queryToDropdown('clinic_specifications', 'clinic_specification_id', 'specification');
     $users_fullname = Form_helper::queryToDropdown('users', 'user_id', 'fullname');
     $users_phone = Form_helper::queryToDropdown('user_phones', 'user_id', 'phone');
     $users_email = Form_helper::queryToDropdown('users', 'user_id', 'email');
     if ($id) {
         $model->clinic_doctor_id = $id;
     }
     $this->input->post($this->input->post('criteria'));
     if ($_POST) {
         $model->user_id = $this->input->post('user_id');
         $model->clinic_specification_id = $this->input->post('clinic_specification_id');
         $model->description = $this->input->post('description');
         $model->period_average = $this->input->post('period_average');
     }
     if ($model->save()) {
         Uri_helper::redirect("management/clinic_doctors");
     } else {
         return $this->render('clinic_doctors/manage', ['item' => $id ? $model->get() : null, 'menu' => ['male' => 'Male', 'female' => 'Female'], 'user_fullname' => $users_fullname, 'user_phone' => $users_phone, 'user_email' => $users_email, 'specification' => $specifications, 'user_id' => $this->input->get('user_id')]);
     }
 }
예제 #7
0
 public function manageAction($id = false)
 {
     $this->permission('manage');
     $model = new \modules\pm\models\Pm_teams();
     $user = new \modules\users\models\Users();
     $team_users = new \modules\pm\models\Pm_team_users(false);
     $model->attributes = $this->Input->post();
     if ($id) {
         $model->pm_team_id = $id;
     }
     if (!$id) {
         $model->created = date("Y-m-d H:i:s");
     }
     $users = [];
     foreach ($user->get() as $item) {
         $users[$item->user_id] = $item->fullname;
     }
     $team_users->_select = "pm_team_users_id , pm_team_id, user_id,pm_role_id";
     $roles = Form_helper::queryToDropdown('pm_roles', 'pm_role_id', 'title');
     if ($tid = $model->save()) {
         if ($id) {
             $team_users->pm_team_id = $id;
             $team_users->delete();
         }
         foreach ($this->input->post('add_user_id') as $key => $member_role) {
             $team_users->user_id = $member_role;
             $team_users->pm_team_id = $tid;
             $team_users->pm_role_id = $this->input->post('add_pm_role_id.' . $key);
             $team_users->save();
         }
         Uri_helper::redirect('management/pm_teams');
     } else {
         return $this->render('pm_teams/manage', ['item' => $id ? $model->get() : null, 'team_users' => $id ? $team_users->get() : null, 'roles' => $roles, 'user' => $users]);
     }
 }
 public function indexAction()
 {
     $this->permission('index');
     $settings = $this->module->getSettings($this->_module);
     $status = Form_helper::queryToDropdown('Pm_issue_statues', 'Pm_issue_statues_id', 'title');
     if ($this->validation->validate($this)) {
         $this->module->saveSettings($this->_module, ['creation_status' => $this->input->post('creation_status'), 'start_status' => $this->input->post('start_status'), 'pause_status' => $this->input->post('pause_status'), 'done_status' => $this->input->post('done_status')]);
         Uri_helper::redirect('management/' . $this->_module . '/pm_settings');
     } else {
         return $this->render('pm_settings/index', ['status' => $status, 'setting' => $settings]);
     }
 }
예제 #9
0
 public function manageAction($id = false)
 {
     $redirect = "management/users";
     $this->permission('manage');
     //        $model = new Users('register');
     if ($id) {
         $model = new \modules\users\models\Users('edit');
         $model_phone = new \modules\users\models\User_phones('edit');
         $model_phone->_select = 'user_phone_id ,phone';
         $model_phone->user_id = $id;
         //            $model_phone->status = 'active' ;
         $res = $model_phone->get();
         $user_phone_id = $res[0]->user_phone_id;
         $model_phone->user_phone_id = $user_phone_id;
     } else {
         $model = new \modules\users\models\Users('add');
         $model_phone = new \modules\users\models\User_phones('add');
     }
     if ($_POST) {
         $model->attributes['fullname'] = $this->input->post('fullname');
         $model->attributes['usergroup_id'] = $this->input->post('usergroup_id');
         $model->attributes['email'] = $this->input->post('email');
         $model->attributes['gender'] = $this->input->post('gender');
     }
     if ($this->input->post('password') != '') {
         $model->attributes['password'] = md5($this->input->post('password'));
     }
     //////////////////////////////////UserGroup/////////////////////////////
     $usergroups = Form_helper::queryToDropdown('usergroups', 'usergroup_id', 'name');
     if ($id) {
         $model->user_id = $id;
         $model_phone->user_id = $id;
     }
     $model_phone->phone = $this->input->post('phone');
     $model->language_id = $this->language->getDefaultLanguage();
     //?
     if (!$id) {
         if ($_POST) {
             $model->created = date("Y-m-d H:i:s");
         }
     }
     if ($r = $model->save()) {
         $model_phone->attributes['phone'] = $this->input->post('phone');
         $model_phone->attributes['user_id'] = $r;
         $model_phone->save();
         if ($this->input->get('url')) {
             $redirect = $this->input->get('url') . $r;
         }
         Uri_helper::redirect($redirect);
     } else {
         return $this->render('users/manage', ['item' => $id ? $model->get() : null, 'menu' => ['male' => 'Male', 'female' => 'Female'], 'usergroup' => $usergroups, 'phone' => $model_phone->get()]);
     }
 }
 public function manageAction($id = false)
 {
     $this->permission('manage');
     $commerce = new \modules\commerce\models\Commerce_category_attributes();
     $commerce->attributes = $this->Input->input['post'];
     $cats = Form_helper::queryToDropdown('commerce_categories', 'commerce_category_id', 'title');
     if ($id) {
         $commerce->commerce_category_attribute_id = $id;
     }
     $commerce->language_id = $this->language->getDefaultLanguage();
     if ($commerce->save()) {
         Uri_helper::redirect("management/commerce_category_attributes");
     } else {
         return $this->render('commerce_category_attributes/manage', ['item' => $id ? $commerce->get() : null, 'categories' => $cats]);
     }
 }
 public function manageAction($id = false)
 {
     $this->permission('manage');
     $this->language->load("clinic_schedule_exceptions");
     $model = new \modules\clinic\models\Clinic_schedule_exceptions();
     $model->attributes = $this->Input->input['post'];
     $schedules = Form_helper::queryToDropdown('clinic_schedules', 'clinic_schedule_id', 'clinic_schedule_id');
     if ($id) {
         $model->clinic_schedule_exception_id = $id;
     }
     $model->language_id = $this->language->getDefaultLanguage();
     if ($model->save()) {
         Uri_helper::redirect("management/clinic_schedule_exceptions");
     }
     return $this->render('clinic_schedule_exceptions/manage', ['item' => $id ? $model->get() : null, 'schedule' => $schedules]);
 }
 public function manageAction($id = false)
 {
     $this->permission('manage');
     $visibility = Form_helper::queryToDropdown('visibility_status', 'visibility_status_id', 'name');
     if ($id) {
         $model = new \modules\testimonials\models\Testimonials('edit');
     } else {
         $model = new \modules\testimonials\models\Testimonials('add');
     }
     $model->attributes = $this->Input->post();
     if ($id) {
         $model->testimonial_id = $id;
     }
     if ($model->save()) {
         Uri_helper::redirect("management/testimonials");
     }
     return $this->render('testimonials/manage', ['item' => $id ? $model->get() : null, 'visibility' => $visibility]);
 }
예제 #13
0
 public function manageAction($id = false)
 {
     $this->permission('manage');
     $model = new \modules\faqs\models\Faqs();
     $model->attributes = $this->Input->input['post'];
     $visibility = Form_helper::queryToDropdown('visibility_status', 'visibility_status_id', 'name');
     if ($id) {
         $model->faq_id = $id;
     }
     $model->language_id = $this->language->getDefaultLanguage();
     if (!$id) {
         $model->created = date("Y-m-d H:i:s");
     }
     if ($model->save()) {
         Uri_helper::redirect("management/faqs");
     } else {
         return $this->render('faqs/manage', ['item' => $id ? $model->get() : null, 'visibility' => $visibility]);
     }
 }
 public function manageAction($id = false)
 {
     $this->permission('manage');
     $this->language->load("license");
     if ($id) {
         $model = new Brightery_licenses('edit');
     } else {
         $model = new Brightery_licenses('add');
     }
     $product = Form_helper::queryToDropdown('brightery_products', 'brightery_product_id', 'title');
     $user = Form_helper::queryToDropdown('users', 'user_id', 'fullname');
     $payment_type;
     if ($this->input->post('payment_type') == 'fixed') {
         $payment_type = 'fixed';
         $brightery_products_subscription_id = null;
     } else {
         $payment_type = 'subscription';
         $brightery_products_subscription_id = $this->input->post('subscription_status');
     }
     if ($_POST) {
         $model->attributes = ['license_code' => $this->input->post('license_code'), 'brightery_product_id' => $this->input->post('brightery_product_id'), 'domain' => $this->input->post('domain'), 'user_id' => $this->input->post('user_id'), 'payment_type' => $payment_type];
         if ($brightery_products_subscription_id) {
             $model->attributes['brightery_products_subscription_id'] = $brightery_products_subscription_id;
         }
     }
     if ($id) {
         $model->brightery_license_id = $id;
     }
     if ($r = $model->save()) {
         if ($id) {
             echo $id;
             Uri_helper::redirect("management/brightery_licenses");
         } else {
             $model11 = new \modules\brightery\models\brightery_invoices(FALSE);
             $model11->attributes = ['brightery_license_id' => $r, 'due_date' => date('Y-m-d'), 'status' => 'due'];
             if ($model11->save()) {
                 Uri_helper::redirect("management/brightery_licenses");
             }
         }
     }
     return $this->render('license/manage', ['item' => $model->get(), 'product' => $product, 'user' => $user]);
 }
 public function manageAction($id = false)
 {
     $this->permission('manage');
     if ($id) {
         $commerce = new \modules\commerce\models\Commerce_shares('edit');
     } else {
         $commerce = new \modules\commerce\models\Commerce_shares('add');
     }
     $commerce->attributes = $this->Input->input['post'];
     if ($id) {
         $commerce->commerce_shares_id = $id;
     }
     $commerce->language_id = $this->language->getDefaultLanguage();
     $user = Form_helper::queryToDropdown('users', 'user_id', 'fullname');
     if ($commerce->save()) {
         Uri_helper::redirect("management/commerce_shares");
     } else {
         return $this->render('commerce_shares/manage', ['item' => $id ? $commerce->get() : null, 'user' => $user]);
     }
 }
예제 #16
0
 public function manageAction($id = false)
 {
     $userInfo = $this->permissions->getUserInformation();
     $this->permission('manage');
     $users = Form_helper::queryToDropdown('users', 'user_id', 'fullname');
     $priorities = Form_helper::queryToDropdown('pm_priorities', 'pm_priority_id', 'name');
     $projects = Form_helper::queryToDropdown('pm_projects', 'pm_project_id', 'title');
     $types = Form_helper::queryToDropdown('pm_issues_types', 'pm_issue_type_id', 'title');
     $attach = new \modules\pm\models\Pm_attachments(false);
     $assign = new \modules\pm\models\Pm_history(false);
     if ($id) {
         $model = new \modules\pm\models\Pm_issues('edit');
         $model->pm_issue_id = $id;
         $attach->pm_issue_id = $id;
         $assign->pm_issue_id = $id;
     } else {
         $model = new \modules\pm\models\Pm_issues('add');
         $model->set('created_time', date('Y-m-d H:i:s'));
     }
     $model->set(['title' => $this->input->post('title'), 'description' => $this->input->post('description'), 'pm_reviewer_id' => $this->input->post('pm_reviewer_id'), 'pm_project_id' => $this->input->post('pm_project_id'), 'pm_priority_id' => $this->input->post('pm_priority_id'), 'estimated_time' => $this->input->post('estimated_time'), 'deadline' => $this->input->post('deadline'), 'pm_issue_type_id' => $this->input->post('pm_issue_type_id'), 'pm_issue_statues_id' => $this->input->post('pm_issue_statues_id')]);
     if ($issue_id = $model->save()) {
         if (!$id) {
             if ($this->input->post('to_user_id')) {
                 $assign->set(['from_user_id' => $userInfo->user_id, 'to_user_id' => $this->input->post('to_user_id'), 'pm_issue_id' => $issue_id, 'actions' => 'assign', 'datetime' => date('Y-m-d H:i:s')]);
                 $assign->save();
             }
         }
         $attach->pm_issue_id = $issue_id;
         $attach->delete();
         foreach ($this->input->post('uploaded_files') as $file) {
             $attach->pm_issue_id = $issue_id;
             $attach->file_name = $file;
             $attach->attachment_type = 'issue';
             $attach->uploaded_time = date('Y-m-d H:i:s');
             $attach->save();
         }
         Uri_helper::redirect("management/pm_issues");
     } else {
         return $this->render('pm_issues/manage', ['item' => $id ? $model->get() : null, 'attach' => $id ? $attach->get() : null, 'users' => $users, 'pm_projects' => $projects, 'priority' => $priorities, 'assign' => $assign, 'types' => $types]);
     }
 }
 public function manageAction($id = false)
 {
     $this->auth = true;
     $this->permission('manage');
     if ($id) {
         $commerce = new \modules\commerce\models\Commerce_products_offers('edit');
     } else {
         $commerce = new \modules\commerce\models\Commerce_products_offers('add');
     }
     $commerce->attributes = $this->Input->input['post'];
     $products = Form_helper::queryToDropdown('commerce_products', 'commerce_product_id', 'name');
     if ($id) {
         $commerce->commerce_products_offer_id = $id;
     }
     $commerce->language_id = $this->language->getDefaultLanguage();
     if ($commerce->save()) {
         Uri_helper::redirect("management/commerce_products_offers");
     } else {
         return $this->render('commerce_products_offers/manage', ['item' => $id ? $commerce->get() : null, 'products' => $products]);
     }
 }
 public function indexAction()
 {
     $order = new \modules\commerce\models\Commerce_orders('order');
     $order_details = new \modules\commerce\models\Commerce_order_details(false);
     $product = new \modules\commerce\models\Commerce_products(false);
     $invoice = new \modules\commerce\models\Commerce_invoices(false);
     $payment_method = Form_helper::queryToDropdown('commerce_payment_method', 'commerce_payment_method_id', 'name', false);
     $addresses = Form_helper::queryToDropdown('user_addresses', 'user_address_id', 'address', false, "WHERE user_id = " . $this->user->user_id);
     $order->set('subtotal', $this->cart->total());
     $order->set('total', $this->cart->total());
     $order->set('commerce_payment_method_id', $this->input->post('commerce_payment_method_id'));
     $order->set('user_id', $this->user->user_id);
     $order->set('billing_address', $addresses[$this->input->post('billing_address')]);
     $order->set('shipping_address', $addresses[$this->input->post('shipping_address')]);
     $order->set('status', $this->input->post('commerce_payment_method_id') == 2 ? 'confirmed' : 'pending');
     if ($order_id = $order->save()) {
         foreach ($this->cart->get() as $item) {
             $order_details->commerce_order_id = $order_id;
             $order_details->product_total = $product->discount($item->price, $item->discount) * $item->qty;
             $order_details->price = $product->discount($item->price, $item->discount);
             $order_details->commerce_product_id = $item->commerce_product_id;
             $order_details->weight = $item->weight;
             $order_details->qty = $item->qty;
             $order_details->save();
         }
         // INVOICE
         $invoice->commerce_order_id = $order_id;
         $invoice->status = 'pending';
         $invoice->save();
         if ($this->input->post('commerce_payment_method_id') == '1') {
             $this->layout = 'ajax';
             return $this->render('payments/paypal', ['total' => $this->cart->total()]);
         }
         // THANK YOU FOR YOUR ORDER
         return $this->render('commerce_orders/commerce_order_confirmed');
     } else {
         return $this->render('commerce_orders/commerce_make_order', ['user' => $this->user, 'payment' => $payment_method, 'addresses' => $addresses, 'cart' => $this->cart]);
     }
 }
 public function manageAction($id = false)
 {
     $this->permission('manage');
     if ($id) {
         $model = new \modules\portfolio\models\Portfolio('edit');
     } else {
         $model = new \modules\portfolio\models\Portfolio('add');
     }
     $model->attributes = $this->Input->post();
     $model->language_id = $this->language->getDefaultLanguage();
     if (!$id) {
         $model->created = date("Y-m-d H:i:s");
     }
     if ($id) {
         $model->portfolio_id = $id;
     }
     $blog_category = Form_helper::queryToDropdown('portfolio_categories', 'portfolio_category_id', 'title');
     if ($model->save()) {
         Uri_helper::redirect("management/portfolio_items");
     }
     return $this->render('portfolio_items/manage', ['item' => $id ? $model->get() : null, 'blog_category' => $blog_category]);
 }
 public function manageAction($id = false)
 {
     $this->permission('manage');
     $commerce = new \modules\commerce\models\Commerce_products();
     $product_images = new \modules\commerce\models\Commerce_product_images(false);
     $commerce->set('name', $this->input->post('name'));
     $commerce->set('commerce_category_id', $this->input->post('commerce_category_id'));
     $commerce->set('price', $this->input->post('price'));
     $commerce->set('type', $this->input->post('type'));
     $commerce->set('discount', $this->input->post('discount'));
     $commerce->set('commerce_brand_id', $this->input->post('commerce_brand_id'));
     $categories = [];
     $cats = Form_helper::queryToDropdown('commerce_categories', 'commerce_category_id', 'title', FALSE, 'WHERE parent="0"');
     foreach ($cats as $catk => $catv) {
         $categories[$catk] = $catv;
         foreach (Form_helper::queryToDropdown('commerce_categories', 'commerce_category_id', 'title', FALSE, 'WHERE parent="' . $catk . '"') as $subk => $subv) {
             $categories[$subk] = ' |-- ' . $subv;
         }
     }
     $categories = Form_helper::arrayToDropdown($categories);
     $brands = Form_helper::queryToDropdown('commerce_brands', 'commerce_brand_id', 'name');
     if ($id) {
         $commerce->commerce_product_id = $id;
     }
     $commerce->language_id = $this->language->getDefaultLanguage();
     if ($id = $commerce->save()) {
         $product_images->commerce_product_id = $id;
         $product_images->delete();
         foreach ($this->input->post('uploaded_files') as $file) {
             $product_images->commerce_product_id = $id;
             $product_images->product_image = $file;
             $product_images->save();
         }
         Uri_helper::redirect("management/commerce_products");
     } else {
         return $this->render('commerce_products/manage', ['item' => $id ? $commerce->get() : null, 'categories' => $categories, 'brands' => $brands, 'type' => ['normal' => 'Normal', 'weighted' => 'Weighted', 'digital' => 'Digital']]);
     }
 }
 public function manageAction($id = false)
 {
     $this->permission('manage');
     if ($id) {
         $commerce = new \modules\commerce\models\Commerce_categories('edit');
         $commerce->commerce_category_id = $id;
     } else {
         $commerce = new \modules\commerce\models\Commerce_categories('add');
     }
     $commerce->set('title', $this->input->post('title'));
     $commerce->set('seo', $this->input->post('seo'));
     $commerce->set('parent', $this->input->post('parent'));
     $commerce->set('description', $this->input->post('description'));
     $commerce->set('featured', $this->input->post('featured'));
     $commerce->language_id = $this->language->getDefaultLanguage();
     $cat['0'] = $this->Language->phrase('main_category');
     $cats = Form_helper::queryToDropdown('commerce_categories', 'commerce_category_id', 'title', $cat, 'WHERE parent = "0"');
     if ($commerce->save()) {
         Uri_helper::redirect("management/commerce_categories");
     } else {
         return $this->render('commerce_categories/manage', ['item' => $id ? $commerce->get() : null, 'categories' => $cats, 'menu' => ['yes' => 'Yes', 'no' => 'No']]);
     }
 }
예제 #22
0
 public function manageAction($id = false)
 {
     $this->permission('manage');
     if ($id) {
         $model = new \modules\pages\models\Pages('edit');
     } else {
         $model = new \modules\pages\models\Pages('add');
     }
     if ($_POST) {
         $model->attributes = $this->input->post();
     }
     $model->language_id = $this->language->getDefaultLanguage();
     if (!$id) {
         $model->created = date("Y-m-d H:i:s");
     }
     if ($id) {
         $model->page_id = $id;
     }
     $model->visibility_status_menu = Form_helper::queryToDropdown('visibility_status', 'visibility_status_id', 'name');
     if ($model->save()) {
         Uri_helper::redirect("management/pages");
     }
     return $this->render('pages/manage', ['item' => $id ? $model->get() : null, 'visibility_status_menu' => $model->visibility_status_menu]);
 }
 public function manageAction($id = false)
 {
     $this->permission('manage');
     if ($id) {
         $model = new \modules\blog\models\Blog_categories('edit');
         $model->blog_category_id = $id;
     } else {
         $model = new \modules\blog\models\Blog_categories('add');
         $model->created = date("Y-m-d H:i:s");
     }
     $model->set('title', $this->Input->post('title'));
     $model->set('seo', $this->Input->post('seo'));
     $model->set('description', $this->Input->post('description'));
     $model->set('sort', $this->Input->post('sort'));
     $model->set('parent', $this->Input->post('parent'));
     $model->language_id = $this->language->getDefaultLanguage();
     $cat['0'] = $this->Language->phrase('main_category');
     $cats = Form_helper::queryToDropdown('blog_categories', 'blog_category_id', 'title', $cat, 'WHERE parent = "0"');
     if ($model->save()) {
         Uri_helper::redirect("management/blog_categories");
     } else {
         return $this->render('blog_categories/manage', ['item' => $id ? $model->get() : null, 'categories' => $cats]);
     }
 }
 public function manageAction($id = false)
 {
     $this->_data = ['news_categories' => Form_helper::queryToDropdown('news_categories', 'news_category_id', 'title')];
     return parent::manageAction($id);
 }
 public function get_areasAction($city_id = null)
 {
     $this->layout = 'ajax';
     $area_id = $this->input->post('classfied_area_id');
     $areas = Form_helper::queryToDropdown('classfied_areas', 'classfied_area_id', 'name', ['' => $this->language->phrase('select_area')], 'WHERE classfied_city_id= "' . $city_id . '"');
     foreach ($areas as $areak => $areav) {
         if ($areak == $area_id) {
             echo '<option value="' . $areak . '" selected="selected">' . $areav . '</option>';
         } else {
             echo '<option value="' . $areak . '">' . $areav . '</option>';
         }
     }
 }
 public function getdoctorTypesAction()
 {
     $doctor_id = $this->input->get('user_id');
     $reservation_type = Form_helper::queryToDropdown('clinic_doctor_reservation_types', 'clinic_doctor_reservation_type_id', 'title', null, 'WHERE clinic_doctor_id = "' . $doctor_id . '"');
     return $this->render('clinic_reservations/manage', ['reservation_type' => $reservation_type]);
 }
예제 #27
0
 public function manageAction($id = false)
 {
     $items = "";
     $locations = "";
     $work = "";
     $skill = "";
     $education = "";
     $activities = "";
     $languages = "";
     $hobbies = "";
     $personal = "";
     $this->permission('manage');
     ///////////////////////////Personal Informations/////////////////////////////////////
     $model_Personal = new \modules\resumes\models\Resumes();
     $model_Personal->_select = "resume_id, language_id, date_of_birth, nationality_id, marital_status_id, created";
     $model_Personal->resume_id = "{$id}";
     ///////////////////////////Matrial Status///////////////////////////////////////////
     $Martial = Form_helper::queryToDropdown('marital_status', 'marital_status_id', 'name');
     ///////////////////////////Nationalities////////////////////////////////////////////
     $Nationality = Form_helper::queryToDropdown('nationalities', 'nationality_id', 'name');
     ///////////////////////////Contacts/////////////////////////////////////
     $model_contact = new \modules\resumes\models\Resume_contacts();
     $model_contact->_select = "resume_contact_id, resume_id, language_id, contact_method, contact_detail, sort";
     $model_contact->resume_id = "{$id}";
     ///////////////////////////Locations////////////////////////////////////
     $model_locations = new \modules\resumes\models\Resume_locations();
     $model_locations->select = "resume_location_id, resume_id, language_id, location, lat, long, address, sort";
     $model_locations->resume_id = "{$id}";
     ///////////////////////////Work ////////////////////////////////
     $model_work = new \modules\resumes\models\Resume_work_history();
     $model_work->select = "resume_work_history_id , resume_id , language_id , company , from , to , category , title , nationality , responsbilities , sort";
     $model_work->resume_id = "{$id}";
     ///////////////////////////Skills ////////////////////////////////
     $model_skill = new \modules\resumes\models\Resume_skills();
     $model_skill->_select = "resume_skill_id , resume_id , language_id , category , content, sort";
     $model_skill->resume_id = "{$id}";
     ///////////////////////////Education ////////////////////////////////
     $model_education = new \modules\resumes\models\Resume_education();
     $model_education->_select = "resume_education_id , resume_id , language_id , degree  , field, school, from_year, from_month , to_year , to_month, sort";
     $model_education->resume_id = "{$id}";
     ///////////////////////////Activities ////////////////////////////////
     $model_activities = new \modules\resumes\models\Resume_activities();
     $model_activities->select = "resume_activity_id , resume_id , language_id , activity  , role , from , to , desc , sort";
     $model_activities->resume_id = "{$id}";
     ///////////////////////////Languages ////////////////////////////////
     $model_languages = new \modules\resumes\models\Resume_languages();
     $model_languages->_select = "resume_language_id , resume_id , language_id , name  , level , sort";
     $model_languages->resume_id = "{$id}";
     ///////////////////////////Hobbies ////////////////////////////////
     $model_hobbies = new \modules\resumes\models\Resume_hobbies();
     $model_hobbies->_select = "resume_hooby_id , resume_id , language_id , name, sort";
     $model_hobbies->resume_id = "{$id}";
     if ($id) {
         $model = new \modules\resumes\models\Resumes('edit');
         $items = $model->get();
         $contacts = $model_contact->get();
         $locations = $model_locations->get();
         $work = $model_work->get();
         $skill = $model_skill->get();
         $activities = $model_activities->get();
         $languages = $model_languages->get();
         $hobbies = $model_hobbies->get();
         $education = $model_education->get();
         $personal = $model_Personal->get();
         //            $Martial = $model_Marital_status->get();
         //            $Nationality = $model_Nationality->get();
     } else {
         $model = new \modules\resumes\models\Resumes('add');
         $contacts = [];
         $locations = [];
     }
     $model->attributes = $this->Input->post();
     $model_contact->attributes = $this->Input->post();
     if ($id) {
         $model->resume_id = $id;
         $model_contact->resume_id = $id;
     }
     $model->language_id = $this->language->getDefaultLanguage();
     if (!$id) {
         $model_Personal->created = date("Y-m-d H:i:s");
     }
     //        if ($model->save()) {
     //            Uri_helper::redirect("management/resumes");
     //        }
     return $this->render('resumes/manage', ['item' => $items, 'item_locations' => $locations, 'item_work' => $work, 'item_skills' => $skill, 'item_education' => $education, 'item_activities' => $activities, 'item_languages' => $languages, 'item_hobbies' => $hobbies, 'item_contacts' => $contacts, 'item_personal' => $personal, 'item_Martial' => $Martial, 'item_Nationality' => $Nationality]);
 }