本文整理汇总了PHP中Container::setData方法的典型用法代码示例。如果您正苦于以下问题:PHP Container::setData方法的具体用法?PHP Container::setData怎么用?PHP Container::setData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Container
的用法示例。
在下文中一共展示了Container::setData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _retrieveData
private function _retrieveData()
{
if ($this->isFormSent()) {
$this->data = array();
$fields = $this->template->getFields();
foreach ($fields as $field) {
$name = str_replace($this->templateName . "_", "", $field->getName());
$field->setValue($_POST[$field->getName()]);
$this->data[$name] = $field->getValue();
}
}
$this->template->setData($this->data);
return $this->data;
}
示例2: render
public function render()
{
$id = "multiform-" . $this->index;
$this->setId($id);
$attributes = $this->getAttributes();
if ($this->data == null) {
$this->_retrieveData();
}
if ($this->template != null) {
$this->template->clearErrors();
$template = $this->template->render();
$count = 0;
foreach ($this->data as $index => $data) {
foreach ($data as $key => $dat) {
$data[$this->templateName . "." . $key . "[]"] = $dat;
}
//$this->clearErrors();
$this->template->setData($data);
//$retval = $this->template->validate();
$this->template->setId("multiform-content-" . $index);
$this->template->getElementById("multi-form-buttons")->buttons[0]->addAttribute("onclick", "fapiMultiFormRemove('{$index}')");
$contents .= "<div id='multi-form-content-{$index}'>" . $this->template->render() . "</div>";
}
}
$ret = "<div {$attributes} >\n <input type='hidden' id='multiform-numitems-{$this->index}' value='{$count}'/>\n <div id='multiform-contents-{$this->index}'>\n {$contents}\n </div>";
$ret .= $this->getShowField() ? "<div class='fapi-multiform-bar'><span onclick='fapiMultiFormAdd({$this->index})' style='font-size:smaller;cursor:pointer'>Add New</span></div>" : "";
$ret .= "</div>\n <div id='multiform-template-{$this->index}' style='display:none'>\n {$template}\n </div>";
return $ret;
}