当前位置: 首页>>代码示例>>PHP>>正文


PHP IPS_SetParent函数代码示例

本文整理汇总了PHP中IPS_SetParent函数的典型用法代码示例。如果您正苦于以下问题:PHP IPS_SetParent函数的具体用法?PHP IPS_SetParent怎么用?PHP IPS_SetParent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了IPS_SetParent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: RefreshLinks

 private function RefreshLinks()
 {
     if ($this->ReadPropertyInteger("LinkSource") == 0) {
         foreach (IPS_GetChildrenIDs($this->InstanceID) as $Child) {
             if (IPS_GetObject($Child)['ObjectType'] == 6) {
                 IPS_DeleteLink($Child);
             }
         }
         return;
     }
     $present = array();
     foreach (IPS_GetChildrenIDs($this->InstanceID) as $Child) {
         if (IPS_GetObject($Child)['ObjectType'] == 6) {
             $present[] = IPS_GetLink($Child)['TargetID'];
         }
     }
     $create = array_diff(IPS_GetChildrenIDs($this->ReadPropertyInteger("LinkSource")), $present);
     foreach ($create as $Target) {
         if (IPS_GetObject($Target)["ObjectIsHidden"]) {
             continue;
         }
         $Link = IPS_CreateLink();
         IPS_SetParent($Link, $this->InstanceID);
         IPS_SetName($Link, IPS_GetName($Target));
         IPS_SetLinkTargetID($Link, $Target);
     }
 }
开发者ID:Nall-chan,项目名称:IPSDynamicVisuControl,代码行数:27,代码来源:LinkHideOrLinkDisableBaseControl.php

示例2: createGroupWithID

 public function createGroupWithID($name, $id, $parentID)
 {
     $group = @IPS_GetObjectIDByIdent($id, $parentID);
     if (!$group) {
         $group = IPS_CreateCategory();
         IPS_SetName($group, $name);
         IPS_SetParent($group, $parentID);
         IPS_SetIdent($group, $id);
         $variable = IPS_CreateVariable(0);
         IPS_SetParent($variable, $group);
         IPS_SetName($variable, "Turn on");
         IPS_SetIdent($variable, "state_" . $id);
         SetValue($variable, true);
         $variable = IPS_CreateVariable(1);
         IPS_SetParent($variable, $group);
         IPS_SetName($variable, "Delay");
         IPS_SetIdent($variable, "delay_" . $id);
         SetValue($variable, 3600);
         $childs = IPS_CreateCategory();
         IPS_SetName($childs, "Links");
         IPS_SetParent($childs, $group);
         IPS_SetIdent($childs, "childs_" . $id);
     }
     return $group;
 }
开发者ID:mcbeyel,项目名称:IPSAbsence,代码行数:25,代码来源:module.php

示例3: CreateVariable

function CreateVariable($Name, $Type, $Value, $Ident = '', $ParentID = 0)
{
    echo "CreateVariable: ( {$Name}, {$Type}, {$Value}, {$Ident}, {$ParentID} ) \n";
    if ('' != $Ident) {
        $VarID = @IPS_GetObjectIDByIdent($Ident, $ParentID);
        if (false !== $VarID) {
            SetVariable($VarID, $Type, $Value);
            return;
        }
    }
    $VarID = @IPS_GetObjectIDByName($Name, $ParentID);
    if (false !== $VarID) {
        $Obj = IPS_GetObject($VarID);
        if (2 == $Obj['ObjectType']) {
            $Var = IPS_GetVariable($VarID);
            if ($Type == $Var['VariableValue']['ValueType']) {
                SetVariable($VarID, $Type, $Value);
                return;
            }
        }
    }
    $VarID = IPS_CreateVariable($Type);
    IPS_SetParent($VarID, $ParentID);
    IPS_SetName($VarID, $Name);
    if ('' != $Ident) {
        IPS_SetIdent($VarID, $Ident);
    }
    SetVariable($VarID, $Type, $Value);
}
开发者ID:Spoosie,项目名称:KH_UniFi,代码行数:29,代码来源:orga.php

