Example #1
0
 public function indexAction()
 {
     $this->view->Title = 'Đặt hàng';
     $this->view->headTitle($this->view->Title);
     $id = $this->getRequest()->getParam("id_product");
     $Product = Product::getById($id);
     if ($this->getRequest()->isPost()) {
         $request = $this->getRequest()->getParams();
         $error = $this->_checkForm($request);
         if (count($error) == 0) {
             $Contact = new Contact();
             $Contact->merge($request);
             $Contact->created_date = date("Y-m-d H:i:s");
             $Contact->save();
             //$_SESSION['msg'] = "Yêu cầu đặt hàng của bạn đã được gửi, xin trân thành cảm ơn!";
             My_Plugin_Libs::setSplash('<b>Yêu cầu đặt hàng của bạn đã được gửi, xin trân thành cảm ơn!</b>');
             $this->_redirect($this->_helper->url('index', 'contact', 'default'));
         }
         if (count($error)) {
             $this->view->error = $error;
         }
     }
     $this->view->Product = $Product;
     $this->view->Contact = $Contact;
 }
Example #2
0
 public function deleteAction()
 {
     $contactObj = Contact::getById($this->getRequest()->getParam('id'));
     if ($this->getRequest()->isPost()) {
         $contactObj->delete();
         $this->Member->log('Đặt hàng: ' . $contactObj->full_name . '(' . $this->getRequest()->getParam('id') . ')', 'Xóa đơn hàng');
         My_Plugin_Libs::setSplash('Đơn hàng của: <b>' . $contactObj->full_name . '</b> đã xóa khỏi hệ thống.');
         $this->_redirect($this->_helper->url('index', 'contact', 'admin'));
     }
     $this->view->Contact = $contactObj;
 }
 public function deleteAction()
 {
     $Product = ProductGroup::getById($this->getRequest()->getParam('id'));
     if ($Product) {
         if ($this->getRequest()->isPost()) {
             $Product->delete();
             $this->Member->log('Nhóm sản phẩm: ' . $Product->name . '(' . $this->getRequest()->getParam('id') . ')', 'Xóa');
             My_Plugin_Libs::setSplash('Nhóm sản phẩm: <b>' . $Product->name . '</b> đã được xóa khỏi hệ thống.');
             $this->_redirect($this->_helper->url('index', 'productgroup', 'admin'));
         }
         $this->view->Product = $Product;
     }
 }
Example #4
0
 /**
  * Delete a Country
  */
 public function deleteAction()
 {
     $Content = Content::getById($this->getRequest()->getParam('id'));
     if ($Content) {
         if ($this->getRequest()->isPost()) {
             $Content->delete();
             $this->Member->log('Delete: ' . $Content->content_title . '(' . $this->getRequest()->getParam('id') . ')', 'Content');
             My_Plugin_Libs::setSplash('Posts: <b>' . $Content->content_title . '</b> have been delete.');
             $this->_redirect($this->_helper->url('index', 'content', 'admin'));
         }
         $this->view->Content = $Content;
     }
 }
Example #5
0
 public function deleteAction()
 {
     $Product = Setions::getById($this->getRequest()->getParam('id'));
     if ($Product) {
         if ($this->getRequest()->isPost()) {
             $Product->delete();
             $this->Member->log('Setions: ' . $Product->name . '(' . $this->getRequest()->getParam('id') . ')', 'Xóa');
             My_Plugin_Libs::setSplash('Delete: <b>' . $Product->name . '</b> have been completed.');
             $this->_redirect($this->_helper->url('index', 'setions', 'admin'));
         }
         $this->view->Setions = $Product;
     }
 }
Example #6
0
 /**
  * Delete a Country
  */
 public function deleteAction()
 {
     $Content = NewGroup::getById($this->getRequest()->getParam('id'));
     if ($Content) {
         if ($this->getRequest()->isPost()) {
             $Content->delete();
             $this->Member->log('Nhóm tin: ' . $Content->name . '(' . $this->getRequest()->getParam('id') . ')', 'Xóa');
             My_Plugin_Libs::setSplash('Nhóm tin: <b>' . $Content->name . '</b> đã được xóa khỏi hệ thống.');
             $this->_redirect($this->_helper->url('index', 'newgroup', 'admin'));
         }
         $this->view->Newgroup = $Content;
     }
 }
