Пример #1
0
 /**
  * Gets the HTML of this table
  * @return string
  */
 public function getHtml()
 {
     if ($this->actions) {
         $this->addDecorator(new ModelFieldOptionDecorator(), null, true);
     }
     return parent::getHtml();
 }
Пример #2
0
 /**
  * Constructs a new connection table
  * @param array $connections Array with Connection instances
  * @param string $formAction URL where the form of the table will point to
  * @param string $connectionAction URL where the name of a connection will point to
  * @param string $exportAction URL to the export action
  * @param string $defaultConnection Name of the default connection
  * @return null
  */
 public function __construct(array $connections, $formAction, $connectionAction = null, $exportAction = null, $defaultConnection = null)
 {
     parent::__construct($connections, $formAction, self::NAME);
     $this->addDecorator(new OptionDecorator());
     $this->addDecorator(new ZebraDecorator(new ConnectionDecorator($connectionAction, $defaultConnection)));
     $this->addDecorator(new StatusDecorator());
     $this->addDecorator(new ExportActionDecorator($exportAction));
 }
Пример #3
0
 /**
  * Constructs a new security table
  * @param string $formAction URL where the form of the table will point to
  * @return null
  */
 public function __construct($formAction)
 {
     $manager = SecurityManager::getInstance();
     $permissions = $manager->getPermissions();
     $roles = $manager->getRoles();
     $deniedRoutes = $manager->getDeniedRoutes();
     parent::__construct($permissions, $formAction, self::FORM_NAME);
     $this->addDecorators($roles);
     $this->addFields($deniedRoutes);
 }
Пример #4
0
 /**
  * Constructs a new modules table
  * @param string $action URL where the form of the table will point to
  * @param array $modules Array with Module objects
  * @return null
  */
 public function __construct($action, array $modules)
 {
     $modules = $this->getModules($modules);
     $modules = $this->orderByName($modules);
     parent::__construct($modules, $action, self::NAME);
     $this->addDecorator(new ZebraDecorator(new ModuleDecorator()));
     $this->addDecorator(new ReinstallActionDecorator($action . '/reinstall/'));
     $this->addDecorator(new UninstallActionDecorator($action . '/uninstall/'));
     //        $this->setPaginationOptions(array(5, 10, 25, 50, 100));
     //        $this->setPagination(10);
     $this->setHasSearch(true);
 }
Пример #5
0
 protected function applyOrder()
 {
     $result = parent::applyOrder();
     if (!$result) {
         return false;
     }
     if ($this->orderDirection === self::ORDER_DIRECTION_ASC) {
         $this->parents = $this->orderMethods[$this->orderMethod]->invokeAscending($this->parents);
     } else {
         $this->parents = $this->orderMethods[$this->orderMethod]->invokeDescending($this->parents);
     }
     return true;
 }
Пример #6
0
 /**
  * Constructs a new cron job table
  * @param array $cronJobs Array with CronJob objects
  * @param string $formAction URL where the form of the table will point to
  * @return null
  */
 public function __construct(array $cronJobs, $formAction)
 {
     parent::__construct($cronJobs, $formAction, self::NAME);
     $translator = I18n::getInstance()->getTranslator();
     $translationInvoke = $translator->translate(self::TRANSLATION_INVOKE);
     $options = array();
     foreach ($cronJobs as $cronJob) {
         $options[$cronJob->getId()] = $translationInvoke;
     }
     $fieldFactory = FieldFactory::getInstance();
     $buttonInvoke = $fieldFactory->createField(FieldFactory::TYPE_SUBMIT, self::BUTTON_INVOKE);
     $buttonInvoke->setIsMultiple(true);
     $buttonInvoke->setOptions($options);
     $this->form->addField($buttonInvoke);
     $this->addDecorator(new ZebraDecorator(new IntervalDecorator()), new StaticDecorator(self::TRANSLATION_INTERVAL, true));
     $this->addDecorator(new CallbackDecorator(), new StaticDecorator(self::TRANSLATION_CALLBACK, true));
     $this->addDecorator(new InvokeDecorator($this->form));
 }
Пример #7
0
 /**
  * Constructs a new clipboard table
  * @param string $action URL where the table form will point to
  * @param zibo\library\filesystem\File $root Path of the root for the filebrowser
  * @param array $files The values for the table: array with File objects
  * @return null
  */
 public function __construct($action, File $root, array $files)
 {
     parent::__construct($files, $action, self::FORM_NAME);
     $this->addDecorator(new FileOptionDecorator());
     $this->addDecorator(new ZebraDecorator(new ClipboardFileDecorator($root)));
 }
 /**
  * Initialize the pagination, search and order of the table
  * @param zibo\library\html\table\ExtendedTable $table
  * @param int $page The current page
  * @param int $rowsPerPage Number or rows to display on each page
  * @param string $orderMethod Name of the order method to use
  * @param string $orderDirection Name of the order direction
  * @param string $searchQuery Value for the search query
  * @return null
  */
 protected function initializeTable(ExtendedTable $table, $page, $rowsPerPage, $orderMethod, $orderDirection, $searchQuery)
 {
     if (!$this->isReadOnly && $this->isDeleteAllowed) {
         $translator = $this->getTranslator();
         $table->addAction($translator->translate(self::TRANSLATION_DELETE), array($this, 'deleteAction'), $translator->translate(self::TRANSLATION_DELETE_CONFIRM));
     }
     if ($this->pagination) {
         $table->setPaginationOptions($this->pagination);
         $table->setRowsPerPage($rowsPerPage);
         $table->setPage($page);
     }
     if ($table->hasOrderMethods()) {
         if ($orderMethod) {
             $table->setOrderMethod($orderMethod);
         }
         if ($orderDirection) {
             $table->setOrderDirection($orderDirection);
         }
     }
     if ($table->hasSearch()) {
         $table->setSearchQuery($searchQuery);
     }
 }
Пример #9
0
 /**
  * Constructs a new namespace table
  * @param array $namespaces Array with ModuleNamespace objects, the data of the table
  * @param string $namespaceAction URL where the name of a namespace will point to, the name of the namespace will be concatted to the action
  * @param string $tableAction URL where the form of this table will point to
  * @return null
  */
 public function __construct(array $namespaces, $namespaceAction = null, $tableAction = null)
 {
     parent::__construct($namespaces, $tableAction, self::FORM_NAME);
     $this->setHasSearch(true);
     $this->addDecorator(new NamespaceDecorator($namespaceAction));
 }
Пример #10
0
 /**
  * Constructs a new module version table
  * @param array $versions Array with Module objects
  * @param string $versionAction URL for the version link
  * @param string $tableAction URL for the table form
  * @return null
  */
 public function __construct(array $versions, $versionAction = null, $tableAction = null)
 {
     parent::__construct($versions, $tableAction, self::FORM_NAME);
     $this->addDecorator(new ModuleVersionDecorator($versionAction));
 }
Пример #11
0
 /**
  * Processes the form of this table, will execute the model query and assign the result to the values
  * of this table
  * @return boolean If the form was already processed, nothing is done and false returned. Otherwise the form
  *                 will be processed and true returned
  */
 public function processForm()
 {
     if (!parent::processForm()) {
         return false;
     }
     if (!$this->pageRows || $this->pageRows && $this->countRows) {
         $this->values = $this->query->query();
     }
     return true;
 }