Пример #1
0
 /**
  * Displays a search form on the top of the page.
  *
  * @return string
  *
  * @since 1.0
  */
 public function after_displayPageHead_callback()
 {
     $config = ConfigProvider::getInstance();
     $body = parent::after_displayPageHead_callback();
     $body .= '<div align="center" class="form-group"><form class="form-inline" method="GET" id="search_form" onsubmit="document.location = \'' . $config->get('app.url') . 'search/\'+document.getElementById(\'q\').value; return false;">';
     $body .= '<label for="q">Search for</label><input type="text" name="q" id="q" class="form-control" style="width:50%; margin:10px;"/>';
     $button = new Button('document.location = \'' . $config->get('app.url') . '/search/\'+document.getElementById(\'q\').value', 'Search', 'searchButton');
     $body .= $button->render();
     $body .= '</p></form></div>';
     return $body;
 }
Пример #2
0
 /**
  * Sets up the pagination start point and limit.
  *
  * @since 2.0
  */
 public function after_displayPageHead_callback()
 {
     $body = parent::after_displayPageHead_callback();
     // set the start point for the list pagination
     if ($this->request->getParam('start') != null) {
         $this->start = $this->request->getParam('start');
         $viewState = ViewState::getInstance();
         $viewState->set('selectedStart', $this->start);
         if ($this->request->getParam('limit') != null) {
             $this->limit = $this->request->getParam('limit');
         } else {
             $config = ConfigProvider::getInstance();
             $this->limit = $config->get('app.list.page.amount');
         }
         $accept = $this->request->getAccept();
         if ($accept == 'application/json') {
             $body .= '[';
         }
     }
     return $body;
 }