Пример #1
0
 /**
  * UITableBody constructor.
  *
  * @param array  $rows Array of UITableRow objects that form this table body
  * @param array  $classes Classes for use with CSS and Javascript
  * @param string $id HTML ID Attribute
  * @param string $on_click Javascript function to be run when the object is clicked
  */
 public function __construct($rows = [], $classes = [], $id = '', $on_click = '')
 {
     parent::__construct($classes, $id, $on_click);
     if (!is_array($rows)) {
         $rows = [$rows];
     }
     $this->rows = $rows;
 }
Пример #2
0
 /**
  * UITableCell constructor.
  *
  * @param array  $contents Contents of this cell
  * @param array  $classes  Classes for use with CSS and Javascript
  * @param string $id       HTML ID Attribute
  * @param string $on_click Javascript function to be run when the object is clicked
  */
 public function __construct($contents = [], $classes = [], $id = '', $on_click = '')
 {
     parent::__construct($classes, $id, $on_click);
     if (!is_array($this->contents)) {
         $contents = [$contents];
     }
     $this->contents = $contents;
 }
Пример #3
0
 /**
  * Returns the HTML string for this object
  * @return string HTML string
  */
 public function __toString()
 {
     $html = '<' . $this->tag . parent::__toString() . '>';
     foreach ($this->contents as $content) {
         $html .= $content;
     }
     $html .= "</{$this->tag}>";
     return $html;
 }
Пример #4
0
 /**
  * Returns the HTML string for this object
  * @return string HTML string
  */
 public function __toString()
 {
     $html = '<img' . parent::__toString();
     if (!empty($this->src)) {
         $html .= "src='{$this->src}'";
     }
     $html .= '>';
     return $html;
 }
Пример #5
0
 /**
  * Returns the HTML string for this object
  *
  * @throws \Exception
  * @return string HTML string
  */
 public function __toString()
 {
     $html = '<thead' . parent::__toString() . '>';
     if ($this->row instanceof UITableCell) {
         $html .= $this->row;
     } else {
         throw new \Exception("");
     }
     $html .= '</thead>';
     return $html;
 }
Пример #6
0
 /**
  * Returns the HTML string for this object
  * @return string HTML string
  */
 public function __toString()
 {
     $html = '<!doctype html><html' . parent::__toString() . 'lang="' . $this->lang . '">';
     if (!empty($this->header)) {
         $html .= $this->header;
     }
     if (!empty($this->body)) {
         $html .= $this->body;
     }
     $html .= '</html>';
     return $html;
 }
Пример #7
0
 /**
  * Returns the HTML string for this object
  * @return string HTML string
  */
 public function __toString()
 {
     $html = "<script" . parent::__toString();
     $html .= " type='{$this->type}'";
     if (!empty($this->url)) {
         $html .= " src='{$this->url}'";
     }
     $html .= '>';
     $html .= $this->javascript;
     $html .= '</script>';
     return $html;
 }
Пример #8
0
 /**
  * Returns the HTML string for this object
  * @return string HTML string
  */
 public function __toString()
 {
     $html = '<body' . parent::__toString() . '>';
     foreach ($this->contents as $content) {
         $html .= $content;
     }
     foreach ($this->js_links as $js_link) {
         $html .= new JSObject('', $js_link);
     }
     $html .= '</body>';
     return $html;
 }
Пример #9
0
 /**
  * Returns the HTML string for this object
  * @return string HTML string
  */
 public function __toString()
 {
     $html = '<table' . parent::__toString() . '>';
     $sections = [$this->header, $this->body, $this->footer];
     foreach ($sections as $section) {
         if (!empty($section)) {
             $html .= $section;
         }
     }
     $html .= '</table>';
     return $html;
 }
Пример #10
0
 /**
  * Returns the HTML string for this object
  * @return string HTML string
  */
 public function __toString()
 {
     $html = '<tr' . parent::__toString() . '>';
     foreach ($this->columns as $column) {
         if ($column instanceof UITableCell) {
             $html .= $column;
         } else {
             $html .= new UITableCell($column);
         }
     }
     $html .= '</tr>';
     return $html;
 }
Пример #11
0
 /**
  * Returns the HTML string for this object
  *
  * @throws \Exception
  * @return string HTML string
  */
 public function __toString()
 {
     $html = '<thead' . parent::__toString() . '>';
     if ($this->row instanceof UITableRow) {
         $html .= $this->row;
     } else {
         if (is_array($this->row)) {
             $html .= new UITableRow($this->row);
         }
     }
     $html .= '</thead>';
     return $html;
 }
