29 $this->_hasCheckedList =
false;
33 $count = $this->
count();
34 $item =
new HtmlListItem(
"item-" . $this->identifier .
"-" . $count, $value);
45 return $this->
getItem($index)->getPart($partName);
52 public function asLinks($hrefs = [], $target = NUll) {
56 return parent::asLinks($hrefs, $target);
59 public function addList($items = array()) {
61 $list->setClass(
"list");
74 $itemO = parent::getItemToAdd($item);
76 $itemO->addClass(
"item");
93 if ($this->_hasCheckedList ===
true) {
94 $jsCode = include dirname(__FILE__) .
'/../../components/jsTemplates/tplCheckedList.php';
95 $jsCode = \str_replace(
"%identifier%",
"#" . $this->identifier, $jsCode);
96 $jsCode = \str_replace(
"%fireOnInit%", $this->_fireOnInit, $jsCode);
97 $jsCode = \str_replace(
"%onChange%", $this->_ckItemChange, $jsCode);
109 $count = $this->
count();
110 for ($i = $this->_maxVisible; $i < $count; $i ++) {
112 ->addClass(
"notVisible")
113 ->setProperty(
"style",
"display: none;");
116 $item->addClass(
"points");
117 $item->onClick(
'$(this).hide();$("#' . $this->identifier .
' .notVisible").show();');
121 $this->_ckItemChange = $jsCode;
129 $this->_fireOnInit = $fireOnInit;
154 if (isset($this->_maxVisible) && $this->_maxVisible < $this->
count()) {
158 $visibility->attach(
"#" . $this->identifier);
159 $visibility->setOnTopVisible(
"$(this).children('.notVisible').hide();$(this).find('.points').show();");
160 $visibility->compile($js, $view);
161 $this->_visibility = $visibility;
164 return parent::compile($js, $view);
176 public function addCheckedList($items = array(), $masterItem = NULL, $values = array(), $notAllChecked =
false, $name = null) {
177 $count = $this->
count();
179 if (isset($masterItem)) {
180 if (\is_array($masterItem)) {
183 $masterO->setName($name);
184 if (isset($masterItem[1])) {
185 if (\array_search($masterItem[1], $values) !==
false) {
186 $masterO->getDataField()->setProperty(
"checked",
"");
192 if ($notAllChecked) {
193 $masterO->getDataField()->addClass(
"_notAllChecked");
195 $masterO->getHtmlCk()->addToProperty(
"class",
"master");
196 $masterO->setClass(
"item");
201 $this->
setFireOnInit(UString::getBooleanStr($this->_fireOnInit ||
count($items) < 30));
202 foreach ($items as $val => $caption) {
204 if (\array_search($val, $values) !==
false) {
205 $itemO->getDataField()->setProperty(
"checked",
"");
208 $itemO->setName($name);
209 $itemO->setClass(
"item");
212 if (isset($masterO) ===
true) {
214 $list->setClass(
"list");
215 $masterO->addContent($list);
219 $this->_hasCheckedList =
true;
224 if (! \is_array($icons)) {
225 $icons = \array_fill(0, \
sizeof($this->content), $icons);
227 $max = \min(\
sizeof($icons), \
sizeof($this->content));
228 for ($i = 0; $i < $max; $i ++) {
229 $this->content[$i]->addIcon($icons[$i]);
compile(JsUtils $js=NULL, &$view=NULL)
{}
addToProperty($name, $value, $separator=" ")
asLinks($hrefs=[], $target=NUll)
addItem($item)
adds and returns an item
addCheckedList($items=array(), $masterItem=NULL, $values=array(), $notAllChecked=false, $name=null)
Adds a grouped checked box to the list.
__construct($identifier, $items=array())
setMaxVisible($_maxVisible)
Base class for Semantic Html collections.
setFireOnInit($fireOnInit)
addHeader($niveau, $content)
getItemPart($index, $partName="header")
Visibility provides a set of callbacks for when a content appears in the viewport.
addToPropertyCtrl($name, $value, $typeCtrl)