示例#1
0
 public function __construct($text, $value = '', $selected = false)
 {
     parent::__construct('option');
     $this->_text = $this->add(new Text($text), true);
     $this->_value = $this->attribute('value', $value, true);
     $this->_selected = $this->attribute('selected', $selected ? 'selected' : '', true);
 }
示例#2
0
 public function __construct($type = null)
 {
     parent::__construct('i');
     if ($type) {
         $this->setType($type);
     }
 }
示例#3
0
 /**
  *
  * @param string $href
  */
 public function __construct($href = '')
 {
     parent::__construct('link');
     $this->attribute('type', 'text/css');
     $this->attribute('rel', 'stylesheet');
     $this->href = $this->attribute('href', $href, true);
 }
示例#4
0
 /**
  *
  * @param string $doctype
  * @param string $xmlns
  * @param string $charset
  * @param string $title
  * @param string $css
  * @param string $jq
  * @param string $jqm
  */
 public function __construct($doctype = Container::DOCTYPE, $xmlns = Container::XMLNS, $charset = Container::CHARSET, $title = Container::TITLE, $css = Container::CSS, $jq = Container::JQUERY_PATH, $jqm = Container::JQUERY_MOBILE_PATH)
 {
     parent::__construct('html');
     $this->_doctype = new Text($doctype);
     $this->head = $this->add(new Head($xmlns, $charset, $title, $css, $jq, $jqm), true);
     $this->body = $this->add(new Body(), true);
 }
示例#5
0
 /**
  * @param array $config Configuration options
  * @param string[] $config['classes'] CSS class names to add
  * @param string $config['id'] HTML id attribute
  * @param string $config['text'] Text to insert
  * @param array $config['content'] Content to append (after text), strings
  *   or Element objects. Strings will be HTML-escaped for output, use an
  *   HtmlSnippet instance to prevent that.
  * @param mixed $config['data'] Element data
  */
 public function __construct(array $config = array())
 {
     // Parent constructor
     parent::__construct($this->getTagName());
     // Initialization
     if (isset($config['infusable']) && is_bool($config['infusable'])) {
         $this->setInfusable($config['infusable']);
     }
     if (isset($config['data'])) {
         $this->setData($config['data']);
     }
     if (isset($config['classes']) && is_array($config['classes'])) {
         $this->ownClasses = $config['classes'];
         $this->addClasses($this->ownClasses);
     }
     if (isset($config['id'])) {
         $this->setAttributes(array('id' => $config['id']));
     }
     if (isset($config['text'])) {
         // JS compatibility
         $this->appendContent($config['text']);
     }
     if (isset($config['content'])) {
         $this->appendContent($config['content']);
     }
 }
示例#6
0
 /**
  *
  * @staticvar array $default_ids Contains default ids for input to prevent repeats
  * @param string $name Input name
  * @param mixed $value Default value sent (radio, checkbox) or filled in (text)
  * @param string $label Label associated with input
  */
 public function __construct($name, $value = null, $label = null)
 {
     static $default_ids = array();
     $this->label = new Label();
     $this->setName($name);
     if (!isset($default_ids[$this->tag_type])) {
         $default_ids[$this->tag_type] = 1;
     }
     $id_name = preg_replace('|[\\W_]+|', '-', preg_replace('/\\[|\\]/', '', $this->name));
     if (isset($default_ids[$id_name])) {
         $default_ids[$id_name]++;
         $id_name = $id_name . '-' . $default_ids[$id_name];
     } else {
         $default_ids[$id_name] = 1;
     }
     $this->setId($id_name);
     $this->type = strtolower($this->popClass());
     parent::__construct($this->tag_type, $value);
     // this MUST come after the above construct
     $this->addIgnoreVariables('has_label', 'label_location');
     $this->label->addClass($this->getType() . '-label');
     if ($label) {
         $this->label->setText($label);
     }
 }
示例#7
0
 public function __construct($text = null, $for = null)
 {
     if (isset($for)) {
         $this->setFor($for);
     }
     parent::__construct('label', $text);
 }