示例4: __construct

		/**
		 * @public
		 *
		 * Initialisierung eines IPSComponentShutter_FS20 Objektes
		 *
		 * @param integer $instanceId InstanceId des FS20 Devices
		 */
		public function __construct($instanceId) {
			$this->instanceId = IPSUtil_ObjectIDByPath($instanceId);
			$this->isRunningId  = @IPS_GetObjectIDByIdent('isrunning', $this->instanceId);
			if($this->isRunningId===false) {
				$this->isRunningId = IPS_CreateVariable(0);
				IPS_SetParent($this->isRunningId, $this->instanceId);
				IPS_SetName($this->isRunningId, 'IsRunning');
				IPS_SetIdent($this->isRunningId, 'isrunning');
				IPS_SetInfo($this->isRunningId, "This Variable was created by Script IPSComponentShutter_FS20");
			}
		}
开发者ID:KOS-CH,项目名称:IPSLibrary,代码行数:18,代码来源:IPSComponentShutter_FS20.class.php

示例5: CheckVariable

function CheckVariable($name, $vartyp, $profile, $parentID)
{
    $InstanzID = @IPS_GetVariableIDByName($name, $parentID);
    if ($InstanzID === false) {
        $InstanzID = IPS_CreateVariable($vartyp);
        IPS_SetName($InstanzID, $name);
        // Instanz benennen
        IPS_SetParent($InstanzID, $parentID);
        IPS_SetVariableCustomProfile($InstanzID, $profile);
    }
    //echo "ID: ".$InstanzID." ".$name."\n";
    return $InstanzID;
}
开发者ID:hermanthegerman2,项目名称:EHzSymcon,代码行数:13,代码来源:sml.php

示例6: Migrate_Structure

	function Migrate_Structure($module, $oldPath, $newPath, $filePath) {
		$oldCategoryId = @get_ObjectIDByPath($oldPath, true);
		if ($oldCategoryId==null) {
			echo "$oldPath not found ...\n";
			return;
		}
		// Download new Module Scripts
		$moduleManager = new IPSModuleManager($module);
		//$moduleManager->DeployModule();
		$moduleManager->LoadModule();

		// Migrate existing Structure
		CreateCategoryPath($newPath);
		$newCategoryPath = str_replace('.app.', '.data.', $newPath);
		$newCategoryId   = CreateCategoryPath($newCategoryPath);
		foreach (IPS_GetChildrenIDs($oldCategoryId) as $idx=>$childId) {
			$object = IPS_GetObject($childId);
			switch($object['ObjectType']) {
				case 0: // Category
				case 1: // Instance
					echo "Migrate Category=$childId, Name=".IPS_GetName($childId)."\n";
					Migrate_Category($childId, $filePath);
					IPS_SetParent($childId, $newCategoryId);
					break;
				case 2: // Variable
					echo "Migrate Variable=$childId, Name=".IPS_GetName($childId)."\n";
					IPS_SetParent($childId, $newCategoryId);
					break;
				case 3: // Script
					Delete_Script($childId, $filePath);
					break;
				default:
					echo "Unknown Object=$childId, Name=".IPS_GetName($childId)."\n";
			}
			echo "Move $childId from $oldCategoryId to $newCategoryId ($newCategoryPath)\n";
		}
		if (!IPS_DeleteCategory($oldCategoryId)) {
			echo "Error deleting old Category ".IPS_GetName($oldCategoryId)."\n";
			exit;
		}
		echo '-------------------------------------------------------------------------------------------------------------'.PHP_EOL;
		echo '---- Bestehende Variablen von Modul '.$module.' wurden in die neue Strukture migriert'.PHP_EOL;
		echo '----'.PHP_EOL;
		echo '---- Anpassung der Konfiguration und erneute Installation muss manuell gemacht werden !!!'.PHP_EOL;
		echo '---- ACHTUNG: Pfad für WebFront und Mobile Installation haben sich geändert (liegt jetzt unter "Visualization.WebFront"'.PHP_EOL;
		echo '----          bzw. "Visualization.Mobile". Pfad im Init File (/IPSLibrary/install/InitializationFiles/<<Module>>.ini'.PHP_EOL;
		echo '----          anpassen oder Links manuell verschieben.'.PHP_EOL;
		echo '----          Im Zweifel einfach die bestehenden Strukture des jeweiligen Modules löschen, und eine erneute Installation'.PHP_EOL;
		echo '----          Installation ausführen.'.PHP_EOL;
		echo '-------------------------------------------------------------------------------------------------------------'.PHP_EOL;
	}
