本文整理汇总了PHP中Submission::bind方法的典型用法代码示例。如果您正苦于以下问题:PHP Submission::bind方法的具体用法?PHP Submission::bind怎么用?PHP Submission::bind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Submission
的用法示例。
在下文中一共展示了Submission::bind方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
public function save()
{
// check for request forgeries
YRequest::checkToken() or jexit('Invalid Token');
// init vars
$post = YRequest::get('post');
$cid = YRequest::getArray('cid.0', '', 'int');
try {
// get item table
$table = YTable::getInstance('submission');
// get item
if ($cid) {
$submission = $table->get($cid);
} else {
$submission = new Submission();
$submission->application_id = $this->application->id;
}
// bind submission data
$submission->bind($post, array('params'));
// generate unique slug
$submission->alias = SubmissionHelper::getUniqueAlias($submission->id, YString::sluggify($submission->alias));
// set params
$submission->params = $submission->getParams()->clear()->set('form.', @$post['params']['form'])->set('trusted_mode', @$post['params']['trusted_mode'])->set('show_tooltip', @$post['params']['show_tooltip'])->toString();
// save submission
$table->save($submission);
// set redirect message
$msg = JText::_('Submission Saved');
} catch (YException $e) {
// raise notice on exception
JError::raiseNotice(0, JText::_('Error Saving Submission') . ' (' . $e . ')');
$this->_task = 'apply';
$msg = null;
}
$link = $this->baseurl;
switch ($this->getTask()) {
case 'apply':
$link .= '&task=edit&cid[]=' . $submission->id;
break;
case 'saveandnew':
$link .= '&task=add';
break;
}
$this->setRedirect($link, $msg);
}