コード例 #1
0
ファイル: button.php プロジェクト: iensenfirippu/RTK
 /**
  * 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
0
ファイル: box.php プロジェクト: iensenfirippu/RTK
 /**
  * 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
0
ファイル: image.php プロジェクト: iensenfirippu/RTK
 /**
  * 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
0
 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
0
ファイル: Box.php プロジェクト: iensenfirippu/securipe
 /**
  * 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
0
ファイル: Listview.php プロジェクト: iensenfirippu/securipe
 /**
  * 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
0
 public function __construct($children = null)
 {
     parent::__construct('fieldset');
     if (is_array($children)) {
         $this->addChildren($children);
     }
 }
コード例 #8
0
ファイル: header.php プロジェクト: iensenfirippu/RTK
 /**
  * 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
0
ファイル: Image.php プロジェクト: iensenfirippu/securipe
 /**
  * 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
0
ファイル: List.php プロジェクト: iensenfirippu/securipe
 /**
  * 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
0
ファイル: Section.php プロジェクト: fruition-sciences/phpfw
 public function __construct($title, $bookmark = null)
 {
     parent::__construct("fieldset");
     $this->setClass("section");
     if ($bookmark) {
         $this->set("id", $bookmark);
     }
     $this->title = $title;
 }
コード例 #12
0
ファイル: form.php プロジェクト: iensenfirippu/RTK
 /**
  * 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
0
ファイル: Button.php プロジェクト: iensenfirippu/securipe
 /**
  * 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
0
ファイル: Table.php プロジェクト: fruition-sciences/phpfw
 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
0
ファイル: htmllist.php プロジェクト: bash-t/admidio
 /**
  * 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);
     }
 }
コード例 #16
0
 function __construct($tag_name, $initial_value, $name, $can_have_children = false)
 {
     parent::__construct($tag_name, null, $can_have_children);
     $this->_name = $name;
     if (!is_null($initial_value)) {
         //The order of these two operations is significant
         $this->_initial_value = $initial_value;
         $this->setValue($initial_value);
     }
 }
コード例 #17
0
ファイル: link.php プロジェクト: iensenfirippu/RTK
 /**
  * A widget containing a clickable link (a)
  * @param string $url The url of the link
  * @param string $name The title of the list
  * @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($url = null, $name = null, $forcehttps = false, $args = null)
 {
     if ($url == null) {
         $url = RTK_EMPTYSTRING;
     }
     if ($name == null) {
         $name = RTK_EMPTYSTRING;
     }
     parent::__construct('a', array('href' => RTK::GetBaseURL($forcehttps) . $url), $name);
     $this->AddAttributes($args);
 }
コード例 #18
0
 /**
  * Constructor
  * 
  * @param HtmlForm $form
  * @return void
  */
 public function __construct(HtmlForm $form)
 {
     $this->_parentForm = $form;
     $tagName = $this->_tagName;
     if ($this->_tagName == '') {
         // decide tag name from tail of class name
         require_once 'core/name_manager.php';
         $parts = NameManager::split(get_class($this));
         $tagName = array_pop($parts);
     }
     parent::__construct($tagName);
 }
コード例 #19
0
ファイル: Textview.php プロジェクト: iensenfirippu/securipe
 /**
  * A widget containing text (essentially just a div or span with text)
  * @param string $text The text to display
  * @param boolean $inline Determines if the widget should be span(true) or div(false)
  * @param string $id The HTML #id of the element
  * @param string $class The HTML .class of element
  * @param HtmlAttributes $args Allows custom html tag arguments to be specified (not recommended)
  **/
 public function __construct($text = EMPTYSTRING, $inline = false, $id = null, $class = null, $args = null)
 {
     HtmlAttributes::Assure($args);
     if (Value::SetAndNotNull($id)) {
         $args->Add('id', $id);
     }
     if (Value::SetAndNotNull($class)) {
         $args->Add('class', $class);
     }
     $tag = $inline ? 'span' : 'div';
     parent::__construct($tag, $args, $text);
 }
コード例 #20
0
ファイル: htmldiv.php プロジェクト: bash-t/admidio
 /**
  * Constructor creates the element
  *
  * @param $id Id of the main div
  * @param $class Class name of the main div
  */
 public function __construct($id = '', $class = '')
 {
     parent::__construct('div', '', '', true);
     if ($id !== '') {
         $this->addAttribute('id', $id);
     }
     if ($class !== '') {
         $this->addAttribute('class', $class);
     }
     // set div level to 1
     $this->level = 1;
 }
