/**
  * Render a checkbox list base on the subset and superset collections.
  *
  * @param string $relationId the relationship id, used to render the form field key.
  * @param BaseCollection[]   the related collection. (optional)
  * @param BaseCollection[]   the superset collection.
  */
 public function renderList($relationId, $subset, $superset)
 {
     $ul = new Element('ul');
     $ul->addClass('actionkit-checkbox-view');
     // now we should render the superset, and set the checkbox to be
     // connected from the $this->checked array.
     foreach ($superset as $item) {
         $li = $this->renderItem($relationId, $subset, $item, isset($this->checked[$item->id]));
         $li->appendTo($ul);
     }
     return $ul;
 }
Exemplo n.º 2
0
 /**
  * Here is a hack for supportting for $label->for( $elementId );
  *
  * Due to the PHP yacc parser issue, we can't define a method named "for".
  */
 public function __call($m, $a)
 {
     if ($m === "for") {
         $this->setAttributeValue($m, $a[0]);
     }
     return parent::__call($m, $a);
 }
Exemplo n.º 3
0
 function __construct($text = null, $attributes = array())
 {
     if ($text && is_string($text)) {
         $textNode = new DOMText($text);
         $this->addChild($textNode);
     }
     parent::__construct('legend', $attributes);
 }
Exemplo n.º 4
0
 public function __construct($attributes = array())
 {
     parent::__construct($this->tagName, $attributes);
 }
Exemplo n.º 5
0
 /**
  * Set attributes
  *
  */
 public function setAttributes($as)
 {
     // filter out options
     $intersects = array_intersect(array_keys($as), $this->optionNames);
     foreach ($intersects as $k) {
         unset($as[$k]);
     }
     parent::setAttributes($as);
 }
Exemplo n.º 6
0
 public function createContainer()
 {
     $container = new Element('div');
     $container->addClass('__region');
     return $container;
 }
Exemplo n.º 7
0
 /**
  * For each existing (one-many) records, 
  * create it's own subaction view for these existing 
  * records.
  */
 public function buildOneToManyRelationalActionViewForExistingRecords($record, $relationId, $relation = null)
 {
     if (!$relation) {
         $relation = $this->action->getRelation($relationId);
     }
     $container = new Element('div');
     // If the record is loaded and the relation is defined
     if ($collection = $record->fetchOneToManyRelationCollection($relationId)) {
         foreach ($collection as $subrecord) {
             $subview = $this->createRelationalActionView($relationId, $relation, $subrecord);
             $container->append($subview);
         }
     }
     return $container;
 }
Exemplo n.º 8
0
 public function createContainerElement()
 {
     $el = new Element('div');
     $el->addClass('__region');
     return $el;
 }
Exemplo n.º 9
0
 public function __construct($text)
 {
     $this->append($text);
     parent::__construct($this->tagName);
 }