/** * Generates the HTML to display the user profile tab * * @param \CB\Database\Table\TabTable $tab the tab database entry * @param \CB\Database\Table\UserTable $user the user being displayed * @param int $ui 1 for front-end, 2 for back-end * @return string|boolean Either string HTML for tab content, or false if ErrorMSG generated */ public function getDisplayTab( $tab, $user, $ui ) { global $_CB_framework, $_CB_database, $_LANG; outputCbJs( 1 ); outputCbTemplate( 1 ); cbimport( 'cb.pagination' ); $plugin = cbpreparatyClass::getPlugin(); $model = cbpreparatyClass::getModel(); $viewer = CBuser::getMyUserDataInstance(); cbpreparatyClass::getTemplate( 'tab' ); $limit = (int) $this->params->get( 'tab_limit', 15 ); $limitstart = $_CB_framework->getUserStateFromRequest( 'tab_articles_limitstart{com_comprofiler}', 'tab_articles_limitstart' ); $filterSearch = $_CB_framework->getUserStateFromRequest( 'tab_articles_search{com_comprofiler}', 'tab_articles_search' ); $where = null; if ( isset( $filterSearch ) && ( $filterSearch != '' ) ) { $where .= "\n AND ( a." . $_CB_database->NameQuote( 'title' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $filterSearch, true ) . '%', false ) . " OR a." . $_CB_database->NameQuote( 'introtext' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $filterSearch, true ) . '%', false ) . " OR a." . $_CB_database->NameQuote( 'fulltext' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $filterSearch, true ) . '%', false ) . " )"; } $searching = ( $where ? true : false ); $total = cbpreparatyModel::getPreparatyTotal( $where, $viewer, $user, $plugin ); if ( $total <= $limitstart ) { $limitstart = 0; } $pageNav = new cbPageNav( $total, $limitstart, $limit ); $pageNav->setInputNamePrefix( 'tab_articles_' ); $rows = cbpreparatyModel::getPreparaty( ( $this->params->get( 'tab_paging', 1 ) ? array( $pageNav->limitstart, $pageNav->limit ) : null ), $where, $viewer, $user, $plugin ); $input = array(); $input['search'] = '<input type="text" name="tab_articles_search" value="' . htmlspecialchars( $filterSearch ) . '" onchange="document.articleForm.submit();" placeholder="' . htmlspecialchars( $_LANG['Search'] ) . '" class="form-control" />'; $tab->params = $this->params; $class = $plugin->params->get( 'general_class', null ); $return = '<div id="cbArticles" class="cbArticles' . ( $class ? ' ' . htmlspecialchars( $class ) : null ) . '">' . '<div id="cbArticlesInner" class="cbArticlesInner">' . HTML_cbpreparatyTab::showPreparatyTab( $rows, $pageNav, $searching, $input, $viewer, $user, $model, $tab, $plugin ) . '</div>' . '</div>'; return $return; }