public function register()
 {
     Column::register('action', \KodiCMS\SleepingOwlAdmin\Columns\Column\Action::class);
     Column::register('checkbox', \KodiCMS\SleepingOwlAdmin\Columns\Column\Checkbox::class);
     Column::register('control', \KodiCMS\SleepingOwlAdmin\Columns\Column\Control::class);
     Column::register('count', \KodiCMS\SleepingOwlAdmin\Columns\Column\Count::class);
     Column::register('custom', \KodiCMS\SleepingOwlAdmin\Columns\Column\Custom::class);
     Column::register('datetime', \KodiCMS\SleepingOwlAdmin\Columns\Column\DateTime::class);
     Column::register('filter', \KodiCMS\SleepingOwlAdmin\Columns\Column\Filter::class);
     Column::register('image', \KodiCMS\SleepingOwlAdmin\Columns\Column\Image::class);
     Column::register('lists', \KodiCMS\SleepingOwlAdmin\Columns\Column\Lists::class);
     Column::register('order', \KodiCMS\SleepingOwlAdmin\Columns\Column\Order::class);
     Column::register('string', \KodiCMS\SleepingOwlAdmin\Columns\Column\String::class);
     Column::register('link', \KodiCMS\SleepingOwlAdmin\Columns\Column\Link::class);
     Column::register('email', \KodiCMS\SleepingOwlAdmin\Columns\Column\Email::class);
     Column::register('treeControl', \KodiCMS\SleepingOwlAdmin\Columns\Column\TreeControl::class);
     Column::register('url', \KodiCMS\SleepingOwlAdmin\Columns\Column\Url::class);
 }
 /**
  * @return array
  */
 public function getAllColumns()
 {
     $columns = $this->getColumns();
     if ($this->isControlActive()) {
         $columns[] = Column::control();
     }
     return $columns;
 }
 /**
  * @return array
  */
 public function getParams()
 {
     $model = $this->getModel();
     return ['items' => $this->getRepository()->getTree(), 'reorderable' => $this->isReorderable(), 'url' => $model->getDisplayUrl(), 'value' => $this->getValue(), 'creatable' => !is_null($model->create()), 'createUrl' => $model->createUrl($this->getParameters() + Input::all()), 'controls' => [Column::treeControl()]];
 }
예제 #4
0
<?php

use KodiCMS\Users\Model\User;
use KodiCMS\Users\Model\UserRole;
use KodiCMS\SleepingOwlAdmin\Filter\Filter;
use KodiCMS\SleepingOwlAdmin\Columns\Column;
use KodiCMS\SleepingOwlAdmin\Filter\FilterBase;
use KodiCMS\SleepingOwlAdmin\FormItems\FormItem;
use KodiCMS\SleepingOwlAdmin\Display\DisplayTabbed;
use KodiCMS\SleepingOwlAdmin\Model\ModelConfiguration;
SleepingOwlModule::registerModel(User::class, function (ModelConfiguration $model) {
    $model->setTitle('User')->onDisplay(function () {
        $display = SleepingOwlDisplay::tabbed();
        $display->setTabs(function (DisplayTabbed $tabbed) {
            $tabbed->appendDisplay(SleepingOwlDisplay::table()->setFilters([Filter::field('name')->setOperator(FilterBase::BEGINS_WITH)->setValue('ad')])->setColumns([Column::link('name')->setLabel('name'), Column::lists('roles.name')->setLabel('Roles')->setWidth('300px'), Column::email('email')->setLabel('E-mail')->setWidth('200px')]), 'First Tab');
            $tabbed->appendDisplay(SleepingOwlDisplay::table()->setColumns([Column::link('username')->setLabel('Username')]), 'Second Tab');
        });
        return $display;
    })->onCreateAndEdit(function () {
        $form = SleepingOwlForm::form();
        $form->setItems(FormItem::columns()->addColumn(function () {
            return [FormItem::wysiwyg('name', 'Username', 'ace')->required(), FormItem::text('email', 'E-mail')->required()->addValidationRule('email'), FormItem::timestamp('created_at', 'Date creation'), FormItem::multiselect('roles', 'Roles')->setModelForOptions(new UserRole())->setDisplay('name')];
        }));
        return $form;
    });
})->addMenuLink(User::class)->setIcon('users');