Ejemplo n.º 1
0
 public function action()
 {
     Exits::exit403If(!Operator::currentOperatorHasAnyOfPermissions([Permissions::PERMISSION_PHPAUTH_MANAGE_OPERATORS]));
     $operator_id = $this->operator_id;
     $operator_obj = Operator::factory($operator_id);
     $html = '<div class="col-md-6">';
     $html .= '<h2>Параметры</h2>';
     $html .= CRUDForm::html($operator_obj, [new CRUDFormRow('title', new CRUDFormWidgetInput('title')), new CRUDFormRow('описание', new CRUDFormWidgetTextarea('description')), new CRUDFormRow('User id', new CRUDFormWidgetReferenceAjax('user_id', User::class, 'login', (new UsersListAjaxAction())->url(), (new UserEditAction('REFERENCED_ID'))->url()))]);
     $new_operator_permission_obj = new OperatorPermission();
     $new_operator_permission_obj->setOperatorId($operator_id);
     $html .= '</div><div class="col-md-6">';
     if (Operator::currentOperatorHasAnyOfPermissions([Permissions::PERMISSION_PHPAUTH_MANAGE_OPERATORS])) {
         $html .= '<h2>Назначенные разрешения</h2>';
         $html .= HTML::div('', '', function () use($operator_id) {
             $new_permissiontouser_obj = new OperatorPermission();
             $new_permissiontouser_obj->setOperatorId($operator_id);
             echo CRUDTable::html(OperatorPermission::class, '', [new \OLOG\CRUD\CRUDTableColumn('Разрешение', new \OLOG\CRUD\CRUDTableWidgetText('{' . Permission::class . '.{this->permission_id}->title}')), new \OLOG\CRUD\CRUDTableColumn('Удалить', new \OLOG\CRUD\CRUDTableWidgetDelete())], [new CRUDTableFilterEqualInvisible('operator_id', $operator_id)], '');
             echo CallapsibleWidget::buttonAndCollapse('Показать все неназначенные разрешения', function () use($operator_id) {
                 $html = CRUDTable::html(Permission::class, '', [new CRUDTableColumn('Разрешение', new CRUDTableWidgetTextWithLink('{this->title}', (new PermissionAddToOperatorAction($operator_id, '{this->id}'))->url())), new CRUDTableColumn('', new CRUDTableWidgetTextWithLink('Добавить оператору', (new PermissionAddToOperatorAction($operator_id, '{this->id}'))->url(), 'btn btn-default btn-xs'))], [new CRUDTableFilterNotInInvisible('id', OperatorPermission::getPermissionIdsArrForOperatorId($operator_id))], 'id', '79687tg8976rt87');
                 return $html;
             });
         });
     }
     $html .= '</div>';
     AdminLayoutSelector::render($html, $this);
 }
Ejemplo n.º 2
0
 public function action()
 {
     \OLOG\Exits::exit403If(!Auth::currentUserHasAnyOfPermissions([1]));
     $html = '';
     $html .= \OLOG\CRUD\CRUDTable::html(\CRUDDemo\DemoTerm::class, CRUDForm::html(new DemoTerm(), [new CRUDFormRow('Title', new CRUDFormWidgetInput('title', false, true)), new CRUDFormRow('Chooser', new CRUDFormWidgetRadios('chooser', [1 => 'one', 2 => 'two'], true, true)), new CRUDFormRow('Options', new CRUDFormWidgetOptions('options', [1 => 'one', 2 => 'two'], false, true))]), [new CRUDTableColumn('Edit', new CRUDTableWidgetTextWithLink('{this->title}', DemoTermEditAction::getUrl('{this->id}'))), new CRUDTableColumn('Vocabulary', new CRUDTableWidgetOptions('{this->vocabulary_id}', DemoTerm::VOCABULARIES_ARR)), new CRUDTableColumn('Parent', new CRUDTableWidgetText('{' . DemoTerm::class . '.{this->parent_id}->title}')), new CRUDTableColumn('', new CRUDTableWidgetWeight(['parent_id' => null])), new CRUDTableColumn('', new CRUDTableWidgetDelete())], [new CRUDTableFilterEqualInvisible('parent_id', null), new CRUDTableFilterEqualOptionsInline('34785ty8y45t8', 'Словарь', 'vocabulary_id', DemoTerm::VOCABULARIES_ARR, false, null, true), new CRUDTableFilterEqualOptionsInline('345634g3tg534', '', 'gender', DemoTerm::GENDER_ARR, false, null, true, 'М. и Ж.'), new CRUDTableFilterLikeInline('3748t7t45gdfg', '', 'title', 'Название содержит')], 'weight', '8726438755234', CRUDTable::FILTERS_POSITION_INLINE);
     DemoLayoutTemplate::render($html, 'Термы', self::breadcrumbsArr());
 }
