public function manageformAction()
 {
     $formForm = new Application_Form_Form();
     $formPageConversionMapper = Application_Model_Mappers_FormPageConversionMapper::getInstance();
     $pageMapper = Application_Model_Mappers_PageMapper::getInstance();
     if ($this->getRequest()->isPost()) {
         if ($formForm->isValid($this->getRequest()->getParams())) {
             $formPageConversionModel = new Application_Model_Models_FormPageConversion();
             $formData = $this->getRequest()->getParams();
             $form = new Application_Model_Models_Form($this->getRequest()->getParams());
             $contactEmail = $form->getContactEmail();
             $validEmail = $this->validateEmail($contactEmail);
             if (isset($validEmail['error'])) {
                 $this->_helper->response->fail(Tools_Content_Tools::proccessFormMessagesIntoHtml(array('contactEmail' => $validEmail['error']), get_class($formForm)));
             }
             if (isset($formData['thankyouTemplate']) && $formData['thankyouTemplate'] != 'select') {
                 $trackingPageUrl = $this->_createTrackingPage($formData['name'], $formData['thankyouTemplate']);
             }
             $this->_addConversionCode();
             $formPageConversionModel->setFormName($formData['name']);
             $formPageConversionModel->setPageId($formData['pageId']);
             $formPageConversionModel->setConversionCode($formData['trackingCode']);
             $formPageConversionMapper->save($formPageConversionModel);
             Application_Model_Mappers_FormMapper::getInstance()->save($form);
             $this->_helper->cache->clean('', '', array(Widgets_Form_Form::WFORM_CACHE_TAG));
             $this->_helper->response->success($this->_helper->language->translate('Form saved'));
         } else {
             $this->_helper->response->fail(Tools_Content_Tools::proccessFormMessagesIntoHtml($formForm->getMessages(), get_class($formForm)));
         }
     }
     $formName = filter_var($this->getRequest()->getParam('name'), FILTER_SANITIZE_STRING);
     $pageId = $this->getRequest()->getParam('pageId');
     $trackingPageName = 'form-' . $formName . '-thank-you';
     $trackingPageUrl = $this->_helper->page->filterUrl($trackingPageName);
     $trackingPageExist = $pageMapper->findByUrl($trackingPageUrl);
     if (!empty($trackingPageExist)) {
         $trackingPageResultUrl = $trackingPageUrl;
     }
     $form = Application_Model_Mappers_FormMapper::getInstance()->findByName($formName);
     $mailTemplates = Tools_Mail_Tools::getMailTemplatesHash();
     $regularPageTemplates = Application_Model_Mappers_TemplateMapper::getInstance()->findByType(Application_Model_Models_Template::TYPE_REGULAR);
     $conversionCode = $formPageConversionMapper->getConversionCode($formName, $pageId);
     if (!empty($conversionCode)) {
         $formForm->getElement('trackingCode')->setValue($conversionCode[0]->getConversionCode());
     }
     $formForm->getElement('name')->setValue($formName);
     $formForm->getElement('replyMailTemplate')->setMultioptions(array_merge(array(0 => 'select template'), $mailTemplates));
     if ($form !== null) {
         $formForm->populate($form->toArray());
     }
     $this->view->trackingPageUrl = $trackingPageResultUrl;
     $this->view->regularTemplates = $regularPageTemplates;
     $this->view->pageId = $pageId;
     $this->view->formForm = $formForm;
     $this->view->helpSection = 'editform';
 }
 public function init()
 {
     parent::init();
     $role_mapper = new Application_Model_RoleMapper();
     $roles = $role_mapper->fetchAll();
     $resource_mapper = new Application_Model_ResourceMapper();
     $resources = $resource_mapper->fetchAll();
     $privilege_mapper = new Application_Model_PrivilegeMapper();
     $privileges = $privilege_mapper->fetchAll();
     $multi_options = array('' => 'Select option');
     if ($roles) {
         foreach ($roles as $row) {
             $multi_options[$row->getId()] = $row->getRole();
         }
     }
     $this->addElement('select', 'role_id', array('required' => true, 'label' => 'Role:', 'MultiOptions' => $multi_options));
     $multi_options = array('' => 'Select option');
     if ($resources) {
         foreach ($resources as $row) {
             $multi_options[$row->getId()] = $row->getResource();
         }
     }
     $this->addElement('select', 'resource_id', array('label' => 'Resource:', 'MultiOptions' => $multi_options));
     $multi_options = array('' => 'Select option');
     if ($privileges) {
         foreach ($privileges as $row) {
             $multi_options[$row->getId()] = $row->getPrivilege();
         }
     }
     $this->addElement('select', 'privilege_id', array('label' => 'Privilege:', 'MultiOptions' => $multi_options));
     $this->addElement('submit', 'submit', array('ignore' => true, 'label' => 'Add Role-Resource-Privilege'));
 }
Example #3
0
 public function init()
 {
     parent::init();
     $this->addElement('text', 'int', array('label' => 'Int:', 'required' => true));
     $this->addElement('text', 'string', array('label' => 'String:', 'required' => true));
     $this->addElement('submit', 'submit', array('ignore' => true, 'label' => 'Create'));
 }
Example #4
0
 public function init()
 {
     parent::init();
     $this->addElement('hidden', 'id', array('required' => true));
     $this->addElement('text', 'privilege', array('label' => 'Privilege:', 'required' => true));
     $this->addElement('submit', 'submit', array('ignore' => true, 'label' => 'Update Privilege'));
 }
