本文整理汇总了PHP中Object::setPost方法的典型用法代码示例。如果您正苦于以下问题:PHP Object::setPost方法的具体用法?PHP Object::setPost怎么用?PHP Object::setPost使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Object
的用法示例。
在下文中一共展示了Object::setPost方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setPost
/**
* @see parent::setPost()
*/
public function setPost(array $data)
{
parent::setPost($data);
if (isset($data['answer']) && is_array($data['answer'])) {
$this->setAnswers($data['answer']);
}
}
示例2: setPost
/**
* @see parent::setPost()
*/
public function setPost(array $data)
{
parent::setPost($data);
if (isset($data['Project']) && is_array($data['Project'])) {
$this->Projects = array();
foreach ($data['Project']['Name'] as $i => $value) {
if (!$value) {
continue;
}
$this->Projects[] = new Client_Project($data['Project']['Name'][$i], $data['Project']['URL'][$i]);
}
}
}
示例3: initForm
protected function initForm(Object $Object, $method = 'edit')
{
$error = array();
if (isset($_POST['submit'])) {
$Object->setPost($_POST);
$fields = Locale::translate(Error::test($Object));
if (count($fields)) {
$error[] = 'Неверно заполнены поля: ' . implode(', ', Locale::translate($fields));
} else {
if ($Object->save()) {
return $this->haltForm($Object, $method);
} else {
$error[] = 'Ошибка базы данных: ' . $Object->getError();
}
}
}
$name = $this->getAliasName($method) ? $this->getAliasName($method) : $this->getModelName($method);
$Document = new Document();
$this->getView()->set('Documents', $Document->findList(array(), 'Position asc'));
$this->getView()->set($name, $Object);
$this->getView()->set('Error', $error);
return $this->getView()->render();
}
示例4: setPost
/**
* @see parent::setPost()
*/
public function setPost(array $data = array())
{
parent::setPost($data);
if (isset($data['Address']) && is_array($data['Address'])) {
$this->setAddress($data['Address']);
}
$this->Pickup = empty($data['Pickup']) ? 0 : 1;
if ($this->Type != self::STANDARD) {
$Custom = new Order_Custom();
$Custom->set($data);
$this->CustomData = $Custom;
}
}
示例5: setPost
/**
* @see parent::setPost()
*/
public function setPost(array $data = array())
{
parent::setPost($data);
if (isset($data['Unit'])) {
$this->Units = $this->UnitsDelete = array();
foreach ($data['Unit']['Name'] as $id => $value) {
$arr = array();
foreach (array_keys($data['Unit']) as $key) {
if (isset($data['Unit'][$key][$id])) {
if ($key == 'Delete') {
$this->UnitsDelete[] = $data['Unit'][$key][$id];
} else {
$arr[$key] = $data['Unit'][$key][$id];
}
}
}
$this->Units[] = $arr;
}
}
if (isset($data['Model'])) {
$this->Models = $this->ModelsDelete = array();
foreach ($data['Model']['Name'] as $id => $value) {
$arr = array();
foreach (array_keys($data['Model']) as $key) {
if (isset($data['Model'][$key][$id])) {
if ($key == 'Delete') {
$this->ModelsDelete[] = $data['Model'][$key][$id];
} else {
$arr[$key] = $data['Model'][$key][$id];
}
}
}
$this->Models[] = $arr;
}
}
if (isset($data['Design']) && isset($data['Design']['Name'])) {
$this->Design = array();
foreach ($data['Design']['Name'] as $id => $value) {
if (!$value) {
continue;
}
$arr = array();
foreach (array_keys($data['Design']) as $key) {
$arr[$key] = isset($data['Design'][$key][$id]) ? $data['Design'][$key][$id] : null;
}
$this->Design[] = $arr;
}
}
if (isset($data['Frame']) && isset($data['Frame']['Name'])) {
$this->Frame = array();
foreach ($data['Frame']['Name'] as $id => $value) {
if (!$value) {
continue;
}
$arr = array();
foreach (array_keys($data['Frame']) as $key) {
$arr[$key] = isset($data['Frame'][$key][$id]) ? $data['Frame'][$key][$id] : null;
}
$this->Frame[] = $arr;
}
}
$this->IsOwn = empty($data['IsOwn']) ? 0 : 1;
}
示例6: initForm
/**
* The function shows edit form and saves data on submit.
*
* @access protected
* @param object $Object The object.
* @return string The HTML code.
*/
protected function initForm(Object $Object, $method = 'edit')
{
$error = array();
if (isset($_POST['submit'])) {
$Object->setPost($_POST);
//$fields = Locale::translate( Error::test( $Object ) );
if (count($fields)) {
$error[] = 'Неверно заполнены поля: ' . implode(', ', Locale::translate($fields));
} else {
if ($Object->save()) {
if (!empty($_FILES['file']['tmp_name'])) {
if (File::upload($Object, $_FILES['file'])) {
$Object->save();
} else {
if ($this->dropOnFailedUpload($Object)) {
$Object->drop();
}
}
}
if (!empty($_POST['detach'])) {
if (File::detach($Object)) {
$Object->save();
}
}
return $this->haltForm($Object, $method);
} else {
$error[] = 'Ошибка базы данных: ' . $Object->getError();
}
}
}
$name = $this->getAliasName($method) ? $this->getAliasName($method) : $this->getModelName($method);
$this->getView()->set($name, $Object);
$this->getView()->set('Error', $error);
return $this->getView()->render();
}
示例7: setPost
/**
* @see parent::setPost()
*/
public function setPost(array $data = array())
{
parent::setPost($data);
if (isset($data['PostedAt'])) {
$this->PostedAt = strtotime($data['PostedAt']);
}
$this->HasVideo = empty($data['HasVideo']) ? 0 : 1;
if (isset($data['Tags'])) {
$this->tags = $data['Tags'];
}
}
示例8: setPost
public function setPost(array $data = array())
{
parent::setPost($data);
if (!empty($data['clear_documents'])) {
$this->Documents = '';
}
if (isset($data['document']) && is_array($data['document'])) {
$this->Documents = implode(':', $data['document']);
}
}