/**
  * Renders the form
  *
  * @return string
  * @access public
  */
 function render()
 {
     // load all child ids for javascript codes
     foreach (array_keys($this->_itemTree) as $item_id) {
         $this->_itemTree[$item_id]['allchild'] = array();
         $this->_loadAllChildItemIds($item_id, $this->_itemTree[$item_id]['allchild']);
     }
     $gperm_handler =& xoops_gethandler('groupperm');
     $member_handler =& xoops_gethandler('member');
     $glist = $member_handler->getGroupList();
     foreach (array_keys($glist) as $i) {
         if ($i == XOOPS_GROUP_ANONYMOUS && !$this->_showAnonymous) {
             continue;
         }
         // get selected item id(s) for each group
         $selected = $gperm_handler->getItemIds($this->_permName, $i, $this->_modid);
         $ele = new XoopsGroupFormCheckBox($glist[$i], 'perms[' . $this->_permName . ']', $i, $selected);
         $ele->setOptionTree($this->_itemTree);
         $this->addElement($ele);
         unset($ele);
     }
     $tray = new XoopsFormElementTray('');
     $tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
     $tray->addElement(new XoopsFormButton('', 'reset', _CANCEL, 'reset'));
     $this->addElement($tray);
     $ret = '<h4>' . $this->getTitle() . '</h4>';
     if ($this->_permDesc) {
         $ret .= $this->_permDesc . '<br /><br />';
     }
     $ret .= '<form title="' . str_replace('"', '', $this->getTitle()) . '" name="' . $this->getName() . '" id="' . $this->getName() . '" action="' . $this->getAction() . '" method="' . $this->getMethod() . '"' . $this->getExtra() . '>' . '<table width="100%" class="outer" cellspacing="1" valign="top">';
     $elements = $this->getElements();
     $hidden = '';
     foreach (array_keys($elements) as $i) {
         if (!is_object($elements[$i])) {
             $ret .= $elements[$i];
         } elseif (!$elements[$i]->isHidden()) {
             $ret .= '<tr valign="top" align="left"><td class="head">' . $elements[$i]->getCaption();
             if ($elements[$i]->getDescription() != "") {
                 $ret .= "<br /><br /><span style='font-weight: normal;'>" . $elements[$i]->getDescription() . "</span>";
             }
             $ret .= '</td>' . '<td class="even">' . $elements[$i]->render() . '</td></tr>' . '';
         } else {
             $hidden .= $elements[$i]->render();
         }
     }
     $ret .= '</table>' . $hidden . '</form>';
     $ret .= $this->renderValidationJS(true);
     return $ret;
 }
Example #2
0
 /**
  * Renders the form
  * 
  * @return string
  * @access public
  */
 function render()
 {
     // load all child ids for javascript codes
     foreach (array_keys($this->_itemTree) as $item_id) {
         $this->_itemTree[$item_id]['allchild'] = array();
         $this->_loadAllChildItemIds($item_id, $this->_itemTree[$item_id]['allchild']);
     }
     $gperm_handler =& xoops_gethandler('groupperm');
     $member_handler =& xoops_gethandler('member');
     $glist =& $member_handler->getGroupList();
     foreach (array_keys($glist) as $i) {
         // get selected item id(s) for each group
         $selected = $gperm_handler->getItemIds($this->_permName, $i, $this->_modid);
         $ele = new XoopsGroupFormCheckBox($glist[$i], 'perms[' . $this->_permName . ']', $i, $selected);
         $ele->setOptionTree($this->_itemTree);
         $this->addElement($ele);
         unset($ele);
     }
     $tray = new XoopsFormElementTray('');
     $tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
     $tray->addElement(new XoopsFormButton('', 'reset', _CANCEL, 'reset'));
     $this->addElement($tray);
     $root =& XCube_Root::getSingleton();
     $renderSystem =& $root->getRenderSystem(XOOPSFORM_DEPENDENCE_RENDER_SYSTEM);
     $renderTarget =& $renderSystem->createRenderTarget('main');
     $renderTarget->setAttribute('legacy_module', 'legacy');
     $renderTarget->setTemplateName("legacy_xoopsform_grouppermform.html");
     $renderTarget->setAttribute("form", $this);
     $renderSystem->render($renderTarget);
     return $renderTarget->getResult();
 }
Example #3
0
 /**
  * Renders the form
  * 
  * @return string
  * @access public
  */
 function render()
 {
     // load all child ids for javascript codes
     foreach (array_keys($this->_itemTree) as $item_id) {
         $this->_itemTree[$item_id]['allchild'] = array();
         $this->_loadAllChildItemIds($item_id, $this->_itemTree[$item_id]['allchild']);
     }
     $gperm_handler =& xoops_gethandler('groupperm');
     $member_handler =& xoops_gethandler('member');
     $glist =& $member_handler->getGroupList();
     foreach (array_keys($glist) as $i) {
         if ($i != XOOPS_GROUP_ANONYMOUS || $this->_showAnonymous) {
             // get selected item id(s) for each group
             $selected = $gperm_handler->getItemIds($this->_permName, $i, $this->_modid);
             $ele = new XoopsGroupFormCheckBox($glist[$i], 'perms[' . $this->_permName . ']', $i, $selected);
             $ele->setOptionTree($this->_itemTree);
             $this->addElement($ele);
             unset($ele);
         }
     }
     $tray = new XoopsFormElementTray('');
     $tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
     $tray->addElement(new XoopsFormButton('', 'reset', _CANCEL, 'reset'));
     $this->addElement($tray);
     $ret = '<h4>' . $this->getTitle() . '</h4>' . $this->_permDesc . '<br />';
     $ret .= "<form name='" . $this->getName() . "' id='" . $this->getName() . "' action='" . $this->getAction() . "' method='" . $this->getMethod() . "'" . $this->getExtra() . ">\n<table width='100%' class='outer' cellspacing='1'>\n";
     $elements =& $this->getElements();
     foreach (array_keys($elements) as $i) {
         if (!is_object($elements[$i])) {
             $ret .= $elements[$i];
         } elseif (!$elements[$i]->isHidden()) {
             $ret .= "<tr valign='top' align='left'><td class='head'>" . $elements[$i]->getCaption();
             if ($elements[$i]->getDescription() != '') {
                 $ret .= '<br /><br /><span style="font-weight: normal;">' . $elements[$i]->getDescription() . '</span>';
             }
             $ret .= "</td>\n<td class='even'>\n" . $elements[$i]->render() . "\n</td></tr>\n";
         } else {
             $ret .= $elements[$i]->render();
         }
     }
     $ret .= '</table></form>';
     return $ret;
 }