Example #7
0
 public function deleteAction()
 {
     $Group = Groups::getById($this->getRequest()->getParam('id'));
     if ($Group) {
         if ($this->getRequest()->isPost()) {
             $Group->delete();
             My_Plugin_Libs::setSplash('Delete:<b>' . $Group->name . '</b> have been completed.');
             $this->Member->log('Member group:' . $Group->name . '(' . $this->getRequest()->getParam('id') . ')', 'Delete');
             $this->_redirect($this->_helper->url('index', 'Group', 'admin'));
         }
         $this->view->Group = $Group;
     }
 }
Example #8
0
 public function deleteAction()
 {
     $contactObj = Contact::getById($this->getRequest()->getParam('id'));
     if ($contactObj) {
         if ($this->getRequest()->isPost()) {
             $contactObj->delete();
             $this->Member->log('Delete: ' . $contactObj->contact_first_name . " " . $contactObj->contact_last_name . '(' . $this->getRequest()->getParam('id') . ')', 'Contact');
             My_Plugin_Libs::setSplash('Contact by: <b>' . $contactObj->contact_first_name . " " . $contactObj->contact_last_name . '</b> have been delete.');
             $this->_redirect($this->_helper->url('index', 'contact', 'admin'));
         }
         $this->view->Contact = $contactObj;
     }
 }
Example #9
0
 /**
  * Delete a Country
  */
 public function deleteAction()
 {
     $Video = Video::getById($this->getRequest()->getParam('id'));
     if ($Video) {
         if ($this->getRequest()->isPost()) {
             $Video->delete();
             $this->Member->log('Video: ' . $Video->name . '(' . $this->getRequest()->getParam('id') . ')', 'Xóa');
             My_Plugin_Libs::setSplash('Video: <b>' . $Video->name . '</b> đã được xóa khỏi hệ thống.');
             $this->_redirect($this->_helper->url('index', 'video', 'admin'));
         }
         $this->view->Video = $Video;
     }
 }
Example #10
0
 /**
  * Delete a Country
  */
 public function deleteAction()
 {
     $trainers = Trainer::getById($this->getRequest()->getParam('id'));
     if ($trainers) {
         if ($this->getRequest()->isPost()) {
             $trainers->delete();
             $this->Member->log('Delete: ' . $trainers->first_name . ' ' . $trainers->last_name . '(' . $this->getRequest()->getParam('id') . ')', 'Trainers');
             My_Plugin_Libs::setSplash('Posts: <b>' . $trainers->first_name . ' ' . $trainers->last_name . '</b> have been delete.');
             $this->_redirect($this->_helper->url('index', 'trainers', 'admin'));
         }
         $this->view->trainers = $trainers;
     }
 }
Example #11
0
 /**
  * Delete a Country
  */
 public function deleteAction()
 {
     $Content = Content::getById($this->getRequest()->getParam('id'));
     if ($Content) {
         if ($this->getRequest()->isPost()) {
             $Content->delete();
             $this->Member->log('Bài viết: ' . $Content->content_title . '(' . $this->getRequest()->getParam('id') . ')', 'Xóa');
             My_Plugin_Libs::setSplash('Bài viết: <b>' . $Content->content_title . '</b> đã được xóa khỏi hệ thống.');
             $this->_redirect($this->_helper->url('index', 'content', 'admin'));
         }
         $this->view->Content = $Content;
     }
 }
Example #12
0
 public function deleteAction()
 {
     $Group = Groups::getById($this->getRequest()->getParam('id'));
     if ($Group) {
         if ($this->getRequest()->isPost()) {
             $Group->delete();
             My_Plugin_Libs::setSplash('Nhóm thành viên:<b>' . $Group->name . '</b> đã được xóa khổi hệ thống.');
             $this->Member->log('Xóa nhóm thành viên:' . $Group->name . '(' . $this->getRequest()->getParam('id') . ')', 'Groups');
             $this->_redirect($this->_helper->url('index', 'Group', 'admin'));
         }
         $this->view->Group = $Group;
     }
 }