开发者ID:KOS-CH,项目名称:IPSLibrary,代码行数:51,代码来源:IPSLibrary_Migration.ips.php

示例7: CreateVariableByIdent

 private function CreateVariableByIdent($id, $ident, $name, $type, $profile = "")
 {
     $vid = @IPS_GetObjectIDByIdent($ident, $id);
     if ($vid === false) {
         $vid = IPS_CreateVariable($type);
         IPS_SetParent($vid, $id);
         IPS_SetName($vid, $name);
         IPS_SetIdent($vid, $ident);
         if ($profile != "") {
             IPS_SetVariableCustomProfile($vid, $profile);
         }
     }
     return $vid;
 }
开发者ID:Seb0815,项目名称:ips4Windows,代码行数:14,代码来源:module.php

示例8: __construct

 /**
  * constructor
  *
  * @throws Exception if $type is not valid
  * @access public
  */
 public function __construct($parentId, $name, $content, $debug = false)
 {
     $this->parentId = $parentId;
     $this->name = $name;
     $this->content = $content;
     $this->debug = $debug;
     $this->id = @IPS_GetScriptIDByName($this->name, $this->parentId);
     //check if event does already exist
     if ($this->id == false) {
         if ($this->debug) {
             echo "INFO - create IPS script {$name}\n";
         }
         $this->id = IPS_CreateScript(0);
         IPS_SetName($this->id, $this->name);
         IPS_SetParent($this->id, $this->parentId);
         IPS_SetScriptContent($this->id, $this->content);
         IPS_SetInfo($this->id, "this script was created by script " . $_IPS['SELF'] . " which is part of the ips-library (https://github.com/florianprobst/ips-library)");
     }
 }
开发者ID:florianprobst,项目名称:ips-library,代码行数:25,代码来源:IPSScript.class.php

示例9: RegisterTimer

 protected function RegisterTimer($ident, $interval, $script) {
   $id = @IPS_GetObjectIDByIdent($ident, $this->InstanceID);
   if ($id && IPS_GetEvent($id)['EventType'] <> 1) {
     IPS_DeleteEvent($id);
     $id = 0;
   }
   if (!$id) {
     $id = IPS_CreateEvent(1);
     IPS_SetParent($id, $this->InstanceID);
     IPS_SetIdent($id, $ident);
   }
   IPS_SetName($id, $ident);
   IPS_SetHidden($id, true);
   IPS_SetEventScript($id, "\$id = \$_IPS['TARGET'];\n$script;");
   if (!IPS_EventExists($id)) throw new Exception("Ident with name $ident is used for wrong object type");
   if (!($interval > 0)) {
     IPS_SetEventCyclic($id, 0, 0, 0, 0, 1, 1);
     IPS_SetEventActive($id, false);
   } else {
     IPS_SetEventCyclic($id, 0, 0, 0, 0, 1, $interval);
     IPS_SetEventActive($id, true);
   }
 }
开发者ID:Vansdan,项目名称:IPSPhoenixILC,代码行数:23,代码来源:module.php

