Пример #1
0
 public function formAction()
 {
     // Display simple text in view
     $this->view->test = 'This is index action for testing module.';
     // Init form here
     $form = new pm_Form_Simple();
     $form->addElement('text', 'exampleText', array('label' => 'Example Text', 'value' => pm_Settings::get('exampleText'), 'required' => true, 'validators' => array(array('NotEmpty', true))));
     $form->addElement('password', 'examplePassword', array('label' => 'Example Password', 'value' => '', 'description' => 'Password: '******'examplePassword'), 'validators' => array(array('StringLength', true, array(5, 255)))));
     $form->addElement('textarea', 'exampleTextarea', array('label' => 'Example TextArea', 'value' => pm_Settings::get('exampleTextarea'), 'class' => 'f-middle-size', 'rows' => 4, 'required' => true, 'validators' => array(array('StringLength', true, array(0, 255)))));
     $form->addElement('simpleText', 'exampleSimpleText', array('label' => 'Example SimpleText', 'escape' => false, 'value' => '<a href="#">Link</a>'));
     $form->addElement('select', 'exampleSelect', array('label' => 'Example Select', 'multiOptions' => array('opt-0' => 'Option 0', 'opt-1' => 'Option 1'), 'value' => pm_Settings::get('exampleSelect'), 'required' => true));
     $form->addElement('radio', 'exampleRadio', array('label' => 'Example Radio', 'multiOptions' => array('opt-0' => 'Option 0', 'opt-1' => 'Option 1'), 'value' => pm_Settings::get('exampleRadio'), 'required' => true));
     $form->addElement('checkbox', 'exampleCheckbox', array('label' => 'Example Checkbox', 'value' => pm_Settings::get('exampleCheckbox')));
     $form->addElement('hidden', 'exampleHidden', array('value' => 'example'));
     $form->addControlButtons(array('cancelLink' => pm_Context::getModulesListUrl()));
     if ($this->getRequest()->isPost() && $form->isValid($this->getRequest()->getPost())) {
         // Form proccessing here
         pm_Settings::set('exampleText', $form->getValue('exampleText'));
         if ($form->getValue('examplePassword')) {
             pm_Settings::set('examplePassword', $form->getValue('examplePassword'));
         }
         pm_Settings::set('exampleTextarea', $form->getValue('exampleTextarea'));
         pm_Settings::set('exampleSelect', $form->getValue('exampleSelect'));
         pm_Settings::set('exampleRadio', $form->getValue('exampleRadio'));
         pm_Settings::set('exampleCheckbox', $form->getValue('exampleCheckbox'));
         $this->_status->addMessage('info', 'Data was successfully saved.');
         $this->_helper->json(array('redirect' => pm_Context::getBaseUrl()));
     }
     $this->view->form = $form;
 }
Пример #2
0
 public function toolsAction()
 {
     // Tools for pm_View_Helper_RenderTools
     $this->view->tools = array(array('icon' => $this->view->skinUrl('/') . "img/icons/big/site-aps_32.gif", 'title' => 'Example', 'description' => 'Example module with UI samples', 'link' => pm_Context::getBaseUrl()), array('icon' => $this->view->skinUrl('/') . "img/icons/big/modules_32.gif", 'title' => 'Modules', 'description' => 'Modules installed in the Panel', 'link' => pm_Context::getModulesListUrl()));
     // Tools for pm_View_Helper_RenderSmallTools
     $this->view->smallTools = array(array('title' => 'Example', 'description' => 'Example module with UI samples', 'class' => 'sb-app-info', 'link' => pm_Context::getBaseUrl()), array('title' => 'Modules', 'description' => 'Modules installed in the Panel', 'class' => 'sb-suspend', 'link' => pm_Context::getModulesListUrl()));
 }
Пример #3
0
 public function indexAction()
 {
     // TODO: allow access for admin only
     $this->view->pageTitle = 'Panel Statistics Settings';
     $form = new Modules_PanelStats_Form_Settings();
     if ($this->getRequest()->isPost() && $form->isValid($this->getRequest()->getPost())) {
         $form->process();
         $this->_status->addMessage('info', 'Settings were saved.');
         $this->_helper->json(array('redirect' => pm_Context::getModulesListUrl()));
     }
     $this->view->form = $form;
 }
Пример #4
0
 public function indexAction()
 {
     $this->view->pageTitle = $this->lmsg('formTitle');
     $form = new Modules_ApiUsage_Form_CreateClientAndWebspace();
     if ($this->getRequest()->isPost() && $form->isValid($this->getRequest()->getPost())) {
         try {
             $form->process();
             $this->_helper->json(array('redirect' => pm_Context::getModulesListUrl()));
         } catch (pm_Exception $exception) {
             $this->_status->addMessage('error', $exception->getMessage());
         }
         $this->_helper->json(array('redirect' => pm_Context::getModulesListUrl()));
     }
     $this->view->form = $form;
 }