示例#8
0
 /**
  *
  * @param string $id
  * @param array $attributes
  * @param array $items
  * @param string $theme
  * @param boolean $fullscreen
  * @param boolean $nobackbtn
  */
 public function __construct($id, array $attributes = array(), array $items = array(), $theme = '', $fullscreen = false, $nobackbtn = false)
 {
     parent::__construct('div', $id, $attributes, $items, $theme);
     if (count($items) > 0) {
         foreach ($items as $item) {
             if ($item instanceof Header) {
                 $this->_header = $this->add($item, true);
             } elseif ($item instanceof Content) {
                 $this->_content = $this->add($item, true);
             } elseif ($item instanceof Footer) {
                 $this->_footer = $this->add($item, true);
             }
         }
     }
     if (!$this->_header) {
         $this->_header = $this->add(new Header(), true);
     }
     if (!$this->_content) {
         $this->_content = $this->add(new Content(), true);
     }
     if (!$this->_footer) {
         $this->_footer = $this->add(new Footer(), true);
     }
     $this->_role = $this->addAttribute(new Attribute('data-role', 'page'), true);
     $this->_fullscreen = $this->addAttribute(new Attribute('data-fullscreen', $fullscreen === true ? 'true' : ''), true);
     $this->_nobackbtn = $this->addAttribute(new Attribute('data-nobackbtn', $nobackbtn === true ? 'true' : ''), true);
 }
示例#9
0
 public function __construct($label, $href = null)
 {
     parent::__construct('a', $label);
     $this->addIgnoreVariables('rel');
     if ($href) {
         $this->setHref($href);
     }
 }
示例#10
0
 /**
  *
  * @param string $id
  * @param array $attributes
  * @param array $items
  * @param string $theme
  */
 public function __construct($id = '', array $attributes = array(), array $items = array(), $theme = '')
 {
     parent::__construct('div', $id, $attributes, $items, $theme);
     $this->_role = $this->attribute('data-role', 'navbar', true);
     $this->items()->prefix('<ul><li>');
     $this->items()->separator('</li><li>');
     $this->items()->suffix('</li></ul>');
 }
示例#11
0
 /**
  * @param string $id
  * @param array $attributes
  * @param array $items
  * @param string $theme
  * @param string $title
  * @param string $position
  * @param bool $uiBar
  */
 public function __construct($id = '', $attributes = array(), $items = array(), $theme = '', $title = '', $position = 'inline', $uiBar = false)
 {
     parent::__construct('div', $id, $attributes, $items, $theme);
     $this->_role = $this->attribute('data-role', 'header', true);
     $this->_position = $this->attribute('data-position', $position, true);
     $this->_uiBar = $this->attribute('class', $uiBar ? 'ui-bar' : '', true);
     $this->_title = $this->add(new Title($title), true);
 }
示例#12
0
 /**
  *
  * @param string $id
  * @param array $attributes
  * @param array $items
  * @param string $theme
  * @param string $title
  * @param boolean $collapsed
  */
 public function __construct($id = '', array $attributes = array(), array $items = array(), $theme = '', $title = '', $collapsed = true)
 {
     parent::__construct('div', $id, $attributes, array(), $theme);
     $this->_role = $this->attribute('data-role', 'collapsible', true);
     $this->_collapsed = $this->attribute('data-collapsed', $collapsed ? 'true' : 'false', true);
     $this->_title = $this->add(new Title($title), true);
     $this->items()->addFromArray($items);
 }
示例#13
0
 /**
  * Return a script object
  *
  * @param string $source 
  * @param string $options 
  * @return LinkCss
  * @author Justin Palmer
  */
 function __construct($source, $options = '')
 {
     $app_path = Registry::get('pr-install-path');
     if ($app_path != null) {
         $source = $app_path . 'public/javascript/' . $source . '?' . time();
     }
     $this->options = "src:{$source},type:text/javascript";
     parent::__construct($options);
 }
示例#14
0
 /**
  *
  * @param string $id
  * @param string $legend
  * @param array $items
  * @param string $theme
  * @param string $dataType
  * @param boolean $fieldContain
  */
 public function __construct($id = '', $legend = '', array $items = array(), $theme = '', $dataType = 'vertical', $fieldContain = false)
 {
     parent::__construct('fieldset', $id, array(), array(), $theme);
     $this->_legend = $this->add(new Tag('legend', '', array(), array($legend)), true);
     $this->items()->addFromArray($items);
     $this->_role = $this->addAttribute(new Attribute('data-role', 'controlgroup'), true);
     $this->_dataType = $this->addAttribute(new Attribute('data-type', $dataType), true);
     $this->_fieldContain = $fieldContain;
 }
