예제 #1
0
 /**
  * List all widgets
  */
 public function indexAction()
 {
     //Update info all widget
     $this->updateInfoAllWidget();
     //Add toolbar button
     $this->_toolbar->addPublishedButton();
     $this->_toolbar->addUnPublishedButton();
     //Add filter
     $this->addFilter('filter_order', 'title', 'string');
     $this->addFilter('filter_order_dir', 'ASC', 'string');
     //Get all filter
     $filter = $this->getFilter();
     //Create conditions
     $conditions = [];
     //Get Items
     $items = CoreWidgets::find(['conditions' => implode(' AND ', $conditions), 'order' => $filter['filter_order'] . ' ' . $filter['filter_order_dir']]);
     //Current page
     $currentPage = $this->request->getQuery('page', 'int');
     $paginationLimit = $this->config->pagination->limit;
     //Create pagination
     $this->view->setVar('_page', ZPagination::getPaginationModel($items, $paginationLimit, $currentPage));
     //Set search value
     $this->view->setVar('_filter', $filter);
     //Set column name, value
     $this->view->setVar('_pageLayout', [['type' => 'check_all', 'column' => 'widget_id'], ['type' => 'index'], ['type' => 'text', 'title' => 'gb_widget_name', 'column' => 'title', 'translation' => true, 'sort' => false], ['type' => 'text', 'title' => 'gb_description', 'column' => 'description', 'translation' => true, 'sort' => false], ['type' => 'text', 'title' => 'gb_author', 'class' => 'text-center', 'column' => 'author'], ['type' => 'text', 'title' => 'gb_version', 'class' => 'text-center', 'column' => 'version'], ['type' => 'published', 'title' => 'gb_published', 'column' => 'published', 'link' => '/admin/template/widget/', 'access' => $this->acl->isAllowed('template|widget|published')], ['type' => 'id', 'title' => 'gb_id', 'column' => 'widget_id']]);
 }
예제 #2
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' => []]]]);
 }
예제 #3
0
 /**
  * View Index
  */
 public function indexAction()
 {
     //Add translation frontend
     ZTranslate::getInstance()->addModuleLang(get_child_folder(APP_DIR . '/frontend/'), 'frontend');
     $this->updateAction(false);
     $this->_toolbar->addPublishedButton();
     $this->_toolbar->addUnPublishedButton();
     $this->_toolbar->addUpdateButton();
     $this->_toolbar->addDeleteButton();
     $this->_toolbar->addCustomButton('deleteCache', 'gb_delete_cache', null, 'fa fa-eraser', 'btn btn-danger delete');
     //Add filter
     $this->addFilter('filter_order', 'ordering', 'string');
     $this->addFilter('filter_order_dir', 'ASC', 'string');
     $this->addFilter('filter_location', '', 'string');
     //Get all filter
     $filter = $this->getFilter();
     $conditions = [];
     if ($filter['filter_location']) {
         $conditions[] = "location = '" . $filter['filter_location'] . "'";
     }
     //Get all template
     $items = CoreModules::find(['conditions' => implode(' AND ', $conditions), 'order' => $filter['filter_order'] . ' ' . $filter['filter_order_dir']]);
     $currentPage = $this->request->getQuery('page', 'int');
     $paginationLimit = $this->config->pagination->limit;
     $filter_location = ['' => __('gb_select_location'), 'backend' => __('gb_backend'), 'frontend' => __('gb_frontend')];
     //Set filter to view
     $this->view->setVar('filter_location', $filter_location);
     //Create pagination
     $this->view->setVar('_page', ZPagination::getPaginationModel($items, $paginationLimit, $currentPage));
     //Set search value
     $this->view->setVar('_filter', $filter);
     //Set column name, value
     $this->view->setVar('_pageLayout', [['type' => 'check_all', 'column' => 'module_id'], ['type' => 'index', 'title' => '#'], ['type' => 'text', 'title' => 'gb_module_name', 'column' => 'name', 'translation' => true, 'sort' => false], ['type' => 'text', 'title' => 'gb_version', 'class' => 'text-center col-version', 'column' => 'version'], ['type' => 'text', 'title' => 'gb_author', 'class' => 'text-center col-author', 'column' => 'author'], ['type' => 'text', 'title' => 'gb_location', 'class' => 'text-center col-location', 'column' => 'location', 'label' => [['condition' => '==', 'condition_value' => 'backend', 'class' => 'label label-sm label-success', 'text' => 'gb_backend'], ['condition' => '!=', 'condition_value' => 'backend', 'class' => 'label label-sm label-warning', 'text' => 'gb_frontend']], 'translation' => true], ['type' => 'published_is_core', 'title' => 'gb_published', 'column' => 'published', 'link' => '/admin/system/module/', 'access' => $this->acl->isAllowed('module|index|index')], ['type' => 'actions', 'title' => 'gb_ordering', 'link_prefix' => 'module_id', 'class' => 'text-center', 'column' => 'ordering', 'display_value' => true, 'actions' => [['link_title' => 'gb_move_up', 'link' => '/admin/system/module/moveUp/', 'link_class' => '', 'icon_class' => 'glyphicon glyphicon-chevron-up', 'access' => $this->acl->isAllowed('update')], ['link_title' => 'gb_move_down', 'link' => '/admin/system/module/moveDown/', 'link_class' => '', 'icon_class' => 'glyphicon glyphicon-chevron-down', 'access' => $this->acl->isAllowed('update')]]], ['type' => 'id', 'title' => 'gb_id', 'column' => 'module_id']]);
 }
