예제 #1
0
 /**
  * UINav constructor.
  *
  * @param string       $brand_name  The name of the website, to be displayed in the navigation bar
  * @param array        $left_links  The links to show on the left hand side of the navigation bar, next to branding
  * @param array        $right_links The links to show on the right hand side of the navigation bar
  * @param array|string $classes     Classes for use with CSS and Javascript
  * @param int          $fixed       Determines whether the navigation bar is fixed, and whether this is to the top or the bottom of the screen
  * @param bool         $collapse    Whether the navigation bar should automatically collapse for smaller screens
  * @param bool         $inverse     Determines whether the navigation bar colours are inversed (i.e. black instead of white)
  * @param string       $id          HTML ID Attribute
  * @param string       $on_click    Javascript function to be run when the object is clicked
  */
 public function __construct($brand_name, $left_links = [], $right_links = [], $classes = [], $fixed = UINav::FIXED_NONE, $collapse = true, $inverse = false, $id = '', $on_click = '')
 {
     parent::__construct($classes, $id, $on_click);
     $this->brand_name = $brand_name;
     if (is_array($left_links)) {
         $left_links = new UIList($left_links, ['nav', 'navbar-nav', 'navbar-left']);
     } else {
         if ($left_links instanceof UIList) {
             $left_links->addClass('nav');
             $left_links->addClass('navbar-nav');
             $left_links->addClass('navbar-left');
         }
     }
     $this->left_links = $left_links;
     if (is_array($right_links)) {
         $right_links = new UIList($right_links, ['nav', 'navbar-nav', 'navbar-right']);
     } else {
         if ($right_links instanceof UIList) {
             $right_links->addClass('nav');
             $right_links->addClass('navbar-nav');
             $right_links->addClass('navbar-right');
         }
     }
     $this->right_links = $right_links;
     $this->fixed = $fixed;
     $this->inverse = $inverse;
     $this->collapse = $collapse;
     $this->addClasses();
 }
예제 #2
0
 /**
  * UIPage constructor.
  *
  * @param UIPageHead $header  Page Head HTMLObject
  * @param UIPageBody $body    Page Body HTMLObject
  * @param array      $classes Classes for use with CSS and Javascript
  * @param string     $id      HTML ID Attribute
  * @param string     $lang    ISO 639-1 Language Code. Assists search engines and browsers.
  */
 public function __construct($header, $body, $classes = [], $id = '', $lang = 'en-GB')
 {
     parent::__construct($classes, $id);
     $this->header = $header;
     $this->body = $body;
     $this->lang = $lang;
 }
예제 #3
0
 /**
  * UITable constructor.
  *
  * @param UITableHeader $header   The header object for this table.
  * @param UITableBody   $body     The body object for this table.
  * @param UITableFooter $footer   The footer object for this table.
  * @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($header = null, $body = null, $footer = null, $classes = [], $id = '', $on_click = '')
 {
     parent::__construct($classes, $id, $on_click);
     $this->header = $header;
     $this->body = $body;
     $this->footer = $footer;
 }
예제 #4
0
 /**
  * CSSObject constructor.
  * @param string $css Any javascript code to be run
  * @param string $url The url where we can find a Javascript file
  * @param string $type HTML ID Attribute
  * @param array $classes Classes for use with CSS and Javascript
  * @param string $id HTML ID Attribute
  */
 public function __construct($css = '', $url = '', $type = 'text/css', $classes = [], $id = '')
 {
     parent::__construct($classes, $id);
     $this->css = $css;
     $this->url = $url;
     $this->type = $type;
 }
예제 #5
0
 /**
  * JSObject constructor.
  * @param string $javascript Any javascript code to be run
  * @param string $url The url where we can find a Javascript file
  * @param string $type HTML ID Attribute
  * @param array $classes Classes for use with CSS and Javascript
  * @param string $id HTML ID Attribute
  */
 public function __construct($javascript = '', $url = '', $type = 'text/javascript', $classes = [], $id = '')
 {
     parent::__construct($classes, $id);
     $this->javascript = $javascript;
     $this->url = $url;
     $this->type = $type;
 }
예제 #6
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;
 }
