/** * Constructs table object. * @method __construct * @param array $inputData User input data. * @param integer $nCols Number of columns. * @param integer $headers Flag enabling/disabling * table headers. * @param integer $rowAlt Add class alt to every * $altRow row. * @param integer $rowOffset Omit class alt for the first * $rowOffset rows. */ public function __construct($inputData = [], $nCols = 2, $headersOnOff = self::SET_TABLE_HEADERS, $rowAlt = 2, $rowOffset = 2) { parent::__construct(['kind' => 'table']); $this->nCols = $this->checkNcolsRange($nCols); $this->headersOnOff = $headersOnOff; $this->rowAlt = $this->checkRowAltRange($rowAlt); $this->rowOffset = $this->checkRowOffsetRange($rowOffset); // Store table data. $this->inputData = $inputData; // Append row nodes to table. $this->append($this->makeTableRows()); }
/** * Constructs object. * @method __construct * @param string $name Input element name. * @param array $options Array of the form: ['option1',...,'selected' => 'option10',...]. */ public function __construct($name = 'name', array $options = ['value1' => 'displayedValue1', 'value2' => 'displayedValue1'], $defaultOption = 'value2') { parent::__construct(['kind' => 'select', 'attr' => ['name' => $name, 'id' => $name]]); $this->initOptions($options, $defaultOption); }
/** * Constructs object. * @method __construct * @param array $input * @param [type] $framework */ public function __construct(array $input = ['kind' => 'div'], callable $getURI = null) { parent::__construct($input); $this->getURI = func_num_args() > 1 ? $getURI : 'Simphotonics\\Utils\\WebUtils::getURI'; $this->selfAnchor = $this->extendAttributes(); }
/** * Constructs object. * @method __construct * @param array $input Array of the form: * [checkBoxName => checkBoxValue] */ public function __construct($name = 'name', $value = 'value') { parent::__construct(['kind' => 'input', 'attr' => ['name' => $name, 'value' => $value, 'type' => 'checkbox']]); }
/** * Constructs object. * @method __construct * @param array $input Objects specs. * @param array $hrefList Array of the form: * ['title' => 'href']. */ public function __construct(array $anchors = ['Home' => 'http://simphotonics.com/']) { parent::__construct(['kind' => 'div']); $this->setAnchors($anchors); }
/** * Constructors an HtmlForm object. * @method __construct * @param array $params Array of the form: * ['action' => url, 'model' => model] */ public function __construct($action = 'Warning: Form action not set!') { parent::__construct(['kind' => 'form', 'attr' => ['id' => $this->id, 'method' => 'post', 'action' => $action]]); }