Пример #1
0
 /**
  * Admin widget form
  *
  * @return string
  */
 public function form()
 {
     $menu_left = isset($this->options->menu_left) ? $this->options->menu_left : '';
     $menu_right = isset($this->options->menu_right) ? $this->options->menu_right : '';
     $title = isset($this->options->title) ? $this->options->title : '';
     $form = '<p><label for="' . $this->getFieldId('title') . '">' . __('gb_title') . '</label>';
     $form .= Tag::textField([$this->getFieldName('title'), 'class' => 'form-control input-sm', 'value' => $title]);
     $form .= '</p>';
     $menuTypeAvailable = MenuTypes::find(['order' => 'name ASC']);
     $form .= '<p><label for="' . $this->getFieldId('menu_left') . '">' . __('w_menu_form_label_select_menu_left') . '</label>';
     $form .= Tag::select([$this->getFieldName('menu_left'), $menuTypeAvailable, 'using' => ['menu_type_id', 'name'], 'class' => 'form-control input-sm', 'value' => $menu_left, 'usingEmpty' => true]);
     $form .= '</p>';
     $form .= '<p><label for="' . $this->getFieldId('menu_left') . '">' . __('w_menu_form_label_select_menu_right') . '</label>';
     $form .= Tag::select([$this->getFieldName('menu_right'), $menuTypeAvailable, 'using' => ['menu_type_id', 'name'], 'class' => 'form-control input-sm', 'value' => $menu_right, 'usingEmpty' => true]);
     $form .= '</p>';
     return $form;
 }
Пример #2
0
 /**
  * View All Menu Type
  */
 public function indexAction()
 {
     //Add toolbar button
     $this->_toolbar->addNewButton();
     $this->_toolbar->addDeleteButton();
     //Add filter
     $this->addFilter('filter_order', 'menu_type_id', 'string');
     $this->addFilter('filter_order_dir', 'ASC', 'string');
     //Get all filter
     $this->getFilter();
     $conditions = [];
     $conditions[] = 'menu_type_id > 0';
     //Get all item
     $items = MenuTypes::find(['conditions' => implode(' AND ', $conditions), 'order' => $this->_filter['filter_order'] . ' ' . $this->_filter['filter_order_dir']]);
     //Create pagination
     $this->view->setVar('_page', ZPagination::getPaginationModel($items, $this->config->pagination->limit, $this->request->getQuery('page', 'int', 1)));
     //Set search value
     $this->view->setVar('_filter', $this->_filter);
     //Set column name, value
     $this->view->setVar('_pageLayout', [['type' => 'check_all', 'column' => 'menu_type_id'], ['type' => 'index', 'title' => '#'], ['type' => 'link', 'title' => 'm_menu_form_menu_type_name', 'sort' => true, 'column' => 'name', 'link' => '/admin/menu/index/edit/', 'access' => $this->acl->isAllowed('menu|index|edit')], ['type' => 'date', 'title' => 'gb_created_at', 'sort' => true, 'column' => 'created_at'], ['type' => 'date', 'title' => 'gb_updated_at', 'sort' => true, 'column' => 'updated_at'], ['type' => 'id', 'title' => 'gb_id', 'column' => 'menu_type_id']]);
 }