本文整理汇总了PHP中JModel::getJsonErrors方法的典型用法代码示例。如果您正苦于以下问题:PHP JModel::getJsonErrors方法的具体用法?PHP JModel::getJsonErrors怎么用?PHP JModel::getJsonErrors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JModel
的用法示例。
在下文中一共展示了JModel::getJsonErrors方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleError
/**
* Handle the view error
*
* @param JView $view View
* @param JModel $model Form Model
*
* @since 3.1b
*
* @return void
*/
protected function handleError($view, $model)
{
$app = JFactory::getApplication();
$package = $app->getUserState('com_fabrik.package', 'fabrik');
$input = $app->input;
$validated = false;
// If its in a module with ajax or in a package or inline edit
if ($input->get('fabrik_ajax')) {
if ($input->getInt('elid', 0) !== 0) {
// Inline edit
$eMsgs = array();
$errs = $model->getErrors();
// Only raise errors for fields that are present in the inline edit plugin
$toValidate = array_keys($input->get('toValidate', array(), 'array'));
foreach ($errs as $errorKey => $e) {
if (in_array($errorKey, $toValidate) && count($e[0]) > 0) {
array_walk_recursive($e, array('FabrikString', 'forHtml'));
$eMsgs[] = count($e[0]) === 1 ? '<li>' . $e[0][0] . '</li>' : '<ul><li>' . implode('</li><li>', $e[0]) . '</ul>';
}
}
if (!empty($eMsgs)) {
$eMsgs = '<ul>' . implode('</li><li>', $eMsgs) . '</ul>';
header('HTTP/1.1 500 ' . FText::_('COM_FABRIK_FAILED_VALIDATION') . $eMsgs);
jexit();
} else {
$validated = true;
}
} else {
// Package / model
echo $model->getJsonErrors();
}
if (!$validated) {
return;
}
}
if (!$validated) {
$this->savepage();
if ($this->isMambot) {
$this->setRedirect($this->getRedirectURL($model, false));
} else {
/**
* $$$ rob - http://fabrikar.com/forums/showthread.php?t=17962
* couldn't determine the exact set up that triggered this, but we need to reset the rowid to -1
* if reshowing the form, otherwise it may not be editable, but rather show as a detailed view
*/
if ($input->get('usekey', '') !== '') {
$input->set('rowid', -1);
}
// Meant that the form's data was in different format - so redirect to ensure that its showing the same data.
$input->set('task', '');
$view->display();
}
return;
}
}