/** * @param string $mode Name of the format mode * @param Doku_Renderer $renderer ref to the Doku_Renderer * @param array $params Parameter object returned by handle() */ function renderActivityByUserReport($mode, Doku_Renderer $renderer, $params) { global $CHUNKPROGRESS_STATUS_TAGS; $renderer->table_open(); $renderer->tablerow_open(); $renderer->tablecell_open(); $renderer->strong_open(); $renderer->unformatted("User"); $renderer->strong_close(); $renderer->tablecell_close(); foreach ($CHUNKPROGRESS_STATUS_TAGS as $status) { $renderer->tablecell_open(); $renderer->strong_open(); $renderer->unformatted($status); $renderer->strong_close(); $renderer->tablecell_close(); } $renderer->tablerow_close(); $user_status_count = $params["user_status_count"]; foreach ($user_status_count as $user => $statuses) { $renderer->tablerow_open(); $renderer->tablecell_open(); $renderer->unformatted($user); $renderer->tablecell_close(); foreach ($CHUNKPROGRESS_STATUS_TAGS as $status) { $renderer->tablecell_open(); if (array_key_exists($status, $statuses)) { $renderer->unformatted($statuses[$status]); } $renderer->tablecell_close(); } $renderer->tablerow_close(); } $renderer->table_close(); }
/** * Renders activity report to the page * @param string $mode Name of the format mode * @param Doku_Renderer $renderer ref to the Doku_Renderer * @param array $params Parameter object returned by handle() */ function renderActivityByNamespaceReport($mode, Doku_Renderer $renderer, $params) { global $CHUNKPROGRESS_STATUS_TAGS; $renderer->table_open(); $renderer->tablerow_open(); $renderer->tablecell_open(); $renderer->strong_open(); $renderer->unformatted("Namespace"); $renderer->strong_close(); $renderer->tablecell_close(); foreach ($CHUNKPROGRESS_STATUS_TAGS as $status) { $renderer->tablecell_open(); $renderer->strong_open(); $renderer->unformatted($status); $renderer->strong_close(); $renderer->tablecell_close(); } $renderer->tablerow_close(); $count_by_sub_namespace_then_status = $params["count_by_sub_namespace_then_status"]; foreach ($count_by_sub_namespace_then_status as $sub_namespace => $statuses) { $renderer->tablerow_open(); $renderer->tablecell_open(); $renderer->unformatted($sub_namespace); $renderer->tablecell_close(); foreach ($CHUNKPROGRESS_STATUS_TAGS as $status) { $renderer->tablecell_open(); if (array_key_exists($status, $statuses)) { $renderer->unformatted($statuses[$status]); } $renderer->tablecell_close(); } $renderer->tablerow_close(); } $renderer->table_close(); }
/** * Renders the data to the page * @param string $mode Name of the format mode * @param Doku_Renderer $renderer ref to the Doku_Renderer * @param array $params Parameter object returned by handle() * @return bool|void */ public function render($mode, Doku_Renderer $renderer, $params) { $render_start_timestamp = microtime(true); // Print warnings or errors, if any if (array_key_exists("message", $params)) { $renderer->p_open(); $renderer->strong_open(); $renderer->unformatted($params["message"]); $renderer->strong_close(); $renderer->p_close(); return; } // Print page title if (array_key_exists("report_title", $params)) { $renderer->header($params["report_title"], 2, 0); } // Render report if recognized if ($params["report"] == "activity_by_user") { // Activity by user renderActivityByUserReport($mode, $renderer, $params); } else { if ($params["report"] == "activity_by_namespace") { // Activity by namespace renderActivityByNamespaceReport($mode, $renderer, $params); } } // Done (except for debug) $params["debug_render_elapsed_time"] = round(microtime(true) - $render_start_timestamp, 3); // Dump params if in debug mode if ($params["debug"] == "true") { $renderer->hr(); $renderer->p_open(); $renderer->emphasis_open(); $renderer->unformatted("Debug: parameter dump"); $renderer->emphasis_close(); $renderer->p_close(); $renderer->table_open(); $renderer->tablerow_open(); $renderer->tablecell_open(); $renderer->strong_open(); $renderer->unformatted("Key"); $renderer->strong_close(); $renderer->tablecell_close(); $renderer->tablecell_open(); $renderer->strong_open(); $renderer->unformatted("Value"); $renderer->strong_close(); $renderer->tablecell_close(); $renderer->tablerow_close(); foreach ($params as $key => $value) { $renderer->tablerow_open(); $renderer->tablecell_open(); $renderer->unformatted($key); $renderer->tablecell_close(); $renderer->tablecell_open(); if (is_array($value)) { // $renderer->unformatted("Array length " . count($value)); $renderer->unformatted(json_encode($value)); } else { $renderer->unformatted($value); } $renderer->tablecell_close(); $renderer->tablerow_close(); } $renderer->table_close(); } }