예제 #1
0
 /**
  * Returns the current sub-form in a sequence and advances the internal pointer.
  *
  * @return Opf_Form
  */
 public function getNextSubform()
 {
     $this->_current = current($this->_items[$this->_placeholder]);
     next($this->_items[$this->_placeholder]);
     if (is_object($this->_current)) {
         $this->_current->setView($this->_view);
         $this->_current->invokeEvent('preInit');
         $this->_current->onInit();
         $this->_current->invokeEvent('postInit');
     }
     return $this->_current;
 }
예제 #2
0
 /**
  * Returns the form stack head element. If the stack is empty,
  * the method returns NULL.
  *
  * @internal
  * @static
  * @return Opf_Form
  */
 public static function topOfStack()
 {
     if (self::$_stack === null) {
         self::$_stack = new SplStack();
     }
     if (self::$_stack->count() == 0) {
         return null;
     }
     return self::$_stack->top();
 }
예제 #3
0
 public function onInit()
 {
     $this->appendItem($item = new Opf_Repeater(new SingleForm('subform'), 10));
     $item->setMinRequired(3);
     parent::onInit();
 }
예제 #4
0
 /**
  * Adds a form to the list of forms to make it available for the
  * templates. You do not have to use this method manually, as the
  * forms register themselves in templates automatically.
  *
  * @static
  * @param Opf_Form $form The form to register.
  * @throws Opf_ItemAlreadyExists_Exception
  */
 public static function addForm(Opf_Form $form)
 {
     if (isset(self::$_forms[$form->getName()])) {
         throw new Opf_Exception('Form ' . $form->getName() . ' already exist.');
     }
     self::$_forms[$form->getName()] = $form;
 }