Example #13
0
 public function indexAction()
 {
     $this->view->Title = 'Contact form';
     $this->view->headTitle($this->view->Title);
     $captcha = new My_Plugin_Image();
     $this->view->captcha = $captcha->render($this->view);
     $this->view->captcha_id = $captcha->getId();
     if ($this->getRequest()->isPost()) {
         $request = $this->getRequest()->getParams();
         $error = $this->_checkForm($request);
         if (count($error) == 0) {
             $Contact = new Contact();
             $Contact->merge($request);
             $Contact->save();
             /**
              * Check server mail valid
              * @var unknown_type
              */
             $check_mail_server = array('username' => Zend_Registry::get('Setting')->EMAIL_SMTP_USER, 'password' => Zend_Registry::get('Setting')->EMAIL_SMTP_PASS, 'port' => Zend_Registry::get('Setting')->EMAIL_SMTP_PORT);
             if (!$check_mail_server['username'] || !$check_mail_server['password'] || !$check_mail_server['port']) {
                 /**
                  * Not send mail to admin
                  */
                 My_Plugin_Libs::setSplash('<b>Your feedback have been send to us. Thank you very much!</b>');
                 $this->_redirect($this->_helper->url('index', 'contact', 'default'));
             } else {
                 /**
                  * Send mail to admin
                  */
                 if ($request['contact_type'] == "Contact") {
                     $subject = "[" . Zend_Registry::get('Setting')->DOMAIN . "][Contact] From : " . $request['contact_first_name'] . " " . $request['contact_last_name'];
                 } else {
                     $subject = "[" . Zend_Registry::get('Setting')->DOMAIN . "][Get listed] - From: " . $request['contact_first_name'] . " " . $request['contact_last_name'];
                 }
                 $email = Zend_Registry::get('Setting')->webmaster_email;
                 $name = "Administrator";
                 $message = $request['message'];
                 $sendmail = new My_Plugin_Email();
                 $sendmail->send($subject, $email, $name, $message, $type = 'html');
                 My_Plugin_Libs::setSplash('<b>Your feedback have been send to us. Thank you very much!</b>');
                 $this->_redirect($this->_helper->url('index', 'contact', 'default'));
             }
         }
         if (count($error)) {
             $this->view->error = $error;
         }
     }
     $this->view->Contact = $Contact;
 }
Example #14
0
 public function __construct($request)
 {
     if (count($request->getParams()) == 0) {
         return;
     }
     $controller = strtolower($request->controller);
     $action = strtolower($request->action);
     if ($_SESSION['Role'][$controller][$action] != 1) {
         if ($_SESSION['Member']) {
             $_SESSION['Member']->log('Access denied: ' . $controller . '-' . $action, $controller);
         }
         My_Plugin_Libs::setSplash('Bạn không đươc quyền truy cập phân mục đó. Hay liên hệ người quản lý cao nhất', 'error');
         header('location: /admin/');
     }
 }
Example #15
0
 public function editAction()
 {
     $this->view->Title = "Chỉnh sửa nhóm thành viên";
     $this->view->headTitle($this->view->Title);
     $Group = Groups::getById($this->getRequest()->getParam('id'));
     $Resources = new Zend_Config_Xml(APPLICATION_PATH . '/configs/resources.xml', 'admin');
     if ($this->getRequest()->isPost()) {
         $Role = $this->getRequest()->getParam('Role');
         $Group->merge($_POST);
         $Group->role = Zend_Json::encode($Role);
         $Group->save();
         $this->Member->log('Chỉnh sửa nhóm thành viên: ' . $Group->name . ' (' . $Group->id . ')', 'Groups');
         My_Plugin_Libs::setSplash('Nhóm thành viên:<b>' . $Group->name . '</b> đã được sửa.');
         $this->_redirect($this->_helper->url('index', 'Group'));
     }
     $this->view->Resources = $Resources;
     $Group->role = Zend_Json::decode($Group->role);
     $this->view->Group = $Group;
 }