예제 #7
0
 /**
  * UILink constructor.
  *
  * @param string $text     Text to display, that should be linked.
  * @param string $link     The target URL for the link (where we are linking to)
  * @param string $on_click Javascript function to be run when the object is clicked
  * @param string $target   Specifies where to open the linked document, i.e. blank, parent
  * @param string $name     The name attribute is used as an anchor on the page for other text to link to
  * @param array  $classes  Classes for use with CSS and Javascript
  * @param string $id       HTML ID Attribute
  */
 public function __construct($text, $link = '/', $on_click = '', $target = '', $name = '', $classes = [], $id = '')
 {
     parent::__construct($classes, $id, $on_click);
     $this->text = $text;
     $this->link = $link;
     $this->target = $target;
     $this->name = $name;
 }
예제 #8
0
 /**
  * UIInteractable constructor.
  * Initialise a new HTML Input object
  *
  * @param string $type      The type of input, i.e. text
  * @param string $value     The value that the input should start with on page load
  * @param string $name      The name of the input element- needed for submitting a form
  * @param bool   $disabled  True if this input should not be editable by the user
  * @param array  $classes   Classes for use with CSS and Javascript
  * @param string $id        HTML ID Attribute
  */
 public function __construct($type = '', $value = '', $name = '', $disabled = false, $classes = [], $id = '')
 {
     $this->type = $type;
     parent::__construct($classes, $id);
     $this->setValue($value);
     $this->setName($name);
     $this->setDisabled($disabled);
 }
예제 #9
0
 public function __construct($input_objects = [], $action = '', $method = 'POST', $classes = [], $id = '', $on_click = '', $enc_type = 'application/x-www-form-urlencoded')
 {
     parent::__construct($classes, $id, $on_click);
     $this->method = $method;
     $this->action = $action;
     $this->input_objects = $input_objects;
     $this->enc_type = $enc_type;
 }
예제 #10
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;
 }
예제 #11
0
 /**
  * UIView constructor.
  *
  * @param string       $tag      The HTML tag that should be used here, i.e. div, span, etc.
  * @param array|string $contents The content of this HTML division.
  * @param string       $id       HTML ID Attribute
  * @param array        $classes  Classes for use with CSS and Javascript
  */
 public function __construct($tag = '', $contents = [], $classes = [], $id = '')
 {
     parent::__construct($classes, $id);
     $this->tag = $tag;
     if (!is_array($contents)) {
         $contents = [$contents];
     }
     $this->contents = $contents;
 }
예제 #12
0
 /**
  * UIPageBody constructor.
  *
  * @param array|string $contents Any additional contents, such as meta data or favicons
  * @param array        $js_links An array of JS links to load. These must be in the correct order.
  * @param array        $classes  Classes for use with CSS and Javascript
  * @param string       $id       HTML ID Attribute
  */
 public function __construct($contents = [], $js_links = [], $classes = [], $id = '')
 {
     parent::__construct($classes, $id);
     $this->js_links = $js_links;
     if (!is_array($contents)) {
         $this->contents = [$contents];
     }
     $this->contents = $contents;
 }
예제 #13
0
 /**
  * UITableHeader constructor.
  *
  * @param UITableRow $row An array of headings to be present in this table.
  * @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($row = null, $classes = [], $id = '', $on_click = '')
 {
     parent::__construct($classes, $id, $on_click);
     if ($row instanceof UITableRow) {
         $this->row = $row;
     } else {
         if (is_array($row)) {
             $this->row = new UITableRow($row);
         }
     }
 }
예제 #14
0
 /**
  * UIList constructor.
  *
  * @param array  $list_items Items present in the UI List
  * @param array  $classes    Classes for use with CSS and Javascript
  * @param int    $list_type  Whether this is an ordered list
  * @param string $id         HTML ID Attribute
  * @param string $on_click   Javascript function to be run when the object is clicked
  */
 public function __construct($list_items = [], $classes = [], $list_type = UIList::UNORDERED_LIST, $id = '', $on_click = '')
 {
     parent::__construct($classes, $id, $on_click);
     $this->list_items = $list_items;
 }
예제 #15
0
 /**
  * UIImage constructor.
  *
  * @param string $src     The URL where we can find the image we want to display
  * @param string $id      HTML ID Attribute
  * @param array  $classes Classes for use with CSS and Javascript
  */
 public function __construct($src = '/img/not-found.png', $classes = [], $id = '')
 {
     parent::__construct($classes, $id);
     $this->src = $src;
 }
예제 #16
0
 /**
  * UITableHeader constructor.
  *
  * @param array  $columns  An array of headings to be present in this table.
  * @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($columns = [], $classes = [], $id = '', $on_click = '')
 {
     parent::__construct($classes, $id, $on_click);
     $this->columns = $columns;
 }