示例10: __construct

 /**
  * constructor
  *
  * @throws Exception if $type is not valid
  * @access public
  */
 public function __construct($parentId, $name, $cycle, $debug = false)
 {
     $this->parentId = $parentId;
     $this->name = $name;
     $this->cycle = $cycle;
     $this->debug = $debug;
     $this->id = @IPS_GetEventIDByName($this->name, $this->parentId);
     //check if event does already exist
     if ($this->id == false) {
         if ($this->debug) {
             echo "INFO - create IPS event {$name}\n";
         }
         $this->id = IPS_CreateEvent(1);
         //create trigger event and store id
         IPS_SetName($this->id, $this->name);
         //set event name
         IPS_SetParent($this->id, $this->parentId);
         //move event to parent (this will be called when trigger occurs)
         IPS_SetEventCyclic($this->id, 0, 1, 0, 0, 1, $cycle);
         //every $cycle seconds
         IPS_SetInfo($this->id, "this event was created by script " . $_IPS['SELF'] . " which is part of the ips-library (https://github.com/florianprobst/ips-library)");
         $this->activate();
     }
 }
开发者ID:florianprobst,项目名称:ips-library,代码行数:30,代码来源:IPSTimerEvent.class.php

示例11: IPSUtil_ObjectIDByPath

	function	IPSWatering_ActivateRefreshTimer($Value) {
		$Name    = 'Refresh';
		$scriptId_Timer = IPSUtil_ObjectIDByPath('Program.IPSLibrary.app.modules.IPSWatering.IPSWatering_RefreshTimer');
		$TimerId = @IPS_GetEventIDByName($Name, $scriptId_Timer);
		if ($TimerId === false) {
 			$TimerId = IPS_CreateEvent(1 /*Cyclic Event*/);
			IPS_SetName($TimerId, $Name);
			IPS_SetParent($TimerId, $scriptId_Timer);
			if (!IPS_SetEventCyclic($TimerId, 2 /*Daily*/, 1 /*Int*/,0 /*Days*/,0/*DayInt*/,1/*TimeType Sec*/,1/*Sec*/)) {
				IPSLogger_Err(__file__, "IPS_SetEventCyclic failed for Refresh Timer!!!");
				exit;
			}
		}

		if ($Value) {
			IPS_SetEventActive($TimerId, true);
		} else {
			$OneOrMoreCirclesActive = false;
			$categoryId_Circles = IPSUtil_ObjectIDByPath('Program.IPSLibrary.data.modules.IPSWatering.WaterCircles');
			$CircleIds          = IPS_GetChildrenIds($categoryId_Circles);
				foreach($CircleIds as $CircleId) {
				$OneOrMoreCirclesActive = ($OneOrMoreCirclesActive or GetValue(get_ControlId(c_Control_Active, $CircleId)));
			}
			if (!$OneOrMoreCirclesActive) {
				IPS_SetEventActive($TimerId, false);
			}
		}
	}
开发者ID:KOS-CH,项目名称:IPSLibrary,代码行数:28,代码来源:IPSWatering.inc.php

