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


PHP SplSubject::getQueryServiceVerify方法代码示例

本文整理汇总了PHP中SplSubject::getQueryServiceVerify方法的典型用法代码示例。如果您正苦于以下问题:PHP SplSubject::getQueryServiceVerify方法的具体用法?PHP SplSubject::getQueryServiceVerify怎么用?PHP SplSubject::getQueryServiceVerify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SplSubject的用法示例。


在下文中一共展示了SplSubject::getQueryServiceVerify方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update

 /**
  * @param \SplSubject|View $subject
  */
 public function update(\SplSubject $subject)
 {
     $viewConfig = $subject->getViewConfigVerify();
     $query = $subject->getQueryServiceVerify()->get($viewConfig->query)->setParams($subject->getParams())->process();
     $subject->setData($query->getData());
     $data = $subject->getData();
     foreach (['actions', 'links'] as $datapartam) {
         foreach ($data[$datapartam] as $key => $link) {
             foreach (['routeparams', 'queryparams'] as $keyparams) {
                 foreach ($link[$keyparams] as $paramkey => $param) {
                     if ($param[0] == ':') {
                         $data[$datapartam][$key][$keyparams][$paramkey] = $subject->getParam(substr($param, 1), '');
                     }
                 }
             }
         }
     }
     $subject->setData(['actions' => $data['actions'], 'links' => $data['links']]);
     $result['paginator'] = $subject->getGatewayVerify()->getPages([], $query->getWhere(), $query->getOrder());
     if ($result['paginator']->count() > 0) {
         $result['paginator']->setCurrentPageNumber($subject->getParam('page', 1))->setItemCountPerPage($viewConfig->rows);
     }
     $subject->getLogicServiceVerify()->get('prelist', $viewConfig->model)->trigger($result['paginator']->getCurrentItems());
     $subject->getLogicServiceVerify()->get('postlist', $viewConfig->model)->trigger($result['paginator']->getCurrentItems());
     $result['rows'] = [5, 10, 25, 50, 100];
     $result['params'] = ['data' => strtolower($viewConfig->model), 'view' => $viewConfig->mode];
     $subject->setData($result);
 }
开发者ID:modelframework,项目名称:modelframework,代码行数:31,代码来源:WidgetObserver.php

示例2: update

 public function update(\SplSubject $subject)
 {
     $viewConfig = $subject->getViewConfigVerify();
     $query = $subject->getQueryServiceVerify()->get($viewConfig->query)->setParams($subject->getParams())->process();
     $models = $subject->getGateway()->find($query->getWhere());
     foreach ($models as $model) {
         $subject->getLogicServiceVerify()->get($viewConfig->mode, $viewConfig->model)->trigger($model->getDataModel());
     }
     $subject->setRedirect($subject->refresh($viewConfig->title . ' successfull', '/common/mail/index.html'));
 }
开发者ID:modelframework,项目名称:modelframework,代码行数:10,代码来源:LogicObserver.php

示例3: update

 /**
  * @param \SplSubject|View $subject
  */
 public function update(\SplSubject $subject)
 {
     $viewConfig = $subject->getViewConfigVerify();
     $query = $subject->getQueryServiceVerify()->get($viewConfig->query)->setParams($subject->getParams())->process();
     $subject->setData($query->getData());
     $model = $subject->getGatewayServiceVerify()->get($viewConfig->model)->find($query->getWhere());
     if (!$model->count()) {
         return;
     }
     foreach ($model as $row) {
         $result['selectlinks'][] = ['route' => 'common', 'label' => $row->title, 'routeparams' => ['view' => $viewConfig->params['view'], 'data' => $subject->getParams()->fromRoute('data')], 'queryparams' => ['id' => $subject->getParams()->fromRoute('id'), 'template' => $row->_id]];
     }
     $subject->setData($result);
 }
开发者ID:modelframework,项目名称:modelframework,代码行数:17,代码来源:ListLiteObserver.php

示例4: update

 public function update(\SplSubject $subject)
 {
     $viewConfig = $subject->getViewConfigVerify();
     $query = $subject->getQueryServiceVerify()->get($viewConfig->query)->setParams($subject->getParams())->process();
     $subject->setData($query->getData());
     $result = [];
     $model = $subject->getGatewayVerify()->findOne($query->getWhere());
     if (!$model) {
         $result['data'] = 'Sorry, some error occured. We can\'t display message. Ask administrator';
     } else {
         $result['data'] = $model->text;
     }
     //        $data = $subject->getData();
     $subject->setData($result);
 }
开发者ID:modelframework,项目名称:modelframework,代码行数:15,代码来源:HTMLObserver.php

