Esempio n. 1
0
 /**
  * @Author: Taymoor Qanadilou
  * @Date created: 26/05/2013
  * @Description:top five users report
  * @Param:
  *   none
  * @Updated History:
  *    none
  */
 function top_five_users_report()
 {
     $db_functions_obj = new DbFunctions();
     $user_obj = new User();
     $output = "";
     $year = $db_functions_obj->get_top_five_by('year');
     while ($rowyear = $this->conn->db_fetch_object($year)) {
         $out5year[$rowyear->uid] = "{$rowyear->year}";
     }
     $month = $db_functions_obj->get_top_five_by('month');
     while ($rowmonth = $this->conn->db_fetch_object($month)) {
         $out5month[$rowmonth->uid] = "{$rowmonth->month}";
     }
     $week = $db_functions_obj->get_top_five_by('week');
     while ($rowweek = $this->conn->db_fetch_object($week)) {
         $out5week[$rowweek->uid] = "{$rowweek->week}";
     }
     $day = $db_functions_obj->get_top_five_by('day');
     while ($rowday = $this->conn->db_fetch_object($day)) {
         $out5day[$rowday->uid] = "{$rowday->day}";
     }
     $output .= "    <table border='1'>\n                            <tr><td colspan='9'>Top 5 Users</td></tr>\n                            <tr>\n                                <th>options</th>\n                                <th>1st user</th>\n                                <th>2nd user</th>\n                                <th>3rd user</th>\n                                <th>4th user</th>\n                                <th>5th user</th>\n                            </tr>\n                            <tr class='odd'>\n                                <td>this year</td>";
     foreach ($out5year as $value => $key) {
         $output .= "<td>" . $user_obj->user_load($value)->name . " -> " . ($key + 0) . "</td>";
     }
     $output .= "</tr>\n                            <tr class='even'>\n                                <td>ths month</td>";
     foreach ($out5month as $value => $key) {
         $output .= "<td>" . $user_obj->user_load($value)->name . " -> " . ($key + 0) . "</td>";
     }
     $output .= "</tr>\n                            <tr class='odd'>\n                                <td>this week</td>";
     foreach ($out5week as $value => $key) {
         $output .= "<td>" . $user_obj->user_load($value)->name . " -> " . ($key + 0) . "</td>";
     }
     $output .= "</tr>\n                            <tr class='even'>\n                                <td>this day</td>";
     foreach ($out5day as $value => $key) {
         $output .= "<td>" . $user_obj->user_load($value)->name . " -> " . ($key + 0) . "</td>";
     }
     $output .= "</tr>\n                        </table>";
     return $output;
 }