Ejemplo n.º 3
0
 public function action($node_id)
 {
     \OLOG\Exits::exit403If(!Auth::currentUserHasAnyOfPermissions([1]));
     $html = self::tabsHtml($node_id);
     $html .= '<div>&nbsp;</div>';
     $node_obj = DemoNode::factory($node_id);
     $html .= \OLOG\CRUD\CRUDForm::html($node_obj, [new CRUDFormRow('Id', new CRUDFormWidgetInput('id')), new CRUDFormRow('Title', new CRUDFormWidgetTextarea('title', true)), new CRUDFormRow('image_path_in_images nullable', new CRUDFormWidgetInput('image_path_in_images', true)), new CRUDFormRow('Date', new CRUDFormWidgetTimestamp('created_at_ts')), new CRUDFormRow('is_published', new CRUDFormWidgetRadios('is_published', [0 => 'no', 1 => 'yes'])), new CRUDFormRow('published_at_datetime_str', new CRUDFormWidgetDateTime('published_at_datetime_str')), new CRUDFormRowHtml('<h2>Extra fields</h2>'), new CRUDFormRow('expiration_date nullable', new CRUDFormWidgetDate('expiration_date')), new CRUDFormRow('State code', new CRUDFormWidgetOptions('state_code', [1 => 'announce', 2 => 'live', 3 => 'archive'])), new CRUDFormRow('State code', new CRUDFormWidgetHtml('<ul><li>html widget - line 1</li><li>html widget - line 2</li></ul>')), new CRUDFormVerticalRow('пример Medium Editor', new CRUDFormWidgetMediumEditor('body2')), new CRUDFormVerticalRow('пример Ace Editor', new CRUDFormWidgetAceTextarea('body'))]);
     DemoLayoutTemplate::render($html, 'Node ' . $node_id, self::breadcrumbsArr($node_id));
 }
Ejemplo n.º 4
0
 public function action($node_id)
 {
     \OLOG\Exits::exit403If(!Auth::currentUserHasAnyOfPermissions([1]));
     $html = DemoNodeEditAction::tabsHtml($node_id);
     $html .= '<div>&nbsp;</div>';
     $new_term_to_node = new DemoTermToNode();
     $new_term_to_node->setNodeId($node_id);
     $html .= CRUDTable::html(DemoTermToNode::class, CRUDForm::html($new_term_to_node, [new CRUDFormInvisibleRow(new CRUDFormWidgetInput('node_id')), new CRUDFormRow('Term id', new CRUDFormWidgetReference('term_id', DemoTerm::class, 'title'), 'Рубрика, с которой должен быть связан материал')]), [new CRUDTableColumn('Term', new CRUDTableWidgetText('{' . DemoTerm::class . '.{this->term_id}->title}')), new CRUDTableColumn('Delete', new CRUDTableWidgetDelete())], [new CRUDTableFilterEqualInvisible('node_id', $node_id)]);
     DemoLayoutTemplate::render($html, 'Node ' . $node_id, DemoNodeEditAction::breadcrumbsArr($node_id));
 }
Ejemplo n.º 5
0
 public function action()
 {
     \OLOG\Exits::exit403If(!Auth::currentUserHasAnyOfPermissions([1]));
     $table_id = 'tableContainer_NodeList';
     $form_id = 'formElem_NodeList';
     $html = '';
     $html .= CRUDTable::html(DemoNode::class, \OLOG\CRUD\CRUDForm::html(new DemoNode(), [new CRUDFormRow('Title', new CRUDFormWidgetInput('title')), new CRUDFormRow('body2', new CRUDFormWidgetInput('body2'))], '', [], $form_id), [new CRUDTableColumn('Title', new CRUDTableWidgetHtmlWithLink('{this->title}<br>{this->getReverseTitle()}', DemoNodeEditAction::getUrl('{this->id}'))), new CRUDTableColumn('Reverse title', new CRUDTableWidgetText('{this->getReverseTitle()}')), new CRUDTableColumn('', new CRUDTableWidgetDelete())], [], 'title', $table_id);
     // Загрузка скриптов
     $html .= CRUDCreateFormScript::getHtml($form_id, $table_id);
     DemoLayoutTemplate::render($html, 'Nodes', self::getBreadcrumbsArr());
 }