Example #16
0
 public function searchjsonAction()
 {
     $keyword = strtolower($this->getRequest()->getParam('term'));
     $numOfItem = (int) Zend_Registry::get('Setting')->autocomplete_limit;
     if ($numOfItem > 0) {
         list($Pager, $aRespon['cities']) = City::getAll(array('LOWER(city_id) || LOWER(tags) LIKE ?' => "%{$keyword}%"), 1, $numOfItem);
         $numOfItem = $numOfItem - $Pager->getNumResults();
     }
     if ($numOfItem > 0) {
         //Search countries three
         $aRespon['countries'] = Countries::getAll(array('LOWER(countries_id) LIKE ? OR  LOWER(tags) LIKE ?' => array("%{$keyword}%", "%{$keyword}%")), $numOfItem);
         $numOfItem = $numOfItem - count($aRespon['countries']);
     }
     header('Content-Type: text/html; charset=iso-8859-1');
     $search = ucwords($keyword);
     $keywords = array($keyword, $search, ucfirst(str_replace(' ', '', $keyword)), ucfirst(str_replace(' ', '', My_Plugin_Libs::unUnicode($keyword))));
     $response = array();
     $address = '';
     //rebuil to autocomplete struc
     foreach ($aRespon as $location => $data) {
         foreach ($data as $Obj) {
             $link = '';
             if ($location == 'cities') {
                 $label = $Obj->name . ', ' . $Obj->Countries->name;
                 $link = $Obj->getLink();
                 $country = $Obj->Countries->name;
             } elseif ($location == 'countries') {
                 $label = $Obj->name;
                 $link = $Obj->getLink();
                 $country = $Obj->name;
             } else {
                 $label = $Obj->name;
                 $link = $Obj->getLink();
                 $country = $Obj->Countries->name;
                 $address = $Obj->address;
             }
             $response[] = array('location' => $location, 'link' => $link, 'id' => $Obj->id, 'label' => str_replace($keywords, '<b>' . $search . '</b>', $label), 'value' => $label, 'country' => $country, 'address' => str_replace($keywords, '<b>' . $search . '</b>', $address));
         }
     }
     echo json_encode($response);
 }
Example #17
0
 /**
  * The default action - show the home page
  */
 public function indexAction()
 {
     $this->view->Title = 'Get Listed Form';
     $this->view->headTitle($this->view->Title);
     $captcha = new My_Plugin_Image();
     $this->view->captcha = $captcha->render($this->view);
     $this->view->captcha_id = $captcha->getId();
     if ($this->getRequest()->isPost()) {
         $request = $this->getRequest()->getParams();
         $error = $this->_checkForm($request);
         if (count($error) == 0) {
             $Contact = new Contact();
             $Contact->merge($request);
             $Contact->save();
             My_Plugin_Libs::setSplash('<b>Your request have been send to us. Thank you very much!</b>');
             $this->_redirect($this->_helper->url('index', 'trainers', 'default'));
         }
         if (count($error)) {
             $this->view->error = $error;
         }
     }
     $this->view->Contact = $Contact;
 }
Example #18
0
 public function loginforgotAction()
 {
     $this->view->Title = "For gotten password";
     $this->view->headTitle($this->view->Title);
     $error = '';
     $id = 7;
     $Content = Content::getById($id);
     if ($this->getRequest()->isPost()) {
         $Request = $this->getRequest()->getParams();
         $Member = Members::getByEmail($Request['email']);
         if ($Member) {
             $String = My_Plugin_Libs::randomStr();
             $Member->encodePassword($String);
             $Member->save();
             $message = str_replace(array('%email%', '%password%'), array($Member->email, $String), $Content['content']);
             $to = $Member->email;
             $subject = $Content->title;
             $oEmail = new My_Plugin_Email();
             $oEmail->send($subject, $to, '', $message);
             $error = 'Password has been sent to your email!';
         } else {
             $error = 'Email is not macth please try again!';
         }
     }
 }
Example #19
0
 /**
  * Delete a Country
  */
 public function deleteAction()
 {
     $Banner = Banner::getById($this->getRequest()->getParam('id'));
     if ($Banner) {
         if ($this->getRequest()->isPost()) {
             $Banner->delete();
             $this->Member->log('Quảng cáo: ' . $Banner->name . '(' . $this->getRequest()->getParam('id') . ')', 'Xóa');
             My_Plugin_Libs::setSplash('Quảng cáo: <b>' . $Banner->name . '</b> đã được xóa khỏi hệ thống.');
             $this->_redirect($this->_helper->url('index', 'banner', 'admin'));
         }
         $this->view->Banner = $Banner;
     }
 }