コード例 #21
0
ファイル: Form.php プロジェクト: iensenfirippu/securipe
 /**
  * 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 = EMPTYSTRING, $action = EMPTYSTRING, $method = 'POST', $usetoken = true, $args = null)
 {
     HtmlAttributes::Assure($args);
     $args->Add('name', $name);
     $args->Add('id', $name);
     $args->Add('action', $action);
     $args->Add('method', $method);
     parent::__construct('form', $args);
     if ($usetoken) {
         $this->AddHiddenField('securitytoken', Site::CreateSecurityToken());
     }
     $this->_containers = array();
 }
コード例 #22
0
ファイル: textview.php プロジェクト: iensenfirippu/RTK
 /**
  * A widget containing text (essentially just a div or span with text)
  * @param string $text The text to display
  * @param boolean $inline Determines if the widget should be span(true) or div(false)
  * @param string $id The HTML #id of the element
  * @param string $class The HTML .class of element
  * @param HtmlAttributes $args Allows custom html tag arguments to be specified (not recommended)
  **/
 public function __construct($text = null, $inline = false, $id = null, $class = null, $args = null)
 {
     if ($text == null) {
         $text = RTK_EMPTYSTRING;
     }
     $attributes = array();
     if (isset($id) && $id != null) {
         $attributes['id'] = $id;
     }
     if (isset($class) && $class != null) {
         $attributes['class'] = $class;
     }
     $tag = $inline ? 'span' : 'div';
     parent::__construct($tag, $attributes, $text);
     $this->AddAttributes($args);
 }
コード例 #23
0
 /**
  * Constructor creates the element
  *
  * @param string $action Optional action attribute of the form
  * @param string $id     Id of the form
  * @param string $method Get/Post (Default "get" if not defined)
  * @param string $event  Optional event handler
  * @param string $script Optional script or function called from event handler
  */
 public function __construct($action = '', $id = '', $method = 'get', $event = '', $script = '')
 {
     parent::__construct('form', '', '', true);
     // set action attribute
     if ($action !== '') {
         $this->addAttribute('action', $action);
     }
     if ($id !== '') {
         $this->addAttribute('id', $id);
     }
     if ($method !== '') {
         $this->addAttribute('method', $method);
     }
     if ($event !== '' && $script !== '') {
         $this->addAttribute($event, $script);
     }
 }
コード例 #24
0
ファイル: DataElement.class.php プロジェクト: Niggu/cloudrexx
 public function __construct($name, $value = '', $type = self::TYPE_INPUT, $validator = null)
 {
     parent::__construct($type);
     $this->validator = $validator;
     $this->type = $type;
     $this->setAttribute('name', $name);
     switch ($type) {
         case self::TYPE_INPUT:
             $this->setAttribute('value', $value);
             break;
         case self::TYPE_SELECT:
             if (is_string($value)) {
                 // this is for customizing only:
                 $this->addChild(new \Cx\Core\Html\Model\Entity\TextElement($value));
             }
             break;
     }
 }
コード例 #25
0
ファイル: dropdown.php プロジェクト: iensenfirippu/RTK
 /**
  * A widget containing a dropdown selector
  * @param string $name The HTML name of the element
  * @param string[][] $options An array of options, each of which is an array of value and title
  * @param string $selected The value of the selected item in the dropdown
  * @param HtmlAttributes $args Allows custom html tag arguments to be specified (not recommended)
  **/
 public function __construct($name, $options, $selected = null, $args = null)
 {
     parent::__construct('select', array('name' => $name, 'id' => $name));
     $this->AddAttributes($args);
     $option_value = RTK_EMPTYSTRING;
     $option_title = RTK_EMPTYSTRING;
     foreach ($options as $option) {
         if (RTK::ArrayIsLongerThan($option, 1)) {
             $option_value = $option[0];
             $option_title = $option[1];
         } else {
             $option_value = $option_title = $option;
         }
         $optionargs = array('value' => $option_value);
         if ($selected == $option_value) {
             $optionargs['selected'] = true;
         }
         $this->AddChild(new HtmlElement('option', $optionargs, $option_title));
     }
 }
コード例 #26
0
ファイル: formline.php プロジェクト: iensenfirippu/RTK
 /**
  * A widget containing a line of user inputs for a form element
  * @param string $name The HTML name (and #id) of the input element(s) and label
  * @param string $title The text written next to the input element(s)
  * @param string $inputs The input element(s) for the form line
  **/
 public function __construct($name, $title, $inputs)
 {
     parent::__construct('div', array('class' => 'formline'));
     // Add the label
     $this->AddContainer(new HtmlElement('label', array('for' => $name), $title), 'LABEL');
     // Create the input group
     $group = new HtmlElement('div', array('class' => 'formgroup'));
     if (is_a($inputs, 'HtmlElement')) {
         $group->AddChild($inputs);
     } elseif (RTK::ArrayIsLongerThan($array, 0)) {
         foreach ($inputs as $input) {
             if (is_a($input, 'HtmlElement')) {
                 $group->AddChild($input);
             }
         }
     }
     $this->AddContainer($group, 'GROUP');
     // Add the error section
     $this->AddContainer(new HtmlElement(), 'ERROR');
 }
