本文整理汇总了PHP中HtmlElement::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP HtmlElement::__construct方法的具体用法?PHP HtmlElement::__construct怎么用?PHP HtmlElement::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HtmlElement
的用法示例。
在下文中一共展示了HtmlElement::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* A button widget
* @param string $name The name/id of the button
* @param string $title The text written on the button
* @param HtmlAttributes $args Allows custom html tag arguments to be specified (not recommended)
**/
public function __construct($name = 'submit', $title = 'Submit', $args = null)
{
parent::__construct('input', array('type' => 'submit', 'name' => $name, 'class' => 'submit', 'value' => $title));
if (RTK::SetAndNotNull($args)) {
$this->AddAttributes($args);
}
}
示例2: __construct
/**
* A widget for containing/structuring other widgets (div)
* @param string $id The HTML #id of the box
* @param string $class The HTML .class of box
* @param HtmlAttributes $args Allows custom html tag arguments to be specified (not recommended)
**/
public function __construct($id = null, $class = null, $args = null)
{
parent::__construct('div', array('id' => $id, 'class' => $class));
if (RTK::SetAndNotNull($args)) {
$this->AddAttributes($args);
}
}
示例3: __construct
/**
* A widget for displaying an image (img)
* @param string $imgurl The url of the image
* @param string $alttext A text that will be shown if the image could not be loaded
* @param boolean $forcehttps Specify if the link has to have https
* @param HtmlAttributes $args Allows custom html tag arguments to be specified (not recommended)
**/
public function __construct($imgurl = EMPTYSTRING, $alttext = '[IMG]', $args = null)
{
parent::__construct();
$img = new HtmlElement('img', $args);
$img->AddAttributes(array('src' => RTK::GetBaseURL() . $imgurl, 'alt' => $alttext));
$this->AddChild($img);
}
示例4: __construct
public function __construct($name, $options, $selectedValue = '', $type = self::TYPE_RADIO, $validator = null)
{
static::$instanceCount++;
HtmlElement::__construct('div');
$this->validator = $validator;
$this->type = $type;
$this->setAttribute('name', $name);
$selectedValues = array();
if ($type == self::TYPE_RADIO) {
$selectedValues = array($selectedValue);
} else {
$selectedValues = explode(',', $selectedValue);
}
$i = 0;
foreach ($options as $key => $value) {
$optionId = 'data-element-group-' . static::$instanceCount . '-' . $i;
$option = new HtmlElement('input');
$option->setAttribute('type', $this->type);
$option->setAttribute('name', $name);
$option->setAttribute('id', $optionId);
$option->setAttribute('value', $value);
if (in_array($key, $selectedValues)) {
$option->setAttribute('checked');
}
$label = new HtmlElement('label');
$label->setAttribute('for', $optionId);
$label->addChild(new TextElement($value));
$this->addChild($option);
$this->addChild($label);
$i++;
}
}
示例5: __construct
/**
* A widget for containing/structuring other widgets (div)
* @param string $id The HTML #id of the box
* @param string $class The HTML .class of box
* @param HtmlAttributes $args Allows custom html tag arguments to be specified (not recommended)
**/
public function __construct($id = null, $class = null, $args = null)
{
HtmlAttributes::Assure($args);
$args->Add('id', $id);
$args->Add('class', $class);
parent::__construct('div', $args);
}
示例6: __construct
/**
* A widget for displaying a list of items
* @param string[] $columnheaders The headers in the top row
* @param boolean $alternaterow Determines if different styling should be applied to every other row
* @param boolean $alternatecell Determines if different styling should be applied to every other cell
* @param HtmlAttributes $args Allows custom html tag arguments to be specified (not recommended)
**/
public function __construct($columnheaders, $alternaterow = true, $alternatecell = false, $args = null)
{
HtmlAttributes::Assure($args);
$args->Add('class', 'listview', false);
parent::__construct();
$this->AddContainer(new HtmlElement('div', $args, EMPTYSTRING, new HtmlElement('table')), 'table');
//$this->SetPointer('table');
if ($alternaterow == false) {
$this->_alternaterow = null;
} else {
$this->_alternaterow = true;
}
if ($alternatecell == false) {
$this->_alternatecell = null;
} else {
$this->_alternatecell = true;
}
if (sizeof($columnheaders) > 0) {
for ($i = 0; $i < sizeof($columnheaders); $i++) {
$string = $columnheaders[$i];
if (is_string($string) && strlen($string) > 0 && $string[0] == '_') {
$this->_compressedcols[] = $i;
$columnheaders[$i] = substr($columnheaders[$i], 1);
}
}
$this->AddHeader($columnheaders);
}
}
示例7: __construct
public function __construct($children = null)
{
parent::__construct('fieldset');
if (is_array($children)) {
$this->addChildren($children);
}
}
示例8: __construct
/**
* A widget for displaying a title/header (h1)
* @param string $text The text in the title
* @param integer $level The level (or "debth") of the title (1-6)
* @param HtmlAttributes $args Allows custom html tag arguments to be specified (not recommended)
**/
public function __construct($text = null, $level = 1, $args = null)
{
if ($text == null) {
$text = RTK_EMPTYSTRING;
}
$tag = is_numeric($level) && $level > 0 && $level <= 6 ? 'h' . $level : 'h1';
parent::__construct($tag, $args, $text);
}
示例9: __construct
/**
* A widget for displaying an image (img)
* @param string $imgurl The url of the image
* @param string $alttext A text that will be shown if the image could not be loaded
* @param boolean $forcehttps Specify if the link has to have https
* @param HtmlAttributes $args Allows custom html tag arguments to be specified (not recommended)
**/
public function __construct($imgurl = EMPTYSTRING, $alttext = EMPTYSTRING, $args = null)
{
HtmlAttributes::Assure($args);
$args->Add('src', $imgurl, true);
$args->Add('alt', $alttext, true);
parent::__construct();
$this->AddChild(new HtmlElement('img', $args));
}
示例10: __construct
/**
* A widget containing an unordered list (ul)
* @param HtmlElement[] $items The items for the list
* @param HtmlAttributes $args Allows custom html tag arguments to be specified (not recommended)
**/
public function __construct($items = null, $args = null)
{
parent::__construct('ul', $args);
foreach ($items as $item) {
if (is_a($item, 'HtmlElement')) {
$this->AddChild($item);
}
}
}
示例11: __construct
public function __construct($title, $bookmark = null)
{
parent::__construct("fieldset");
$this->setClass("section");
if ($bookmark) {
$this->set("id", $bookmark);
}
$this->title = $title;
}
示例12: __construct
/**
* A widget containing a user input form
* @param string $name The HTML #id and name of the element
* @param string $action The url that should handle the request (leave blank for current page)
* @param string $method POST or GET
* @param boolean $usetoken Includes a security token on all forms, pass false to opt out (not recommended)
* @param HtmlAttributes $args Allows custom html tag arguments to be specified (not recommended)
**/
public function __construct($name = null, $action = null, $method = 'POST', $usetoken = true, $args = null)
{
parent::__construct('form', array('name' => $name, 'id' => $name, 'action' => $action, 'method' => $method));
$this->AddAttributes($args);
if ($usetoken) {
$this->AddHiddenField('securitytoken', RTK::CreateSecurityToken($name));
}
$this->_containers = array();
}
示例13: __construct
/**
* A button widget
* @param string $name The name/id of the button
* @param string $title The text written on the button
* @param HtmlAttributes $args Allows custom html tag arguments to be specified (not recommended)
**/
public function __construct($name = 'submit', $title = 'Submit', $args = null)
{
HtmlAttributes::Assure($args);
$args->Add('type', 'submit', false);
$args->Add('name', $name, false);
$args->Add('class', 'submit', false);
$args->Add('value', $title, false);
parent::__construct('input', $args);
}
示例14: __construct
public function __construct($name, $className = '', $ctx = null)
{
parent::__construct("table", $name);
if ($className != '') {
$this->set('class', $className);
}
$this->set("cellpadding", 0);
$this->set("cellspacing", 0);
$this->pagingInfo = $this->createPagingInfo($ctx);
}
示例15: __construct
/**
* Constructor creates the element
*
* @param $list List element ( ul/ol Default: ul)
* @param $id Id of the list
* @param $class Class name of the list
*/
public function __construct($list = 'ul', $id = '', $class = '')
{
parent::__construct($list, '', '', true);
if ($id !== '') {
$this->addAttribute('id', $id);
}
if ($class !== '') {
$this->addAttribute('class', $class);
}
}