private function templateHistory(GWF_User $user) { require_once GWF_CORE_PATH . 'module/WeChall/WC_SiteDescr.php'; require_once GWF_CORE_PATH . 'module/WeChall/WC_HistoryUser2.php'; $uid = $user->getID(); $ipp = 50; $history = GDO::table('WC_HistoryUser2'); $nItems = $history->countRows("userhist_uid={$uid}"); $nPages = GWF_PageMenu::getPagecount($ipp, $nItems); $page = Common::clamp(Common::getGet('page', 1), 1, $nPages); $from = GWF_PageMenu::getFrom($page, $ipp); $by = Common::getGet('by', ''); $dir = Common::getGet('dir', ''); $orderby = $history->getMultiOrderby($by, $dir); $uuname = $user->urlencode2('user_name'); $duname = $user->displayUsername(); GWF_Website::setPageTitle($this->module->lang('pt_texthis', array($duname))); GWF_Website::setMetaDescr($this->module->lang('md_texthis', array($duname))); GWF_Website::setMetaTags($this->module->lang('mt_texthis', array($duname))); $tVars = array('user' => $user, 'duname' => $duname, 'sites' => WC_Site::getSites('site_id'), 'data' => $history->selectObjects('*', "userhist_uid={$uid}", $orderby, $ipp, $from), 'sort_url' => GWF_WEB_ROOT . 'history/for/' . $uuname . '/by/%BY%/%DIR%/page-1', 'page_menu' => GWF_PageMenu::display($page, $nPages, GWF_WEB_ROOT . 'history/for/' . $uuname . '/by/' . urlencode($by) . '/' . urlencode($dir) . '/page-%PAGE%')); return $this->module->templatePHP('text_history.php', $tVars); }
function wcProfileLastActivity(GWF_User $user, $ipp, $priv = false) { $uid = $user->getID(); $uh = GDO::table('WC_HistoryUser2'); $entries = $uh->selectObjects('*', "userhist_uid={$uid}", 'userhist_date DESC', $ipp); // $entries = array_reverse($entries); $back = ''; $back .= '<table class="cl">'; $href_txt_history = GWF_WEB_ROOT . 'history/for/' . $user->urlencode2('user_name'); $anchor = GWF_HTML::anchor($href_txt_history, WC_HTML::lang('th_last_activites', array($user->displayUsername()))); $back .= sprintf('<thead><tr><th colspan="2">%s</th></tr></thead>', $anchor); $unknown = GWF_HTML::lang('unknown'); foreach ($entries as $entry) { $entry instanceof WC_HistoryUser2; $back .= GWF_Table::rowStart(); $back .= sprintf('<td class="gwf_date">%s</td>', $priv ? $unknown : $entry->displayDate()); $back .= sprintf('<td>%s</td>', $entry->displayComment()); $back .= GWF_Table::rowEnd(); } $back .= '</table>'; return $back; }