Exemple #1
0
 /**
  * List all slide show
  */
 public function indexAction()
 {
     //Add toolbar button
     $this->_toolbar->addPublishedButton();
     $this->_toolbar->addUnPublishedButton();
     $this->_toolbar->addNewButton();
     $this->_toolbar->addDeleteButton();
     //Add sorting
     $this->addFilter('filter_order', 'slide_show_id', 'string');
     $this->addFilter('filter_order_dir', 'DESC', 'string');
     $this->addFilter('filter_column_title', '', 'string');
     $this->addFilter('filter_slide_show_id', '', 'int');
     $this->addFilter('filter_published', '', 'string');
     //Get filter
     $filter = $this->getFilter();
     $this->view->setVar('_filter', $filter);
     $conditions = [];
     if ($filter['filter_column_title']) {
         $conditions[] = "title ILIKE '%" . htmlspecialchars($filter['filter_column_title']) . "%'";
     }
     if ($filter['filter_slide_show_id']) {
         $conditions[] = "slide_show_id = " . intval($filter['filter_slide_show_id']);
     }
     if ($filter['filter_published'] != '') {
         $conditions[] = "published = " . intval($filter['filter_published']);
     }
     $slides = SlideShows::find(['conditions' => implode(' AND ', $conditions), 'order' => $filter['filter_order'] . ' ' . $filter['filter_order_dir']]);
     $paginationLimit = $this->config->pagination->limit;
     $currentPage = $this->request->getQuery('page', 'int');
     $this->view->setVar('_page', ZPagination::getPaginationModel($slides, $paginationLimit, $currentPage));
     $this->view->setVar('_pageLayout', [['type' => 'check_all', 'column' => 'slide_show_id'], ['type' => 'index', 'title' => '#'], ['type' => 'image', 'width' => '100', 'height' => 'auto', 'uri_prefix' => '', 'column' => 'image', 'css' => 'width : 105px', 'title' => 'm_slide_form_slide_show_form_image', 'class' => 'text-center', 'default_thumbnail' => '/media/default/no-image.png'], ["type" => "link", "title" => "m_slide_form_slide_show_form_title", "column" => "title", "link" => "/admin/slide/index/edit/", "access" => $this->acl->isAllowed('slide|index|edit'), 'filter' => ['type' => 'text', 'name' => 'filter_column_title', 'attributes' => []]], ["type" => "action", "title" => "m_admin_slide_index_manage_slide_items", "css" => "width: 120px;", "class" => 'text-center', 'link_prefix' => 'slide_show_id', "action" => [['condition' => '!=', 'condition_value' => '0', 'link' => '/admin/slide/manage-slide/slide/', 'link_title' => 'Manage this slide', 'icon_class' => 'fa fa-edit', "access" => $this->acl->isAllowed('slide|manage-slide|slide')]], "column" => "title", "sort" => false], ['type' => 'published', 'title' => 'gb_published', 'access' => $this->acl->isAllowed('slide|index|edit'), 'link' => '/admin/slide/index/', 'column' => 'published', 'filter' => ['type' => 'select', 'name' => 'filter_published', 'attributes' => ['useEmpty' => true, 'emptyValue' => '0', 'emptyText' => 'All', 'value' => $filter['filter_published'] == '' ? -1 : $filter['filter_published']], 'value' => [0 => 'No', 1 => 'Yes']]], ['type' => 'id', 'title' => 'gb_id', 'column' => 'slide_show_id', 'css' => 'width : 100px', 'filter' => ['type' => 'text', 'name' => 'filter_slide_show_id', 'attributes' => []]]]);
 }
Exemple #2
0
 /**
  * @return string
  */
 public function form()
 {
     $title = isset($this->options->title) ? $this->options->title : "";
     $slide_show_id = isset($this->options->slide_show_id) ? $this->options->slide_show_id : "";
     $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>';
     $form .= '<p><label for="' . $this->getFieldId('slide_show_id') . '">' . __('w_slide_show_form_id_slide_show') . '</label><br/>';
     //Get all slide show
     $slideShows = SlideShows::find(['conditions' => 'published = 1', 'order' => 'slide_show_id ASC']);
     $form .= Tag::select([$this->getFieldName('slide_show_id'), $slideShows, 'using' => ['slide_show_id', 'title'], 'class' => 'form-control input-sm', 'value' => $slide_show_id]);
     $form .= '</p>';
     return $form;
 }