Example #5
0
 public function init()
 {
     parent::init();
     $this->addElement('text', 'question', array('label' => 'Question:', 'required' => true));
     $this->addElement('text', 'answer', array('label' => 'Answer:', 'required' => true));
     $this->addElement('submit', 'submit', array('ignore' => true, 'label' => 'Create'));
 }
Example #6
0
 public function init()
 {
     parent::init();
     $multi_options = array('' => 'Select option', 'id' => 'ID: ', 'question' => 'Question: ', 'answer' => 'Answer: ');
     $this->addElement('select', 'where', array('label' => 'Condition:', 'MultiOptions' => $multi_options));
     $this->addElement('text', 'value', array('label' => 'Value:', 'required' => true));
     $this->addElement('submit', 'submit', array('ignore' => true, 'label' => 'Search'));
 }
Example #7
0
 public function init()
 {
     parent::init();
     $this->addElement('password', 'password', array('label' => 'Password:'******'required' => true));
     $this->addElement('password', 'password_confirm', array('label' => 'Confirm Password:'******'required' => true));
     $this->addElement('hidden', 'password_reset_key');
     $this->addElement('submit', 'submit', array('ignore' => true, 'label' => 'Reset Password'));
 }
 public function init()
 {
     parent::init();
     $multi_options = array('' => 'Select option', 'id' => 'ID: ', 'role_id' => 'Role ID: ', 'resource_id' => 'Resource ID: ', 'privilege_id' => 'Privilege ID: ');
     $this->addElement('select', 'where', array('label' => 'Condition:', 'MultiOptions' => $multi_options));
     $this->addElement('text', 'value', array('label' => 'Value:', 'required' => true));
     $this->addElement('submit', 'submit', array('ignore' => true, 'label' => 'Search'));
 }
Example #9
0
 public function init()
 {
     parent::init();
     // Add this hidden ID field
     $this->addElement('hidden', 'id', array('required' => true));
     $this->addElement('text', 'int', array('label' => 'Int:', 'required' => true));
     $this->addElement('text', 'string', array('label' => 'String:', 'required' => true));
     // Change the label to Update
     $this->addElement('submit', 'submit', array('ignore' => true, 'label' => 'Update'));
 }
Example #10
0
 public function init()
 {
     parent::init();
     $this->addElement('text', 'first_name', array('label' => 'First name:', 'required' => true, 'filters' => array('StringTrim')));
     $this->addElement('text', 'last_name', array('label' => 'Last name:', 'required' => true, 'filters' => array('StringTrim')));
     $this->addElement('text', 'first_name', array('label' => 'First name:', 'required' => true, 'filters' => array('StringTrim')));
     $this->addElement('text', 'phone', array('label' => 'Phone:', 'required' => true, 'filters' => array('StringTrim')));
     $this->addElement('text', 'email', array('label' => 'Email:', 'required' => true, 'filters' => array('stringTrim'), 'validators' => array('EmailAddress')));
     $this->addElement('text', 'address', array('label' => 'Address:', 'required' => true, 'filters' => array('StringTrim')));
     $this->addElement('text', 'city', array('label' => 'City:', 'required' => true, 'filters' => array('StringTrim')));
     $this->addElement('text', 'state', array('label' => 'State:', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(2, 2)))));
     $this->addElement('text', 'zip', array('label' => 'Zip:', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array('PostCode')));
     $this->addElement('submit', 'submit', array('ignore' => true, 'label' => 'Update'));
 }
Example #11
0
 public function init()
 {
     parent::init();
     $controller_mapper = new Application_Model_ControllerMapper();
     $controllers = $controller_mapper->fetchAll();
     $multi_options = array('' => 'Select option');
     if ($controllers) {
         foreach ($controllers as $row) {
             $controller = $row->getController();
             $multi_options[$controller] = $controller;
         }
     }
     $this->addElement('select', 'resource', array('label' => 'Resource:', 'required' => true, 'MultiOptions' => $multi_options));
     $this->addElement('submit', 'submit', array('ignore' => true, 'label' => 'Add Resource'));
 }
Example #12
0
 public function init()
 {
     parent::init();
     $role_mapper = new Application_Model_RoleMapper();
     $roles = $role_mapper->fetchAll();
     $this->addElement('text', 'role', array('label' => 'Role:', 'required' => true));
     $multi_options = array('' => 'Select option');
     if ($roles) {
         foreach ($roles as $row) {
             $multi_options[$row->getId()] = $row->getRole();
         }
     }
     $this->addElement('select', 'inherited_role_id', array('label' => 'Role to Inherit From:', 'MultiOptions' => $multi_options));
     $this->addElement('submit', 'submit', array('ignore' => true, 'label' => 'Add Role'));
 }
Example #13
0
 public function init()
 {
     parent::init();
     $this->addElement('hidden', 'id', array('required' => true));
     $this->addElement('submit', 'submit', array('ignore' => true, 'label' => 'Delete'));
 }
Example #14
0
 public function init()
 {
     parent::init();
     $this->addElement('text', 'email', array('label' => 'Email:', 'required' => true, 'filters' => array('stringTrim'), 'validators' => array('EmailAddress')));
     $this->addElement('submit', 'submit', array('ignore' => true, 'label' => 'Submit'));
 }