public function init() { $this->setName('frmRequest'); $model = new Application_Model_Department(); $arrDepartment = $model->getDepartment('operations'); $this->addElement('select', 'departmentId', array('label' => 'Department:', 'id' => 'departmentId', 'style' => 'width:193px', 'class' => 'text-input small-input', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select department.')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrDepartment)); $this->addElement('textarea', 'request', array('label' => 'Request:', 'class' => 'text-input textarea address', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter request')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'))); $this->addElement('submit', 'submit', array('required' => false, 'class' => 'button', 'ignore' => true, 'label' => 'Submit', 'value' => 'submit', 'decorators' => $this->buttonDecorators)); }
public function init() { $this->addElementPrefixPath('Base_Validate', 'Base/Validate/', 'validate'); $this->setName('frmRegistration'); // $this->addElementPrefixPath('Base_Decorator', // 'Base/Decorator/', // 'decorator'); $this->addElement('text', 'employeeCode', array('label' => 'Employee Code:', 'autocomplete' => "off", 'class' => 'text-input medium-input', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter employee code'))), array('Db_NoRecordExists', true, array('table' => 'user', 'field' => 'employee_code', 'messages' => 'This employee code is already taken!'))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'))); $this->addElement('text', 'username', array('label' => 'Username:'******'autocomplete' => "off", 'class' => 'text-input medium-input', '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, 'class' => 'text-input medium-input', '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, 'class' => 'text-input medium-input', '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:', 'class' => 'text-input medium-input', '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', 'middleName', array('label' => 'Middle Name:', 'class' => 'text-input medium-input', 'required' => false, 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'))); // Add an last name element $this->addElement('text', 'lastName', array('label' => 'Last Name:', 'class' => 'text-input medium-input', 'required' => true, 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter surname')))), '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')))), 'class' => 'text-input medium-input', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'))); $this->addElement('text', 'dob', array('label' => 'Date of Birth:', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter dob')))), 'class' => 'text-input medium-input', 'readonly' => 'true', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'))); $this->addElement('text', 'doj', array('label' => 'Date of Joining:', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter date of joining')))), 'class' => 'text-input medium-input', 'readonly' => 'true', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'))); $model = new Application_Model_Designation(); $arrDesignation = $model->getDesignation(); $this->addElement('select', 'designationId', array('label' => 'Designation:', 'id' => 'designationId', 'style' => 'width:193px', 'class' => 'text-input small-input', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select employee designation.')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrDesignation)); $model = new Application_Model_Department(); $arrDepartment = $model->getDepartment(); $this->addElement('select', 'departmentId', array('label' => 'Department:', 'id' => 'departmentId', 'style' => 'width:193px', 'class' => 'text-input small-input', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select department.')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrDepartment)); $model = new Application_Model_UserLevel(); $arrUserLevel = $model->getUserLevel(); $this->addElement('select', 'userLevelId', array('label' => 'User Level:', 'id' => 'userLevelId', 'style' => 'width:193px', 'class' => 'text-input small-input', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select user level.')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrUserLevel)); $this->addElement('text', 'fatherName', array('label' => "Father's Name:", 'class' => 'text-input medium-input', 'required' => false, 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'))); $this->addElement('select', 'sex', array('label' => 'Gender:', 'class' => 'text-input small-input', 'required' => true, 'decorators' => $this->elementDecorators, 'MultiOptions' => array('male' => "Male", 'female' => "Female"), 'value' => "male")); $this->addElement('text', 'pan', array('label' => 'Permanent Account No. (PAN):', 'class' => 'text-input medium-input', 'decorators' => $this->elementDecorators, 'required' => false, 'filters' => array('StringTrim'))); $this->addElement('text', 'mobile', array('label' => 'Mobile Number:', 'class' => 'text-input medium-input', 'decorators' => $this->elementDecorators, 'required' => false, 'filters' => array('StringTrim'))); $this->addElement('text', 'extensionNo', array('label' => 'Extension Number:', 'class' => 'text-input medium-input', 'decorators' => $this->elementDecorators, 'required' => false, 'filters' => array('StringTrim'))); $this->addElement('text', 'skype', array('label' => 'Skype Id:', 'class' => 'text-input medium-input', 'decorators' => $this->elementDecorators, 'required' => false, 'filters' => array('StringTrim'))); $this->addElement('text', 'contactNo', array('label' => 'Contact Number:', 'class' => 'text-input medium-input', 'decorators' => $this->elementDecorators, 'required' => false, 'filters' => array('StringTrim'))); $this->addElement('text', 'marriageAnniversary', array('label' => 'Marriage Anniversary:', 'required' => false, 'class' => 'text-input medium-input', 'readonly' => 'true', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'))); $this->addElement('textarea', 'correspondenceAddress', array('label' => 'Correspondence Address:', 'class' => 'text-input textarea address', 'required' => false, 'decorators' => $this->elementDecorators, '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', 'style' => 'width:193px', 'class' => 'text-input small-input', '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, 'class' => 'button', 'ignore' => true, 'label' => 'Submit', 'value' => 'submit', 'decorators' => $this->buttonDecorators)); }
public function init() { $this->setName('frmJob'); $this->addElement('text', 'title', array('label' => 'Job Title:', 'autocomplete' => "off", 'class' => 'text-input medium-input', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter job title'))), array('Db_NoRecordExists', true, array('table' => 'job', 'field' => 'title', 'messages' => 'job title already exists'))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'))); $this->addElement('textarea', 'description', array('label' => 'Job Description:', 'class' => 'text-input textarea address', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter job description')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'))); $arrDepartment = array(); $department = new Application_Model_Department(); $arrDepartment = $department->getDepartment(); $this->addElement('select', 'departmentId', array('label' => 'Department:', 'class' => 'text-input small-input', 'required' => true, 'decorators' => $this->elementDecorators, 'MultiOptions' => $arrDepartment)); $noOfOpening = array(); for ($i = 1; $i <= 100; $i++) { $noOfOpening[$i] = $i; } $this->addElement('select', 'noOfOpenings', array('label' => 'No Of Openings:', 'class' => 'text-input small-input', 'required' => true, 'decorators' => $this->elementDecorators, 'MultiOptions' => $noOfOpening, 'value' => "1")); $this->addElement('select', 'status', array('label' => 'Status:', 'class' => 'text-input small-input', 'required' => true, 'decorators' => $this->elementDecorators, 'MultiOptions' => array('open' => "Open", 'close' => "Close"), 'value' => "open")); $this->addElement('submit', 'submit', array('required' => false, 'class' => 'button', 'ignore' => true, 'label' => 'Submit', 'value' => 'submit', 'decorators' => $this->buttonDecorators)); }
public function getDepartment($type = null) { if ($type == "operations") { $where = "type='operations'"; } else { if ($type == "normal") { $where = "type='normal'"; } else { $where = null; } } $obj = new Application_Model_Department(); $entries = $obj->fetchAll($where); $arrUserLevel = array(); foreach ($entries as $entry) { $arrUserLevel[$entry->getId()] = $entry->getTitle(); } return $arrUserLevel; }
public function currentJobOpeningsAction() { /*--search options---*/ $search = trim($this->_getParam('search')); $department_id = trim($this->_getParam('department_id')); $where = "status='open'"; $linkArray = array(); $this->view->search = "Search..."; if ($search != "" && $search != "Search...") { $where = "(j.title like '%{$search}%' or j.description like '%{$search}%' or d.title like '%{$search}%')"; $linkArray['search'] = $search; $this->view->search = $search; } if ($department_id != "") { if (is_null($where)) { $where .= " j.department_id='{$department_id}'"; } else { $where .= " and j.department_id='{$department_id}'"; } $linkArray['department_id'] = $department_id; $this->view->department_id = $department_id; } /*----search options----*/ $this->view->linkArray = $linkArray; $this->view->page_size = $page_size = $this->_getParam('page_size', 25); $page = $this->_getParam('page', 1); $model = new Application_Model_Job(); $table = $model->getMapper()->getDbTable(); $select = $table->select()->setIntegrityCheck(false)->from(array("j" => 'job'))->join(array("d" => "department"), 'd.id=j.department_id', array('department_title' => 'title'))->order('addedon desc')->where($where); //echo $sql = $select->__toString(); $paginator = Base_Paginator::factory($select); $paginator->setItemCountPerPage($page_size); $paginator->setCurrentPageNumber($page); $this->view->totalItems = $paginator->getTotalItemCount(); $this->view->paginator = $paginator; $department = new Application_Model_Department(); $this->view->departments = $department->getDepartment(); }
public function editDepartmentAction() { $id = $this->_getParam('id'); $this->view->user_id = $id; $model1 = new Application_Model_Department(); $model = $model1->find($id); if (false === $model) { $this->_flashMessenger->addMessage(array('error' => 'Invalid request! Please try again.')); $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/hr/departments')); } $options['title'] = $model->getTitle(); $options['type'] = $model->getType(); $options['departmentHeadId'] = $model->getDepartmentHeadId(); $request = $this->getRequest(); $form = new Application_Form_Department(); $form->populate($options); $options = $request->getPost(); if ($request->isPost()) { /*---- email validation ----*/ if ($options['title'] == $model->getTitle()) { $form->getElement('title')->removeValidator("Db_NoRecordExists"); } /*-------------------------*/ if ($form->isValid($options)) { $model->setOptions($options); $model->save(); $this->_flashMessenger->addMessage(array('success' => 'Department title has been updated successfully!')); $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/hr/edit-department/id/' . $id)); } else { $this->_flashMessenger->addMessage(array('error' => 'Unable to save the data. Please provide valid inputs and try again.')); $form->reset(); $form->populate($options); } } $this->view->form = $form; }