예제 #4
0
 /**
  * List all backup
  */
 public function indexAction()
 {
     $this->_toolbar->addBreadcrumb('m_system_system_manager');
     $this->_toolbar->addBreadcrumb('m_system_backup_database');
     $this->_toolbar->addHeaderPrimary('m_system_backup_database');
     $this->_toolbar->addCustomButton('system|database|backup', 'Backup Database', '/admin/system/database/backup/', 'glyphicon glyphicon-floppy-disk', 'btn btn-success');
     $this->_toolbar->addCustomButton('system|database|fullBackUp', 'Backup Full Site', '/admin/system/database/fullBackUp/', 'glyphicon glyphicon-retweet', 'btn btn-primary');
     $filesBackup = glob(APP_DIR . '/backup/database/' . '*.backup');
     $files = [];
     foreach ($filesBackup as $index => $file) {
         $fileOb = new \stdClass();
         $fileOb->id = $index + 1;
         $fileOb->name = basename($file);
         $fileOb->base64Name = base64_encode($fileOb->name);
         $fileOb->size = number_format(filesize($file) / (1024 * 1024), 3) . ' MB';
         $files[] = $fileOb;
     }
     //Add filter
     $this->addFilter('filter_order', 'id', 'string');
     $this->addFilter('filter_order_dir', 'ASC', 'string');
     //Get all filter
     $filter = $this->getFilter();
     $this->view->setVar('_filter', $filter);
     $currentPage = $this->request->get('page');
     $this->view->setVar('_page', ZPagination::getPaginationNativeArray($files, $this->config->pagination->limit, $currentPage));
     $this->view->setVar('_pageLayout', [['type' => 'check_all'], ['type' => 'index', 'title' => '#'], ['type' => 'link', 'title' => 'File Name', 'column' => 'name', 'access' => $this->acl->isAllowed('system|database|download'), 'link' => '/admin/system/database/download/', 'link_prefix' => 'base64Name', 'sort' => false], ['type' => 'text', 'title' => 'Size', 'class' => 'text-center', 'column' => 'size', 'sort' => false]]);
 }
