function displayTree(Collections $elem, $html, $value, $name, $user = null) { $img_expand = 'blue_expand.png'; $img_expand_up = 'blue_expand_up.png'; if ($elem->hasChild()) { $html .= '<ul>'; foreach ($elem->getChilds() as $child) { $html .= "<li class=\"rid_" . $child->getId() . "\""; if ($child->isEncodable()) { $html .= ' data-enc="true" '; } $html .= "><div class=\"col_name\">"; $html .= image_tag($img_expand, array('alt' => '+', 'class' => 'tree_cmd collapsed')); $html .= image_tag($img_expand_up, array('alt' => '-', 'class' => 'tree_cmd expanded hidden')); $html .= "<span>" . $child->getName() . "</span>"; $options = array('type' => 'checkbox', 'class' => 'col_check', 'value' => $child->getId(), 'name' => $name); if (is_array($value) && in_array($child->getId(), $value)) { $options['checked'] = "checked"; } if ($name != '') { $html .= '<label class="chk">' . $this->renderTag('input', $options) . '</label>'; } else { if (!$this->getOption('is_choose')) { $html .= ' ' . image_tag('info.png', array('title' => 'info', 'class' => 'extd_info', 'data-manid' => $child->getMainManagerRef(), 'data-staffid' => $child->getStaffRef())); if ($user->isA(Users::ADMIN) || $user->isAtLeast(Users::MANAGER) && $child->getTypeInCol() >= Users::MANAGER) { $html .= link_to(image_tag('edit.png', array('title' => 'Edit Collection', 'class' => 'collection_edit')), 'collection/edit?id=' . $child->getId()); $html .= link_to(image_tag('duplicate.png', array('title' => 'Duplicate Collection')), 'collection/new?duplicate_id=' . $child->getId()); } } } $html .= "</div>"; $html .= $this->displayTree($child, '', $value, $name, $user) . '</li>'; } $html .= '</ul>'; } return $html; }