public function renderWidget($ps_widget_id, &$pa_settings) { parent::renderWidget($ps_widget_id, $pa_settings); $this->opo_view->setVar('request', $this->getRequest()); $this->opo_view->setVar('hours', $pa_settings['hours']); $vo_tq = new TaskQueue(); $qr_completed = $this->opo_db->query("\n\t\t\t\tSELECT tq.*, u.fname, u.lname \n\t\t\t\tFROM ca_task_queue tq \n\t\t\t\tLEFT JOIN ca_users u ON u.user_id = tq.user_id \n\t\t\t\tWHERE tq.completed_on > ? \n\t\t\t\tORDER BY tq.completed_on desc\n\t\t\t", time() - 60 * 60 * $pa_settings['hours']); $va_completed = array(); while ($qr_completed->nextRow()) { $va_row = $qr_completed->getRow(); $va_params = caUnserializeForDatabase($va_row["parameters"]); $va_completed[$va_row["task_id"]]["handler_name"] = $vo_tq->getHandlerName($va_row['handler']); $va_completed[$va_row["task_id"]]["created"] = $va_row["created_on"]; $va_completed[$va_row["task_id"]]["by"] = $va_row["fname"] . ' ' . $va_row['lname']; $va_completed[$va_row["task_id"]]["completed_on"] = $va_row["completed_on"]; $va_completed[$va_row["task_id"]]["error_code"] = $va_row["error_code"]; if ((int) $va_row["error_code"] > 0) { $o_e = new ApplicationError((int) $va_row["error_code"], '', '', '', false, false); $va_row["error_message"] = $o_e->getErrorMessage(); } else { $va_row["error_message"] = ''; } $va_completed[$va_row["task_id"]]["error_message"] = $va_row["error_message"]; if (is_array($va_report = caUnserializeForDatabase($va_row["notes"]))) { $va_completed[$va_row["task_id"]]["processing_time"] = (double) $va_report['processing_time']; } $va_completed[$va_row["task_id"]]["status"] = $vo_tq->getParametersForDisplay($va_row); } $this->opo_view->setVar('jobs_done', $qr_completed->numRows()); $this->opo_view->setVar('jobs_done_data', $va_completed); $qr_qd = $this->opo_db->query("\n\t\t\t\tSELECT * \n\t\t\t\tFROM ca_task_queue tq\n\t\t\t\tLEFT JOIN ca_users AS u ON tq.user_id = u.user_id\n\t\t\t\tWHERE tq.completed_on is NULL\n\t\t\t"); $this->opo_view->setVar('jobs_queued_processing', $qr_qd->numRows()); $va_qd_jobs = array(); $va_pr_jobs = array(); while ($qr_qd->nextRow()) { $va_row = $qr_qd->getRow(); $va_params = caUnserializeForDatabase($va_row["parameters"]); if (!$vo_tq->rowKeyIsBeingProcessed($va_row["row_key"])) { $va_qd_jobs[$va_row["task_id"]]["handler_name"] = $vo_tq->getHandlerName($va_row['handler']); $va_qd_jobs[$va_row["task_id"]]["created"] = $va_row["created_on"]; $va_qd_jobs[$va_row["task_id"]]["by"] = $va_row["fname"] . ' ' . $va_row['lname']; $va_qd_jobs[$va_row["task_id"]]["status"] = $vo_tq->getParametersForDisplay($va_row); } else { $va_pr_jobs[$va_row["task_id"]]["handler_name"] = $vo_tq->getHandlerName($va_row['handler']); $va_pr_jobs[$va_row["task_id"]]["created"] = $va_row["created_on"]; $va_pr_jobs[$va_row["task_id"]]["by"] = $va_row["fname"] . ' ' . $va_row['lname']; $va_pr_jobs[$va_row["task_id"]]["status"] = $vo_tq->getParametersForDisplay($va_row); } } $this->opo_view->setVar('qd_job_data', $va_qd_jobs); $this->opo_view->setVar('pr_job_data', $va_pr_jobs); $this->opo_view->setVar('update_frequency', ($vn_freq = (int) $this->opo_config->get('update_frequency')) ? $vn_freq : 60); return $this->opo_view->render('main_html.php'); }