예제 #5
0
 public function indexAction()
 {
     //Add toolbar button
     $this->_toolbar->addNewButton();
     $this->_toolbar->addEditButton();
     $this->_toolbar->addDeleteButton();
     $this->updateRules();
     UserRoles::updateModuleMenu();
     $this->updateACLCache();
     //Add filter
     $this->addFilter("filter_order", "role_id", "string");
     $this->addFilter("filter_order_dir", "ASC", "string");
     $conditions = [];
     $conditions[] = 'ar.is_super_admin != 1';
     //Get all filter
     $filter = $this->getFilter();
     $items = $this->modelsManager->createBuilder()->columns('ar.role_id AS id, ar.name AS name, ar.is_default, ar.location, ar.updated_at AS updated_at, ar.updated_by AS updated_by, ar.created_at AS created_at')->addFrom('ZCMS\\Core\\Models\\UserRoles', "ar")->where(implode(' AND ', $conditions))->orderBy($filter['filter_order'] . ' ' . $filter['filter_order_dir']);
     $currentPage = $this->request->getQuery("page", "int", 1);
     $paginationLimit = $this->config->pagination->limit;
     //Create pagination
     $this->view->setVar('_page', ZPagination::getPaginationQueryBuilder($items, $paginationLimit, $currentPage));
     //Set search value
     $this->view->setVar('_filter', $filter);
     //Set column name, value
     $this->view->setVar('_pageLayout', [['type' => 'check_all'], ['type' => 'index', 'title' => '#'], ['type' => 'link', 'title' => 'm_system_role_form_name', 'column' => 'name', 'link' => '/admin/system/role/edit/', 'access' => $this->acl->isAllowed('system|role|edit')], ['type' => 'text', 'title' => 'gb_is_default', 'column' => 'is_default', 'class' => 'text-center col-location', 'label' => [['condition' => '==', 'condition_value' => '1', 'class' => 'glyphicon glyphicon-star orange', 'text' => ''], ['condition' => '==', 'condition_value' => '0', 'class' => 'glyphicon glyphicon-star grey', 'text' => '']]], ['type' => 'text', 'title' => 'gb_location', 'class' => 'text-center col-location', 'column' => 'location', 'label' => [['condition' => '==', 'condition_value' => 'backend', 'class' => 'label label-sm label-success', 'text' => 'gb_backend'], ['condition' => '!=', 'condition_value' => 'backend', 'class' => 'label label-sm label-warning', 'text' => 'gb_frontend']], 'translation' => true], ['type' => 'date', 'title' => 'gb_created_at', 'column' => 'created_at'], ['type' => 'date', 'title' => 'gb_updated_at', 'column' => 'updated_at'], ['type' => 'id', 'title' => 'gb_id', 'column' => 'id']]);
 }
예제 #6
0
 public function indexAction()
 {
     $this->_toolbar->addCustomButton('system|language|setDefaultLanguage', 'm_system_language_message_set_default_language', '/admin/system/language/setDefaultLanguage/', 'glyphicon glyphicon-star', 'btn btn-primary btn-sm', 'return ZCMS.customSubmit(this,\'' . __('m_system_language_message_do_you_wan_set_default_language') . '\',\'' . __('gb_please_select_item_to_set_default_language') . '\');');
     $this->_toolbar->addPublishedButton('system|language|published', '/admin/system/language/publish');
     $this->_toolbar->addUnPublishedButton('system|language|unpublished', '/admin/system/language/unPublish');
     //Add filter
     $this->addFilter('filter_order', 'language_id', 'string');
     $this->addFilter('filter_order_dir', 'ASC', 'string');
     $this->addFilter('filter_search', '', 'string');
     //Get all filter
     $filter = $this->getFilter();
     $conditions = [];
     if ($filter['filter_search'] = trim($filter['filter_search'])) {
         $conditions[] = "language_code like '%" . $filter['filter_search'] . "%' OR title like '%" . $filter['filter_search'] . "%'";
     }
     //Get all template
     $items = CoreLanguages::find(['conditions' => implode(' AND ', $conditions), 'order' => $filter['filter_order'] . ' ' . $filter['filter_order_dir']]);
     $currentPage = $this->request->getQuery('page', 'int');
     $paginationLimit = $this->config->pagination->limit;
     //Create pagination
     $this->view->setVar('_page', ZPagination::getPaginationModel($items, $paginationLimit, $currentPage));
     //Set search value
     $this->view->setVar('_filter', $filter);
     //Set column name, value
     $this->view->setVar('_pageLayout', [['type' => 'check_all', 'column' => 'language_id'], ['type' => 'index', 'title' => '#'], ['type' => 'text', 'title' => 'gb_language_title', 'column' => 'title'], ['type' => 'text', 'title' => 'gb_language_code', 'column' => 'language_code', 'class' => 'text-center col-language'], ['type' => 'action', 'title' => 'gb_default_language', 'column' => 'is_default', 'link_prefix' => 'id', 'class' => 'text-center col-language', 'action' => [['condition' => '==', 'condition_value' => '1', 'link' => '/admin/system/language/#', 'link_title' => 'gb_default_language', 'access' => 1, 'icon_class' => 'glyphicon glyphicon-star orange'], ['condition' => '==', 'condition_value' => '0', 'link' => '/admin/system/language/setDefaultLanguage/', 'link_title' => 'm_system_language_message_set_default_language', 'access' => $this->acl->isAllowed('system|language|setDefault'), 'icon_class' => 'glyphicon glyphicon-star grey']]], ['type' => 'published', 'title' => 'gb_published', 'column' => 'published', 'access' => $this->acl->isAllowed('system|language|published'), 'link' => '/admin/system/language/'], ['type' => 'id', 'title' => 'gb_id', 'column' => 'language_id']]);
 }