Ejemplo n.º 6
0
 public function action($term_id)
 {
     \OLOG\Exits::exit403If(!Auth::currentUserHasAnyOfPermissions([1]));
     $html = '';
     $term_obj = DemoTerm::factory($term_id);
     $html .= \OLOG\CRUD\CRUDForm::html($term_obj, [new CRUDFormVerticalRow('Title', new CRUDFormWidgetInput('title', false, true), 'Comment string'), new CRUDFormVerticalRow('weight', new CRUDFormWidgetInput('weight', false, true)), new CRUDFormRow('Chooser', new CRUDFormWidgetRadios('chooser', [1 => 'one', 2 => 'two'], true, true)), new CRUDFormRow('Gender', new CRUDFormWidgetRadios('gender', [1 => 'male', 2 => 'female'], true)), new CRUDFormRow('Options', new CRUDFormWidgetOptions('options', [1 => 'one', 2 => 'two'], false, true)), new CRUDFormRow('Vocabulary', new CRUDFormWidgetOptions('vocabulary_id', DemoTerm::VOCABULARIES_ARR, false, true)), new CRUDFormRow('Parent id', new CRUDFormWidgetReferenceAjax('parent_id', DemoTerm::class, 'title', DemoAjaxTermsListAction::getUrl(), DemoTermEditAction::getUrl('REFERENCED_ID')))]);
     $html .= '<h2>Child terms</h2>';
     $new_term_obj = new DemoTerm();
     $new_term_obj->setParentId($term_id);
     $html .= \OLOG\CRUD\CRUDTable::html(\CRUDDemo\DemoTerm::class, \OLOG\CRUD\CRUDForm::html($new_term_obj, [new CRUDFormRow('Title', new CRUDFormWidgetInput('title')), new CRUDFormInvisibleRow(new CRUDFormWidgetInput('parent_id'))]), [new CRUDTableColumn('Title', new CRUDTableWidgetTextWithLink('{this->title}', DemoTermEditAction::getUrl('{this->id}'))), new CRUDTableColumn('Weight', new CRUDTableWidgetWeight(['parent_id' => $term_id])), new CRUDTableColumn('Delete', new CRUDTableWidgetDelete())], [new CRUDTableFilterEqualInvisible('parent_id', $term_id)], 'weight');
     DemoLayoutTemplate::render($html, 'Term ' . $term_id, self::breadcrumbsArr($term_id));
 }
Ejemplo n.º 7
0
 public static function userInGroupsTable($user_id)
 {
     if (!Operator::currentOperatorHasAnyOfPermissions([Permissions::PERMISSION_PHPAUTH_MANAGE_GROUPS])) {
         return '';
     }
     $html = '';
     $html .= '<h2>В составе групп</h2>';
     $new_user_to_group_obj = new UserToGroup();
     $new_user_to_group_obj->setUserId($user_id);
     $html .= CRUDTable::html(UserToGroup::class, CRUDForm::html($new_user_to_group_obj, [new CRUDFormInvisibleRow(new CRUDFormWidgetInput(UserToGroup::_USER_ID)), new CRUDFormRow('Группа', new CRUDFormWidgetReferenceAjax(UserToGroup::_GROUP_ID, Group::class, Group::_TITLE, (new GroupsListAjaxAction())->url(), (new GroupEditAction('REFERENCED_ID'))->url(), true))]), [new CRUDTableColumn('Группа', new CRUDTableWidgetTextWithLink('{' . Group::class . '.{this->' . UserToGroup::_GROUP_ID . '}->' . Group::_TITLE . '}', (new GroupEditAction('{this->' . UserToGroup::_GROUP_ID . '}'))->url())), new CRUDTableColumn('Удалить', new CRUDTableWidgetDelete())], [new CRUDTableFilterEqualInvisible(UserToGroup::_USER_ID, $user_id)]);
     return $html;
 }
Ejemplo n.º 8
0
 public function action()
 {
     Exits::exit403If(!Operator::currentOperatorHasAnyOfPermissions([Permissions::PERMISSION_PHPAUTH_MANAGE_OPERATORS]));
     $html = \OLOG\CRUD\CRUDTable::html(\OLOG\Auth\Operator::class, CRUDForm::html(new Operator(), [new CRUDFormRow('user_id', new CRUDFormWidgetReference('user_id', User::class, 'login')), new CRUDFormRow('title', new CRUDFormWidgetInput('title')), new CRUDFormRow('Описание', new CRUDFormWidgetTextarea('description'))]), [new \OLOG\CRUD\CRUDTableColumn('ID', new \OLOG\CRUD\CRUDTableWidgetTextWithLink('{this->id}', (new OperatorEditAction('{this->id}'))->url())), new \OLOG\CRUD\CRUDTableColumn('title', new \OLOG\CRUD\CRUDTableWidgetText('{this->title}')), new \OLOG\CRUD\CRUDTableColumn('описание', new \OLOG\CRUD\CRUDTableWidgetText('{this->description}')), new \OLOG\CRUD\CRUDTableColumn('login', new \OLOG\CRUD\CRUDTableWidgetText('{\\OLOG\\Auth\\User.{this->user_id}->login}'))], [new CRUDTableFilterLike('title_1287318', 'title', 'title'), new CRUDTableFilterLike('description_1287318', 'описание', 'description')], '', '1', \OLOG\CRUD\CRUDTable::FILTERS_POSITION_TOP);
     AdminLayoutSelector::render($html, $this);
 }
