本文整理汇总了PHP中Button::__toString方法的典型用法代码示例。如果您正苦于以下问题:PHP Button::__toString方法的具体用法?PHP Button::__toString怎么用?PHP Button::__toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Button
的用法示例。
在下文中一共展示了Button::__toString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test__toString_WithProperties
public function test__toString_WithProperties()
{
$this->button->setIdentifier('Search_Button');
$this->button->setProperties(array('label' => 'Search', 'id' => 'cmdSearch', 'class' => 'longbtn', 'type' => 'submit', 'name' => '_search'));
$expectedAttributes = array('type="submit"', 'class="longbtn"', 'id="cmdSearch"', 'name="_search"', 'onmouseover="this.className=\'longbtn longbtnhov\'"', 'onmouseout="this.className=\'longbtn\'"', 'value="Search"');
$html = $this->button->__toString();
foreach ($expectedAttributes as $attribute) {
$this->assertRegExp("/{$attribute}/", $html);
}
}
示例2: renderActionBar
function renderActionBar($buttons, $condition = true)
{
if ($condition && count($buttons) > 0) {
?>
<?php
foreach ($buttons as $key => $buttonProperties) {
$button = new Button();
$button->setProperties($buttonProperties);
$button->setIdentifier($key);
echo $button->__toString(), "\n";
}
?>
<?php
}
}
示例3: renderActionBar
function renderActionBar($buttons, $condition = true)
{
if ($condition && count($buttons) > 0) {
?>
<div class="actionbar">
<div class="formbuttons">
<?php
foreach ($buttons as $key => $buttonProperties) {
$button = new Button();
$button->setProperties($buttonProperties);
$button->setIdentifier($key);
echo $button->__toString(), "\n";
}
?>
</div>
<br class="clear" />
</div>
<?php
}
}
示例4: __toString
public function __toString()
{
#$style = "";
if ($this->type == "date" and strpos($this->style, "width:") === false) {
$this->style .= "width:87%;";
}
#if($this->style != null) $style = " style=\"$this->style\"";
switch ($this->type) {
case "audio":
return "<audio controls preload=\"auto\" autobuffer style=\"{$this->style}\"><source src=\"{$this->value}\"></audio>";
break;
case "HTMLEditor":
$B = new Button("in HTML-Editor\nbearbeiten", "editor");
$B->windowRme("Wysiwyg", "", "getEditor", "", "WysiwygGUI;FieldClass:{$this->options[0]};FieldClassID:{$this->options[1]};FieldName:{$this->options[2]}");
$B->className("backgroundColor2");
return $B->__toString();
break;
case "TextEditor":
#return "<input ".(isset($this->events[$as]) ? $eve : "")." style=\"background-image:url(./images/navi/editor.png);".(isset($this->inputStyle[$as]) ? "".$this->inputStyle[$as]."" : "")."\" type=\"button\" class=\"bigButton backgroundColor2\" onclick=\"TextEditor.show('$as','$this->FormID');\" value=\"".$this->texts["in Editor bearbeiten"]."\" /><textarea style=\"display:none;\" name=\"".$as."\" id=\"".$as."\">".$this->attributes->$as."</textarea>";
$B = new Button("in Editor\nbearbeiten", "editor");
$B->className("backgroundColor2");
$B->onclick("TextEditor.show('{$this->name}','{$this->options[0]}');");
$ITA = new HTMLInput($this->name, "textarea", $this->value);
$ITA->id($this->name);
$ITA->style("display:none;");
return $B->__toString() . $ITA;
break;
case "tinyMCE":
$BO = array("'{$this->options[0]}'", "'{$this->options[1]}'");
if (isset($this->options[2])) {
$BO[] = "'{$this->options[2]}'";
}
$B = new Button("in Editor\nbearbeiten", "editor");
#$B->windowRme("Wysiwyg","","getEditor","","WysiwygGUI;FieldClass:{$this->options[0]};FieldClassID:{$this->options[1]};FieldName:{$this->options[2]}");
$B->popup("", "Editor", "Wysiwyg", "-1", "editInPopup", $BO, "", "Popup.presets.large");
$B->className("backgroundColor2");
$ITA = new HTMLInput($this->name, "textarea", $this->value);
return $B->__toString() . $ITA;
break;
case "multiInput":
return "<input\n\t\t\t\t\tclass=\"multiEditInput2\"\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t" . ($this->style != null ? " style=\"{$this->style}\"" : "") . "\n\t\t\t\t\tvalue=\"" . htmlspecialchars($this->value) . "\"\n\t\t\t\t\tonfocus=\"oldValue = this.value;\"\n\t\t\t\t\tid=\"" . $this->options[2] . "ID" . $this->options[1] . "\"\n\t\t\t\t\tonblur=\"if(oldValue != this.value) saveMultiEditInput('" . $this->options[0] . "','" . $this->options[1] . "','" . $this->options[2] . "');\"\n\t\t\t\t\tonkeydown=\"if(event.keyCode == 13) saveMultiEditInput('" . $this->options[0] . "','" . $this->options[1] . "','" . $this->options[2] . "');\"/>";
break;
/*case "customSelection":
$B = new Button("Eintrag auswählen...", "gutschrift");
$B->type("LPBig");
$B->style("float:right;margin-left:10px;");
# "contentRight" "callingPluginID" "selectPlugin"
$B->customSelect($this->options[0], $this->options[1], $this->options[2], $this->options[3]);
return $B."<input type=\"text\" name=\"$this->name\" value=\"$this->value\" />";
break;*/
/*case "customSelection":
$B = new Button("Eintrag auswählen...", "gutschrift");
$B->type("LPBig");
$B->style("float:right;margin-left:10px;");
# "contentRight" "callingPluginID" "selectPlugin"
$B->customSelect($this->options[0], $this->options[1], $this->options[2], $this->options[3]);
return $B."<input type=\"text\" name=\"$this->name\" value=\"$this->value\" />";
break;*/
case "textarea":
if ($this->isDisplayMode) {
return nl2br($this->value);
}
if ($this->multiEditOptions != null) {
$this->id($this->name . "ID" . $this->multiEditOptions[1]);
$this->onfocus .= " oldValue = this.value;";
$this->onkeyup .= "if(event.keyCode == 13) saveMultiEditInput('" . $this->multiEditOptions[0] . "','" . $this->multiEditOptions[1] . "','" . $this->name . "'" . ($this->multiEditOptions[2] != null ? ", " . $this->multiEditOptions[2] : "") . ");";
$this->onblur .= "if(oldValue != this.value) saveMultiEditInput('" . $this->multiEditOptions[0] . "','" . $this->multiEditOptions[1] . "','" . $this->name . "'" . ($this->multiEditOptions[2] != null ? ", " . $this->multiEditOptions[2] : "") . ");";
if ($this->hasFocusEvent) {
$this->onfocus .= "focusMe(this);";
$this->onblur .= "blurMe(this);";
}
$this->hasFocusEvent = false;
}
return "<textarea\n\t\t\t\t\t" . ($this->style != null ? " style=\"{$this->style}\"" : "") . "\n\t\t\t\t\tname=\"{$this->name}\"\n\t\t\t\t\t" . ($this->className != null ? "class=\"{$this->className}\"" : "") . "\n\t\t\t\t\t" . ($this->onkeyup != null ? "onkeyup=\"{$this->onkeyup}\"" : "") . "\n\t\t\t\t\t" . ($this->onblur != null ? "onblur=\"{$this->onblur}\"" : "") . "\n\t\t\t\t\t" . ($this->onfocus != null ? "onfocus=\"{$this->onfocus}\"" : "") . "\n\t\t\t\t\t" . ($this->onkeyup != null ? "onkeyup=\"{$this->onkeyup}\"" : "") . "\n\t\t\t\t\t" . ($this->hasFocusEvent ? "onfocus=\"focusMe(this);\" onblur=\"blurMe(this);\"" : "") . "\n\t\t\t\t\t" . ($this->id != null ? "id=\"{$this->id}\"" : "") . ">{$this->value}</textarea>";
break;
case "file":
$currentId = ($this->id != null ? $this->id : $this->name) . rand(100, 100000000);
return "\n\t\t\t\t\t<div id=\"progress_{$currentId}\" style=\"height:10px;width:95%;display:none;\" class=\"\">\n\t\t\t\t\t\t<div id=\"progressBar_{$currentId}\" style=\"height:10px;width:0%;\" class=\"backgroundColor1\"></div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div id=\"{$currentId}\" style=\"width:100%;\"></div>\n\t\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\t\t\tvar QQUploader = new qq.FileUploader({\n\t\t\t\t\t\t\tmaxSizePossible: '" . ini_get("upload_max_filesize") . "B',\n\t\t\t\t\t\t\telement: \$('{$currentId}'),\n\t\t\t\t\t\t\taction: './interface/set.php',\n\t\t\t\t\t\t\tparams: {\n\t\t\t\t\t\t\t\t'class': '" . (($this->options == null or !isset($this->options["class"])) ? "TempFile" : $this->options["class"]) . "'\n\t\t\t\t\t\t\t\t,'id':'-1'\n\t\t\t\t\t\t\t\t" . (($this->options != null and isset($this->options["path"])) ? ",'path':'" . $this->options["path"] . "'" : "") . "\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonSubmit: function(id, fileName){ \$('progress_{$currentId}').style.display = 'block';},\n\t\t\t\t\t\t\tonComplete: function(id, fileName, transport){ \$('progress_{$currentId}').style.display = 'none'; if(checkResponse(transport)) { {$this->onchange} } },\n\t\t\t\t\t\t\tonProgress: function(id, fileName, loaded, total){ \$('progressBar_{$currentId}').style.width = Math.ceil((loaded / total) * 100)+'%'; }});\n\t\t\t\t\t</script>";
break;
case "radio1":
case "date":
case "text":
case "hidden":
case "submit":
case "button":
case "password":
case "checkbox":
case "readonly":
$JS = "";
if ($this->type == "radio1") {
$this->type = "radio";
}
if ($this->isDisplayMode) {
if ($this->type == "checkbox") {
return Util::catchParser($this->value);
}
if ($this->type == "hidden") {
return "";
//.........这里部分代码省略.........
示例5: __toString
public function __toString()
{
#$style = "";
if ($this->type == "date" and strpos($this->style, "width:") === false) {
$this->style .= "width:calc(100% - 28px)%;";
}
#if($this->style != null) $style = " style=\"$this->style\"";
switch ($this->type) {
/*case "JSONMultiText":
$data = json_decode($this->value);
print_r($data);
$L = new HTMLList();
$L->noDots();
$L->addListStyle("padding:0px;");
foreach($data AS $k => $v){
$IL = new HTMLInput($this->name."_$k", "text", $v);
$BL = new Button("Element hinzufügen");
$L->addItem($IL);
$L->addItemStyle("margin-left:0px;");
}
$I = new HTMLInput($this->name, "textarea", $this->value);
$I->id($this->name);
return $L.$I;
break;*/
case "audio":
return "<audio controls preload=\"auto\" autobuffer style=\"{$this->style}\"><source src=\"{$this->value}\"></audio>";
break;
case "search":
$currentId = $this->id != null ? $this->id : $this->name . rand(100, 100000000);
$enter = "if(\$j('#{$currentId}').val() != ''){ \$j('#SB{$currentId}').fadeOut(200, function(){ \$j('#SA{$currentId}').fadeIn();}); } else { \$j('#SA{$currentId}').fadeOut(200, function(){ \$j('#SB{$currentId}').fadeIn(); }); }";
$I = new HTMLInput($this->name, "text", $this->value, $this->options);
$I->style($this->style);
$I->placeholder($this->placeholder);
$I->onEnter($this->onenter . $enter);
#$I->onEnter(" ");
$I->id($currentId);
$BSearch = new Button("Suchen", "question_mark", "iconicG");
$BSearch->style("margin-left:5px;");
$BSearch->id("SB{$currentId}");
$BSearch->onclick($this->onenter . $enter);
#$BSearch->id("searchMailsInfo");
$BSearchClear = new Button("Suche beenden", "x_alt", "iconicR");
$BSearchClear->style("margin-left:5px;display:none;");
$BSearchClear->id("SA{$currentId}");
$BSearchClear->onclick("\$j('#{$currentId}').val('').trigger('blur'); {$this->onenter}{$enter}");
#$BSearchClear->id("searchMailsClear");
return $I . $BSearch . $BSearchClear . $this->requestFocus;
break;
case "HTMLEditor":
$B = new Button("in HTML-Editor\nbearbeiten", "editor");
$B->windowRme("Wysiwyg", "", "getEditor", "", "WysiwygGUI;FieldClass:{$this->options[0]};FieldClassID:{$this->options[1]};FieldName:{$this->options[2]}");
$B->className("backgroundColor2");
return $B->__toString();
break;
case "TextEditor":
#return "<input ".(isset($this->events[$as]) ? $eve : "")." style=\"background-image:url(./images/navi/editor.png);".(isset($this->inputStyle[$as]) ? "".$this->inputStyle[$as]."" : "")."\" type=\"button\" class=\"bigButton backgroundColor2\" onclick=\"TextEditor.show('$as','$this->FormID');\" value=\"".$this->texts["in Editor bearbeiten"]."\" /><textarea style=\"display:none;\" name=\"".$as."\" id=\"".$as."\">".$this->attributes->$as."</textarea>";
$B = new Button("in Editor\nbearbeiten", "editor");
$B->className("backgroundColor2");
$B->onclick("TextEditor.show('{$this->name}','{$this->options[0]}');");
$ITA = new HTMLInput($this->name, "textarea", $this->value);
$ITA->id($this->name);
$ITA->style("display:none;");
return $B->__toString() . $ITA;
break;
case "nicEdit":
$BO = array("'{$this->options[0]}'", "'{$this->options[1]}'");
if (isset($this->options[2])) {
$BO[] = "'{$this->options[2]}'";
}
$B = new Button("in Editor\nbearbeiten", "editor");
#$B->windowRme("Wysiwyg","","getEditor","","WysiwygGUI;FieldClass:{$this->options[0]};FieldClassID:{$this->options[1]};FieldName:{$this->options[2]}");
$B->doBefore("Overlay.showDark(); %AFTER");
$B->popup("", "Editor", "nicEdit", "-1", "editInPopup", $BO, "", "Popup.presets.large");
$B->className("backgroundColor2");
$ITA = new HTMLInput($this->name, "hidden", $this->value);
return $B->__toString() . $ITA;
break;
case "tinyMCE":
$BO = array("'{$this->options[0]}'", "'{$this->options[1]}'");
if (isset($this->options[2])) {
$BO[] = "'{$this->options[2]}'";
}
if (isset($this->options[3])) {
$BO[] = "'{$this->options[3]}'";
}
$B = new Button("in Editor\nbearbeiten", "editor");
#$B->windowRme("Wysiwyg","","getEditor","","WysiwygGUI;FieldClass:{$this->options[0]};FieldClassID:{$this->options[1]};FieldName:{$this->options[2]}");
$B->doBefore("Overlay.showDark(); %AFTER");
$B->popup("", "Editor", "tinyMCE", "-1", "editInPopup", $BO, "", "Popup.presets.large");
$B->className("backgroundColor2");
$ITA = new HTMLInput($this->name, "hidden", $this->value);
return $B->__toString() . $ITA;
break;
case "multiInput":
return "<input\n\t\t\t\t\tclass=\"multiEditInput2\"\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t" . ($this->style != null ? " style=\"{$this->style}\"" : "") . "\n\t\t\t\t\tvalue=\"" . htmlspecialchars($this->value) . "\"\n\t\t\t\t\tonfocus=\"oldValue = this.value;\"\n\t\t\t\t\tid=\"" . $this->options[2] . "ID" . $this->options[1] . "\"\n\t\t\t\t\tonblur=\"if(oldValue != this.value) saveMultiEditInput('" . $this->options[0] . "','" . $this->options[1] . "','" . $this->options[2] . "');\"\n\t\t\t\t\tonkeydown=\"if(event.keyCode == 13) saveMultiEditInput('" . $this->options[0] . "','" . $this->options[1] . "','" . $this->options[2] . "');\"/>";
//.........这里部分代码省略.........