예제 #7
0
 /**
  * List view
  */
 public function indexAction()
 {
     //Add toolbar button
     $this->_toolbar->addEditButton();
     $this->_toolbar->addNewButton();
     $this->_toolbar->addDeleteButton();
     //Add filter
     $this->addFilter('filter_order', 'first_name', 'string');
     $this->addFilter('filter_order_dir', 'ASC', 'string');
     $this->addFilter('filter_search', '', 'string');
     $this->addFilter('filter_role', '', 'string');
     /**
      * @var UserRoles[] $roles
      */
     $roles = UserRoles::find();
     $rolesData = ['' => __('gb_select_role')];
     foreach ($roles as $role) {
         $rolesData[$role->role_id] = $role->name;
     }
     $this->view->setVar('rolesData', $rolesData);
     //Get all filter
     $filter = $this->getFilter();
     //echo '<pre>'; var_dump($filter);echo '</pre>'; die();
     $conditions = [];
     //$conditions[] = 'user_id != ' . Users::getCurrentUser()['id'];
     if (trim($filter['filter_role'])) {
         $conditions[] = "role_id = " . intval($filter['filter_role']);
     }
     $filter['filter_search'] = trim($filter['filter_search']);
     if ($filter['filter_search']) {
         $conditions[] = "CONCAT(first_name, ' ', last_name) ILIKE '%" . $filter['filter_search'] . "%' OR email like '%" . $filter['filter_search'] . "%'";
     }
     //Get all user
     $items = Users::find(['conditions' => implode(' AND ', $conditions), 'order' => $filter['filter_order'] . ' ' . $filter['filter_order_dir']]);
     $currentPage = $this->request->getQuery('page', 'int');
     $paginationLimit = $this->config->pagination->limit;
     $filter_location = ['' => __('gb_select_location'), 'backend' => __('gb_backend'), 'frontend' => __('gb_frontend')];
     //Set filter to view
     $this->view->setVar('filter_location', $filter_location);
     //Create pagination
     $this->view->setVar('_page', ZPagination::getPaginationModel($items, $paginationLimit, $currentPage));
     //Set search value
     $this->view->setVar('_filter', $filter);
     //Set column name, value
     $this->view->setVar('_pageLayout', [['type' => 'check_all', 'column' => 'user_id'], ['type' => 'index', 'title' => '#'], ['type' => 'link', 'title' => 'gb_user_first_name', 'link' => '/admin/system/user/edit/', 'link_prefix' => 'user_id', 'access' => $this->acl->isAllowed('system|user|edit'), 'column' => 'first_name'], ['type' => 'link', 'title' => 'gb_user_last_name', 'column' => 'last_name', 'link' => '/admin/system/user/edit/', 'link_prefix' => 'user_id', 'access' => $this->acl->isAllowed('system|user|edit')], ['type' => 'text', 'title' => 'gb_user_email', 'column' => 'email'], ['type' => 'text', 'title' => 'Role', 'column' => 'role_id', 'array_values' => $rolesData], ['type' => 'active', 'title' => 'gb_is_active', 'column' => 'is_active', 'access' => $this->acl->isAllowed('system|user|active'), 'link' => '/admin/system/user/'], ['type' => 'id', 'title' => 'gb_id', 'column' => 'user_id']]);
 }
