コード例 #1
0
 public function init()
 {
     $this->addElementPrefixPath('Base_Validate', 'Base/Validate/', 'validate');
     $this->setName('frmC');
     $model = new Base_Security_Privilege();
     $this->addElement('text', 'cowid', array('label' => 'Cow ID:', 'class' => 'text-input medium-input', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $arrSuplier = $model->getSupplier();
     $this->addElement('select', 'supplier', array('label' => 'Select Supplier:', 'id' => 'type', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrSuplier));
 }
コード例 #2
0
 public function ajaxGetRoleAction()
 {
     $this->view->layout()->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     $sub_group_id = $this->_getParam('sub_group_id');
     $objPrivilege = new Base_Security_Privilege();
     $roles = $objPrivilege->getRoleArray($sub_group_id);
     echo Zend_Json::encode($roles);
 }
コード例 #3
0
 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();
 }
コード例 #4
0
 public function init()
 {
     $model = new Security_Model_WorkflowMaster();
     $arrWorkflow = $model->getWorkflowArray();
     // print_r($arrGroup);die();
     $this->addElement('select', 'workflowId', array('label' => 'Workflow:', 'id' => 'workflowId', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select workflow.')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrWorkflow));
     $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));
     $this->addElement('submit', 'submit', array('required' => false, 'class' => 'button', 'ignore' => true, 'label' => 'Submit', 'value' => 'submit', 'decorators' => $this->buttonDecorators));
 }
コード例 #5
0
ファイル: User.php プロジェクト: riteshsahu1981/Weadvance
 public function init()
 {
     $this->addElementPrefixPath('Base_Validate', 'Base/Validate/', 'validate');
     $this->setName('frmRegistration');
     //        $this->addElementPrefixPath('Base_Decorator',
     //                            'Base/Decorator/',
     //                            'decorator');
     $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')));
     // 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('select', 'sex', array('label' => 'Gender:', 'class' => 'text-input small-input', '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', 'style' => 'width:193px', 'class' => 'text-input small-input', '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("0" => "Sub Group");
     $this->addElement('select', 'subGroupId', array('label' => 'Sub Group:', 'id' => 'subGroupId', 'style' => 'width:193px', 'class' => 'text-input small-input', 'required' => false, 'decorators' => $this->elementDecorators, 'onchange' => 'getRoles()', 'filters' => array('StringTrim'), 'MultiOptions' => $arrSubgroup));
     $arrUserRole = array("0" => 'Roles');
     $this->addElement('select', 'roleId', array('label' => 'User Role:', 'id' => 'roleId', 'style' => 'width:193px', 'class' => 'text-input small-input', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select user Role.')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrUserRole));
     $this->addElement('text', 'mobile', array('label' => 'Mobile Number:', 'class' => 'text-input medium-input', 'decorators' => $this->elementDecorators, 'required' => false, '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));
 }
コード例 #6
0
 public function init()
 {
     $this->addElementPrefixPath('Base_Validate', 'Base/Validate/', 'validate');
     $this->setName('frmProduction');
     $model = new Base_Security_Privilege();
     $arrBreed = $model->getMasterValues('fdAnimal');
     $this->addElement('select', 'breed', array('label' => 'Breed:', 'id' => 'breed', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrBreed));
     $arrType = $model->getMasterValues('fdAnimalType');
     $this->addElement('select', 'type', array('label' => 'Type:', 'id' => 'type', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrType));
     $arrColor = $model->getMasterValues('fdAnimalColor');
     $this->addElement('select', 'color', array('label' => 'Color:', 'id' => 'color', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrColor));
     $this->addElement('text', 'cowid', array('label' => 'Cow ID:', 'class' => 'text-input medium-input', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $arrSuplier = $model->getSupplier();
     $this->addElement('select', 'supplier', array('label' => 'Select Supplier:', 'id' => 'type', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrSuplier));
     $arrInputs = $model->getCondumnValues('fdCondumnSubStatus');
     $this->addElement('multiselect', 'inputs', array('label' => 'Input(s):', 'id' => 'inputs', 'class' => 's1', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrInputs));
 }
コード例 #7
0
 public function editUserAction()
 {
     $this->view->postUrl = $this->getRequest()->getRequestUri();
     $id = $this->_getParam('id');
     $guid = $this->_getParam('guid');
     $model1 = new Security_Model_User();
     $model = $model1->fetchRow("id='{$id}' and row_guid='{$guid}'");
     //$model = $model1->find($id);
     if (false === $model) {
         $this->_flashMessenger->addMessage(array('error' => 'Invalid request! Please try again.'));
         $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/security/user/index'));
     }
     $options['firstName'] = $model->getFirstName();
     $options['middleName'] = $model->getMiddleName();
     $options['lastName'] = $model->getLastName();
     $options['email'] = $model->getEmail();
     $options['dob'] = $model->getDob();
     $options['sex'] = $model->getSex();
     $options['phone'] = $model->getPhone();
     $options['fax'] = $model->getFax();
     $options['zip'] = $model->getZip();
     $options['city'] = $model->getCity();
     $options['state'] = $model->getState();
     $options['address1'] = $model->getAddress1();
     $options['address2'] = $model->getAddress2();
     $options['organizationName'] = $model->getOrganizationName();
     $options['groupId'] = $model->getGroupId();
     $options['subGroupId'] = $model->getSubGroupId();
     $options['roleId'] = $model->getRoleId();
     $options['status'] = $model->getStatus();
     $options['supervisorId'] = $model->getSupervisorId();
     $this->view->username = $model->getUsername();
     $request = $this->getRequest();
     $form = new Security_Form_User();
     $elements = $form->getElements();
     $form->clearDecorators();
     foreach ($elements as $element) {
         $element->removeDecorator('label');
         //$element->removeDecorator('Errors');
     }
     $form->removeElement('username');
     $form->removeElement('password');
     $form->removeElement('confirmPassword');
     $usersNs = new Zend_Session_Namespace("members");
     if ($usersNs->userId == $id) {
         //$form->removeElement('groupId');
         //$form->removeElement('subGroupId');
         //$form->removeElement('roleId');
         $form->removeElement('status');
     }
     $modelP = new Base_Security_Privilege();
     $arrSubgroup = $modelP->getSubGroupArray($model->getGroupId());
     $form->getElement("subGroupId")->addMultiOptions($arrSubgroup);
     $form->populate($options);
     $arrUserRole = $modelP->getRoleArray($model->getSubGroupId());
     $form->getElement("roleId")->addMultiOptions($arrUserRole);
     $form->populate($options);
     $options = $request->getPost();
     if ($request->isPost()) {
         /*---- email validation ----*/
         if ($options['email'] != $model->getEmail()) {
             $form->getElement('email')->addValidators(array(array('Db_NoRecordExists', false, array('table' => 'user', 'field' => 'email', 'messages' => 'Email already exists, Please choose another email address.'))));
         }
         /*-------------------------*/
         $modelP = new Base_Security_Privilege();
         $arrSubgroup = $modelP->getSubGroupArray($options['groupId']);
         $form->getElement("subGroupId")->addMultiOptions($arrSubgroup);
         $form->populate($options);
         $arrUserRole = $modelP->getRoleArray($options['subGroupId']);
         $form->getElement("roleId")->addMultiOptions($arrUserRole);
         if ($form->isValid($options)) {
             $model->setOptions($options);
             $model->save();
             /*---------  Upload image START -------------------------*/
             //$model->uploadProfilePicture($id,$options);
             /*---------  Upload image END -------------------------*/
             $this->_flashMessenger->addMessage(array('success' => 'User information has been updated successfully!'));
             $this->_helper->_redirector->gotoUrl($this->view->seoUrl($this->view->postUrl));
         } 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->profile_image = $model->getProfileImage();
     $this->view->form = $form;
 }
コード例 #8
0
ファイル: UserController.php プロジェクト: riteshsahu1981/we
 public function editUserAction()
 {
     $id = $this->_getParam('id');
     $this->view->user_id = $id;
     $model1 = new Security_Model_User();
     $model = $model1->find($id);
     if (false === $model) {
         $this->_flashMessenger->addMessage(array('error' => 'Invalid request! Please try again.'));
         $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/admin/user'));
     }
     $options['firstName'] = $model->getFirstName();
     $options['middleName'] = $model->getMiddleName();
     $options['lastName'] = $model->getLastName();
     $options['email'] = $model->getEmail();
     $options['dob'] = $model->getDob();
     $options['sex'] = $model->getSex();
     $options['mobile'] = $model->getMobile();
     $options['groupId'] = $model->getGroupId();
     $options['subGroupId'] = $model->getSubGroupId();
     $options['roleId'] = $model->getRoleId();
     $options['status'] = $model->getStatus();
     $options['correspondenceAddress'] = $model->getCorrespondenceAddress();
     $this->view->username = $model->getUsername();
     $request = $this->getRequest();
     $form = new Security_Form_User();
     //remove fields do not need to display in Edit
     //$form->removeElement('employeeCode');
     //$form->getElement('employeeCode')->setAttrib("readonly", "true");
     $form->removeElement('username');
     $form->removeElement('password');
     $form->removeElement('confirmPassword');
     $usersNs = new Zend_Session_Namespace("members");
     if ($usersNs->userId == $id) {
         //$form->removeElement('groupId');
         //$form->removeElement('subGroupId');
         //$form->removeElement('roleId');
         $form->removeElement('status');
     }
     $modelP = new Base_Security_Privilege();
     $arrSubgroup = $modelP->getSubGroupArray($model->getGroupId());
     $form->getElement("subGroupId")->addMultiOptions($arrSubgroup);
     $form->populate($options);
     $arrUserRole = $modelP->getRoleArray($model->getSubGroupId());
     $form->getElement("roleId")->addMultiOptions($arrUserRole);
     $form->populate($options);
     $options = $request->getPost();
     if ($request->isPost()) {
         /*---- email validation ----*/
         if ($options['email'] != $model->getEmail()) {
             $form->getElement('email')->addValidators(array(array('Db_NoRecordExists', false, array('table' => 'user', 'field' => 'email', 'messages' => 'Email already exists, Please choose another email address.'))));
         }
         /*-------------------------*/
         $modelP = new Base_Security_Privilege();
         $arrSubgroup = $modelP->getSubGroupArray($options['groupId']);
         $form->getElement("subGroupId")->addMultiOptions($arrSubgroup);
         $form->populate($options);
         $arrUserRole = $modelP->getRoleArray($options['subGroupId']);
         $form->getElement("roleId")->addMultiOptions($arrUserRole);
         if ($form->isValid($options)) {
             $model->setOptions($options);
             $model->save();
             /*---------  Upload image START -------------------------*/
             $model->uploadProfilePicture($id, $options);
             /*---------  Upload image END -------------------------*/
             $this->_flashMessenger->addMessage(array('success' => 'User information has been updated successfully!'));
             $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/security/user/edit-user/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->profile_image = $model->getProfileImage();
     $this->view->form = $form;
 }
コード例 #9
0
 public function weighingAction()
 {
     $model = new Mps_Model_RawProduct();
     $Pstatus = "Weighing";
     $code = "fdCondumnStatus";
     $model2 = new Base_Security_Privilege();
     $arrValues = $model2->getCondumnValues($code);
     $arrSubcondumn = $model2->getCondumnValues('fdCondumnSubStatus');
     $this->view->condumnValue = $arrValues;
     $this->view->condumnSubValue = $arrSubcondumn;
     $where = "p.id<>'-2147483648' and process_status='{$Pstatus}'";
     //Edit cow weight values
     $request = $this->getRequest();
     $options = $request->getPost();
     $cowid = trim($this->_getParam('cowid'));
     $weight = trim($this->_getParam("weight"));
     $this->view->cowid = $cowid;
     if ($request->isPost()) {
         if (isset($options['submit'])) {
             //Update Cow weight
             $isExist = $model->isExist("id='{$cowid}' and process_status='{$Pstatus}'");
             if ($isExist) {
                 $model = $model->fetchRow("id='{$cowid}' and process_status='{$Pstatus}'");
                 if ($model !== false) {
                     $model->setWeight($weight);
                     $model->save();
                 }
                 $this->_flashMessenger->addMessage(array('success' => 'Cow weight has been updated successfully!'));
                 $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/mps/production/weighing/cowid/' . $cowid));
             } else {
                 $this->_flashMessenger->addMessage(array('error' => 'Cow ID does not exist!'));
                 $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/mps/production/weighing/cowid/' . $cowid));
             }
             //End Update Cow weight
         } else {
             //Update condumn status and weight
             $condumnStatus = trim($this->_getParam("condumnStatus"));
             //get condumn id on the basis of condumn value
             while ($value = current($arrValues)) {
                 if ($value == $condumnStatus) {
                     $condumnID = key($arrValues);
                 }
                 next($arrValues);
             }
             $model = $model->fetchRow("id='{$cowid}' and process_status='{$Pstatus}'");
             if ($model !== false && !empty($condumnID)) {
                 $model->setWeight($weight);
                 $model->setStatusOn($condumnID);
                 $model->save();
                 $this->_flashMessenger->addMessage(array('success' => 'Condumn status has been updated successfully!'));
                 $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/mps/production/weighing/cowid/' . $cowid));
             } else {
                 $this->_flashMessenger->addMessage(array('error' => 'Invalid Condumn status'));
                 $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/mps/production/weighing/'));
             }
             //End Update condumn status and weight
         }
     }
     //End Edit
     /*---sorting ----*/
     $order = trim($this->_getParam('order', ""));
     $col = trim($this->_getParam('col', ""));
     if ($order != "" && $col != "") {
         if ($col == "id") {
             $strOrderBy = "p.id {$order}";
         } else {
             if ($col == "knocked_date") {
                 $strOrderBy = "p.knocked_date {$order}";
             } else {
                 if ($col == "first_name") {
                     $strOrderBy = array("s.first_name {$order}", "s.last_name {$order}");
                 }
             }
         }
     } else {
         $strOrderBy = "p.knocked_date desc";
         //"p.knocked_date desc"
     }
     $this->view->sortOptions = array();
     /*-----sorting----------*/
     /*--search---*/
     $this->view->linkArray = array();
     $page_size = Zend_Registry::get('page_size');
     $page = $this->_getParam('page', 1);
     $table = $model->getMapper()->getDbTable();
     $select = $table->select()->setIntegrityCheck(false)->from(array("s" => 'supplier'), array("first_name", "last_name"))->join(array("p" => "raw_product"), "s.id=p.supplier_id and p.process_status='{$Pstatus}' and s.id!='-2147483648'", array("*"))->order($strOrderBy);
     // echo $sql = $select->__toString(); die;
     $paginator = Base_Paginator::factory($select);
     $paginator->setItemCountPerPage($page_size);
     $paginator->setCurrentPageNumber($page);
     $this->view->totalItems = $paginator->getTotalItemCount();
     $this->view->paginator = $paginator;
 }
コード例 #10
0
 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();
 }
コード例 #11
0
 public function indexAction()
 {
     $Pstatus = "Knocked";
     if ($this->_getParam('inputs')) {
         $search_input = trim(implode(',', $this->_getParam('inputs')));
     } else {
         $search_input = '';
     }
     $form = new Mps_Form_Compliance();
     $elements = $form->getElements();
     $form->clearDecorators();
     foreach ($elements as $element) {
         $element->removeDecorator('data');
         $element->removeDecorator('Label');
         $element->removeDecorator('row');
     }
     //Used in listing
     $model2 = new Base_Security_Privilege();
     $arrCondumnSubValue = $model2->getCondumnValues('fdCondumnSubStatus');
     $this->view->condumnSubValue = $arrCondumnSubValue;
     //End
     /*---sorting ----*/
     $order = trim($this->_getParam('order', ""));
     $col = trim($this->_getParam('col', ""));
     if ($order != "" && $col != "") {
         if ($col == "breed") {
             $strOrderBy = "s2.master_value {$order}";
         } else {
             if ($col == "type") {
                 $strOrderBy = "s.master_value {$order}";
             } else {
                 if ($col == "color") {
                     $strOrderBy = "s3.master_value {$order}";
                 } else {
                     if ($col == "auction_tag") {
                         $strOrderBy = "p.auction_tag {$order}";
                     } else {
                         if ($col == "ear_tag") {
                             $strOrderBy = "p.ear_tag {$order}";
                         } else {
                             if ($col == "trich") {
                                 $strOrderBy = "p.trich {$order}";
                             } else {
                                 if ($col == "trich") {
                                     $strOrderBy = "p.trich {$order}";
                                 } else {
                                     if ($col == 'id') {
                                         $strOrderBy = "p.id {$order}";
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     } else {
         $strOrderBy = "p.id";
     }
     $this->view->sortOptions = array();
     /*-----sorting----------*/
     /*--search---*/
     $search = trim($this->_getParam('search'));
     $where = "p.id<>'-2147483648' and p.process_status='{$Pstatus}'";
     $this->view->linkArray = array();
     if ($search != "") {
         $params = $this->_getAllParams();
         $breed = trim($this->_getParam('breed'));
         $type = trim($this->_getParam('type'));
         $color = trim($this->_getParam('color'));
         $id = trim($this->_getParam('id'));
         $supplier = trim($this->_getParam('supplier'));
         if (!empty($breed)) {
             $where .= " and breed='{$breed}'";
         }
         if (!empty($type)) {
             $where .= " and type='{$type}'";
         }
         if (!empty($color)) {
             $where .= " and color = '{$color}'";
         }
         if (!empty($id)) {
             $where = " and id = '{$id}' and p.process_status='{$Pstatus}'";
         }
         if (!empty($supplier)) {
             $where .= " and supplier_id = '{$supplier}'";
         }
         if (!empty($search_input)) {
             $where .= " and condumn_sub_status like '%{$search_input}%'";
         }
         $where = "{$where}";
         $this->view->sortOptions['inputs'] = $search_input;
         $form->populate($params);
     }
     $page_size = Zend_Registry::get('page_size');
     $page = $this->_getParam('page', 1);
     $model = new Mps_Model_RawProduct();
     $table = $model->getMapper()->getDbTable();
     $select = $table->select()->setIntegrityCheck(false)->from(array("p" => 'raw_product'), array("*"))->join(array("s" => "system_master"), "s.master_code='fdAnimalType' and s.master_id=p.type", array("type" => "master_value"))->join(array("s2" => "system_master"), "s2.master_code='fdAnimal' and s2.master_id=p.breed", array("breed" => "master_value"))->join(array("s3" => "system_master"), "s3.master_code='fdAnimalColor' and s3.master_id=p.color", array("color" => "master_value"))->order("{$strOrderBy}")->where($where);
     // echo $sql = $select->__toString(); die;
     $paginator = Base_Paginator::factory($select);
     $paginator->setItemCountPerPage($page_size);
     $paginator->setCurrentPageNumber($page);
     $this->view->totalItems = $paginator->getTotalItemCount();
     $this->view->paginator = $paginator;
     //End Listing
     $this->view->form = $form;
 }