示例#15
0
 /**
  *
  * @staticvar int $default_id  Helps in the creation of form ids if none is set
  */
 public function __construct()
 {
     parent::__construct('form');
     $this->action = \Server::getCurrentUrl();
     static $default_id = 1;
     $this->setId('form-' . $default_id);
     $default_id++;
     $this->addClass('phpws-form');
 }
示例#16
0
 /**
  *
  * @param string $id
  * @param string $name
  * @param string $label
  * @param array $items
  * @param string $theme
  * @param boolean $fieldContain
  * @param string $icon
  * @param boolean $inline
  */
 public function __construct($id = '', $name = '', $label = '', array $items = array(), $theme = '', $fieldContain = false, $icon = '', $inline = false)
 {
     parent::__construct('select', $id, array(), $items, $theme);
     $this->_name = $this->addAttribute(new Attribute('name', $name, true), true);
     $this->_label = new Label('', $label, $name);
     $this->_fieldContain = $fieldContain;
     $this->_icon = $this->addAttribute(new Attribute('data-icon', $icon), true);
     $this->_inline = $this->addAttribute(new Attribute('data-inline', $inline === true ? 'true' : ''), true);
 }
示例#17
0
 public function __construct($tagname, array $attributes = array(), $children = array())
 {
     $tagname = strtolower($tagname);
     $loweredAttributes = array();
     foreach ($attributes as $key => $value) {
         $loweredAttributes[strtolower($key)] = $value;
     }
     parent::__construct($tagname, $loweredAttributes, $children);
 }
示例#18
0
 /**
  * If the value is not set, the $text parameter is copied to value.
  * @param string $text Text that appears between the option tag
  * @param string $value The value of the option tag.
  * @param string $optgroup Name of group this option is a member of.
  */
 public function __construct($text, $value = null, $optgroup = null)
 {
     parent::__construct('option', $text);
     if (isset($value)) {
         $this->setValue($value);
     } else {
         $this->setValue($text);
     }
     $this->setOptgroup($optgroup);
 }
示例#19
0
 /**
  * 
  * @param mixed $content
  * @param mixed $options
  */
 public function __construct($content = '', $options = null)
 {
     if (is_string($options)) {
         $options = ['href' => $options];
     }
     if ($content === null) {
         $content = '';
     }
     parent::__construct('a', $content, $options);
 }
示例#20
0
 /**
  * 
  * @param mixed $content
  * @param mixed $options
  */
 public function __construct($content = '', $options = null)
 {
     if (is_string($options)) {
         $options = ['legend' => $options];
     }
     if (!$content) {
         $content = '';
     }
     parent::__construct('fieldset', $content, $options);
 }
示例#21
0
 /**
  *
  * @param string $id
  * @param array $attributes
  * @param array $items
  * @param string $theme
  * @param boolean $inset
  * @param boolean $filter
  * @param boolean $ordered
  * @param string $splitIcon
  * @param string $splitTheme
  * @param string $dividerTheme
  * @param string $countTheme
  */
 public function __construct($id = '', array $attributes = array(), array $items = array(), $theme = '', $inset = false, $filter = false, $ordered = false, $splitIcon = '', $splitTheme = '', $dividerTheme = '', $countTheme = '')
 {
     parent::__construct($ordered === true ? 'ol' : 'ul', $id, $attributes, $items, $theme);
     $this->_role = $this->addAttribute(new Attribute('data-role', 'listview'), true);
     $this->_inset = $this->addAttribute(new Attribute('data-inset', $inset === true ? 'true' : ''), true);
     $this->_filter = $this->addAttribute(new Attribute('data-filter', $filter === true ? 'true' : ''), true);
     $this->_splitIcon = $this->addAttribute(new Attribute('data-split-icon', $splitIcon), true);
     $this->_splitTheme = $this->addAttribute(new Attribute('data-split-theme', $splitTheme), true);
     $this->_dividerTheme = $this->addAttribute(new Attribute('data-divider-theme', $dividerTheme), true);
     $this->_countTheme = $this->addAttribute(new Attribute('data-count-theme', $countTheme), true);
 }