Example #20
0
 public function deleteAction()
 {
     $Product = Color::getById($this->getRequest()->getParam('id'));
     if ($Product) {
         if ($this->getRequest()->isPost()) {
             $dir = new My_Plugin_Libs();
             $name = $dir->trimSpacer($request['car_paint_color']);
             $dirname = "uploads/color/" . $name . "/" . $Product->image;
             if (is_file($dirname)) {
                 @chmod($dirname, 0666);
                 @unlink($dirname);
             }
             $Product->delete();
             $this->Member->log('Phong thủy xe: ' . $Product->car_paint_color . '(' . $this->getRequest()->getParam('id') . ')', 'Xóa');
             My_Plugin_Libs::setSplash('Phong thủy xe: <b>' . $Product->car_paint_color . '</b> đã được xóa khỏi hệ thống.');
             $this->_redirect($this->_helper->url('index', 'color', 'admin'));
         }
         $this->view->Color = $Product;
     }
 }
Example #21
0
 public function deleteAction()
 {
     $Product = Product::getById($this->getRequest()->getParam('id'));
     if ($Product) {
         if ($this->getRequest()->isPost()) {
             $filename = "uploads/" . str_replace("", "-", $Product->product_name) . "/" . $Product->product_images;
             if (is_file($filename)) {
                 chmod($filename, 0777);
                 @unlink($filename);
             }
             $Product->delete();
             $this->Member->log('Sản phẩm: ' . $Product->product_name . '(' . $this->getRequest()->getParam('id') . ')', 'Xóa');
             My_Plugin_Libs::setSplash('Sản phẩm: <b>' . $Product->product_name . '</b> đã được xóa khỏi hệ thống.');
             $this->_redirect($this->_helper->url('index', 'product', 'admin'));
         }
         $this->view->Product = $Product;
     }
 }
Example #22
0
 /**
  * Delete a news
  */
 public function deleteAction()
 {
     $Content = News::getById($this->getRequest()->getParam('id'));
     if ($Content) {
         if ($this->getRequest()->isPost()) {
             $Content->delete();
             $this->Member->log('News: ' . $Content->title . '(' . $this->getRequest()->getParam('id') . ')', 'Delete');
             My_Plugin_Libs::setSplash('Delete: <b>' . $Content->title . '</b> have been completed.');
             $this->_redirect($this->_helper->url('index', 'news', 'admin'));
         }
         $this->view->News = $Content;
     }
 }
Example #23
0
 private function getFileDir($dir)
 {
     $Adv = scandir($dir);
     foreach ($Adv as $key => $file) {
         if (in_array($file, array('.', '..', '.svn', 'thumb.db'))) {
             unset($Adv[$key]);
             continue;
         }
         $Adv[$key] = My_Plugin_Libs::fileDetail($dir . '/' . $file);
     }
     return $Adv;
 }
Example #24
0
 public function editcategoryAction()
 {
     $this->view->Title = "Sửa nhóm link";
     $this->view->headTitle($this->view->Title);
     $ExchangeCategories = ExchangeCategories::getById($this->getRequest()->getParam('id'));
     if ($this->getRequest()->isPost()) {
         $ExchangeCategories->merge($_POST);
         echo $ExchangeCategories->save();
         $this->Member->log('Create exchange categories:' . $ExchangeCategories->name . '(' . $ExchangeCategories->id . ')', 'Exchange');
         My_Plugin_Libs::setSplash('Exchange categories: <b>' . $ExchangeCategories->name . '</b> đã được sửa. ');
         $this->_redirect($this->_helper->url('category', 'exchange', 'admin'));
     }
     $this->view->edit = $ExchangeCategories;
 }
Example #25
0
 public function log($message, $Controller)
 {
     $cvs_file = APPLICATION_PATH . 'data' . DIRECTORY_SEPARATOR . 'member_' . $this->id . '.log.csv';
     My_Plugin_Libs::appendCsv($cvs_file, array(date('m-d-Y H:i:s', time()), $_SERVER['REMOTE_ADDR'], $Controller, $message));
 }