예제 #8
0
 /**
  * Index action
  *
  * Display list template
  */
 public function indexAction()
 {
     //Add template language
     $this->_addTemplateLang();
     //Update all template backend
     $this->_updateAllTemplate('backend');
     //Update all template frontend
     $this->_updateAllTemplate('frontend');
     //Add toolbar button
     $this->_toolbar->addNewButton('install');
     //Add filter
     $this->addFilter('filter_order', 'template_id', 'string');
     $this->addFilter('filter_order_dir', 'ASC', 'string');
     $this->addFilter('filter_search', '', 'string');
     $this->addFilter('filter_location', '', 'string');
     //Get all filter
     $filter = $this->getFilter();
     $conditions = [];
     if (trim($filter['filter_search'])) {
         $conditions[] = "name like '%" . trim($filter['filter_search']) . "%'";
     }
     if ($filter['filter_location']) {
         $conditions[] = "location = '" . $filter['filter_location'] . "'";
     }
     /**
      * @var CoreTemplates[] $items
      */
     $items = CoreTemplates::find(['conditions' => implode(' AND ', $conditions), 'order' => $filter['filter_order'] . ' ' . $filter['filter_order_dir']]);
     if (!count($items)) {
         $this->flashSession->notice(__('m_template_notice_there_are_no_template_matching_your_query'));
     }
     $currentPage = $this->request->getQuery('page', 'int');
     $paginationLimit = $this->config->pagination->limit;
     $filter_location = ['' => __('gb_select_location'), 'backend' => __('gb_backend'), 'frontend' => __('gb_frontend')];
     //Set filter to view
     $this->view->setVar('filter_location', $filter_location);
     //Create pagination
     $this->view->setVar('_page', ZPagination::getPaginationModel($items, $paginationLimit, $currentPage));
     //Set search value
     $this->view->setVar('_filter', $filter);
     //Set column name, value
     $this->view->setVar('_pageLayout', [['type' => 'check_all', 'column' => 'template_id'], ['type' => 'index', 'title' => '#'], ['type' => 'text', 'title' => 'gb_template_name', 'column' => 'name', 'translation' => true], ['type' => 'text', 'title' => 'gb_description', 'column' => 'description', 'translation' => true], ['type' => 'text', 'title' => __('gb_version'), 'class' => 'text-center', 'column' => 'version'], ['type' => 'text', 'title' => 'gb_author', 'class' => 'text-center', 'column' => 'author'], ['type' => 'action', 'title' => 'gb_active', 'column' => 'published', 'link_prefix' => 'template_id', 'class' => 'text-center col-published', 'action' => [['condition' => '==', 'condition_value' => '1', 'link' => '/admin/template/index/#', 'link_title' => 'gb_default_language', 'access' => 1, 'icon_class' => 'glyphicon glyphicon-star orange'], ['condition' => '==', 'condition_value' => '0', 'link' => '/admin/template/index/publish/', 'link_title' => 'm_system_language_message_set_default_language', 'access' => $this->acl->isAllowed('system|language|published'), 'icon_class' => 'glyphicon glyphicon-star grey']]], ['type' => 'text', 'title' => 'gb_location', 'class' => 'text-center', 'column' => 'location', 'label' => [['condition' => '==', 'condition_value' => 'backend', 'class' => 'label label-sm label-success', 'text' => 'gb_backend'], ['condition' => '!=', 'condition_value' => 'backend', 'class' => 'label label-sm label-warning', 'text' => 'gb_frontend']], 'translation' => true], ['type' => 'id', 'title' => 'gb_id', 'column' => 'template_id']]);
 }
예제 #9
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']]);
 }
예제 #10
0
 /**
  * Set item to view
  *
  * @param string $condition
  * @param array $filter
  */
 private function setItemsToView($condition, $filter)
 {
     //Limit
     $paginationLimit = $this->config->pagination->limit;
     $currentPage = $this->request->getQuery('page', 'int');
     $items = $this->modelsManager->createBuilder()->columns("b.id as id, bts.name as bug_tracking_status, CONCAT(u.first_name, ' ', u.last_name) as full_name, zcms_cut_string(b.description, 63) as description, b.created_at as b_created_at, ur.created_at as user_role_created_at, ur.name as name, btt.name as btt_name, btp.name as btp_name ")->addFrom('\\ZCMS\\Core\\Models\\BugTracking', 'b')->join('\\ZCMS\\Core\\Models\\UserRoles', 'b.role_id = ur.id', 'ur')->join('\\ZCMS\\Core\\Models\\BugTrackingPriority', 'b.bug_tracking_priority_id = btp.id', 'btp')->join('\\ZCMS\\Core\\Models\\BugTrackingType', 'b.bug_tracking_type_id = btt.id', 'btt')->join('\\ZCMS\\Core\\Models\\BugTrackingStatus', 'b.bug_tracking_status_id = bts.id', 'bts')->join('\\ZCMS\\Core\\Models\\Users', 'b.created_by = u.id', 'u')->where($condition)->orderBy($filter['filter_order'] . ' ' . $filter['filter_order_dir']);
     $this->view->setVar('_page', ZPagination::getPaginationQueryBuilder($items, $paginationLimit, $currentPage));
     //Set search value
     $this->view->setVar('_filter', $filter);
 }
