public function __toString() { $hiddenFields = ""; if ($this->cols == 2 or $this->cols == 1) { foreach ($this->fields as $k => $v) { if (isset($this->spaceLines[$v])) { $this->table->addRow(array("<hr />")); #$this->table->addRowStyle("font-weight:bold;"); #$this->table->addCellStyle(1, "padding-top:20px;"); $this->table->addRowColspan(1, 2); $this->table->addRowClass("FormSeparatorWithoutLabel"); } if (isset($this->spaces[$v]) and $this->spaces[$v] != "") { $this->table->addRow(array($this->spaces[$v])); #$this->table->addRowStyle("font-weight:bold;"); #$this->table->addCellStyle(1, "padding-top:20px;"); $this->table->addRowColspan(1, 2); $this->table->addRowClass("FormSeparatorWithLabel"); } if (isset($this->spaces[$v]) and $this->spaces[$v] == "") { $this->table->addRow(array("")); $this->table->addRowClass("backgroundColor0"); $this->table->addRowColspan(1, 2); $this->table->addRowClass("FormSeparatorWithoutLabel"); } $Input = $this->getInput($v); $B = $this->getCustomButton($v, $Input); if (is_object($Input) and $Input instanceof HTMLInput) { $InputS = $Input->__toString(); $this->callbacks .= $Input->getCallback(); } else { $InputS = $Input; } if (!isset($this->types[$v]) or $this->types[$v] != "hidden") { if ($this->cols == 2) { $this->table->addLV((isset($this->labels[$v]) ? $this->labels[$v] : ucfirst($v)) . ($this->printColon ? ":" : ""), $B . $InputS . (isset($this->descriptionField[$v]) ? "<br /><small style=\"color:grey;\">" . $this->descriptionField[$v] . "</small>" : "")); } if ($this->cols == 1) { $this->table->addRow("<label " . ($this->cols == 1 ? "style=\"width:100%;\"" : "") . ">" . (isset($this->labels[$v]) ? $this->labels[$v] : ucfirst($v)) . ":</label>"); $this->table->addRowClass("backgroundColor3"); $this->table->addRow($B . $InputS . (isset($this->descriptionField[$v]) ? "<br /><small style=\"color:grey;\">" . $this->descriptionField[$v] . "</small>" : "")); $this->table->addRowClass("backgroundColor0"); } if (isset($this->inputLineSyles[$v])) { $this->table->addRowStyle($this->inputLineSyles[$v]); } } else { $hiddenFields .= $InputS; } } } if ($this->cols == 4) { $row = array(); foreach ($this->fields as $k => $v) { $Input = $this->getInput($v); if (isset($this->types[$v]) and $this->types[$v] == "hidden") { $hiddenFields .= $Input; continue; } if (isset($this->spaces[$v])) { if ($this->spaces[$v] == "") { if (count($row) == 0) { $this->table->addRow(array("", "", "", "")); $this->table->addRowClass("backgroundColor0"); } if (count($row) == 2) { $row[] = ""; $row[] = ""; $this->table->addRow($row); $row = array(); $this->table->addRow(array("", "", "", "")); $this->table->addRowClass("backgroundColor0"); } } else { if (count($row) == 0) { $this->table->addRow(array($this->spaces[$v], "", "", "")); $this->table->addRowClass("backgroundColor0"); } if (count($row) == 2) { $row[] = ""; $row[] = ""; $this->table->addRow($row); $row = array(); $this->table->addRow(array($this->spaces[$v], "", "", "")); $this->table->addRowClass("backgroundColor0"); } } #$this->table->addRow($row); #$row = array(); } $B = $this->getCustomButton($v, $Input); $row[] = "<label>" . (isset($this->labels[$v]) ? $this->labels[$v] : ucfirst($v)) . ":</label>"; $row[] = $B . $Input . (isset($this->descriptionField[$v]) ? "<br /><small style=\"color:grey;\">" . $this->descriptionField[$v] . "</small>" : ""); /*if(!isset($this->types[$v]) OR $this->types[$v] != "hidden"){ $this->table->addLV( (isset($this->labels[$v]) ? $this->labels[$v] : ucfirst($v)).":", $B.$Input); if(isset($this->inputLineSyles[$v])) $this->table->addRowStyle($this->inputLineSyles[$v]); } else $hiddenFields .= $Input;*/ if (count($row) == 4) { $this->table->addRow($row); $row = array(); } } if (count($row) == 2) { $row[] = ""; $row[] = ""; $this->table->addRow($row); } } foreach ($this->endLV as $k => $v) { $this->table->addLV($v[0], $v[1]); } if ($this->saveMode != null) { switch ($this->saveMode) { case "custom": $this->table->addRow(array($this->saveButtonCustom)); $this->table->addRowColspan(1, $this->cols); break; case "class": $S = $this->saveButton(); $this->table->addRow(array($S)); $this->table->addRowColspan(1, $this->cols); break; case "multiCMS": $S = new HTMLInput("submitForm", "submit", $this->saveButtonLabel); if ($this->saveButtonBGIcon != "") { $S->style("background-image:url({$this->saveButtonBGIcon});background-position:98% 50%;background-repeat:no-repeat;"); } if ($this->saveButtonSubmit != null) { $S->onclick(str_replace("/*CALLBACKS*/", $this->callbacks, $this->saveButtonSubmit)); } $action = new HTMLInput("action", "hidden", $this->saveAction); $handler = new HTMLInput("HandlerName", "hidden", $this->saveClass); $return = new HTMLInput("returnP", "hidden", "/" . $_GET["permalink"]); if ($this->cols > 1) { $this->table->addRow(array("", $S . $action . $handler . $return)); } else { $this->table->addRow(array($S . $action . $handler . $return)); } break; case "rmeP": $S = new HTMLInput("submitForm", "button", $this->saveButtonLabel); if ($this->saveButtonBGIcon != "") { $S->style("background-image:url({$this->saveButtonBGIcon});background-position:98% 50%;background-repeat:no-repeat;"); } $S->onclick(($this->saveButtonConfirm != null ? "if(confirm('" . $this->saveButtonConfirm . "')) " : "") . $this->saveButtonSubmit); $S->setClass("submitFormButton borderColor1"); $C = ""; if ($this->abortButton != null) { $C = new HTMLInput("abortForm", "button", $this->abortButton[0]); if ($this->abortButton[2] != null) { $C->style("background-image:url({$this->abortButton[2]});background-position:98% 50%;background-repeat:no-repeat;"); } $C->onclick($this->abortButton[1]); $C->setClass("abortFormButton borderColor1"); } $this->table->addRow(array($S . $C)); $this->table->addRowColspan(1, 2); break; case "Bericht": $S = new HTMLInput("submitForm", "button", $this->saveButtonLabel); if ($this->saveButtonBGIcon != "") { $S->style("background-image:url({$this->saveButtonBGIcon});background-position:98% 50%;background-repeat:no-repeat;"); } $S->onclick($this->saveButtonOnclick); $this->table->addRow(array($S)); $this->table->addRowColspan(1, 2); break; } } $html = ""; if ($this->formTag) { $html .= "\n\t<form\n\t\tid=\"{$this->id}\"\n\t\t" . ($this->action != null ? "action=\"{$this->action}\"" : "") . "\n\t\t" . ($this->method != null ? "method=\"{$this->method}\"" : "") . "\n\t\t" . ($this->enctype != null ? "enctype=\"{$this->enctype}\"" : "") . "\n\t\t" . ($this->onSubmit != null ? "onsubmit=\"{$this->onSubmit}\"" : "") . "\n\t\t" . ($this->style != null ? "style=\"{$this->style}\"" : "") . ">"; } $html .= $this->table; $html .= $hiddenFields; if ($this->formTag) { $html .= "\n\t</form>"; } return $html . ($this->appendJs != "" ? OnEvent::script($this->appendJs) : "") . ($this->useRecentlyChanged ? GUIFactory::editFormOnchangeTest($this->id) : ""); }
function getEditHTML() { $this->object->loadMeOrEmpty(); if ($this->object->getID() == -1) { $this->addToEvent("onSave", "\$('contentLeft').update('');"); } $F = $this->getForm(); $requestFocus = ""; if ($this->requestFocus) { $requestFocus = OnEvent::script("setTimeout(function(){ var target1 = \$j('input[name=" . $this->requestFocus[0] . "]:visible, textarea[name=" . $this->requestFocus[0] . "]:visible'); if(target1.length > 0) target1.focus(); " . ($this->requestFocus[1] != null ? "else \$j('input[name=" . $this->requestFocus[1] . "]:visible, textarea[name=" . $this->requestFocus[1] . "]:visible').focus();" : "") . "}, 100);"); } $prepended = ""; foreach ($this->prepended as $p) { $prepended .= $p; } return $prepended . $this->topButtons() . $this->sideButtons() . $F . $requestFocus . GUIFactory::editFormOnchangeTest($this->formID == null ? "edit" . get_class($this->object) : $this->formID) . ($this->hiddenJS != "" ? OnEvent::script($this->hiddenJS . " \$j('#{$this->formID} .recentlyChanged').removeClass('recentlyChanged');") : ""); }
/** * Call getEditHTML() if you want a form to edit the values of each single attribute */ function getEditHTML() { $AName = get_class($this->attributes); if ($AName == "stdClass" and $this->className == null) { die("Can't determine the name of the plugin!<br />If you extended the class PersistentObject please use HTMLGUI::setStandardSaveButton(\$this);"); } if ($AName == "stdClass" or $AName == "Attributes") { $AName = str_replace("GUI", "", $this->className); } $pluginName = str_replace("Attributes", "", $AName); $userCanEdit = mUserdata::isDisallowedTo("cantEdit" . $pluginName); $userCanCreate = mUserdata::isDisallowedTo("cantCreate" . $pluginName); $html = ""; if (count($this->prependedElements) > 0) { foreach ($this->prependedElements as $k => $v) { $html .= $v->getHTML(); } } $userLabels = mUserdata::getRelabels($pluginName); $userHiddenFields = mUserdata::getHides($pluginName); $this->texts = $this->languageClass->getEditTexts(); if (!$userCanEdit and ($userCanCreate and $this->editedID != -1 or !$userCanCreate)) { $html .= "\n\t\t\t<table>\n\t\t\t\t<tr>\n\t\t\t\t\t<td><img style=\"float:left;margin-right:10px;\" src=\"./images/navi/restrictions.png\" />" . $this->texts["kein Speichern"] . "</tr>\n\t\t\t</table>"; } try { $as = PMReflector::getAttributesArray($this->attributes); foreach ($this->addedRows as $key => $value) { if ($key == "top") { array_unshift($as, $value); } if ($key == "bottom") { array_push($as, $value); } } } catch (ReflectionException $e) { $_SESSION["messages"]->addMessage(get_class($e) . " thrown!"); $_SESSION["messages"]->addMessage("You need to set the attributes with setAttributes() of class HTMLGUI!"); return "An Error was caught. Please check the system log for additional information."; } $DesktopLinkButton = $this->getDesktopLinkButton(); $html .= "\n\t\t\t<form id=\"{$this->FormID}\">\n\t\t\t\t<div class=\"backgroundColor1 Tab\">\n\t\t\t\t\t<p>" . $this->getOperationsHTML($pluginName, $this->editedID) . $DesktopLinkButton . "" . ($this->labelCaption == null ? $this->name . " editieren:" : $this->labelCaption) . "</p>\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t<table>\n\t\t\t\t\t<colgroup>\n\t\t\t\t\t <col class=\"backgroundColor3\" style=\"width:120px;\" />\n\t\t\t\t\t <col class=\"backgroundColor2\" />\n\t\t\t\t\t</colgroup>"; $tab = 0; $sortOrder = $as; if (count($this->showAttributes) > 0) { $sortOrder = $this->showAttributes; } foreach ($sortOrder as $key => $value) { if (isset($this->dontShow[$value])) { continue; } if (isset($userHiddenFields[$value])) { continue; } if (isset($this->types[$value]) and $this->types[$value] == "hidden") { $this->hiddenInputs .= $this->getInput($value); continue; } if (isset($this->insertSpaceBefore[$value])) { $html .= ""; if ($this->insertSpaceBefore[$value] == "") { $html .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=\"backgroundColor0\" colspan=\"2\"></td>\n\t\t\t\t\t</tr>"; } if ($this->insertSpaceBefore[$value] != "" and !$this->tabs[$value]) { $html .= "\n\t\t\t\t\t<tr class=\"FormSeparatorWithLabel\">\n\t\t\t\t\t\t<td colspan=\"2\">" . $this->insertSpaceBefore[$value] . "</td>\n\t\t\t\t\t</tr>"; } elseif ($this->insertSpaceBefore[$value] != "" and $this->tabs[$value]) { $html .= "\n\t\t\t\t</table>\n\t\t\t\t</div>\n\t\t\t\t\n\t\t\t\t<div onclick=\"if(\$('Tab{$this->className}{$tab}').style.display == 'none') new Effect.BlindDown('Tab{$this->className}{$tab}', {queue: 'end'}); else new Effect.BlindUp('Tab{$this->className}{$tab}', {queue: 'end'});\" class=\"backgroundColor1 Tab borderColor1\">\n\t\t\t\t\t<p>" . $this->insertSpaceBefore[$value] . "</p>\n\t\t\t\t</div>\n\t\t\t\t<div id=\"Tab{$this->className}{$tab}\" style=\"display:none;\">\n\t\t\t\t<table>\n\t\t\t\t\t<colgroup>\n\t\t\t\t\t\t<col class=\"backgroundColor2\" style=\"width:120px;\" />\n\t\t\t\t\t\t<col class=\"backgroundColor3\" />\n\t\t\t\t\t</colgroup>"; $tab++; } } $label = ucfirst($value); if (isset($this->labels[$value])) { $label = $this->labels[$value]; } if (isset($userLabels[$value])) { $label = $userLabels[$value]; } $html .= "\n\t\t\t\t\t<tr " . (isset($this->style[$value]) ? "style=\"" . $this->style[$value] . "\"" : "") . ">\n\t\t\t\t\t\t<td id=\"" . $value . "EditL\"><label for=\"" . $value . "\">" . $label . ":" . (isset($this->labelDescriptions[$value]) ? "<br /><small>" . $this->labelDescriptions[$value] . "</small>" : "") . "</label></td>\n\t\t\t\t\t\t<td id=\"" . $value . "EditR\">" . $this->getInput($value) . "" . (isset($this->fieldDescriptions[$value]) ? "<br /><small style=\"color:grey;\">" . $this->fieldDescriptions[$value] . "</small>" : "") . "</td>\n\t\t\t\t\t</tr>"; } if ($tab > 0) { $html .= "\n\t\t\t\t</table>\n\t\t\t\t</div>\n\t\t\t\t<table style=\"\">\n\t\t\t\t\t<colgroup>\n\t\t\t\t\t\t<col class=\"backgroundColor2\" style=\"width:120px;\" />\n\t\t\t\t\t\t<col class=\"backgroundColor3\" />\n\t\t\t\t\t</colgroup>"; } if (!$this->replaceSaveButton) { if (!(!$userCanEdit and ($userCanCreate and $this->editedID != -1 or !$userCanCreate)) and !$this->onlyDisplayMode) { $html .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td colspan=\"2\">\n\t\t\t\t\t\t\t<input \n\t\t\t\t\t\t\t\ttype=\"button\" \n\t\t\t\t\t\t\t\tname=\"currentSaveButton\"\n\t\t\t\t\t\t\t\tvalue=\"" . ($this->labelSaveButton == null ? $this->name . " speichern" : $this->labelSaveButton) . "\" \n\t\t\t\t\t\t\t\tonclick=\"" . $this->saveButtonEvent . "\" \n\t\t\t\t\t\t\t\tstyle=\"background-image:url(./images/i2/save.gif);\"\n\t\t\t\t\t\t\t/>" . $this->hiddenInputs . "\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>"; } } else { $html .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td colspan=\"2\">\n\t\t\t\t\t\t\t" . $this->replaceSaveButton . $this->hiddenInputs . "\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>"; } /* if(PMReflector::implementsInterface($pluginName,"iScrollable") AND $this->editedID != -1) { $html .= " <tr> <td class=\"backgroundColor0\" style=\"height:20px;\"></td> </tr> <tr> <td colspan=\"2\" class=\"backgroundColor3\"> <table> <tr> <td title=\"[Shift] + [Alt] + y\" style=\"cursor:pointer;width:7%;\" onclick=\"rme('$pluginName', '$this->editedID', 'getNextID','true','if(checkResponse(transport)) contentManager.loadFrame(\'contentLeft\',\'$pluginName\', transport.responseText);');\" onmouseover=\"this.className='backgroundColor1';\" onmouseout=\"this.className='';\"> <a href=\"javascript:rme('$pluginName', '$this->editedID', 'getNextID','true','if(checkResponse(transport)) contentManager.loadFrame(\'contentLeft\',\'$pluginName\', transport.responseText);');\" accesskey=\"y\"></a><img src=\"./images/left.gif\"> </td> <td title=\"[Shift] + [Alt] + x\" style=\"cursor:pointer;width:23%;\" onclick=\"rme('$pluginName', '$this->editedID', 'getPreviousID','false','if(checkResponse(transport)) contentManager.loadFrame(\'contentLeft\',\'$pluginName\', transport.responseText);');\" onmouseover=\"this.className='backgroundColor1';\" onmouseout=\"this.className='';\"> <a href=\"javascript:rme('$pluginName', '$this->editedID', 'getPreviousID','false','if(checkResponse(transport)) contentManager.loadFrame(\'contentLeft\',\'$pluginName\', transport.responseText);');\" accesskey=\"x\"></a><img src=\"./images/lefts.gif\"> </td> <td style=\"width:40%;\">".$this->texts["gehe zu Datensatz ID"].": <input onblur=\"blurMe(this);\" onfocus=\"focusMe(this);\" style=\"width:40px;text-align:right;\" onkeydown=\"if(event.keyCode == 13) rme('$pluginName', '$this->editedID', 'checkInputID',this.value,'if(checkResponse(transport)) loadLeftFrameV2(\'$pluginName\', transport.responseText);');\" type=\"text\" value=\"$this->editedID\" /></td> <td title=\"[Shift] + [Alt] + c\" style=\"cursor:pointer;width:23%;\" onclick=\"rme('$pluginName', '$this->editedID', 'getNextID','false','if(checkResponse(transport)) contentManager.loadFrame(\'contentLeft\',\'$pluginName\', transport.responseText);');\" onmouseover=\"this.className='backgroundColor1';\" onmouseout=\"this.className='';\"> <a href=\"javascript:rme('$pluginName', '$this->editedID', 'getNextID','false','if(checkResponse(transport)) contentManager.loadFrame(\'contentLeft\',\'$pluginName\', transport.responseText);');\" accesskey=\"c\" ></a><img style=\"float:right;\" src=\"./images/rights.gif\"> </td> <td title=\"[Shift] + [Alt] + v\" style=\"cursor:pointer;width:7%;\" onclick=\"rme('$pluginName', '$this->editedID', 'getPreviousID','true','if(checkResponse(transport)) contentManager.loadFrame(\'contentLeft\',\'$pluginName\', transport.responseText);');\" onmouseover=\"this.className='backgroundColor1';\" onmouseout=\"this.className='';\"> <a href=\"javascript:rme('$pluginName', '$this->editedID', 'getPreviousID','true','if(checkResponse(transport)) contentManager.loadFrame(\'contentLeft\',\'$pluginName\', transport.responseText);');\" accesskey=\"v\"></a><img style=\"float:right;\" src=\"./images/right.gif\"> </td> </tr> </table> </td> </tr>"; }*/ $html .= "\n\t\t\t\t\t</table>\n\t\t\t\t</div>\n\t\t\t</form>"; if (count($this->appendedElements) > 0) { foreach ($this->appendedElements as $k => $v) { $html .= $v->getHTML(); } } return $html . GUIFactory::editFormOnchangeTest($this->FormID); }
public function __construct(GUIFactory $factory) { $button = $factory->createButton(); $button->setCaption("Start"); $button->render(); }
/** * @param GUIFactory $factory */ public function __construct(GUIFactory $factory) { $button = $factory->createButton(); $button->paint(); }