本文整理汇总了PHP中TextField::render方法的典型用法代码示例。如果您正苦于以下问题:PHP TextField::render方法的具体用法?PHP TextField::render怎么用?PHP TextField::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextField
的用法示例。
在下文中一共展示了TextField::render方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
public function render($echo = false)
{
$name = $this->field->getName();
$html = parent::render($echo);
$html .= <<<HTML
<script type="text/javascript">
\$(function () {
\$('#field-{$name}').datetimepicker({
format: "YYYY-MM-DD hh:mm A"
});
});
</script>
HTML;
return $html;
}
示例2: render
public function render()
{
$name = $this->getName();
$hidden = new HiddenField($name, $this->getValue());
$id = $this->getId();
$hidden->addAttribute("id", $id);
$ret = $hidden->render();
if ($this->storedFieldSet === false) {
$this->addSearchField($this->storedField);
$this->storedFieldSet = true;
}
$object = array("model" => $this->model->package, "format" => "json", "fields" => $this->searchFields, "limit" => 20, "conditions" => "", "and_conditions" => $this->andConditions);
$jsonSearchFields = array_reverse($this->searchFields);
$object = base64_encode(serialize($object));
$path = Application::$prefix . "/lib/models/urlaccess.php?object={$object}";
$fields = urlencode(json_encode($jsonSearchFields));
$text = new TextField();
$text->addAttribute("onkeyup", "fapiUpdateSearchField('{$id}','{$path}','{$fields}',this," . ($this->boldFirst ? "true" : "false") . ",'{$this->onChangeAttribute}')");
$text->addAttribute("autocomplete", "off");
if ($this->getValue() != "") {
$data = $this->model[$this->getValue()];
for ($i = 2; $i < count($jsonSearchFields); $i++) {
$val .= $data[0][$jsonSearchFields[$i]] . " ";
}
$text->setValue($val);
}
$text->setId($id . "_search_entry");
$ret .= $text->render();
$ret .= "<div class='fapi-popup' id='{$id}_search_area'></div>";
return $ret;
}
示例3: renderHeader
protected function renderHeader()
{
$searchFunction = $this->name . "Search()";
$table = "<table class='tapi-table' id='{$this->name}'>";
//Render Headers
$table .= "<thead><tr>";
//$table .= "<td><input type='checkbox' onchange=\"wyf.tapi.checkToggle('$this->name',this)\"></td>";
foreach ($this->headers as $i => $header) {
$table .= "<td onclick=\"wyf.tapi.sort('" . $this->name . "','" . $this->tableData["rawFields"][$i + 1] . "')\">\n {$header}\n </td>";
}
if ($this->useInlineOperations) {
$table .= "<td>Operations</td>";
}
$table .= "</tr>";
//Render search fields
$table .= "<tr id='tapi-{$this->name}-search' class='tapi-search-row' >";
foreach ($this->headers as $i => $header) {
$table .= "<td>";
//if(count(explode(",",$this->fields[$i]))==1)
//{
switch ($this->fields[$i + 1]["type"]) {
case "string":
case "text":
$text = new TextField();
$text->setId($this->fields[$i + 1]["name"]);
$text->addAttribute("onkeyup", $searchFunction);
$table .= $text->render();
$name = $this->fields[$i + 1]["name"];
// veeery dirty code @todo clean this up small
//$this->searchScript .= "if($('#$name').val()!='') conditions = (conditions==''?'':conditions+' AND ')+ \"lower('\" + $('#$name').val() +\"') in lower({$this->tableData["rawFields"][$i+1]}))>0\";\n";
$this->searchScript .= "if(\$('#{$name}').val()!='') { conditions = (conditions==''?'':conditions+' AND ')+ \"lower({$this->tableData["rawFields"][$i + 1]}::varchar) like ?\"; boundData.push('%'+\$('#{$name}').val().toLowerCase()+'%');}\n";
break;
/*case "reference":
$text = new TextField();
$text->setId($this->fields[$i]["name"]);
$text->addAttribute("onkeyup",$searchFunction);
$table .= $text->render();
$modelInfo = Model::resolvePath($this->fields[$i]["reference"]);
$model = Model::load($modelInfo["model"]);
$fieldName = $model->database.".".$this->fields[$i]["referenceValue"];
$this->searchScript .= "if($('#{$this->fields[$i]["name"]}').val()!='') condition += escape('$fieldName='+$('#{$fields[$i]["name"]}').val()+',');";
break;
$list = new ModelSearchField($fields[$i]["reference"],$fields[$i]["referenceValue"]);
$list->boldFirst = false;
$list->setId($fields[$i]["name"]);
$list->addAttribute("onChange",$searchFunction);
$table .= $list->render();
$modelInfo = Model::resolvePath($fields[$i]["reference"]);
$model = Model::load($modelInfo["model"]);
$fieldName = $model->database.".".$field[$i]["name"];
$this->searchScript .= "if($('#{$field["name"]}').val()!='') condition += escape('$fieldName='+$('#{$field["name"]}').val()+',');";
break;*/
/*case "enum":
$list = new SelectionList();
foreach($fields[$i]["options"] as $value => $label)
{
$list->addOption($label,$value);
}
$list->setId($fields[$i]["name"]);
$table.=$list->render();
break;
case "integer":
case "double":
$options = Element::create("SelectionList")->
addOption("Equals",0)->
addOption("Greater than",1)->
addOption("Less than",2);
$text = new TextField();
$text->setId($fields[$i]["name"]);
$table .= $options->render().$text->render();
break;
case "date":
$date = new DateField();
$date->setId($fields[$i]["name"]);
$table .= $date->render();
break;
case "boolean":
$options = Element::create("SelectionList")->
addOption("Yes",1)->addOption("No",0);
$options->setId($fields[$i]["name"]);
$table .= $options->render();
break;*/
}
//}
/*else
{
$text = new TextField();
$text->setId("concat_field_$i");
$text->addAttribute("onkeyup",$searchFunction);
$table .= $text->render();
$name = addslashes($this->model->datastore->concatenate(explode(",",$this->fields[$i])));
$this->searchScript .= "if($('#concat_field_$i').val()!='') condition += escape('$name='+$('#concat_field_$i').val()+',');";
}*/
$table .= "</td>";
}
if ($this->useInlineOperations) {
$table .= "<td><input class='fapi-button' type='button' value='Search' onclick='{$searchFunction}'/></td></tr></thead>";
}
//Render Data
//.........这里部分代码省略.........
示例4: render
/**
* {@inheritDoc}
*/
public function render(array $attributes = array())
{
return parent::render(array_merge(array('value' => $this->getOption('always_empty') && !$this->isBound() ? '' : $this->getDisplayedData(), 'type' => 'password'), $attributes));
}
示例5: testTextFieldWithInputAttrsOption
public function testTextFieldWithInputAttrsOption()
{
$f = new TextField(array('input_attrs' => array('cols' => 80, 'rows' => 20)));
$this->assertEquals('<textarea name="bar" cols="80" rows="20"></textarea>', $f->render('bar'));
}