예제 #11
0
 /**
  * List all slide show item(s) in 1 slide show
  *
  * @param $id
  * @return bool
  */
 public function slideAction($id)
 {
     $id = intval($id);
     /**
      * @var $slideShow SlideShows
      */
     $slideShow = SlideShows::findFirst(['conditions' => 'slide_show_id = ?0', 'bind' => [$id]]);
     if (!$slideShow) {
         return $this->response->redirect('/admin/slide/');
     }
     $this->_toolbar->addPublishedButton();
     $this->_toolbar->addUnPublishedButton();
     $this->_toolbar->addNewButton('new', '/admin/slide/manage-slide/new/' . $id . '/');
     $this->_toolbar->addDeleteButton('delete', '/admin/slide/manage-slide/delete/' . $id . '/');
     $this->_toolbar->addCancelButton('index', '/admin/slide/', 'Backward', 'fa fa-backward');
     //Add sorting
     $this->addFilter('filter_order', 'slide_show_item_id', 'string');
     $this->addFilter('filter_order_dir', 'DESC', 'string');
     $this->addFilter('filter_column_title', '', 'string');
     $this->addFilter('filter_column_title', '', 'string');
     $this->addFilter('filter_published', '', 'string');
     $this->addFilter('filter_id', '', 'int');
     $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_id']) {
         $conditions[] = "slide_show_item_id = " . intval($filter['filter_id']);
     }
     if ($filter['filter_published'] != '') {
         $conditions[] = "published = " . intval($filter['filter_published']);
     }
     $conditions[] = 'slide_show_id = ' . $id;
     $slides = SlideShowItems::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_item_id'], ['type' => 'index', 'title' => '#'], ['type' => 'image', 'width' => '100', 'height' => 'auto', 'uri_prefix' => '', 'column' => 'image', 'css' => 'width : 105px', 'title' => 'Image', 'class' => 'text-center', 'default_thumbnail' => '/media/default/no-image.png'], ['type' => 'link', 'title' => 'Slide Item Name', 'column' => 'title', 'link' => '/admin/slide/manage-slide/edit/' . $id . '/', 'access' => $this->acl->isAllowed('slide|manage-slide|edit'), 'filter' => ['type' => 'text', 'name' => 'filter_column_title', 'attributes' => []]], ['type' => 'actions', 'title' => 'gb_ordering', 'link_prefix' => 'slide_show_item_id', 'class' => 'text-center', 'column' => 'ordering', 'display_value' => true, 'actions' => [['link_title' => 'gb_move_up', 'link' => '/admin/slide/manage-slide/moveUp/' . $id . '/', 'link_class' => '', 'icon_class' => 'glyphicon glyphicon-chevron-up', 'access' => $this->acl->isAllowed('slide|manage-slide|edit')], ['link_title' => 'gb_move_down', 'link' => '/admin/slide/manage-slide/moveDown/' . $id . '/', 'link_class' => '', 'icon_class' => 'glyphicon glyphicon-chevron-down', 'access' => $this->acl->isAllowed('slide|manage-slide|edit')]]], ['type' => 'published', 'title' => 'gb_published', 'access' => $this->acl->isAllowed('slide|manage-slide|edit'), 'link' => '/admin/slide/manage-slide/', 'column' => 'published', 'filter' => ['type' => 'select', 'name' => 'filter_published', 'attributes' => ['useEmpty' => true, 'emptyText' => 'All', 'value' => $filter['filter_published'] == '' ? -1 : $filter['filter_published']], 'value' => [0 => 'No', 1 => 'Yes']]], ['type' => 'id', 'title' => 'gb_id', 'column' => 'slide_show_item_id', 'css' => 'width : 100px', 'filter' => ['type' => 'text', 'name' => 'filter_id', 'attributes' => []]]]);
     return true;
 }