示例#1
0
function ExportXML()
{
    // XML
    $xml = new DomDocument('1.0', 'UTF-8');
    $root = $xml->createElement('Categories');
    $root = $xml->appendChild($root);
    $categories = NULL;
    if (View::newInstance()->_exists('categories')) {
        $categories = View::newInstance()->_get('categories');
    } else {
        $categories = osc_get_categories();
    }
    global $SubCategory_Array;
    foreach ($categories as $c) {
        $Category = $xml->createElement('Category');
        $Category = $root->appendChild($Category);
        $Name = $xml->createElement('Name', $c['s_name']);
        $Name = $Category->appendChild($Name);
        if (isset($c['categories']) && is_array($c['categories'])) {
            CreateCategory($c['categories'], $xml, $Category);
        }
    }
    $xml->formatOutput = true;
    $xml->saveXML();
    $xml->save('outCategory.xml');
    global $message;
    $message = "Successful Category export. '/oc-admin/outCategory.xml'";
}
示例#2
0
 $scriptResult .= "<td style='text-align:center'>" . $client->ip . "</td>";
 // Accesspoints übersetzen
 $apName = "";
 foreach ($apList as $ap) {
     if ($ap["MAC"] == $client->ap_mac) {
         $apName = $ap["Name"];
         break;
     }
 }
 // War nicht in Liste!
 if ($apName == "") {
     $apName = $client->ap_mac;
 }
 $ident = str_replace(":", "", $client->mac);
 $rootCatID = CreateCategory("Clients", "Clients", $parentID);
 $catID = CreateCategory($clientName, $ident . "_name", $rootCatID);
 CreateVariable("MAC", 3, $client->mac, $ident . "_mac", $catID);
 CreateVariable("IP", 3, $client->ip, $ident . "_ip", $catID);
 CreateVariable("AP Name", 3, $apName, $ident . "_apname", $catID);
 CreateVariable("Signal", 1, $client->signal, $ident . "_signal", $catID);
 CreateVariable("Radio", 3, $client->radio, $ident . "_radio", $catID);
 CreateVariable("TX Bytes", 1, $client->tx_bytes, $ident . "_txbytes", $catID);
 CreateVariable("RX Bytes", 1, $client->rx_bytes, $ident . "_rxbytes", $catID);
 CreateVariable("Uptime", 1, $client->uptime, $ident . "_uptime", $catID);
 $scriptResult .= "<td style='text-align:center'>{$apName}</td>";
 $scriptResult .= "<td style='text-align:center'>" . $client->essid . "</td>";
 $scriptResult .= "<td style='text-align:center'><div style='width:100%;height:20px;overflow:hidden;'>";
 // Pegelumwandlung - Entspricht leider nicht dem Wert in der Webconsole. Kein Plan wie die das berechnen
 /* 100% -35 / 50% -65 / 1% -95 */
 if ($client->signal <= -95) {
     $percent = 1;
	$AstronomicBegLim  = CreateVariable("AstronomicBeginLimited", 3 /*String*/,  $categoryId_DataValues,  430, '~String', $scriptId_Refresh, '');
	$AstronomicEndLim  = CreateVariable("AstronomicEndLimited",   3 /*String*/,  $categoryId_DataValues,  440, '~String', $scriptId_Refresh, '');
	$AstronomicDisplay = CreateVariable("AstronomicDisplay",      3 /*String*/,  $categoryId_DataValues,  450, '~String', null,              '00:00 - 00:00');
	$AstronomicLimits  = CreateVariable("AstronomicLimits",       3 /*String*/,  $categoryId_DataValues,  460, '~String', $scriptId_Refresh, '04:00-06:00/20:00-22:00');

	IPSUtils_Include ("IPSTwilight.ips.php", "IPSLibrary::app::modules::Weather::IPSTwilight");

	// ----------------------------------------------------------------------------------------------------------------------------
	// WebFront Installation
	// ----------------------------------------------------------------------------------------------------------------------------
	if ($WFC10_Enabled) {
		$categoryId_WebFront         = CreateCategoryPath($WFC10_Path);
		$categoryId_WebFrontTopLeft  = CreateCategory(  'TopLeft',  $categoryId_WebFront, 10);
		$categoryId_WebFrontTopRight = CreateCategory(  'TopRight', $categoryId_WebFront, 20);
		$categoryId_WebFrontBottom   = CreateCategory(  'Bottom',   $categoryId_WebFront, 30);
		$categoryId_WebFrontRight    = CreateCategory(  'Right',    $categoryId_WebFront, 40);

		CreateLinkByDestination('Sonnen-Aufgang/Untergang', $SunriseDisplay,    $categoryId_WebFrontTopLeft,  10);
		CreateLinkByDestination('Limits',                   $SunriseLimits,     $categoryId_WebFrontTopRight, 10);
		CreateLinkByDestination('Zivile Dämmerung',         $CivilDisplay,      $categoryId_WebFrontTopLeft,  20);
		CreateLinkByDestination('Limits',                   $CivilLimits,       $categoryId_WebFrontTopRight, 20);
		CreateLinkByDestination('Nautische Dämmerung',      $NauticDisplay,     $categoryId_WebFrontTopLeft,  30);
		CreateLinkByDestination('Limits',                   $NauticLimits,      $categoryId_WebFrontTopRight, 30);
		CreateLinkByDestination('Astronomische Dämmerung',  $AstronomicDisplay, $categoryId_WebFrontTopLeft,  40);
		CreateLinkByDestination('Limits',                   $AstronomicLimits,  $categoryId_WebFrontTopRight, 40);

		CreateLinkByDestination("Tag- und Nachtstunden in $Location",  $YearMediaId,      $categoryId_WebFrontBottom, 10);
		CreateLinkByDestination('Show Limited',                        $DisplaySwitchId,  $categoryId_WebFrontRight,  10);
		CreateLinkByDestination('Aktueller Tag',                       $DayMediaId,       $categoryId_WebFrontRight,  20);

		$UId = date('Hi');
示例#4
0
<?php

include_once "../modules/KH_UniFi/UniFi/orga.php";
$parentID = IPS_GetParent($_IPS["SELF"]);
$wlanList = UniFi_GetWLANConfig($parentID);
$setWLANID = IPS_GetScriptIDByName("setWLAN", $parentID);
foreach ($wlanList->data as $wlan) {
    $ident = $wlan->_id;
    $rootCatID = CreateCategory("WLAN", "WLAN", $parentID);
    $catID = CreateCategory($wlan->name, $ident, $rootCatID);
    CreateVariable("ID", 3, $wlan->_id, $ident . "_id", $catID);
    CreateVariable("Enabled", 0, $wlan->enabled, $ident . "_enabled", $catID);
    $enabledID = IPS_GetVariableIDByName("Enabled", $catID);
    IPS_SetVariableCustomAction($enabledID, $setWLANID);
    IPS_SetVariableCustomProfile($enabledID, "~Switch");
    CreateVariable("Security", 3, $wlan->security, $ident . "_security", $catID);
}
	SetVariableConstant ("c_ID_ProwlOutPriority",   $ID_ProwlOutPriority, 'IPSLogger_IDs.inc.php', 'IPSLibrary::app::core::IPSLogger');

	// ----------------------------------------------------------------------------------------------------------------------------
	// Webfront Installation
	// ----------------------------------------------------------------------------------------------------------------------------
	if ($WFC10_Enabled) {
		$ID_CategoryWebFront         = CreateCategoryPath($WFC10_Path);
		$ID_CategoryOutput           = CreateCategory('Output',    $ID_CategoryWebFront, 10);
		$ID_CategorySettings         = CreateCategory('Settings',  $ID_CategoryWebFront, 20);
		$ID_CategorySettingsWidget   = CreateCategory(  'Widget',  $ID_CategorySettings, 200);
		$ID_CategorySettingsWebFront = CreateCategory(  'WebFront',$ID_CategorySettings, 300);
		$ID_CategorySettingsIPS      = CreateCategory(  'IPS',     $ID_CategorySettings, 400);
		$ID_CategorySettingsFile     = CreateCategory(  'File',    $ID_CategorySettings, 500);
		$ID_CategorySettingsLog4IPS  = CreateCategory(  'Log4IPS', $ID_CategorySettings, 600);
		$ID_CategorySettingsEMail    = CreateCategory(  'EMail',   $ID_CategorySettings, 700);
		$ID_CategorySettingsProwl    = CreateCategory(  'Prowl',   $ID_CategorySettings, 800);

		$UniqueId = date('Hi');
		DeleteWFCItems($WFC10_ConfigId, 'SystemTP_LogWindow');
		DeleteWFCItems($WFC10_ConfigId, 'SystemTP_LogSettings');
		DeleteWFCItems($WFC10_ConfigId, $WFC10_TabPaneItem.$WFC10_TabItem1);
		DeleteWFCItems($WFC10_ConfigId, $WFC10_TabPaneItem.$WFC10_TabItem2);
		CreateWFCItemTabPane   ($WFC10_ConfigId, $WFC10_TabPaneItem,  $WFC10_TabPaneParent, $WFC10_TabPaneOrder, $WFC10_TabPaneName, $WFC10_TabPaneIcon);
		CreateWFCItemCategory  ($WFC10_ConfigId, $WFC10_TabPaneItem.$WFC10_TabItem1.$UniqueId, $WFC10_TabPaneItem, $WFC10_TabOrder1, $WFC10_TabName1, $WFC10_TabIcon1, $ID_CategoryOutput /*BaseId*/, 'false' /*BarBottomVisible*/);
		CreateWFCItemCategory  ($WFC10_ConfigId, $WFC10_TabPaneItem.$WFC10_TabItem2.$UniqueId, $WFC10_TabPaneItem, $WFC10_TabOrder2, $WFC10_TabName2, $WFC10_TabIcon2, $ID_CategorySettings /*BaseId*/, 'true' /*BarBottomVisible*/);

		CreateLink('Logging Window',   $ID_HtmlOutMsgList,    $ID_CategoryOutput, 10);

		// Output Overview
		CreateLink('Output Widget',    $ID_SingleOutEnabled,  $ID_CategorySettings, 10);
		CreateLink('Output WebFront',  $ID_HtmlOutEnabled,    $ID_CategorySettings, 20);
	
	// ----------------------------------------------------------------------------------------------------------------------------
	// Mobile Definition
	// ----------------------------------------------------------------------------------------------------------------------------
	if ($Mobile_Enabled) {
		$mobileId  = CreateCategoryPath($Mobile_Path, $Mobile_PathOrder, $Mobile_PathIcon);
		$Idx               = 10;
		foreach ($WaterConfig as $CircleId=>$CircleData) {
			$CirclyId   = get_WateringCirclyId($CircleId, $CategoryIdCircles);
			$CircleName = $CircleData[c_Property_Name];

		   // iPhone Overview
			CreateLink($CircleName,  get_WateringControlId(c_Control_Active,     $CirclyId),  $mobileId,      $Idx);

			// Detailed CirclyData
			$WebFrontiPhoneDetailId  = CreateCategory($CircleName, $mobileId, $Idx*10);
			$iPhoneControl = CreateDummyInstance("Steuerung", $WebFrontiPhoneDetailId, 10);
			CreateLink('Status',             get_WateringControlId(c_Control_Active,     $CirclyId),  $iPhoneControl, 10);
			CreateLink('Automatik',          get_WateringControlId(c_Control_Automatic,  $CirclyId),  $iPhoneControl, 20);

			$iPhoneProgram = CreateDummyInstance("Programm", $WebFrontiPhoneDetailId, 20);
			CreateLink('Programm',           get_WateringControlId(c_Control_Program,    $CirclyId),  $iPhoneProgram, 30);
			CreateLink('Sensor',             get_WateringControlId(c_Control_Sensor,     $CirclyId),  $iPhoneProgram, 35);
			CreateLink('Beregnungs Dauer',   get_WateringControlId(c_Control_Duration,   $CirclyId),  $iPhoneProgram, 40);
			CreateLink('Start Zeit',         get_WateringControlId(c_Control_StartTime,  $CirclyId),  $iPhoneProgram, 50);

			$iPhoneInfos = CreateDummyInstance("Infos", $WebFrontiPhoneDetailId, 30);
			CreateLink('Nächste Dauer',      get_WateringControlId(c_Control_ToBeDone,   $CirclyId),  $iPhoneInfos, 60);
			CreateLink('Nächste Beregnung',  get_WateringControlId(c_Control_NextDisplay,$CirclyId),  $iPhoneInfos, 70);
			CreateLink('Nächstes Datum',     get_WateringControlId(c_Control_NextDate,   $CirclyId),  $iPhoneInfos, 80);
			CreateLink('Letztes Datum',      get_WateringControlId(c_Control_LastDate,   $CirclyId),  $iPhoneInfos, 90);