Example #1
0
 public function init()
 {
     $this->setName('frmConfiguration');
     $model = new Security_Model_SysConfig();
     $arrLogs = $model->getConfigs();
     $this->addElement('select', 'parentConfigId', array('label' => 'Parent Config Id:', 'required' => false, 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrLogs));
     $this->addElement('text', 'configName', array('label' => 'Config Name:', 'autocomplete' => "off", 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter Configuration Name')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $this->addElement('textarea', 'configDesc', array('label' => 'Config Desc:', 'autocomplete' => "off", 'rows' => 5, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please Enter Config Description.')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $this->addElement('text', 'param1', array('label' => 'Param1:', 'autocomplete' => "off", 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $this->addElement('text', 'param2', array('label' => 'Param2:', 'autocomplete' => "off", 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $this->addElement('text', 'param3', array('label' => 'Param3:', 'autocomplete' => "off", 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $this->addElement('text', 'param4', array('label' => 'Param4:', 'autocomplete' => "off", 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $this->addElement('text', 'param5', array('label' => 'Param5:', 'autocomplete' => "off", 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $this->addElement('submit', 'submit', array('required' => false, 'class' => 'button', 'ignore' => true, 'label' => 'Submit', 'value' => 'submit', 'decorators' => $this->buttonDecorators));
 }
Example #2
0
 public function init()
 {
     $this->setName('frmDbConfig');
     $model = new Security_Model_SysConfig();
     $configArray = $model->getConfigs();
     $this->addElement('select', 'configId', array('label' => 'Config Field:', 'autocomplete' => "off", 'class' => 'text-input medium-input', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Select Config Id')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $configArray));
     $this->addElement('text', 'dbServerName', array('label' => 'Server Name :', '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 database server name'))))));
     // Add an first name element
     $this->addElement('text', 'dbServerPort', array('label' => 'Server Port:', 'class' => 'text-input medium-input', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter databse server port')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     // Add an last name element
     $this->addElement('text', 'dbName', array('label' => 'Database Name:', 'class' => 'text-input medium-input', 'required' => true, 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter databse name name')))), 'filters' => array('StringTrim')));
     $this->addElement('text', 'dbUser', array('label' => 'DB Username:'******'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter database user')))), 'class' => 'text-input medium-input', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $this->addElement('text', 'dbPassword', array('label' => 'DB Password:'******'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter databse password')))), 'class' => 'text-input medium-input', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $this->addElement('select', 'dbTransType', array('label' => 'Transection Type:', 'class' => 'text-input small-input', 'required' => true, 'decorators' => $this->elementDecorators, 'MultiOptions' => array('0' => "select", '1' => "Insert", '2' => "Update", '3' => "Delete"), 'value' => "select"));
     $this->addElement('select', 'status', array('label' => 'Status:', 'class' => 'text-input medium-input', 'decorators' => $this->elementDecorators, 'required' => false, 'MultiOptions' => array('0' => "Inactive", '1' => "Active")));
     $this->addElement('submit', 'submit', array('required' => false, 'class' => 'button', 'ignore' => true, 'label' => 'Submit', 'value' => 'submit', 'decorators' => $this->buttonDecorators));
 }
 public function deleteConfigAction()
 {
     $configId = $this->_getParam('id');
     $guid = $this->_getParam('guid');
     $model1 = new Security_Model_SysConfig();
     $model = $model1->fetchRow("config_id='{$configId}' and row_guid='{$guid}'");
     if (false === $model) {
         $this->_flashMessenger->addMessage(array('error' => 'Invalid request! Please try again.'));
         $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/security/sys-config/index'));
     }
     if ($model->deleteConfig($configId)) {
         $this->_flashMessenger->addMessage(array('success' => 'Data Deleted succesfully'));
         $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/security/sys-config/index'));
     } else {
         $this->_flashMessenger->addMessage(array('error' => 'Failed to Delete the data '));
         $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/security/sys-config/index'));
     }
 }
Example #4
0
 public function deleteConfig($parent_id)
 {
     $model = new Security_Model_SysConfig();
     $result = $model->fetchAll("parent_config_id='{$parent_id}'");
     $model->delete("config_id='{$parent_id}'");
     if (count($result) > 0) {
         foreach ($result as $row) {
             //check child tree
             $modelC = new Security_Model_SysConfig();
             $resultC = $modelC->fetchAll("parent_config_id='{$row->getConfigId()}'");
             $modelC->delete("config_id='{$row->getConfigId()}'");
             if (count($resultC) > 0) {
                 $this->deleteConfig($row->getConfigId());
             }
         }
     }
     return true;
 }