Add files via upload
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"elements":
|
||||
[
|
||||
{ "type": "SelectCategory", "name": "PropertyCategoryID", "caption": "Target" }
|
||||
],
|
||||
"actions":
|
||||
[
|
||||
|
||||
{ "type": "Button", "label": "Rename", "onClick": "VTRN_rename($id);" }
|
||||
],
|
||||
"status":
|
||||
[
|
||||
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"id": "{97873A1E-70E1-9AB9-0CA1-812C762E68FC}",
|
||||
"name": "Renamer",
|
||||
"type": 3,
|
||||
"vendor": "J.H. Artworks",
|
||||
"aliases":
|
||||
[
|
||||
],
|
||||
"url": "https://jh-artworks.com",
|
||||
"parentRequirements": [],
|
||||
"childRequirements": [],
|
||||
"implemented": [],
|
||||
"prefix": "VTRN"
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?
|
||||
// Klassendefinition
|
||||
class Renamer extends IPSModule {
|
||||
// Überschreibt die interne IPS_Create($id) Funktion
|
||||
public function Create() {
|
||||
// Diese Zeile nicht löschen.
|
||||
parent::Create();
|
||||
|
||||
$this->RegisterPropertyInteger("PropertyCategoryID",0);
|
||||
}
|
||||
|
||||
// Überschreibt die intere IPS_ApplyChanges($id) Funktion
|
||||
public function ApplyChanges() {
|
||||
// Diese Zeile nicht löschen
|
||||
parent::ApplyChanges();
|
||||
}
|
||||
/**
|
||||
* Die folgenden Funktionen stehen automatisch zur Verfügung, wenn das Modul über die "Module Control" eingefügt wurden.
|
||||
* Die Funktionen werden, mit dem selbst eingerichteten Prefix, in PHP und JSON-RPC wiefolgt zur Verfügung gestellt:
|
||||
*
|
||||
*
|
||||
*/
|
||||
public function rename() {
|
||||
|
||||
$idKat = $this->ReadPropertyInteger("PropertyCategoryID");
|
||||
$katChilds = IPS_GetChildrenIDs($idKat);
|
||||
|
||||
foreach ($katChilds as $katChild) {
|
||||
$chilid = IPS_GetChildrenIDs($katChild)[0];
|
||||
$parentname = IPS_GetName($katChild);
|
||||
$childname = $parentname;
|
||||
IPS_SetName($chilid,$childname);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user