示例12: __construct2

 /**
  * constructor
  *
  * second constructor: create the variable in symcon if it does not exist
  *
  * @param string $name name of the variable
  * @param integer $type IPS datatype
  * @param integer $parent id of the variables parent, this defines where the variable will be created
  * @param mixed $value initially set a variable value
  * @param IPSVariableProfile $profile variable profile for this variable
  * @param boolean $enableLogging enables or disables the ips functionality to log variable changes in a database
  * @param integer $archiveId instance id of the archive control (usually located in IPS\core)
  * @param integer $aggregationType logging aggregation: 0 = gauge, 1 = counter
  * @param boolean $debug enables / disables debug information
  *
  * @throws Exception if the parameter \$profile is not an IPSVariableProfile datatype
  * @access public
  */
 private function __construct2($name, $type, $parent, $profile = NULL, $enableLogging = false, $archiveId = NULL, $aggregationType = 0, $debug = false)
 {
     if (isset($profile) && !$profile instanceof IPSVariableProfile) {
         throw new Exception("Parameter \$profile must be an instance of IPSVariableProfile! \$name of the variable is '{$name}'");
     }
     $this->name = $name;
     $this->type = $type;
     $this->parent = $parent;
     $this->profile = $profile;
     $this->enableLogging = $enableLogging;
     $this->archiveId = $archiveId;
     $this->aggregationType = $aggregationType;
     $this->debug = $debug;
     $this->id = @IPS_GetVariableIDByName($name, $parent);
     if ($this->id == false) {
         if ($this->debug) {
             echo "INFO - create IPS variable {$name}\n";
         }
         $this->id = IPS_CreateVariable($this->type);
         IPS_SetName($this->id, $name);
         IPS_SetParent($this->id, $parent);
         IPS_SetInfo($this->id, "this variable was created by script " . $_IPS['SELF'] . " which is part of the ips-library (https://github.com/florianprobst/ips-library)");
         if (isset($profile)) {
             IPS_SetVariableCustomProfile($this->id, $profile->getName());
         }
         $this->verifyVariableLogging();
     }
 }
开发者ID:florianprobst,项目名称:ips-library,代码行数:46,代码来源:IPSVariable.class.php

示例13: SetTimerByIdent_InSekunden

 protected function SetTimerByIdent_InSekunden($ident, $Sekunden)
 {
     $eid = @IPS_GetObjectIDByIdent($ident, $this->InstanceID);
     if ($eid === false) {
         $eid = IPS_CreateEvent(1);
         IPS_SetParent($eid, $this->InstanceID);
         IPS_SetName($eid, $ident);
         IPS_SetIdent($eid, $ident);
         IPS_SetEventScript($eid, 'HMON_Benachrichtigung($_IPS[\'TARGET\'], false, true);');
         IPS_SetInfo($eid, "this timer was created by script #" . $_IPS['SELF']);
     }
     if ($Sekunden === false) {
         IPS_SetEventActive($eid, false);
         return $eid;
     } else {
         IPS_SetEventCyclicTimeFrom($eid, intval(date("H", time() + $Sekunden)), intval(date("i", time() + $Sekunden)), intval(date("s", time() + $Sekunden)));
         IPS_SetEventActive($eid, true);
         return $eid;
     }
 }
开发者ID:BayaroX,项目名称:BY_HostMonitor,代码行数:20,代码来源:module.php

