Пример #1
0
 public function getHTML($id, $page)
 {
     $this->addAssocV3("DateiClassID", "=", $this->classID);
     $this->addAssocV3("DateiClass", "=", $this->className);
     $this->lCV3($id);
     $gui = new HTMLGUI();
     $gui->setName("Dateien");
     $gui->setAttributes($this->collector);
     $gui->setCollectionOf($this->collectionOf);
     $gui->setShowAttributes(array("DateiName"));
     $gui->setParser("DateiName", "mDateiGUI::nameParser", array("\$DateiPath", "\$DateiIsDir", "\$DateiSize"));
     $gui->setIsDisplayMode(true);
     if (!$this->viewOnly) {
         $gui->setDeleteInDisplayMode(true);
     }
     $t = new HTMLTable(1);
     if ($this->classID != null and !$this->viewOnly) {
         $B = new Button("Datei\nhinzufügen", "computer");
         $B->select(true, "mFile", $this->onAddClass != null ? $this->onAddClass : "'+lastLoadedLeftPlugin+'", $this->classID, "addFile");
         $B->customSelect("contentRight", $this->classID, "mFile", "{$this->onAddClass}.addFile");
         $t->addRow($B);
         #$t->addRow(array("<input onclick=\"loadFrameV2('contentRight','mFile','mFileGUI;selectionMode:multiSelection,".($this->onAddClass != null ? $this->onAddClass : "'+lastLoadedLeftPlugin+'").",$this->classID,addFile,'+lastLoadedRightPlugin+',".($this->onReloadFrame != null ? $this->onReloadFrame : "contentLeft").",".($this->onReloadClass != null ? $this->onReloadClass : "'+lastLoadedLeftPlugin+'").",".($this->onReloadID != null ? $this->onReloadID : $this->classID)."');\" type=\"button\" class=\"backgroundColor3 bigButton\" style=\"background-image:url(./images/navi/computer.png);\" value=\"Datei\nhinzufügen\" />"));
     }
     $gui->setJSEvent("onDelete", $this->onDeleteFunction == null ? "function() { contentManager.reloadFrame('contentLeft'); }" : $this->onDeleteFunction);
     try {
         if ($this->viewOnly and $this->numLoaded() == 0) {
             return "";
         }
         return $t->getHTML() . $gui->getBrowserHTML($id);
     } catch (Exception $e) {
     }
 }
Пример #2
0
 function getHTML($id)
 {
     $this->loadMeOrEmpty();
     $gui = new HTMLGUI();
     $gui->setObject($this);
     $gui->setName("Preset");
     $gui->selectWithCollection("FhemPresetServerID", new mFhemServerGUI(), "FhemServerName");
     $gui->setLabel("FhemPresetServerID", "Server");
     $gui->setLabel("FhemPresetName", "Name");
     $gui->setType("FhemPresetHide", "checkbox");
     $gui->setLabel("FhemPresetHide", "Hide?");
     $gui->setType("FhemPresetNightOnly", "checkbox");
     $gui->setLabel("FhemPresetNightOnly", "Night only?");
     $gui->setLabel("FhemPresetLocationID", "Location");
     $gui->setLabel("FhemPresetRunOn", "run on");
     $gui->settype("FhemPresetLocationID", "select");
     $gui->selectWithCollection("FhemPresetLocationID", new mFhemLocationGUI(), "FhemLocationName");
     $gui->setFieldDescription("FhemPresetRunOn", "The event that triggers this Preset. For example HomeStatus:here will trigger this Preset when the dummy 'HomeStatus' is set to 'here'. The Preset will create its own dummy if this field is empty.");
     $gui->setStandardSaveButton($this, "mFhemPreset");
     #$gui->setIsDisplayMode(true);
     #$gui->setShowAttributes(array("name"));
     $gui->setShowAttributes(array("FhemPresetServerID", "FhemPresetLocationID", "FhemPresetName", "FhemPresetRunOn", "FhemPresetHide", "FhemPresetNightOnly"));
     $desc = new HTMLTable(1);
     $desc->addRow("For the \"Night only\"-option to work correctly you might want to set <code>{sunrise_coord(\"10.873799\",\"48.699495\",\"Europe/Berlin\")}</code> in the <code>fhem.cfg</code>-file. With your own coordinates/timezone of course.");
     if ($id == -1) {
         return $gui->getEditHTML() . $desc;
     }
     $_SESSION["BPS"]->registerClass("mFhemSelection");
     $_SESSION["BPS"]->setACProperty("selectionServerID", $this->A->FhemPresetServerID);
     $B = new Button("add Device", "./fheME/Fhem/fhem.png");
     $B->select("false", "mFhem", "FhemPreset", $this->ID, "addDevice");
     $BW = new Button("add custom", "backup");
     $BW->rmePCR("FhemPreset", $this->ID, "addWait", "", "contentManager.reloadFrame('contentLeft');");
     $BW->style("float:right;");
     $t = new HTMLTable(1);
     $t->addRow($BW . $B);
     $_SESSION["CurrentAppPlugins"]->addClass("Presets", "mFhemPreset");
     $mFE = new mFhemEventGUI();
     $mFE->addJoinV3("Fhem", "FhemEventFhemID", "=", "FhemID");
     $mFE->addAssocV3("FhemEventPresetID", "=", $this->ID);
     return $gui->getEditHTML() . $desc . "<div style=\"height:30px;\"></div>" . $t . $mFE->getHTML(-1) . "<div style=\"height:30px;\"></div>";
 }
Пример #3
0
 public function getHTML($id, $page)
 {
     if (!$this->singleOwner) {
         $this->addAssocV3($this->collectionOf . "OwnerClass", "=", $this->ownerClassName, $this->SelectionJoin);
         $this->addAssocV3($this->collectionOf . "OwnerClassID", "=", $this->ownerClassID);
     } else {
         $this->addAssocV3($this->collectionOf . $this->ownerClassName . "ID", "=", $this->ownerClassID);
     }
     $gui = $this->GUI;
     try {
         $this->lCV3($id);
     } catch (FieldDoesNotExistException $e) {
         return "<p>" . $e->getErrorMessage() . "</p>";
     }
     if ($this->showAttributes != null) {
         $gui->attributes($this->showAttributes);
     }
     $gui->name($this->name);
     $gui->object($this);
     if ($this->displayMode == null) {
         if ($this->ownerClassID > 0) {
             $gui->addToEvent("onDelete", "contentManager.reloadFrame('contentLeft');");
         } else {
             $gui->addToEvent("onDelete", "contentManager.rmePCR('m{$this->collectionOf}', '-1', 'getContent', ['{$this->ownerClassName}', '{$this->ownerClassID}'], '\$(\\'propertym{$this->collectionOf}\\').update(transport.responseText);');");
         }
     } else {
         $gui->displayMode($this->displayMode);
     }
     if ($this->buttonLabel instanceof Button) {
         $B = $this->buttonLabel;
     } else {
         $B = new Button($this->buttonLabel, $this->buttonIcon == null ? "new" : $this->buttonIcon);
         if ($this->buttonOnclick == null) {
             $B->select(false, "m" . $this->targetClassName, $this->ownerClassName, $this->ownerClassID, "add" . $this->targetClassName);
         } else {
             $B->onclick($this->buttonOnclick);
         }
     }
     if (!$this->singleEntry or $this->numLoaded() == 0) {
         $gui->addTopButton($B);
     }
     if ($this->allowEdit) {
         $gui->activateFeature("editInPopup", $this, "{remember:true}");
     }
     $gui->options($this->allowDelete, $this->allowEdit, false, false);
     return $gui->getBrowserHTML($id);
 }