示例#22
0
 /**
  * Creates a image object.
  * @param string $src Path to the image
  */
 public function __construct($directory, $src = null)
 {
     # @todo check this, was using an old tag format for construction
     parent::__construct('img');
     $this->setDirectory($directory);
     if (empty($src)) {
         $this->loadSrc();
     } else {
         $this->setSrc($src);
     }
 }
示例#23
0
 /**
  *
  * @param string $id
  * @param string $name
  * @param string $type
  * @param string $value
  * @param string $label
  * @param string $theme
  * @param boolean $fieldContain
  */
 public function __construct($id, $name = '', $type = 'text', $value = '', $label = '', $theme = '', $fieldContain = false)
 {
     if ($name == '') {
         $name = $id;
     }
     parent::__construct('input', $id, array(), array(), $theme);
     $this->_type = $this->addAttribute(new Attribute('type', $type, true), true);
     $this->_name = $this->addAttribute(new Attribute('name', $name, true), true);
     $this->_value = $this->addAttribute(new Attribute('value', $value, true), true);
     $this->_label = new Label('', $label, $name);
     $this->_fieldContain = $fieldContain;
 }
示例#24
0
 /**
  *
  * @param string $id
  * @param array $attributes
  * @param array $items
  * @param string $theme
  * @param string $href
  * @param string $text
  * @param string $icon
  * @param boolean $active
  * @param boolean $inline
  * @param string $rel
  * @param string $target
  */
 public function __construct($id = '', array $attributes = array(), array $items = array(), $theme = '', $href = '', $text = '', $icon = '', $active = false, $inline = false, $rel = '', $target = '')
 {
     parent::__construct('a', $id, $attributes, $items, $theme);
     $this->_href = $this->attribute('href', $href, true);
     $this->_icon = $this->attribute('data-icon', $icon, true);
     $this->_role = $this->attribute('data-role', 'button', true);
     $this->active($active);
     $this->_inline = $this->attribute('data-inline', $inline ? 'true' : '', true);
     $this->_text = $this->add(new Text($text), true);
     $this->_rel = $this->addAttribute(new Attribute('rel', $rel, false), true);
     $this->_target = $this->addAttribute(new Attribute('target', $target, false), true);
 }
示例#25
0
 /**
  *
  * @param string $id
  * @param string $name
  * @param string $label
  * @param boolean $isOn
  * @param string $onLabel
  * @param string $onValue
  * @param string $offLabel
  * @param string $offValue
  * @param string $theme
  * @param boolean $fieldContain
  */
 public function __construct($id = '', $name = '', $label = '', $isOn = false, $onLabel = 'on', $onValue = 'on', $offLabel = 'off', $offValue = 'off', $theme = '', $fieldContain = false)
 {
     parent::__construct('select', $id, array(), array(), $theme);
     $this->_role = $this->attribute(new Attribute('data-role', 'slider'), true);
     $this->_name = $this->addAttribute(new Attribute('name', $name, true), true);
     $this->_isOn = $isOn;
     $this->_label = new Label('', $label, $name);
     $this->_fieldContain = $fieldContain;
     $this->_off = $this->add(new Tag('option', '', array(new Attribute('value', $offValue), new Attribute('selected', '')), array($offLabel)), true);
     $this->_on = $this->add(new Tag('option', '', array(new Attribute('value', $onValue), new Attribute('selected', '')), array($onLabel)), true);
     $this->isOn($this->_isOn);
 }
示例#26
0
 /**
  *
  * @param string $id
  * @param string $name
  * @param string $text
  * @param string $cols
  * @param string $rows
  * @param string $label
  * @param string $theme
  * @param boolean $fieldContain
  */
 public function __construct($id, $name = '', $text = 'text', $cols = '', $rows = '', $label = '', $theme = '', $fieldContain = false)
 {
     if ($name == '') {
         $name = $id;
     }
     parent::__construct('textarea', $id, array(), array(), $theme);
     $this->_name = $this->addAttribute(new Attribute('name', $name, true), true);
     $this->_cols = $this->addAttribute(new Attribute('cols', $cols, true), true);
     $this->_rows = $this->addAttribute(new Attribute('rows', $rows, true), true);
     $this->_text = $this->add(new Text($text), true);
     $this->_label = new label('', $label, $name);
     $this->_fieldContain = $fieldContain;
 }
