protected function initContent($content) { if (\is_array($content)) { if (JArray::isAssociative($content) === false) { $icon = @$content[0]; $title = @$content[1]; $desc = @$content[2]; } else { $icon = @$content["icon"]; $image = @$content["image"]; $title = @$content["title"]; $header = @$content["header"]; $desc = @$content["description"]; $items = @$content["items"]; } if (isset($icon) === true) { $this->setIcon($icon); } if (isset($image) === true) { $this->setImage($image); } if (isset($title) === true) { $this->setTitle($title, $desc); } elseif (isset($header) === true) { $this->setTitle($header, $desc, "header"); } if (isset($items) === true) { $this->addList($items); } } else { $this->setContent($content); } }
/** * * {@inheritDoc} * * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() */ public function compile(JsUtils $js = NULL, &$view = NULL) { if (\is_array($this->content)) { $this->content = JArray::sortAssociative($this->content, ["icon", "image", "content"]); } return parent::compile($js, $view); }
protected function initContent($content) { if (\is_array($content)) { if (JArray::isAssociative($content) === false) { $icon = @$content[0]; $title = @$content[1]; $desc = @$content[2]; $status = @$content[3]; } else { $icon = @$content["icon"]; $title = @$content["title"]; $desc = @$content["description"]; $status = @$content["status"]; } if (isset($icon) === true) { $this->setIcon($icon); } if (isset($status) === true) { $this->setStatus($status); } if (isset($title) === true) { $this->setTitle($title, $desc); } } else { $this->setContent($content); } }
protected function createItem($value) { if (\is_array($value)) { $itemO = new HtmlFormInput(JArray::getDefaultValue($value, "id", ""), JArray::getDefaultValue($value, "label", null), JArray::getDefaultValue($value, "type", "text"), JArray::getDefaultValue($value, "value", ""), JArray::getDefaultValue($value, "placeholder", JArray::getDefaultValue($value, "label", null))); return $itemO; } else { return new HtmlFormInput($value); } }
public static function wrapStrings($input, $separator = ' ', $valueQuote = '"') { if (JArray::isAssociative($input) === true) { $result = implode($separator, array_map(function ($v, $k) use($valueQuote) { return $k . '=' . $valueQuote . $v . $valueQuote; }, $input, array_keys($input))); } else { $result = implode($separator, array_values($input)); } return $result; }
public function setContent($content) { if ($content === "-") { $this->asDivider(); } elseif ($content === "-search-") { $values = \explode(",", $content, -1); $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."), JArray::getDefaultValue($values, 1, "search")); } else { parent::setContent($content); } return $this; }
protected function createItem($value) { $caption = $value; $icon = NULL; $tagName = "div"; if (\is_array($value)) { $caption = JArray::getValue($value, "caption", 0); $icon = JArray::getValue($value, "icon", 1); $tagName = JArray::getValue($value, "tagName", 2); } $labelO = new HtmlLabel("label-" . $this->identifier, $caption, $icon, $tagName); return $labelO; }
public function addItems($items) { if (JArray::isAssociative($items)) { foreach ($items as $k => $v) { $this->addItem([$k, $v]); } } else { foreach ($items as $item) { $this->addItem($item); } } return $this; }
protected function createItem($value) { $icon = $value; if (\is_array($value)) { $icon = JArray::getValue($value, "icon", 0); $size = JArray::getValue($value, "size", 1); } $iconO = new HtmlIcon("icon-" . $this->identifier, $icon); if (isset($size)) { $iconO->setSize($size); } return $iconO; }
public function fromArray($array) { if (JArray::isAssociative($array)) { foreach ($array as $k => $v) { $this->addOption($v, $k); } } else { foreach ($array as $v) { $this->addOption($v, $v); } } return $this; }
public function addResults($objects) { if (\is_array($objects) === false) { return $this->addResult($objects); } if (JArray::dimension($objects) === 1) { foreach ($objects as $object) { $this->addResult(["title" => $object]); } } else { $this->elements = \array_merge($this->elements, $objects); } return $this; }
/** * Sets values to the row cols * @param mixed $values */ public function setValues($values = array()) { $count = $this->count(); if (\is_array($values) === false) { $values = \array_fill(0, $count, $values); } else { if (JArray::isAssociative($values) === true) { $values = \array_values($values); } } $count = \min(\sizeof($values), $count); for ($i = 0; $i < $count; $i++) { $cell = $this->content[$i]; $cell->setValue($values[$i]); } }
public function setHeadingAndContent($title, $content = "", $niveau = "1") { if (is_array($title)) { $array = $title; $title = JArray::getValue($array, "title", 0); $content = JArray::getValue($array, "content", 1); $niveau = JArray::getValue($array, "niveau", 2); } $elementHeader = new HtmlDoubleElement("", "h" . $niveau); $elementHeader->setContent($title); $elementHeader->setClass("list-group-item-heading"); $element = new HtmlDoubleElement("", "p"); $element->setContent($content); $element->setClass("list-group-item-text"); $this->element->setContent(array($elementHeader, $element)); return $this->element; }
protected function createItem($value) { $result = new HtmlCard("card-" . $this->count()); if (\is_array($value)) { $header = JArray::getValue($value, "header", 0); $metas = JArray::getValue($value, "metas", 1); $description = JArray::getValue($value, "description", 2); $image = JArray::getValue($value, "image", 3); $extra = JArray::getValue($value, "extra", 4); if (isset($image)) { $result->addImage($image); } $result->addCardHeaderContent($header, $metas, $description); if (isset($extra)) { $result->addExtraContent($extra); } } else { $result->addCardContent($value); } return $result; }
public function compile(JsUtils $js = NULL, &$view = NULL) { $actualStyle = $this->style; if (isset($this->styleLimits) && JArray::isAssociative($this->styleLimits)) { foreach ($this->styleLimits as $k => $v) { $actualStyle = $k; if ($v > $this->value) { break; } } } $this->style = $actualStyle; $this->_template = str_replace("%caption%", $this->caption, $this->_template); if ($this->getIsStacked() === false) { $this->wrap('<div class="progress">', '</div>'); } return parent::compile($js, $view); }
/** * Sets the cells values * @param mixed $values */ public function setValues($values = array()) { $count = $this->count(); $isArray = true; if (\is_array($values) === false) { $values = \array_fill(0, $count, $values); $isArray = false; } if (JArray::dimension($values) == 1 && $isArray) { $values = [$values]; } $count = \min(\sizeof($values), $count); for ($i = 0; $i < $count; $i++) { $row = $this->content[$i]; $row->setValues($values[$i]); } return $this; }
/** * * {@inheritDoc} * * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() */ public function compile(JsUtils $js = NULL, &$view = NULL) { $this->content = JArray::sortAssociative($this->content, ["thead", "tbody", "tfoot"]); if ($this->propertyContains("class", "sortable")) { $this->addEvent("execute", "\$('#" . $this->identifier . "').tablesort();"); } return parent::compile($js, $view); }
public function contentAsString() { return JArray::implode($this->_contentSeparator, $this->content); }
/** * * @param mixed $active * @param mixed $error * @param mixed $success * @param mixed $warning * @param mixed $percent * @param mixed $ratio * @return HtmlProgress */ public function setTextValues($active = false, $error = false, $success = false, $warning = false, $percent = "{percent}%", $ratio = "{value} of {total}") { if (\is_array($active) == true) { $array = $active; $active = JArray::getDefaultValue($array, "active", false); $success = JArray::getDefaultValue($array, "success", $success); $warning = JArray::getDefaultValue($array, "warning", $warning); $percent = JArray::getDefaultValue($array, "percent", $percent); $ratio = JArray::getDefaultValue($array, "ratio", $ratio); } $this->_params["text"] = "%{active : " . \var_export($active, true) . ",error: " . \var_export($error, true) . ",success : " . \var_export($success, true) . ",warning : " . \var_export($warning, true) . ",percent : " . \var_export($percent, true) . ",ratio : " . \var_export($ratio, true) . "}%"; return $this; }
/** * Performs a get to $url on the event $event on $element * and display it in $responseElement * @param string $event * @param string $element * @param string $url The url of the request * @param string $responseElement The selector of the HTML element displaying the answer * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true) */ public function getOn($event, $element, $url, $responseElement = "", $parameters = array()) { $params = JArray::getDefaultValue($parameters, "params", "{}"); return $this->js->_getOn($event, $element, $url, $params, $responseElement, $parameters); }
/** * * {@inheritDoc} * * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() */ public function compile(JsUtils $js = NULL, $view = NULL) { $this->content = JArray::sortAssociative($this->content, ["header", "image", "content", "extra-content"]); return parent::compile($js, $view); }
/** * * {@inheritDoc} * * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() */ public function compile(JsUtils $js = NULL, &$view = NULL) { $this->content = JArray::sortAssociative($this->content, ["image", "header", "meta", "description"]); return parent::compile($js, $view); }
public function addItems($items) { if (JArray::isAssociative($items)) { foreach ($items as $k => $v) { $this->addItem($v)->setData($k); } } else { foreach ($items as $item) { $this->addItem($item); } } }