Beispiel #1
0
 /**
  * Allows sub-portions of address to be accessed by keywords.
  *
  * Access to the sub-portions of the address fields is by:
  * <code>
  * $addr = new T_Form_Address('addr','Address');
  * $addr->line_1;  // line 1
  * $addr->line_2;  // line 2
  * $addr->city;  // city
  * $addr->state;  // state
  * $addr->postcode; // postcode
  * $addr->country; // country (note this may or may not exist)
  * </code>
  *
  * To achieve this, we need to add the alias to any of these incoming string
  * requests accessed in this manner, as the alias is prefixed to prevent clashes
  * with other items.
  *
  * @param string $key  child keyword
  * @return OKT_HttpUrl  the tree sub-portion
  */
 function __get($key)
 {
     $prefixed = $this->getAlias() . '_' . $key;
     if (strlen($key) && array_key_exists($prefixed, $this->children)) {
         return $this->children[$prefixed];
     } else {
         return parent::__get($key);
     }
 }
Beispiel #2
0
 function testPipePriorFilter()
 {
     $filter = new T_Validate_IsNumericRange('min', 'max', new T_Test_Filter_Failure());
     $test = new T_Form_Fieldset('container', 'label');
     $min = new T_Test_Form_ElementStub('min', 'label');
     $test->addChild($min);
     $max = new T_Test_Form_ElementStub('max', 'label');
     $test->addChild($max);
     $test->validate(new T_Cage_Array(array('min' => 0.9, 'max' => 1.2)));
     try {
         $filter->transform($test);
         $this->fail();
     } catch (T_Exception_Filter $e) {
     }
 }
Beispiel #3
0
 /**
  * Visit a fieldset node.
  *
  * @param T_Form_Fieldset $node
  */
 function visitFormFieldset(T_Form_Fieldset $node)
 {
     $attributes = $node->getAllAttributes();
     $attributes += array('id' => $node->getAlias());
     $node->setAttribute('id', $attributes['id']);
     // <fieldset>
     $xhtml = $this->indent . '<fieldset ';
     foreach ($attributes as $key => $value) {
         $xhtml .= $key . '="' . $value . '"' . EOL . $this->indent . '       ';
     }
     $xhtml = rtrim($xhtml) . ' >' . EOL;
     $xhtml .= $this->indent . '<legend><span>' . $this->escape($node->getLabel()) . '</span></legend>' . EOL;
     $xhtml .= $this->preGroup($node);
     $this->addXhtml($xhtml);
     // </fieldset>
     $xhtml = $this->postGroup($node);
     $xhtml .= $this->indent . '</fieldset>' . EOL;
     $this->addPostXhtml($node, $xhtml);
 }
Beispiel #4
0
 function testPipePriorFilter()
 {
     $filter = new T_Validate_Confirm('master', 'slave', new T_Test_Filter_Failure());
     $test = new T_Form_Fieldset('container', 'label');
     $master = new T_Test_Form_ElementStub('master', 'label');
     $test->addChild($master);
     $slave = new T_Test_Form_ElementStub('slave', 'label');
     $test->addChild($slave);
     $test->validate(new T_Cage_Array(array('master' => 'a', 'slave' => 'a')));
     try {
         $filter->transform($test);
         $this->fail();
     } catch (T_Exception_Filter $e) {
     }
 }