Пример #1
0
 /**
  * Class constructor
  *
  * Initializes a variable in $_SESSION array, its name is based upon the
  * name of the Controller passed here
  *
  * @param    HTML_QuickForm2_Controller
  */
 public function __construct(HTML_QuickForm2_Controller $controller)
 {
     $name = sprintf(HTML_QuickForm2_Controller::KEY_CONTAINER, $controller->getId());
     if (empty($_SESSION[$name])) {
         $_SESSION[$name] = array('datasources' => array(), 'values' => array(), 'valid' => array());
     }
     $this->data =& $_SESSION[$name];
 }
Пример #2
0
 public function __construct(HTML_QuickForm2_Controller $controller)
 {
     $this->name = sprintf(HTML_QuickForm2_Controller::KEY_CONTAINER, $controller->getId());
     /* @var $session Zend_Session_Namespace */
     if (empty($_SESSION['amember'][$this->name])) {
         $_SESSION['amember'][$this->name] = array('datasources' => array(), 'values' => array(), 'valid' => array());
     }
     $this->data =& $_SESSION['amember'][$this->name];
 }
Пример #3
0
 /**
  * Wrapper around populateForm() ensuring that it is only called once
  */
 public final function populateFormOnce()
 {
     if (!$this->_formPopulated) {
         if (!empty($this->controller) && $this->controller->propagateId()) {
             $this->form->addElement('hidden', HTML_QuickForm2_Controller::KEY_ID, array('id' => HTML_QuickForm2_Controller::KEY_ID))->setValue($this->controller->getId());
         }
         $this->populateForm();
         $this->_formPopulated = true;
     }
 }
 public function testFindID()
 {
     try {
         $controller = new HTML_QuickForm2_Controller();
         $this->fail('Expected HTML_QuickForm2_NotFoundException was not thrown');
     } catch (HTML_QuickForm2_NotFoundException $e) {
     }
     $_REQUEST[HTML_QuickForm2_Controller::KEY_ID] = 'foo';
     try {
         $controller = new HTML_QuickForm2_Controller();
         $this->fail('Expected HTML_QuickForm2_NotFoundException was not thrown');
     } catch (HTML_QuickForm2_NotFoundException $e) {
     }
     $_SESSION[sprintf(HTML_QuickForm2_Controller::KEY_CONTAINER, 'foo')] = array('datasources' => array(), 'values' => array(), 'valid' => array());
     $controller = new HTML_QuickForm2_Controller(null, true, false);
     $this->assertEquals('foo', $controller->getId());
     $this->assertTrue($controller->isWizard());
     $this->assertTrue($controller->propagateId());
 }