当前位置: 首页>>代码示例>>PHP>>正文


PHP JModel::getJsonErrors方法代码示例

本文整理汇总了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;
     }
 }
开发者ID:ankaau,项目名称:GathBandhan,代码行数:65,代码来源:form.php


注:本文中的JModel::getJsonErrors方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。