示例14: CreateEnergyDevice

 /**
  * Create a new EnergyDev instance and set its properties
  * @param array $data parsed record
  * @param String $caps String semicolon seperated capabilities of this device
  * @return int new Instance ID
  */
 private function CreateEnergyDevice($data, $caps)
 {
     $instID = 0;
     $Device = $data['Id'];
     $typ = $data['Typ'];
     $name = $data['Name'];
     $branch = $data['Branch'];
     unset($data['Branch']);
     if (!$name) {
         $name = "XS1 {$branch} {$Device}";
     }
     $class = __CLASS__ . "-EN";
     //$host = $this->GetHost();
     $ModuleID = $this->module_interfaces['EnergyDev'];
     if (IPS_ModuleExists($ModuleID)) {
         //return $result;
         $this->debug(__FUNCTION__, 'Device:' . $Device);
         $instID = IPS_CreateInstance($ModuleID);
         if ($instID > 0) {
             IPS_SetProperty($instID, 'DeviceID', $Device);
             IPS_SetProperty($instID, 'Class', $class);
             IPS_SetProperty($instID, 'Typ', $typ);
             IPS_SetProperty($instID, 'CapList', $caps);
             IPS_SetProperty($instID, 'Debug', $this->isDebug());
             //follow debug settings from splitter
             IPS_SetName($instID, "XS1 {$branch} '{$name}'");
             $ident = $class . "_" . $branch . "_{$Device}";
             $ident = preg_replace("/\\W/", "_", $ident);
             //nicht-Buchstaben/zahlen entfernen
             IPS_SetIdent($instID, $ident);
             IPS_ConnectInstance($instID, $this->InstanceID);
             IPS_ApplyChanges($instID);
             //set category
             $cat = $this->GetCategory() . " {$branch}" . "s";
             $pcat = $this->GetParentCategory();
             $ident = preg_replace("/\\W/", "_", $cat);
             //fix naming
             $catid = @IPS_GetObjectIDByIdent($ident, $pcat);
             if ($catid == 0) {
                 $catid = IPS_CreateCategory();
                 IPS_SetName($catid, $cat);
                 if (IPS_SetIdent($catid, $ident) && IPS_SetParent($catid, $pcat)) {
                     IPS_LogMessage($class, "Category {$cat} Ident {$ident} ({$catid}) created");
                 } else {
                     IPS_LogMessage($class, "Category {$cat} Ident {$ident} ({$catid}) FAILED");
                 }
             }
             $this->debug(__FUNCTION__, "Category:{$catid}");
             if (!IPS_SetParent($instID, $catid)) {
                 $this->debug(__FUNCTION__, "SetParent Instance {$instID} to Cat {$catid} failed, Dropping instance");
                 IPS_DeleteInstance($instID);
                 $instID = 0;
             } else {
                 $this->debug(__FUNCTION__, 'New ID:' . $instID);
             }
             //if instID
         } else {
             $this->debug(__FUNCTION__, 'Instance  is not created!');
         }
     }
     //module exists
     return $instID;
 }
开发者ID:Tommi2Day,项目名称:ipsymcon-phpmodule-by-Tommi,代码行数:69,代码来源:module.php

示例15: WriteCoil

 /**
  * ModBusMaster_WriteCoil
  * @param boolean $Value
  * @return boolean
  */
 public function WriteCoil($Value)
 {
     if ($this->ReadPropertyBoolean("ReadOnly")) {
         trigger_error("Address is marked as read-only!", E_USER_WARNING);
         return;
     }
     if ($this->ReadPropertyInteger("DataType") === 0) {
         $resultat = $this->SendDataToParent(json_encode(array("DataID" => "{A3419A88-C83B-49D7-8706-D3AFD596DFBB}", "FC" => "5", "Address" => $this->ReadPropertyInteger("Address"), "Data" => $Value)));
         if ($this->ReadPropertyInteger("SwitchDuration") > 0 and $Value) {
             $eid = @IPS_GetObjectIDByIdent("SwitchDuration", $this->InstanceID);
             if ($eid === false) {
                 $eid = 0;
             } else {
                 if (IPS_GetEvent($eid)['EventType'] != 1) {
                     IPS_DeleteEvent($eid);
                     $eid = 0;
                 }
             }
             if ($eid == 0) {
                 $eid = IPS_CreateEvent(1);
                 IPS_SetParent($eid, $this->InstanceID);
                 IPS_SetIdent($eid, "SwitchDuration");
                 IPS_SetName($eid, "SwitchDuration");
                 IPS_SetHidden($eid, true);
                 IPS_SetEventScript($eid, "ModBusMaster_WriteCoil(\$_IPS['TARGET'], false);IPS_SetEventActive(\$_IPS['EVENT'],false);");
             }
             IPS_SetEventCyclicTimeFrom($eid, date("H"), date("i"), date("s"));
             IPS_SetEventCyclic($eid, 0, 0, 0, 0, 1, $this->ReadPropertyInteger("SwitchDuration"));
             IPS_SetEventActive($eid, true);
         }
         return $resultat;
     } else {
         trigger_error("Invalid DataType!", E_USER_WARNING);
     }
 }
开发者ID:Charykun,项目名称:SymconModbusMaster,代码行数:40,代码来源:module.php


注:本文中的IPS_SetParent函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。