Ejemplo n.º 1
0
 /** Produce XML data for the browser tree
  * @param $treedata A set of records to populate the tree.
  * @param $attrs Attributes for tree items
  *        'text' - the text for the tree node
  *        'icon' - an icon for node
  *        'openIcon' - an alternative icon when the node is expanded
  *        'toolTip' - tool tip text for the node
  *        'action' - URL to visit when single clicking the node
  *        'iconAction' - URL to visit when single clicking the icon node
  *        'branch' - URL for child nodes (tree XML)
  *        'expand' - the action to return XML for the subtree
  *        'nodata' - message to display when node has no children
  */
 function printTreeXML(&$treedata, &$attrs)
 {
     global $conf, $lang;
     header("Content-Type: text/xml; charset=UTF-8");
     header("Cache-Control: no-cache");
     echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
     echo "<tree>\n";
     if (count($treedata) > 0) {
         foreach ($treedata as $rec) {
             echo "<tree";
             echo value_xml_attr('text', $attrs['text'], $rec);
             echo value_xml_attr('action', $attrs['action'], $rec);
             echo value_xml_attr('src', $attrs['branch'], $rec);
             $icon = $this->icon(value($attrs['icon'], $rec));
             echo value_xml_attr('icon', $icon, $rec);
             echo value_xml_attr('iconaction', $attrs['iconAction'], $rec);
             if (!empty($attrs['openicon'])) {
                 $icon = $this->icon(value($attrs['openIcon'], $rec));
             }
             echo value_xml_attr('openicon', $icon, $rec);
             echo value_xml_attr('tooltip', $attrs['toolTip'], $rec);
             echo " />\n";
         }
     } else {
         $msg = isset($attrs['nodata']) ? $attrs['nodata'] : $lang['strnoobjects'];
         echo "<tree text=\"{$msg}\" onaction=\"tree.getSelected().getParent().reload()\" icon=\"", $this->icon('ObjectNotFound'), "\" />\n";
     }
     echo "</tree>\n";
 }
Ejemplo n.º 2
0
Archivo: Misc.php Proyecto: hardikk/HNH
 /** Produce XML data for the browser tree
  * @param $treedata A set of records to populate the tree.
  * @param $attrs Attributes for tree items
  *        'text' - the text for the tree node
  *        'icon' - an icon for node
  *        'openIcon' - an alternative icon when the node is expanded
  *        'toolTip' - tool tip text for the node
  *        'action' - URL to visit when single clicking the node
  *        'iconAction' - URL to visit when single clicking the icon node
  *        'branch' - URL for child nodes (tree XML)
  *        'expand' - the action to return XML for the subtree
  *        'nodata' - message to display when node has no children
  *        'nohead' - suppress headers and opening <tree> tag
  *        'nofoot' - suppress closing </tree> tag
  */
 function printTreeXML(&$treedata, &$attrs)
 {
     global $conf, $lang;
     if (!isset($attrs['nohead']) || $attrs['nohead'] === false) {
         header("Content-Type: text/xml");
         header("Cache-Control: no-cache");
         echo "<?xml version=\"1.0\" encoding=\"", htmlspecialchars($lang['appcharset']), "\"?>\n";
         echo "<tree>\n";
     }
     if ($treedata->recordCount() > 0) {
         while (!$treedata->EOF) {
             $rec =& $treedata->fields;
             echo "<tree";
             echo value_xml_attr('text', $attrs['text'], $rec);
             echo value_xml_attr('action', $attrs['action'], $rec);
             echo value_xml_attr('src', $attrs['branch'], $rec);
             $icon = $this->icon(value($attrs['icon'], $rec));
             echo value_xml_attr('icon', $icon, $rec);
             echo value_xml_attr('iconaction', $attrs['iconAction'], $rec);
             if (!empty($attrs['openicon'])) {
                 $icon = $this->icon(value($attrs['openIcon'], $rec));
             }
             echo value_xml_attr('openicon', $icon, $rec);
             echo value_xml_attr('tooltip', $attrs['toolTip'], $rec);
             echo " />\n";
             $treedata->moveNext();
         }
     } else {
         $msg = isset($attrs['nodata']) ? $attrs['nodata'] : $lang['strnoobjects'];
         echo "<tree text=\"{$msg}\" onaction=\"tree.getSelected().getParent().reload()\" icon=\"", $this->icon('ObjectNotFound'), "\" />\n";
     }
     if (!isset($attrs['nofoot']) || $attrs['nofoot'] === false) {
         echo "</tree>\n";
     }
 }