public function workflowListAction() { /*--search---*/ $search = trim($this->_getParam('search')); /*---sorting ----*/ $order = trim($this->_getParam('order', "")); $col = trim($this->_getParam('col', "")); if ($order != "" && $col != "") { $strOrderBy = "w.{$col} {$order}"; } else { $strOrderBy = "w.workflow_name asc"; } $this->view->sortOptions = array(); /*-----sorting----------*/ $where = "w.id<>'-2147483648' and w.is_deleted<>1"; $this->view->linkArray = array(); $this->view->search = ""; if ($search != "") { $where = "w.workflow_name like '%{$search}%' and {$where} "; $this->view->linkArray = array('search' => $search); $this->view->search = $search; $this->view->sortOptions['search'] = $search; } $model = new Security_Model_User(); $table = $model->getMapper()->getDbTable(); $select = $table->select()->setIntegrityCheck(false)->from(array("w" => 'workflow_master'), array("id", "workflow_name", "row_guid", "is_deleted"))->order($strOrderBy)->where($where); //echo $sql = $select->__toString(); exit; $page_size = Zend_Registry::get('page_size'); $page = $this->_getParam('page', 1); $paginator = Base_Paginator::factory($select); $paginator->setItemCountPerPage($page_size); $paginator->setCurrentPageNumber($page); $this->view->totalItems = $paginator->getTotalItemCount(); $this->view->paginator = $paginator; }
public function recoverUsername(Security_Model_User $user) { $options['email'] = $user->getEmail(); $options['username'] = $user->getUsername(); $options['firstName'] = $user->getFirstName(); $options['lastName'] = $user->getLastName(); $Mail = new Base_Mail(); $Mail->sendForgotUsernameMail($options); }
public function manageAction() { $Privilege = new Base_Security_Privilege(); $this->view->groups = $Privilege->getGroupArray(); $this->view->subGroups = $Privilege->getSubGroupArray("All"); $this->view->roles = $Privilege->getRoleArray("All"); $User = new Security_Model_User(); $this->view->users = $User->getAllUsers(); $Menu = new Base_Security_Action(); $this->view->actionTree = $Menu->getFullActionTree(); }
public function sendRequestNotification($requestId) { $request = new Application_Model_Request(); $request = $request->find($requestId); if (false === $request) { return false; } $departmentId = $request->getDepartmentId(); $dept = new Application_Model_Department(); $dept = $dept->find($departmentId); if ($dept === false) { return false; } $user = new Security_Model_User(); $users = $user->fetchAll("department_id='{$departmentId}' and status='active' and id ='{$dept->getDepartmentHeadId()}'"); if (count($users) == 0) { return false; } $emails = array(); foreach ($users as $_user) { $emails[$_user->getFirstName() . " " . $_user->getLastName()] = $_user->getEmail(); } if (count($emails) == 0) { return false; } $user = new Security_Model_User(); $requestedBy = $user->find($request->getRequestedBy()); $from_email = $this->settingValue('admin_email'); $from_name = $this->settingLable('admin_email'); /*---Template-----*/ $template = $this->getEmailTemplate('request_notification_email'); $htmlBody = $template['body']; $htmlBody = str_replace("__REQUESTER_NAME__", $requestedBy->getFirstName() . " " . $requestedBy->getLastName(), $htmlBody); $htmlBody = str_replace("__REQUESTER_EMAIL__", $requestedBy->getEmail(), $htmlBody); $htmlBody = str_replace("__REQUESTER_EMP_CODE__", $requestedBy->getEmployeeCode(), $htmlBody); $htmlBody = str_replace("__REQUEST__", $request->getRequest(), $htmlBody); /*---------------------*/ $subject = $template['subject']; $this->setBodyHtml($htmlBody); $this->setFrom($from_email, $from_name); $this->addTo($emails); $this->setSubject($subject); $this->send(); }
public function changePasswordAction() { $usersNs = new Zend_Session_Namespace("members"); $user = new Security_Model_User(); $model = $user->find($usersNs->userId); $request = $this->getRequest(); $form = new Application_Form_ChangePassword(); $elements = $form->getElements(); $form->clearDecorators(); foreach ($elements as $element) { $element->removeDecorator('label'); $element->removeDecorator('Errors'); } if ($request->isPost()) { $options = $request->getPost(); if ($form->isValid($options)) { $model->setPassword(md5($options['password'])); $model->save(); $this->_flashMessenger->addMessage(array('success' => 'Your password has been changed successfully!')); $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/admin/dashboard')); } else { $this->view->password_msg = array_pop($form->getMessages('password')); $this->view->cpassword_msg = array_pop($form->getMessages('confirmPassword')); $form->reset(); $form->populate($options); } } // Assign the form to the view $this->view->form = $form; }
public function changePasswordAction() { $request = $this->getRequest(); $form = new Security_Form_User(); $userM = new Security_Model_User(); $arrUser = $userM->getAllUsers(); $form->addElement('select', 'userId', array('label' => 'Username:'******'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select username.')))), 'decorators' => array('ViewHelper', array('Errors', array('class' => 'input-notification-ul-li error png_bg')), array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))), 'filters' => array('StringTrim'), 'MultiOptions' => $arrUser)); $elements = $form->getElements(); $form->clearDecorators(); foreach ($elements as $element) { $element->removeDecorator('label'); //$element->removeDecorator('Errors'); if ($element->getName() != "password" && $element->getName() != "confirmPassword" && $element->getName() != "userId" && $element->getName() != "submit") { $form->removeElement($element->getName()); } } if ($request->isPost()) { $options = $request->getPost(); if ($form->isValid($options)) { // $usersNs = new Zend_Session_Namespace("members"); $user = new Security_Model_User(); $model = $user->find($options['userId']); $model->setPassword(md5($options['password'])); $model->save(); $this->_flashMessenger->addMessage(array('success' => 'Password has been changed successfully!')); $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/security/user/change-password')); } else { $form->reset(); $form->populate($options); } } // Assign the form to the view $this->view->form = $form; }
public function init() { $this->addElementPrefixPath('Base_Validate', 'Base/Validate/', 'validate'); $this->setName('frmRegistration'); $this->addElement('text', 'username', array('label' => 'Username:'******'autocomplete' => "off", 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter username'))), array('Db_NoRecordExists', true, array('table' => 'user', 'field' => 'username', 'messages' => 'username already exists'))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'))); $this->addElement('password', 'password', array('label' => 'Password:'******'autocomplete' => "off", 'required' => true, 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter password'))), array('validator' => 'StringLength', 'options' => array(6, 20)))))->getElement('password')->addValidator('IdenticalField', false, array('confirmPassword', 'Confirm Password')); // Add an password element $this->addElement('password', 'confirmPassword', array('label' => 'Confirm Password:'******'required' => true, 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(6, 20))))); // Add an password element // Add an first name element $this->addElement('text', 'firstName', array('label' => 'First Name:', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter first name')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'))); $this->addElement('text', 'lastName', array('label' => 'Last Name:', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter last name')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'))); $this->addElement('text', 'organizationName', array('label' => 'Organization Name:', 'required' => true, 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter organization name')))), 'filters' => array('StringTrim'))); $this->addElement('text', 'address1', array('label' => 'Address1:', 'required' => true, 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter address')))), 'filters' => array('StringTrim'))); $this->addElement('text', 'address2', array('label' => 'Address2:', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'))); $this->addElement('text', 'city', array('label' => 'City:', 'required' => true, 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter city')))), 'filters' => array('StringTrim'))); $this->addElement('text', 'state', array('label' => 'State:', 'required' => true, 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter state')))), 'filters' => array('StringTrim'))); $this->addElement('text', 'zip', array('label' => 'Zip:', 'required' => true, 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter zip')))), 'filters' => array('StringTrim'))); $this->addElement('text', 'phone', array('label' => 'Phone:', 'required' => true, 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter phone')))), 'filters' => array('StringTrim'))); $this->addElement('text', 'fax', array('label' => 'Fax:', 'required' => true, 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter fax')))), 'filters' => array('StringTrim'))); $this->addElement('text', 'email', array('label' => 'Email Address:', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter email'))), array('EmailAddress', true, array('messages' => array('emailAddressInvalidFormat' => 'Invalid email address format')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'))); $this->addElement('text', 'dob', array('label' => 'Date of Birth:', 'required' => false, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter dob')))), 'readonly' => 'true', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'))); $this->addElement('select', 'sex', array('label' => 'Gender:', 'required' => true, 'decorators' => $this->elementDecorators, 'MultiOptions' => array('male' => "Male", 'female' => "Female"), 'value' => "male")); $model = new Base_Security_Privilege(); $arrGroup = $model->getGroupArray(); // print_r($arrGroup);die(); $this->addElement('select', 'groupId', array('label' => 'Group:', 'id' => 'groupId', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select user group.')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrGroup, 'onchange' => 'getSubGroups()')); $arrSubgroup = array("" => "Sub Group"); $this->addElement('select', 'subGroupId', array('label' => 'Sub Group:', 'id' => 'subGroupId', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select Subgroup.')))), 'decorators' => $this->elementDecorators, 'onchange' => 'getRoles()', 'filters' => array('StringTrim'), 'MultiOptions' => $arrSubgroup)); $arrUserRole = array("" => 'Roles'); $this->addElement('select', 'roleId', array('label' => 'User Role:', 'id' => 'roleId', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select user Role.')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrUserRole)); $user = new Security_Model_User(); $arrSupervisor = $user->getAllUsers(); $this->addElement('select', 'supervisorId', array('label' => 'Supervisor:', 'id' => 'supervisorId', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select user Supervisor.')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrSupervisor)); // $this->addElement('text', 'mobile', array( // 'label' => 'Mobile Number:', // 'decorators' => $this->elementDecorators, // 'required' => false, // 'filters' => array('StringTrim'), // )); // $this->addElement('file', 'profilePicture', array( // 'class' =>'text-input medium-input', // 'label' => 'Profile Picture:', // 'required' => false, // 'decorators' => $this->fileDecorators, // )); // $this->getElement('profilePicture')->addValidator('Size', false, 1024*1024*5); //2 MB file is allowed // $this->getElement('profilePicture')->getValidator('Size')->setMessages(array("fileSizeTooBig"=>"Maximum allowed file size is 5 MB.","fileSizeTooSmall"=>"")); // $this->getElement('profilePicture')->addValidator('Extension', false, 'jpg,jpeg,png,gif'); // $this->getElement('profilePicture')->getValidator('Extension')->setMessages(array("fileExtensionFalse"=>"Please upload jpg,jpeg,png,gif file.","fileExtensionNotFound"=>"")); // // // // $this->addElement('select', 'status',array( // 'label' => 'Status:', // 'id' => 'status', // 'required' => true, // 'validators' => array( // array('NotEmpty', true, array('messages'=>array('isEmpty'=>'Please select status.'))) // ), // 'decorators' => $this->elementDecorators, // 'filters' => array('StringTrim'), // 'MultiOptions'=>array("active"=>"Active","inactive"=>"Inactive") // )); // $this->addElement('submit', 'submit', array('required' => false, 'ignore' => true, 'label' => 'Submit', 'value' => 'submit', 'decorators' => $this->buttonDecorators)); }
public function permissionSetupAction() { $Privilege = new Base_Security_Privilege(); $this->view->groups = $Privilege->getGroupArray(); $this->view->subGroups = $Privilege->getSubGroupArray("All"); $this->view->roles = $Privilege->getRoleArray("All"); $User = new Security_Model_User(); $this->view->users = $User->getAllUsers(); $Menu = new Base_Security_Menu(); $this->view->menuTree = $Menu->getFullMenuTree(); }
public function getids() { $obj = new Security_Model_User(); $entries = $obj->fetchAll(); $arrUser = array(); foreach ($entries as $entry) { $arrUser[$entry->getId()] = $entry->getUsername(); } return $arrUser; }