示例5: update

 /**
  * @param \SplSubject|View $subject
  */
 public function update(\SplSubject $subject)
 {
     $viewConfig = $subject->getViewConfigVerify();
     $query = $subject->getQueryServiceVerify()->get($viewConfig->query)->setParams($subject->getParams())->process();
     $subject->setData($query->getData());
     $model = $subject->getGatewayServiceVerify()->get($viewConfig->model)->find($query->getWhere());
     if (!$model->count()) {
         return;
     }
     foreach ($model as $key => $row) {
         $result['selectlinks'][] = ['route' => 'common', 'label' => $row->title, 'folder_title' => $row->folder_title, 'routeparams' => ['view' => 'send', 'data' => 'mail'], 'queryparams' => ['recipient' => $subject->getParams()->fromRoute('id'), 'template' => $row->_id]];
     }
     usort($result['selectlinks'], function ($a, $b) {
         return strnatcmp($a['folder_title'], $b['folder_title']);
     });
     $subject->setData($result);
 }
开发者ID:modelframework,项目名称:modelframework,代码行数:20,代码来源:MailTplObserver.php

示例6: update

 /**
  * @param \SplSubject|View $subject
  *
  * @throws \Exception
  */
 public function update(\SplSubject $subject)
 {
     $viewConfig = $subject->getViewConfigVerify();
     $query = $subject->getQueryServiceVerify()->get($viewConfig->query)->setParams($subject->getParams())->process();
     $subject->setData($query->getData());
     $result = [];
     $model = $subject->getGatewayVerify()->findOne($query->getWhere());
     if (!$model) {
         throw new \Exception('Data not found');
     }
     $subject->setDataModel($model);
     $data = $subject->getData();
     foreach (['actions', 'links'] as $datapartam) {
         foreach ($data[$datapartam] as $key => $link) {
             foreach (['routeparams', 'queryparams'] as $keyparams) {
                 foreach ($link[$keyparams] as $paramkey => $param) {
                     if ($param[0] == ':') {
                         $_f = substr($param, 1);
                         $data[$datapartam][$key][$keyparams][$paramkey] = $model->{$_f};
                     }
                 }
             }
         }
     }
     $result['fieldsets'] = [];
     $aclData = $subject->getAclServiceVerify()->getAclConfig($viewConfig->model);
     $modelFields = $subject->getParsedModelConfigVerify()->fields;
     $usedGroups = [];
     foreach ($viewConfig->fields as $field) {
         if (!array_key_exists($field, $modelFields)) {
             continue;
         }
         $fConfig = $modelFields[$field];
         //check $field in acl
         if (!array_key_exists($field, $aclData->fields) || !in_array($aclData->fields[$field], ['read', 'write'])) {
             continue;
         }
         if ($fConfig['type'] == 'pk') {
             continue;
         }
         $usedGroups[$modelFields[$field]['group']][] = $field;
     }
     $chosenGroups = [];
     $fieldSet2Group = [];
     foreach ($viewConfig->groups as $grKey => $groupBlock) {
         if (is_array($groupBlock)) {
             foreach ($groupBlock as $group) {
                 if (array_key_exists($group, $usedGroups)) {
                     $chosenGroups[$group] = $usedGroups[$group];
                     $fieldSet2Group[$group] = $grKey;
                 }
             }
             continue;
         }
         if (array_key_exists($groupBlock, $usedGroups)) {
             $chosenGroups[$groupBlock] = $usedGroups[$groupBlock];
             $fieldSet2Group[$groupBlock] = $groupBlock;
         }
     }
     foreach ($chosenGroups as $group => $groupElements) {
         $fieldSet = $subject->getParsedModelConfigVerify()->fieldsets[$group];
         $elements = $fieldSet['elements'];
         $fieldSet['elements'] = [];
         foreach ($groupElements as $field) {
             $fieldSet['elements'][$field] = $elements[$field];
         }
         $fieldSet['group'] = $fieldSet2Group[$group];
         $chosenGroups[$group] = $fieldSet;
     }
     $result['fieldsets'] = $chosenGroups;
     $subject->getLogicServiceVerify()->get('preview', $viewConfig->model)->trigger($model);
     $result['model'] = $model;
     $result['title'] = $viewConfig->title . ': ' . $model->title;
     $result['actions'] = $data['actions'];
     $result['links'] = $data['links'];
     $subject->setData($result);
     $subject->getLogicServiceVerify()->get('postview', $viewConfig->model)->trigger($model);
 }
开发者ID:modelframework,项目名称:modelframework,代码行数:83,代码来源:ViewObserver.php


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