コード例 #27
0
ファイル: Pagination.php プロジェクト: iensenfirippu/securipe
 /**
  * A widget containing the links to different pages for a common URL
  * @param string $baseurl The base part of the URL that all links in the paginition shares
  * @param integer $amount The amount of items to divide into pages
  * @param integer $perpage The amount of items per page
  * @param HtmlAttributes $args Allows custom html tag arguments to be specified (not recommended)
  **/
 public function __construct($baseurl, $amount, $perpage, $page, $args = null)
 {
     HtmlAttributes::Assure($args);
     $args->Add('class', 'pagination', false);
     if ($amount > $perpage || PAGINATIONSHOWEMPTY) {
         parent::__construct('ul', $args);
         $firstpage = 1;
         $lastpage = ceil($amount / $perpage);
         $lowerlimit = $page - PAGINATIONLINKS;
         $upperlimit = $page + PAGINATIONLINKS;
         $nolink = new HtmlElement('li', EMPTYSTRING, '&nbsp;');
         // First, previous
         if ($page > $firstpage) {
             $this->AddChild(new HtmlElement('li', EMPTYSTRING, EMPTYSTRING, new HtmlElement('a', array('href' => $baseurl . $firstpage . SINGLESLASH), PAGINATIONFIRST)));
             $this->AddChild(new HtmlElement('li', EMPTYSTRING, EMPTYSTRING, new HtmlElement('a', array('href' => $baseurl . ($page - 1) . SINGLESLASH), PAGINATIONPREV)));
         } else {
             $this->AddChild($nolink);
             $this->AddChild($nolink);
         }
         // Available page numbers
         for ($i = $lowerlimit; $i <= $upperlimit; $i++) {
             if ($i == $page) {
                 $this->AddChild(new HtmlElement('li', array('class' => 'current'), $page));
             } elseif ($i >= $firstpage && $i <= $lastpage) {
                 $this->AddChild(new HtmlElement('li', EMPTYSTRING, EMPTYSTRING, new HtmlElement('a', array('href' => $baseurl . $i . SINGLESLASH), $i)));
             } else {
                 $this->AddChild($nolink);
             }
         }
         // Next Page, Last Page
         if ($page < $lastpage) {
             $this->AddChild(new HtmlElement('li', EMPTYSTRING, EMPTYSTRING, new HtmlElement('a', array('href' => $baseurl . ($page + 1) . SINGLESLASH), PAGINATIONNEXT)));
             $this->AddChild(new HtmlElement('li', EMPTYSTRING, EMPTYSTRING, new HtmlElement('a', array('href' => $baseurl . $lastpage . SINGLESLASH), PAGINATIONLAST)));
         } else {
             $this->AddChild($nolink);
             $this->AddChild($nolink);
         }
     } else {
         parent::__construct();
     }
 }
コード例 #28
0
ファイル: Link.php プロジェクト: iensenfirippu/securipe
 /**
  * A widget containing a clickable link (a)
  * @param string $url The url of the link
  * @param string $name The title of the list
  * @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($url = EMPTYSTRING, $name = EMPTYSTRING, $forcehttps = false, $args = null)
 {
     HtmlAttributes::Assure($args);
     $args->Add('href', Site::GetBaseURL($forcehttps) . $url);
     parent::__construct('a', $args, $name);
 }
コード例 #29
0
ファイル: html.php プロジェクト: harshzalavadiya/fatak
 public function __construct($data)
 {
     parent::__construct($data);
     //default settings
     $this->sts['total'] = 0;
     $this->sts['page'] = 1;
     $this->sts['limit'] = 20;
     $this->sts['split'] = 5;
     $this->sts['limits'] = array();
     //max pages to show in pagination
     $this->sts['num_links'] = 10;
     $this->sts['url'] = '';
     $this->sts['text'] = 'Showing {start} to {end} of {total} ({pages} Pages)';
     $this->sts['text_limit'] = 'Per Page';
     $this->sts['text_first'] = '&lt;&lt;';
     $this->sts['text_last'] = '&gt;&gt;';
     $this->sts['text_next'] = '&gt;';
     $this->sts['text_prev'] = '&lt;';
     $this->sts['style_links'] = 'links';
     $this->sts['style_results'] = 'results';
     $this->sts['style_limits'] = 'limits';
     //override default
     foreach ($this->data as $key => $val) {
         if (isset($val)) {
             $this->sts[$key] = $val;
         }
     }
 }
コード例 #30
0
ファイル: Header.php プロジェクト: iensenfirippu/securipe
 /**
  * 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
  * @param HtmlAttributes $args Allows custom html tag arguments to be specified (not recommended)
  **/
 public function __construct($text = EMPTYSTRING, $level = 1, $args = null)
 {
     $tag = is_numeric($level) && $level > 0 && $level < 9 ? 'h' . $level : 'h1';
     parent::__construct($tag, $args, $text);
 }