public function indexAction() { //$this->modelUsers->createQuery(''); $users = $this->modelUsers->findBy(array('isdelete' => '0')); //tableTitle = table heading //datarow row of table... render by heading key //heading key = table column name $dataRow = $this->modelUsers->convertToArray($users); $data = array('title' => $this->translator->translate('Login'), 'link' => '/admin/login', 'buttonLogin' => $this->translator->translate('Login'), 'userNameText' => $this->translator->translate('User name'), 'passwordText' => $this->translator->translate('Password')); if ($this->getRequest()->isPost()) { $userName = $this->params()->fromPost('userName'); $password = $this->params()->fromPost('password'); $data = $this->params()->fromPost(); //login here $login_obj = new AuthenticationService(null, $this->modelUsers); $this->modelUsers->setLoginUser($data); $login_obj->authenticate(); //check login $user = Utility::checkLogin($this); if ($user != null) { Utility::insertHistory('login'); $this->redirect()->toRoute('admin/child', array('controller' => 'dashboard')); } else { $this->redirect()->toRoute('admin/child', array('controller' => 'login')); } //end check login } return new ViewModel($data); }
public function onDispatch(\Zend\Mvc\MvcEvent $e) { $install = setupUtility::checkInstall(); if ($install == true) { return $this->redirect()->toRoute('install'); } //get doctrine service $this->serviceLocatorStr = 'doctrine'; $this->sm = $this->getServiceLocator(); $this->doctrineService = $this->sm->get($this->serviceLocatorStr); //get translate service $this->translator = Utility::translate(); //check login $user = Utility::checkLogin(); if (!is_object($user) && $user == 0) { $this->redirect()->toRoute('frontend/child', array('controller' => 'login')); } //start acl // $acl = new myAcl(); // $currentRoute = $this->getModuleCurrentRoute($e); // $isOk = $acl->checkRole(UtilityRoleLevel::convertUserTypeToRole($user->userType)['role'],$currentRoute); // if(!$isOk || $isOk == '' || $isOk == null){ // return $this->redirect()->toRoute('frontend/child', array('controller' => 'login')); // } //end check login //end acl $this->init(); return parent::onDispatch($e); }
public function init() { $this->modelCategories = new categoryModel($this->doctrineService); $this->translator = Utility::translate(); //check login $user = Utility::checkLogin($this); if (!is_object($user) && $user == 0) { $this->redirect()->toRoute('frontend/child', array('controller' => 'login')); } parent::init(); }
public function onDispatch(\Zend\Mvc\MvcEvent $e) { //get doctrine service $this->serviceLocatorStr = 'doctrine'; $this->sm = $this->getServiceLocator(); $this->doctrineService = $this->sm->get($this->serviceLocatorStr); //get translate service $this->translator = Utility::translate(); //check login $user = Utility::checkLogin(); if (!is_object($user) && $user == 0) { $this->redirect()->toRoute('frontend/child', array('controller' => 'login')); } $this->init(); return parent::onDispatch($e); }
public function init() { $service_locator_str = 'doctrine'; $this->sm = $this->getServiceLocator(); $doctrineService = $this->sm->get($service_locator_str); $this->modelOrder = new orderModel($doctrineService); $this->modelOrderDetail = new orderdetailModel($doctrineService); $this->tableModel = new tableModel($doctrineService); $this->translator = Utility::translate(); //check login $this->userLogin = Utility::checkLogin($this); if (!is_object($this->userLogin) && $this->userLogin == 0) { $this->redirect()->toRoute('admin/child', array('controller' => 'login')); } return parent::init(); }
public function onDispatch(\Zend\Mvc\MvcEvent $e) { $service_locator_str = 'doctrine'; $this->sm = $this->getServiceLocator(); $doctrine = $this->sm->get($service_locator_str); $this->modelEvent = new eventModel($doctrine); $this->translator = Utility::translate(); //check login $user = Utility::checkLogin($this); if (!is_object($user) && $user == 0) { $this->redirect()->toRoute('admin/child', array('controller' => 'login')); } else { $isPermission = Utility::checkRole($user->userType, ROLE_ADMIN); if ($isPermission == false) { $this->redirect()->toRoute('admin/child', array('controller' => 'login')); } } return parent::onDispatch($e); }
public function onDispatch(\Zend\Mvc\MvcEvent $e) { $install = setupUtility::checkInstall(); if ($install == true) { return $this->redirect()->toRoute('install'); } //get doctrine service $this->serviceLocatorStr = 'doctrine'; $this->sm = $this->getServiceLocator(); $this->doctrineService = $this->sm->get($this->serviceLocatorStr); //get translate service $this->translator = Utility::translate(); //check login $user = Utility::checkLogin(); if (!is_object($user) && $user == 0) { $this->redirect()->toRoute('admin/child', array('controller' => 'login')); } if (!Utility::checkRole($user->userType, ROLE_ADMIN)) { $this->redirect()->toRoute('frontend/child', array('controller' => 'login')); } $this->init(); return parent::onDispatch($e); }
public function indexAction() { $currentUser = Utility::checkLogin(); //config table /////column for table $columns = array(array('title' => 'Id', 'db' => 'id', 'dt' => 0, 'select' => 'id', 'prefix' => 'o', 'search' => false, 'type' => 'number'), array('title' => 'Table', 'db' => 'name', 'dt' => 1, 'select' => 'name', 'prefix' => 't', 'search' => true, 'type' => 'text', 'dataSelect' => Utility::getTableForSelect()), array('title' => 'User Name', 'db' => 'userName', 'dt' => 2, 'select' => 'userName', 'prefix' => 'u', 'search' => true, 'type' => 'text'), array('title' => 'Create date', 'db' => 'createDate', 'dt' => 3, 'select' => 'createDate', 'prefix' => 'o', 'search' => true, 'type' => 'text', 'formatter' => function ($d, $row) { return date('d-m-Y h:i:s', $d); }), array('title' => 'Coupon', 'db' => 'code', 'dt' => 4, 'select' => 'code', 'prefix' => 'c', 'search' => true, 'type' => 'text'), array('title' => 'Total cost', 'db' => 'totalCost', 'dt' => 5, 'select' => 'totalCost', 'prefix' => 'o', 'search' => true, 'type' => 'text', 'formatter' => function ($d, $row) { return Utility::formatCost($d); }), array('title' => 'Total real cost', 'db' => 'totalRealCost', 'select' => 'totalRealCost', 'prefix' => 'o', 'dt' => 6, 'search' => true, 'type' => 'text', 'formatter' => function ($d, $row) { return Utility::formatCost($d); }), array('title' => 'Action', 'db' => 'orderId', 'dt' => 7, 'select' => 'id', 'prefix' => 'o', 'search' => false, 'type' => 'number', 'formatter' => function ($d, $row) { $actionUrl = '/admin/order'; return ' <a class="btn-xs action action-detail btn btn-default btn-primary " href="' . $actionUrl . '/detail/' . $d . '"><i class="icon-external-link "></i></a> '; })); /////end column for table $table = new AjaxTableSum(array(), array(), 'frontend/order'); $table->setTableColumns($columns); $table->setTablePrefix('o'); $table->setExtendJoin(array(array("Admin\\Entity\\User", "u", "WITH", "u.id = o.userId"), array("Admin\\Entity\\Managetable", "t", "WITH", "t.id = o.tableId"), array("Admin\\Entity\\Coupon", "c", "WITH", "c.id = o.couponId"))); $d = date('d', time()); $m = date('m', time()); $y = date('Y', time()); $min = strtotime(' 0:0:0 ' . $d . '-' . $m . '-' . $y); $max = strtotime(' 23:59:59 ' . $d . '-' . $m . '-' . $y); $table->setExtendSQl(array(array('AND', 'o.isdelete', '=', '0'), array('AND', 'o.userId', '=', $currentUser->userId), array('AND', 'o.createDate', '>=', $min), array('AND', 'o.createDate', '<', $max))); $table->setSumColumn(array('5', '6')); $table->setAjaxCall('/frontend/order'); $table->setActionDeleteAll('deleteall'); $this->tableAjaxRequest($table, $columns, $this->modelOrder); //end config table return new ViewModel(array('table' => $table, 'title' => $this->translator->translate('Order'))); }