_renderOptionTree ( &$  tree,
option,
prefix,
parentIds = array() 
)

Renders checkbox options for an item tree.

Parameters:
string $tree
array $option
string $prefix
array $parentIds private

Definition at line 294 of file grouppermform.php.

References XoopsFormElement.getName().

Referenced by render().

00295     {
00296      $ele_name = $this->getName();
00297         $tree .= $prefix . "<input type=\"checkbox\" name=\"" . $ele_name . "[groups][" . $this->_groupId . "][" . $option['id'] . "]\" id=\"" . $ele_name . "[groups][" . $this->_groupId . "][" . $option['id'] . "]\" onclick=\""; 
00298         // If there are parent elements, add javascript that will
00299         // make them selecteded when this element is checked to make
00300         // sure permissions to parent items are added as well.
00301         foreach ($parentIds as $pid) {
00302             $parent_ele = $ele_name . '[groups][' . $this->_groupId . '][' . $pid . ']';
00303             $tree .= "var ele = xoopsGetElementById('" . $parent_ele . "'); if(ele.checked != true) {ele.checked = this.checked;}";
00304         } 
00305         // If there are child elements, add javascript that will
00306         // make them unchecked when this element is unchecked to make
00307         // sure permissions to child items are not added when there
00308         // is no permission to this item.
00309         foreach ($option['allchild'] as $cid) {
00310             $child_ele = $ele_name . '[groups][' . $this->_groupId . '][' . $cid . ']';
00311             $tree .= "var ele = xoopsGetElementById('" . $child_ele . "'); if(this.checked != true) {ele.checked = false;}";
00312         } 
00313         $tree .= '" value="1"';
00314         if (in_array($option['id'], $this->_value)) {
00315             $tree .= ' checked="checked"';
00316         } 
00317         $tree .= " />" . $option['name'] . "<input type=\"hidden\" name=\"" . $ele_name . "[parents][" . $option['id'] . "]\" value=\"" . implode(':', $parentIds). "\" /><input type=\"hidden\" name=\"" . $ele_name . "[itemname][" . $option['id'] . "]\" value=\"" . htmlspecialchars($option['name']). "\" /><br />\n";
00318         if (isset($option['children'])) {
00319             foreach ($option['children'] as $child) {
00320                 array_push($parentIds, $option['id']);
00321                 $this->_renderOptionTree($tree, $this->_optionTree[$child], $prefix . '&nbsp;-', $parentIds);
00322             }
00323         }
00324     }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on Sun Feb 17 01:00:52 2008 for XOOPS by  doxygen 1.5.5