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));
 }
 public function addWorkflowDetailAction()
 {
     $request = $this->getRequest();
     $form = new Security_Form_WorkflowDetail();
     $elements = $form->getElements();
     $form->clearDecorators();
     foreach ($elements as $element) {
         $element->removeDecorator('label');
         //$element->removeDecorator('Errors');
     }
     if ($request->isPost()) {
         $form->getElement('workflowName')->addValidators(array(array('Db_NoRecordExists', false, array('table' => 'workflow_master', 'field' => 'workflow_name', 'messages' => 'Workflow already exists, Please choose another name.'))));
         $options = $request->getPost();
         if ($form->isValid($options)) {
             $model = new Security_Model_WorkflowMaster($options);
             $id = $model->save();
             if ($id) {
                 /*---------  Upload image START -------------------------*/
                 //$model->uploadProfilePicture($id,$options);
                 /*---------  Upload image END -------------------------*/
                 $this->_flashMessenger->addMessage(array('success' => 'Workflow added successfully!'));
                 $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/security/workflow/add-workflow'));
             } else {
                 $this->_flashMessenger->addMessage(array('error' => 'Failed to add workflow!'));
                 $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/security/workflow/add-workflow'));
             }
             $form->reset();
         } else {
             $form->reset();
             $form->populate($options);
         }
     }
     $this->view->form = $form;
 }
 public function setModel($row)
 {
     $model = new Security_Model_WorkflowMaster();
     $model->setId($row->id)->setWorkflowName($row->workflow_name)->setCreatedOn($row->created_on)->setCreatedBy($row->created_by)->setUpdatedOn($row->updated_on)->setUpdatedBy($row->updated_by)->setRowGuid($row->row_guid)->setRowVersion($row->row_version)->setIsDeleted($row->is_deleted);
     return $model;
 }