示例#27
0
 /**
  * @param string $xmlns
  * @param string $charset
  * @param array|string $title
  * @param array|string $css
  * @param string $jq
  * @param string $jqm
  */
 public function __construct($xmlns = Container::XMLNS, $charset = Container::CHARSET, $title = Container::TITLE, $css = Container::CSS, $jq = Container::JQUERY_PATH, $jqm = Container::JQUERY_MOBILE_PATH)
 {
     parent::__construct('head');
     $this->_xmlns = $this->attribute('xmlns', $xmlns, true);
     $this->_charset = $this->addAttribute(new Attribute('charset', $charset), true);
     $this->add(new Tag('meta', '', array($this->_charset)));
     $this->_viewport = $this->addAttribute(new Attribute('content', Container::VIEWPORT), true);
     $this->add(new Tag('meta', '', array(new Attribute('name', 'viewport'), $this->_viewport)));
     $this->_css = $this->add(new Link($css), true);
     $this->_jq = $this->add(new Script($jq), true);
     $this->_jqm = $this->add(new Script($jqm), true);
     $this->add(new Tag('title', '', array(), array(new Text($title))));
 }
示例#28
0
 /**
  *
  * @param string $id
  * @param string $type
  * @param array $a
  * @param array $b
  * @param array $c
  * @param array $d
  * @param array $e
  */
 public function __construct($id = '', $type = 'a', array $a = array(), array $b = array(), array $c = array(), array $d = array(), array $e = array())
 {
     parent::__construct('div', $id);
     $this->grid($type);
     $this->_a = $this->add(new Collection($a), true);
     $this->_b = $this->add(new Collection($b), true);
     $this->_c = $this->add(new Collection($c), true);
     $this->_d = $this->add(new Collection($d), true);
     $this->_e = $this->add(new Collection($e), true);
     $this->_a->prefix('<div class="ui-block-a">')->suffix('</div>');
     $this->_b->prefix('<div class="ui-block-b">')->suffix('</div>');
     $this->_c->prefix('<div class="ui-block-c">')->suffix('</div>');
     $this->_d->prefix('<div class="ui-block-d">')->suffix('</div>');
     $this->_e->prefix('<div class="ui-block-e">')->suffix('</div>');
 }
示例#29
0
 /**
  * @param string $id
  * @param array $attributes
  * @param array $items
  * @param bool $divider
  * @param string $title
  * @param string $href
  * @param string $count
  * @param string $img
  * @param string $subTitle
  * @param bool $isThumb
  * @param string $splitHref
  * @param string $rel
  * @param string $target
  * @param string $splitRel
  * @param string $splitTarget
  */
 public function __construct($id = '', array $attributes = array(), array $items = array(), $divider = false, $title = '', $href = '', $count = '', $img = '', $subTitle = '', $isThumb = false, $splitHref = '', $rel = '', $target = '', $splitRel = '', $splitTarget = '')
 {
     parent::__construct('li', $id, $attributes, $items);
     $this->_divider = $this->addAttribute(new Attribute('data-role', $divider === true ? 'list-divider' : ''), true);
     $this->_title = $title;
     $this->_href = $href;
     $this->_rel = $rel;
     $this->_target = $target;
     $this->_count = $count;
     $this->_img = $img;
     $this->_subTitle = $subTitle;
     $this->_isThumb = $isThumb;
     $this->_splitHref = $splitHref;
     $this->_splitRel = $splitRel;
     $this->_splitTarget = $splitTarget;
 }
示例#30
0
 /**
  *
  * @param string $id
  * @param string $text
  * @param string $forField
  */
 public function __construct($id = '', $text = '', $forField = '')
 {
     parent::__construct('label', $id);
     $this->_text = $this->add(new Text($text), true);
     $this->_forField = $this->attribute('for', $forField, true);
 }