Example #1
0
 /**
  * Generate HTML of the list <select> element for drop-down list.
  *
  * @param array<mixed> $dataSet List of drop-down options data.
  * @param string,integer $currentValue Current value if selected.
  * @param array<string => string> $attributesList List of the HTML attributes
  *           for the drop-down element (optional).
  * @param string $template Path to the template file of the drop-down (optional).
  */
 public function __construct($dataSet = [], $currentValue = null, $attributesList = [], $template = "")
 {
     if (empty($template)) {
         $template = self::DEFAULT_TEMPLATE;
     }
     parent::__construct($attributesList, $template, $dataSet, $currentValue);
 }
Example #2
0
 public function __construct($attribs = [], $template = null, $show = false)
 {
     if (empty($template)) {
         $template = __DIR__ . self::DEFAULT_TEMPLATE;
     }
     if ($show) {
         parent::__construct($attribs, $template);
     } else {
         $this->template = $template;
         $this->setAttributes($attribs);
     }
 }
Example #3
0
 /**
  * Generate HTML of the list <option> element.
  *
  * @param string,integer $optionValue Value of the option.
  * @param mixed $option Option object, pair array or single title value.
  * @param string,integer $currentValue Current selected list option value (optional).
  * @param string $template HTML template of this component (optional).
  */
 public function __construct($optionValue, $option, $currentValue, $template = "")
 {
     if (empty($template)) {
         $template = self::DEFAULT_TEMPLATE;
     }
     if (isObject($option)) {
         parent::__construct(['value' => $option->id, 'title' => $option->title], $template, [], $currentValue);
     } elseif (is_array($option)) {
         parent::__construct($option, $template, [], $currentValue);
     } else {
         parent::__construct(['value' => $optionValue, 'title' => $option], $template, [], $currentValue);
     }
 }
Example #4
0
 /**
  * Generate HTML of the list <input type="checkbox" ... /> element.
  *
  * @param array<string => string> $attributesList List of the component attributes.
  * @param string $template Path to the components template file.
  */
 public function __construct($attributesList, $template)
 {
     parent::__construct($attributesList, $template);
 }