Ejemplo n.º 9
0
 public function action()
 {
     Exits::exit403If(!Operator::currentOperatorHasAnyOfPermissions([Permissions::PERMISSION_PHPAUTH_MANAGE_USERS]));
     $html = \OLOG\CRUD\CRUDTable::html(\OLOG\Auth\User::class, CRUDForm::html(new User(), [new CRUDFormRow('login', new CRUDFormWidgetInput('login')), new CRUDFormRow('Комментарий', new CRUDFormWidgetTextarea('description'))]), [new \OLOG\CRUD\CRUDTableColumn('Логин', new \OLOG\CRUD\CRUDTableWidgetTextWithLink('{this->login}', (new UserEditAction('{this->id}'))->url())), new \OLOG\CRUD\CRUDTableColumn('Создан', new \OLOG\CRUD\CRUDTableWidgetTimestamp('{this->created_at_ts}')), new \OLOG\CRUD\CRUDTableColumn('Комментарий', new \OLOG\CRUD\CRUDTableWidgetText('{this->description}')), new \OLOG\CRUD\CRUDTableColumn('Основная группа', new \OLOG\CRUD\CRUDTableWidgetText('{' . Group::class . '.{this->' . User::_PRIMARY_GROUP_ID . '}->title}')), new \OLOG\CRUD\CRUDTableColumn('Удалить', new \OLOG\CRUD\CRUDTableWidgetDelete())], [new CRUDTableFilterLike('login_1287318', 'login', 'login'), new CRUDTableFilterLike('description_1287318', 'комментарий', 'description'), new \OLOG\Auth\CRUDTableFilterOwnerInvisible()], 'login', '1', \OLOG\CRUD\CRUDTable::FILTERS_POSITION_TOP);
     AdminLayoutSelector::render($html, $this);
 }
Ejemplo n.º 10
0
 public function action()
 {
     Exits::exit403If(!Operator::currentOperatorHasAnyOfPermissions([Permissions::PERMISSION_PHPAUTH_MANAGE_GROUPS]));
     $html = \OLOG\CRUD\CRUDTable::html(\OLOG\Auth\Group::class, CRUDForm::html(new Group(), [new CRUDFormRow('title', new CRUDFormWidgetInput(Group::_TITLE))]), [new \OLOG\CRUD\CRUDTableColumn('Title', new \OLOG\CRUD\CRUDTableWidgetTextWithLink('{this->' . Group::_TITLE . '}', (new GroupEditAction('{this->id}'))->url())), new \OLOG\CRUD\CRUDTableColumn('Создана', new \OLOG\CRUD\CRUDTableWidgetTimestamp('{this->created_at_ts}')), new \OLOG\CRUD\CRUDTableColumn('Удалить', new \OLOG\CRUD\CRUDTableWidgetDelete())], [new CRUDTableFilterLike('wgieruygfigfe', 'Title', Group::_TITLE), new CRUDTableFilterOwnerInvisible()], 'title', '1', \OLOG\CRUD\CRUDTable::FILTERS_POSITION_TOP);
     AdminLayoutSelector::render($html, $this);
 }
Ejemplo n.º 11
0
 public static function usersInGroupTable($group_id)
 {
     if (!Operator::currentOperatorHasAnyOfPermissions([Permissions::PERMISSION_PHPAUTH_MANAGE_USERS])) {
         return '';
     }
     $html = '<h2>Пользователи в группе</h2>';
     $new_user_to_group_obj = new UserToGroup();
     $new_user_to_group_obj->setGroupId($group_id);
     $html .= CRUDTable::html(UserToGroup::class, CRUDForm::html($new_user_to_group_obj, [new CRUDFormInvisibleRow(new CRUDFormWidgetInput(UserToGroup::_GROUP_ID)), new CRUDFormRow('Пользователь', new CRUDFormWidgetReferenceAjax(UserToGroup::_USER_ID, User::class, User::_LOGIN, (new UsersListAjaxAction())->url(), (new UserEditAction('REFERENCED_ID'))->url(), true))]), [new CRUDTableColumn('Логин', new \OLOG\CRUD\CRUDTableWidgetTextWithLink('{' . User::class . '.{this->' . UserToGroup::_USER_ID . '}->' . User::_LOGIN . '}', (new UserEditAction('{this->' . UserToGroup::_USER_ID . '}'))->url())), new CRUDTableColumn('Удалить', new CRUDTableWidgetDelete())], [new CRUDTableFilterEqualInvisible(UserToGroup::_GROUP_ID, $group_id)]);
     return $html;
 }