예제 #1
0
 public function __construct(Module $module, string $form = 'form-module-manager')
 {
     parent::__construct('manager.module.info');
     $this->module = $module;
     $this->form = $form;
     $this->arguments = null;
 }
예제 #2
0
 /**
  * Pager constructor.
  * @param int $count
  * @param string|null $path
  * @param array $settings
  */
 public function __construct(int $count, string $path = null, array $settings = [])
 {
     $settings += ['pageKey' => 'page', 'results' => 30, 'showArrows' => true, 'disableArrows' => true, 'nextText' => 'Next', 'prevText' => 'Previous', 'alignOnSides' => false, 'leftArrow' => '←', 'rightArrow' => '→', 'queryString' => true];
     $request = request();
     if ($path === null) {
         $path = $request->path();
     }
     if ($settings['queryString'] !== false) {
         if ($settings['queryString'] === true) {
             $settings['queryString'] = $request->get();
         }
         unset($settings['queryString'][$settings['pageKey']]);
         $settings['queryString'] = http_build_query($settings['queryString']);
         if (!isset($settings['queryString'][0])) {
             $settings['queryString'] = false;
         }
     }
     $pageno = (int) $request->get($settings['pageKey'], 1);
     $settings['count'] = $count;
     $settings['path'] = $path;
     $settings['page'] = (int) $request->get($settings['pageKey'], 1);
     if ($pageno <= 0) {
         $pageno = 1;
     }
     $pages = ceil($count / $settings['results']);
     $page = $pageno - 1;
     $next = $page + 1;
     $prev = $page - 1;
     parent::__construct('pager', ['pageKey' => $settings['pageKey'], 'path' => $path, 'next' => $next < $pages ? $next + 1 : false, 'prev' => $prev >= 0 && $prev < $pages ? $prev + 1 : false, 'align' => (bool) $settings['alignOnSides'], 'showArrows' => (bool) $settings['showArrows'], 'nextText' => $settings['nextText'], 'prevText' => $settings['prevText'], 'leftArrow' => $settings['leftArrow'], 'rightArrow' => $settings['rightArrow'], 'disableArrows' => $settings['disableArrows'], 'queryString' => $settings['queryString']]);
 }
예제 #3
0
 public function __construct(array $form = [])
 {
     $form += array('id' => 'form-module-manager', 'method' => 'post', 'action' => getURL('/module-manager/module'));
     $modules = array();
     foreach (app()->getModules() as $module) {
         if (!$module->isHidden()) {
             $modules[$module->name()] = new ModuleInfo($module, $form['id']);
         }
     }
     ksort($modules);
     parent::__construct('manager.module.list', ['list' => $modules, 'form' => $form]);
 }
예제 #4
0
 /**
  * Paginator constructor.
  * @param int $count
  * @param string|null $path
  * @param array $settings
  */
 public function __construct(int $count, string $path = null, array $settings = [])
 {
     $settings += ['type' => 'pager', 'pageKey' => 'page', 'results' => 30, 'items' => 5, 'size' => 'normal', 'showArrows' => true, 'leftArrow' => '&laquo;', 'rightArrow' => '&raquo;', 'queryString' => true];
     $request = request();
     if ($path === null) {
         $path = $request->path();
     }
     if ($settings['queryString'] !== false) {
         if ($settings['queryString'] === true) {
             $settings['queryString'] = $request->get();
         }
         unset($settings['queryString'][$settings['pageKey']]);
         $settings['queryString'] = http_build_query($settings['queryString']);
         if (!isset($settings['queryString'][0])) {
             $settings['queryString'] = false;
         }
     }
     $pageno = (int) $request->get($settings['pageKey'], 1);
     if ($pageno <= 0) {
         $pageno = 1;
     }
     $pages = ceil($count / $settings['results']);
     $page = $pageno - 1;
     if ($settings['items'] <= 0) {
         $settings['items'] = 1;
     }
     $items = [];
     if ($page < $pages) {
         $mod = $page % $settings['items'];
         for ($i = 0, $p = $page - $mod, $s = $settings['items']; $i < $s; $i++, $p++) {
             if ($p >= $pages) {
                 break;
             }
             $items[] = $p + 1;
         }
     }
     $next = $page + 1;
     $prev = $page - 1;
     $mapSize = ['normal' => 'pagination', 'large' => 'pagination pagination-lg', 'small' => 'pagination pagination-sm'];
     $class = isset($mapSize[$settings['size']]) ? $mapSize[$settings['size']] : 'pagination';
     parent::__construct('paginator', ['class' => $class, 'page' => $pageno, 'pageKey' => $settings['pageKey'], 'path' => $path, 'items' => $items, 'showArrows' => (bool) $settings['showArrows'], 'next' => $next < $pages ? $next + 1 : false, 'prev' => $prev >= 0 ? $prev + 1 : false, 'leftArrow' => $settings['leftArrow'], 'rightArrow' => $settings['rightArrow'], 'queryString' => $settings['queryString']]);
 }
예제 #5
0
 /**
  * Collection constructor.
  */
 public function __construct()
 {
     parent::__construct('collection', ['items' => []]);
 }
예제 #6
0
 /**
  * Script constructor.
  */
 public function __construct()
 {
     parent::__construct('script', ['content' => null, 'attributes' => new Attributes()]);
 }
예제 #7
0
 /**
  * Style constructor.
  * @param string|null $content
  * @param string|null $media
  */
 public function __construct(string $content = null, string $media = null)
 {
     parent::__construct('css.style', ['content' => $content, 'media' => $media]);
 }
예제 #8
0
 /**
  * Attributes constructor.
  */
 public function __construct()
 {
     parent::__construct('attributes', ['attributes' => []]);
 }
예제 #9
0
 /**
  * Link constructor.
  * @param string $href
  */
 public function __construct(string $href)
 {
     parent::__construct('css.link', ['href' => $href]);
 }
예제 #10
0
 public function __construct()
 {
     parent::__construct('html', ['title' => null, 'content' => null, 'icon' => null, 'styles' => new CSSCollection(), 'scripts' => new ScriptCollection(), 'meta' => new MetaCollection(), 'htmlAttributes' => null, 'bodyAttributes' => null]);
 }
예제 #11
0
 /**
  * Alerts constructor.
  */
 public function __construct()
 {
     parent::__construct('alerts');
     $this->arguments = null;
 }
예제 #12
0
 /**
  * Meta constructor.
  * @param bool $xhtml
  */
 public function __construct(bool $xhtml = false)
 {
     parent::__construct('meta', ['xhtml' => $xhtml, 'attributes' => new Attributes()]);
 }