Пример #12
0
 /**
  * Returns the HTML string for this object
  * @return string HTML string
  */
 public function __toString()
 {
     $html = '<a' . parent::__toString();
     if (!empty($this->target)) {
         $html .= " target='{$this->target}'";
     }
     if (!empty($this->link)) {
         $html .= " href='{$this->link}'";
     }
     if (!empty($this->name)) {
         $html .= " name='{$this->name}'";
     }
     $html .= '>' . $this->text . '</a>';
     return $html;
 }
Пример #13
0
 /**
  * Returns the HTML string for this object
  * @return string HTML string
  */
 public function __toString()
 {
     $html = '<head' . parent::__toString() . '>';
     if (!empty($this->title)) {
         $html .= '<title>' . $this->title . '</title>';
     }
     foreach ($this->css_links as $css_link) {
         $html .= new CSSObject('', $css_link);
     }
     foreach ($this->contents as $content) {
         $html .= $content;
     }
     $html .= '</head>';
     return $html;
 }
Пример #14
0
 /**
  * Returns the HTML string for this object
  * @return string HTML string
  */
 public function __toString()
 {
     if (!empty($this->url)) {
         $html = "<link rel='stylesheet'" . parent::__toString();
         $html .= " type='{$this->type}'";
         if (!empty($this->url)) {
             $html .= " href='{$this->url}'";
         }
         $html .= '>';
     } else {
         if (!empty($this->css)) {
             $html = '<style' . parent::__toString() . '>' . $this->css . '</style>';
         } else {
             $html = '';
         }
     }
     return $html;
 }
Пример #15
0
 public function __toString()
 {
     $html = '<form';
     $html .= parent::__toString();
     if (!empty($this->method)) {
         $html .= " method='{$this->method}'";
     }
     if (!empty($this->action)) {
         $html .= " action='{$this->action}'";
     }
     if (!empty($this->enc_type) && $this->method === 'POST') {
         $html .= " enctype='{$this->enc_type}'";
     }
     $html .= '>';
     foreach ($this->input_objects as $input_object) {
         $html .= $input_object;
     }
     $html .= '</form>';
     return $html;
 }
Пример #16
0
 /**
  * Returns the HTML string for this object
  * @return string HTML string
  */
 public function __toString()
 {
     if ($this->list_type === UIList::ORDERED_LIST) {
         $html = '<ol';
     } else {
         $html = '<ul';
     }
     $html .= parent::__toString() . '>';
     foreach ($this->list_items as $list_item) {
         if ($list_item instanceof UIListItem) {
             $html .= $list_item;
         } else {
             $html .= new UIListItem($list_item);
         }
     }
     if ($this->list_type === UIList::ORDERED_LIST) {
         $html .= '</ol>';
     } else {
         $html .= '</ul>';
     }
     return $html;
 }
Пример #17
0
 /**
  * Returns the HTML string for this object
  * @return string HTML string
  */
 public function __toString()
 {
     $html = '<nav' . parent::__toString() . '>';
     $this->addClasses();
     $list = $this->left_links;
     $list .= $this->right_links;
     if ($this->collapse) {
         $list = new UIDiv($list, ['collapse navbar-collapse']);
         $list->setId($this->getId() . '-collapse');
         $collapse_button = '<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#' . $this->getId() . '-collapse">';
         for ($i = 0; $i < 3; $i++) {
             $collapse_button .= new UISpan([], ['icon-bar']);
         }
         $collapse_button .= '</button>';
     }
     $html .= new UIDiv([new UIDiv([isset($collapse_button) ? $collapse_button : '', $this->brand_name], 'navbar-header'), $list], 'container-fluid');
     $html .= '</nav>';
     return $html;
 }
Пример #18
0
 /**
  * Returns the HTML string for this object
  * @return string HTML string
  */
 public function __toString()
 {
     $html = parent::__toString();
     $html .= " type='{$this->type}'";
     if (!empty($this->value)) {
         $html .= " value='{$this->value}'";
     }
     if (!empty($this->name)) {
         $html .= " name='{$this->name}'";
     }
     if ($this->disabled) {
         $html .= ' disabled';
     }
     return $html;
 }