示例#1
0
 /**
  * Exports the groups to a master XML file for distribution
  *
  * @return	@e void		[Outputs to screen]
  */
 public function masterXMLExport()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $entry = array();
     $skip = IPSLib::fetchNonDefaultGroupFields();
     //-----------------------------------------
     // Get xml class
     //-----------------------------------------
     require_once IPS_KERNEL_PATH . 'classXML.php';
     /*noLibHook*/
     $xml = new classXML(IPS_DOC_CHAR_SET);
     $xml->newXMLDocument();
     $xml->addElement('export');
     $xml->addElement('group', 'export');
     //-----------------------------------------
     // Grab our default 6 groups
     //-----------------------------------------
     $this->DB->build(array('select' => '*', 'from' => 'groups', 'order' => 'g_id ASC', 'limit' => array(0, 6)));
     $this->DB->execute();
     while ($r = $this->DB->fetch()) {
         $content = array();
         $r['g_icon'] = '';
         if (is_array($skip) and count($skip)) {
             foreach ($skip as $_kk) {
                 unset($r[$_kk]);
             }
         }
         $xml->addElementAsRecord('group', 'row', $r);
     }
     //-----------------------------------------
     // Print to browser
     //-----------------------------------------
     $this->registry->output->showDownload($xml->fetchDocument(), 'groups.xml', '', 0);
 }
 /**
  * Exports the groups to a master XML file for distribution
  *
  * @access	public
  * @return	void		[Outputs to screen]
  */
 public function masterXMLExport()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $entry = array();
     $skip = IPSLib::fetchNonDefaultGroupFields();
     //-----------------------------------------
     // Get XML class
     //-----------------------------------------
     require_once IPS_KERNEL_PATH . 'class_xml.php';
     $xml = new class_xml();
     $xml->doc_type = IPS_DOC_CHAR_SET;
     $xml->xml_set_root('export', array('exported' => time()));
     //-----------------------------------------
     // Set group
     //-----------------------------------------
     $xml->xml_add_group('group');
     //-----------------------------------------
     // Grab our default 6 groups
     //-----------------------------------------
     $this->DB->build(array('select' => '*', 'from' => 'groups', 'order' => 'g_id ASC', 'limit' => array(0, 6)));
     $this->DB->execute();
     while ($r = $this->DB->fetch()) {
         $content = array();
         $r['g_icon'] = '';
         //-----------------------------------------
         // Sort the fields...
         //-----------------------------------------
         foreach ($r as $k => $v) {
             if (!in_array($k, $skip)) {
                 $content[] = $xml->xml_build_simple_tag($k, $v);
             }
         }
         $entry[] = $xml->xml_build_entry('row', $content);
     }
     $xml->xml_add_entry_to_group('group', $entry);
     $xml->xml_format_document();
     //-----------------------------------------
     // Print to browser
     //-----------------------------------------
     $this->registry->output->showDownload($xml->xml_document, 'groups.xml', '', 0);
 }