• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Table\TableBuilder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Anomaly\Streams\Platform\Ui\Table\TableBuilder的典型用法代码示例。如果您正苦于以下问题:PHP TableBuilder类的具体用法?PHP TableBuilder怎么用?PHP TableBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: guess

 /**
  * Guess the HREF for a button.
  *
  * @param TableBuilder $builder
  */
 public function guess(TableBuilder $builder)
 {
     $buttons = $builder->getButtons();
     if (!($section = $this->sections->active())) {
         return;
     }
     if (!($module = $this->modules->active())) {
         return;
     }
     $stream = $builder->getTableStream();
     foreach ($buttons as &$button) {
         // If we already have an HREF then skip it.
         if (isset($button['attributes']['href'])) {
             continue;
         }
         switch (array_get($button, 'button')) {
             case 'restore':
                 $button['attributes']['href'] = $this->url->to('entry/handle/restore/' . $module->getNamespace() . '/' . $stream->getNamespace() . '/' . $stream->getSlug() . '/{entry.id}');
                 break;
             default:
                 // Determine the HREF based on the button type.
                 $type = array_get($button, 'segment', array_get($button, 'button'));
                 if ($type && !str_contains($type, '\\') && !class_exists($type)) {
                     $button['attributes']['href'] = $section->getHref($type . '/{entry.id}');
                 }
                 break;
         }
     }
     $builder->setButtons($buttons);
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:35,代码来源:HrefGuesser.php


示例2: guess

 /**
  * Guess the HREF for the views.
  *
  * @param TableBuilder $builder
  */
 public function guess(TableBuilder $builder)
 {
     $views = $builder->getViews();
     foreach ($views as &$view) {
         // Only automate it if not set.
         if (!isset($view['attributes']['href'])) {
             $view['attributes']['href'] = $this->url->to($this->request->path() . '?' . array_get($view, 'prefix') . 'view=' . $view['slug']);
         }
     }
     $builder->setViews($views);
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:16,代码来源:HrefGuesser.php


示例3: guess

 /**
  * Guess the action text.
  *
  * @param TableBuilder $builder
  */
 public function guess(TableBuilder $builder)
 {
     $actions = $builder->getActions();
     $stream = $builder->getTableStream();
     if (!($module = $this->modules->active())) {
         return;
     }
     $section = $this->controlPanel->getControlPanelActiveSection();
     foreach ($actions as &$action) {
         /*
          * Nothing to do if set already.
          */
         if (isset($action['permission'])) {
             continue;
         }
         /*
          * Try and guess the permission.
          */
         if ($stream) {
             $action['permission'] = $module->getNamespace($stream->getSlug() . '.' . $action['slug']);
         } elseif ($section) {
             $action['permission'] = $module->getNamespace($section->getSlug() . '.' . $action['slug']);
         }
     }
     $builder->setActions($actions);
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:31,代码来源:PermissionGuesser.php


示例4: guess

 /**
  * Guess the text for a button.
  *
  * @param TableBuilder $builder
  */
 public function guess(TableBuilder $builder)
 {
     $buttons = $builder->getButtons();
     if (!($module = $this->modules->active())) {
         return;
     }
     if (!($stream = $builder->getTableStream())) {
         return;
     }
     foreach ($buttons as &$button) {
         if (isset($button['permission'])) {
             continue;
         }
         /**
          * Try and guess the permission value.
          */
         switch (array_get($button, 'button')) {
             case 'edit':
                 $button['permission'] = $module->getNamespace($stream->getSlug() . '.write');
                 break;
             default:
                 break;
         }
     }
     $builder->setButtons($buttons);
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:31,代码来源:PermissionGuesser.php


示例5: handle

 /**
  * Handle the command.
  */
 public function handle()
 {
     $table = $this->builder->getTable();
     $model = $this->builder->getModel();
     /*
      * If the model is already instantiated
      * then use it as is.
      */
     if (is_object($model)) {
         $table->setModel($model);
         return;
     }
     /*
      * If no model is set, try guessing the
      * model based on best practices.
      */
     if ($model === null) {
         $parts = explode('\\', str_replace('TableBuilder', 'Model', get_class($this->builder)));
         unset($parts[count($parts) - 2]);
         $model = implode('\\', $parts);
         $this->builder->setModel($model);
     }
     /*
      * If the model does not exist or
      * is disabled then skip it.
      */
     if (!$model || !class_exists($model)) {
         return;
     }
     /*
      * Set the model on the table!
      */
     $table->setModel(app($model));
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:37,代码来源:SetTableModel.php


示例6: defaults

 /**
  * Set defaults.
  *
  * @param TableBuilder $builder
  */
 public function defaults(TableBuilder $builder)
 {
     $stream = $builder->getTableStream();
     if ($builder->getColumns() == []) {
         $builder->setColumns([$stream->getTitleColumn()]);
     }
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:12,代码来源:HeaderDefaults.php


示例7: handle

 /**
  * Handle the filter.
  *
  * @param Builder               $query
  * @param SearchFilterInterface $filter
  */
 public function handle(Builder $query, TableBuilder $builder, SearchFilterInterface $filter)
 {
     $stream = $filter->getStream();
     $model = $builder->getTableModel();
     /**
      * If the model is translatable then
      * join it's translations so they
      * are filterable too.
      *
      * @var EloquentQueryBuilder $query
      */
     if ($model->getTranslationModelName() && !$query->hasJoin($model->getTranslationTableName())) {
         $query->leftJoin($model->getTranslationTableName(), $model->getTableName() . '.id', '=', $model->getTranslationTableName() . '.' . $model->getRelationKey());
     }
     $query->where(function (Builder $query) use($filter, $stream) {
         foreach ($filter->getColumns() as $column) {
             $query->orWhere($column, 'LIKE', "%{$filter->getValue()}%");
         }
         foreach ($filter->getFields() as $field) {
             $filter->setField($field);
             $fieldType = $stream->getFieldType($field);
             $fieldTypeQuery = $fieldType->getQuery();
             $fieldTypeQuery->setConstraint('or');
             $this->container->call([$fieldTypeQuery, 'filter'], compact('query', 'filter', 'builder'));
         }
     });
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:33,代码来源:SearchFilterQuery.php


示例8: authorize

 /**
  * Authorize the table.
  *
  * @param TableBuilder $builder
  */
 public function authorize(TableBuilder $builder)
 {
     // Try the option first.
     $permission = $builder->getTableOption('permission');
     if ($permission && !$this->authorizer->authorize($permission)) {
         abort(403);
     }
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:13,代码来源:TableAuthorizer.php


示例9: normalize

 /**
  * Normalize button input.
  *
  * @param TableBuilder $builder
  */
 public function normalize(TableBuilder $builder)
 {
     $buttons = $builder->getButtons();
     foreach ($buttons as $key => &$button) {
         $button = $this->process($key, $button);
     }
     $builder->setButtons($buttons);
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:13,代码来源:ButtonNormalizer.php


示例10: defaults

 /**
  * Default table views.
  *
  * @param TableBuilder $builder
  */
 public function defaults(TableBuilder $builder)
 {
     if (!($stream = $builder->getTableStream())) {
         return;
     }
     if ($stream->isTrashable() && !$builder->getViews()) {
         $builder->setViews(['all', 'trash']);
     }
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:14,代码来源:ViewDefaults.php


示例11: handle

 /**
  * Save the order of the entries.
  *
  * @param SectionCollection $sections
  * @param TableBuilder      $builder
  * @param array             $selected
  */
 public function handle(SectionCollection $sections, Redirector $redirector, TableBuilder $builder, array $selected)
 {
     $prefix = $builder->getTableOption('prefix');
     $edit = array_shift($selected);
     $ids = implode(',', $selected);
     if ($section = $sections->active()) {
         $builder->setTableResponse($redirector->to($section->getHref('edit/' . $edit . '?' . $prefix . 'edit_next=' . $ids)));
     }
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:16,代码来源:Edit.php


示例12: normalize

 /**
  * Normalize action input.
  *
  * @param TableBuilder $builder
  */
 public function normalize(TableBuilder $builder)
 {
     $actions = $builder->getActions();
     $prefix = $builder->getTableOption('prefix');
     foreach ($actions as $slug => &$action) {
         $action = $this->process($prefix, $slug, $action);
     }
     $builder->setActions($actions);
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:14,代码来源:ActionNormalizer.php


示例13: build

 /**
  * Build the actions.
  *
  * @param TableBuilder $builder
  */
 public function build(TableBuilder $builder)
 {
     $table = $builder->getTable();
     $this->input->read($builder);
     foreach ($builder->getActions() as $action) {
         if (array_get($action, 'enabled', true)) {
             $table->addAction($this->factory->make($action));
         }
     }
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:15,代码来源:ActionBuilder.php


示例14: handle

 /**
  * Handle the command.
  *
  * @param  Request         $request
  * @param  ResponseFactory $response
  * @throws \Exception
  */
 public function handle(Request $request, ResponseFactory $response)
 {
     if ($this->builder instanceof MultipleTableBuilder) {
         return;
     }
     $this->dispatch(new ExecuteAction($this->builder));
     if (!$this->builder->getTableResponse()) {
         $this->builder->setTableResponse($response->redirectTo($request->fullUrl()));
     }
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:17,代码来源:PostTable.php


示例15: merge

 /**
  * Merge in registered parameters.
  *
  * @param TableBuilder $builder
  */
 public function merge(TableBuilder $builder)
 {
     $views = $builder->getViews();
     foreach ($views as &$parameters) {
         if ($view = $this->views->get(array_get($parameters, 'view'))) {
             $parameters = array_replace_recursive($view, array_except($parameters, ['view']));
         }
     }
     $builder->setViews($views);
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:15,代码来源:ViewLookup.php


示例16: guess

 /**
  * Guess the HREF for a button.
  *
  * @param TableBuilder $builder
  */
 public function guess(TableBuilder $builder)
 {
     $buttons = $builder->getButtons();
     foreach ($buttons as &$button) {
         if (isset($button['permission']) && !$this->authorizer->authorize($button['permission'])) {
             $button['enabled'] = false;
         }
     }
     $builder->setButtons($buttons);
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:15,代码来源:EnabledGuesser.php


示例17: merge

 /**
  * Merge in registered properties.
  *
  * @param TableBuilder $builder
  */
 public function merge(TableBuilder $builder)
 {
     $buttons = $builder->getButtons();
     foreach ($buttons as &$parameters) {
         if ($button = $this->buttons->get(array_get($parameters, 'button'))) {
             $parameters = array_replace_recursive($button, $parameters);
         }
     }
     $builder->setButtons($buttons);
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:15,代码来源:ButtonLookup.php


示例18: normalize

 /**
  * Normalize the column input.
  *
  * @param TableBuilder $builder
  */
 public function normalize(TableBuilder $builder)
 {
     $columns = $builder->getColumns();
     foreach ($columns as $key => &$column) {
         /*
          * If the key is non-numerical then
          * use it as the header and use the
          * column as the column if it's a class.
          */
         if (!is_numeric($key) && !is_array($column) && class_exists($column)) {
             $column = ['heading' => $key, 'column' => $column];
         }
         /*
          * If the key is non-numerical then
          * use it as the header and use the
          * column as the value.
          */
         if (!is_numeric($key) && !is_array($column) && !class_exists($column)) {
             $column = ['heading' => $key, 'value' => $column];
         }
         /*
          * If the column is not already an
          * array then treat it as the value.
          */
         if (!is_array($column)) {
             $column = ['value' => $column];
         }
         /*
          * If the key is non-numerical and
          * the column is an array without
          * a heading then use the key.
          */
         if (!is_numeric($key) && is_array($column) && !array_has($column, 'field')) {
             $column['field'] = $key;
         }
         /*
          * If the key is non-numerical and
          * the column is an array without
          * a value then use the key.
          */
         if (!is_numeric($key) && is_array($column) && !isset($column['value'])) {
             $column['value'] = $key;
         }
         /*
          * If no value wrap is set
          * then use a default.
          */
         array_set($column, 'wrapper', array_get($column, 'wrapper', '{value}'));
         /*
          * If there is no value then use NULL
          */
         array_set($column, 'value', array_get($column, 'value', null));
     }
     $builder->setColumns($columns);
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:60,代码来源:ColumnNormalizer.php


示例19: setActiveFilter

 /**
  * Set the active filter.
  *
  * @param              $slug
  * @param TableBuilder $builder
  */
 protected function setActiveFilter($slug, TableBuilder $builder)
 {
     /* @var FilterInterface $filter */
     foreach ($builder->getTableFilters() as $filter) {
         if ($filter->getSlug() === $slug) {
             $filter->setPrefix($builder->getTableOption('prefix'));
             $filter->setActive(true);
             break;
         }
     }
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:17,代码来源:SetActiveFilters.php


示例20: setActiveAction

 /**
  * Set the active action.
  *
  * @param              $slug
  * @param TableBuilder $builder
  */
 protected function setActiveAction($slug, TableBuilder $builder)
 {
     /* @var ActionInterface $action */
     foreach ($builder->getTableActions() as $action) {
         if ($action->getSlug() === $slug) {
             $action->setPrefix($builder->getTableOption('prefix'));
             $action->setActive(true);
             break;
         }
     }
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:17,代码来源:SetActiveActions.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Solr\Site类代码示例发布时间:2022-05-23
下一篇:
PHP Form\FormBuilder类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap