return get_lang('Messages posted') . ' : ' . $this->getUserTotalForumPost() . '<br />' . "\n" . get_lang('Topics started') . ' : ' . $this->getUserTotalForumTopics() . '<br />' . "\n" . '<a href="' . claro_htmlspecialchars(Url::Contextualize(get_module_url('CLFRM') . '/viewsearch.php?searchUser='******'">' . get_lang('View all user\'s posts') . '</a>' . "\n"; } private function getUserTotalForumPost() { $sql = "SELECT count(`post_id`)\n FROM `" . $this->tbl_bb_posts . "`\n WHERE `poster_id` = '" . (int) $this->userId . "'"; $value = claro_sql_query_get_single_value($sql); if (is_numeric($value)) { return $value; } else { return 0; } } private function getUserTotalForumTopics() { $sql = "SELECT count(`topic_title`)\n FROM `" . $this->tbl_bb_topics . "`\n WHERE `topic_poster` = '" . (int) $this->userId . "'"; $value = claro_sql_query_get_single_value($sql); if (is_numeric($value)) { return $value; } else { return 0; } } private function getUserLastTenPosts() { $sql = "SELECT `bb_t`.`topic_id`,\n `bb_t`.`topic_title`,\n max(`bb_t`.`topic_time`) AS `last_message`\n FROM `" . $this->tbl_bb_posts . "` AS `bb_p`\n , `" . $this->tbl_bb_topics . "` AS `bb_t`\n WHERE `bb_p`.`poster_id` = '" . (int) $this->userId . "'\n AND `bb_t`.`topic_id` = `bb_p`.`topic_id`\n GROUP BY `bb_t`.`topic_title`\n ORDER BY `bb_p`.`post_time` DESC\n LIMIT 10"; $results = claro_sql_query_fetch_all($sql); return $results; } } TrackingRendererRegistry::registerUser('CLFRM_UserTrackingRenderer');
$courseAccess = $this->prepareContent(); $html = ''; $html = '<table class="claroTable emphaseLine" cellpadding="2" cellspacing="1" border="0" align="center" style="width: 99%;">' . "\n" . '<thead>' . "\n" . '<tr class="headerX">' . "\n" . '<th>' . get_lang('Month') . '</th>' . "\n" . '<th>' . get_lang('Number of access') . '</th>' . "\n" . '</tr>' . "\n" . '</thead>' . "\n"; $total = 0; if (!empty($courseAccess) && is_array($courseAccess)) { $langLongMonthNames = get_lang_month_name_list('long'); $_html = ""; foreach ($courseAccess as $access) { $_html .= '<tr>' . "\n" . '<td>' . "\n" . $langLongMonthNames[date('n', $access['unix_date']) - 1] . ' ' . date('Y', $access['unix_date']) . "\n" . '</td>' . "\n" . '<td valign="top" align="right">' . (int) $access['nbr_access'] . '</td>' . "\n" . '</tr>' . "\n"; $total += (int) $access['nbr_access']; } $html .= '<tfoot>' . "\n" . '<tr>' . "\n" . '<td>' . get_lang('Total') . '</td>' . "\n" . '<td align="right">' . $total . '</td>' . "\n" . '</tr>' . "\n" . '</tfoot>' . "\n" . '<tbody>' . "\n" . $_html . '</tbody>' . "\n"; } else { $html .= '<tfoot>' . "\n" . '<tr>' . "\n" . '<td colspan="2">' . "\n" . '<center>' . get_lang('No result') . '</center>' . "\n" . '</td>' . "\n" . '</tr>' . "\n" . '</tfoot>' . "\n"; } $html .= '</table>' . "\n"; return $html; } protected function renderFooter() { return ''; } private function prepareContent() { $sql = "SELECT UNIX_TIMESTAMP(`date`) AS `unix_date`,\n count(`date`) AS `nbr_access`\n FROM `" . $this->tbl_course_tracking_event . "`\n WHERE `user_id` = " . $this->userId . "\n AND `type` = 'user_login'\n GROUP BY MONTH(`date`), YEAR(`date`)\n ORDER BY `date` ASC"; $results = claro_sql_query_fetch_all($sql); return $results; } } TrackingRendererRegistry::registerUser('CLTRACK_userPlatformAccess', TrackingRendererRegistry::PLATFORM);