try { if (!is_null(CHttpRequest::get_Value('client_id'))) { $clientid = CHttpRequest::get_Value('client_id'); } else { throw new Exception("Application error: client ID not specified as expected in Client report page"); } // Check time period if (!is_null(CHttpRequest::get_Value('period'))) { $period = CHttpRequest::get_Value('period'); } else { throw new Exception("Application error: the period hasn't been provided as expected"); } // Client informations $client = Clients_Model::getClientInfos($dbSql->db_link, $clientid); // Get job names for the client foreach (Jobs_Model::get_Jobs_List($dbSql->db_link, $clientid) as $jobname) { // Last good client's for each backup jobs $query = 'SELECT Job.Name, Job.Jobid, Job.Level, Job.Endtime, Job.Jobbytes, Job.Jobfiles, Status.JobStatusLong FROM Job '; $query .= "LEFT JOIN Status ON Job.JobStatus = Status.JobStatus "; $query .= "WHERE Job.Name = '{$jobname}' AND Job.JobStatus = 'T' AND Job.Type = 'B' "; $query .= 'ORDER BY Job.EndTime DESC '; $query .= 'LIMIT 1'; $jobs_result = CDBUtils::runQuery($query, $dbSql->db_link); foreach ($jobs_result->fetchAll() as $job) { $job['level'] = $job_levels[$job['level']]; $job['jobfiles'] = CUtils::format_Number($job['jobfiles']); $job['jobbytes'] = CUtils::Get_Human_Size($job['jobbytes']); $backup_jobs[] = $job; } } $view->assign('backup_jobs', $backup_jobs);
// Number of clients $view->assign('clients', Clients_Model::count($dbSql->db_link)); // Defined Jobs and Filesets $view->assign('defined_filesets', FileSets_Model::count($dbSql->db_link)); $view->assign('defined_jobs', Jobs_Model::count_Job_Names($dbSql->db_link)); // Incremental, Differential and Full jobs over the last 24 hours $view->assign('incr_jobs', Jobs_Model::count_Jobs($dbSql->db_link, $custom_period, null, J_INCR)); $view->assign('diff_jobs', Jobs_Model::count_Jobs($dbSql->db_link, $custom_period, null, J_DIFF)); $view->assign('full_jobs', Jobs_Model::count_Jobs($dbSql->db_link, $custom_period, null, J_FULL)); // Volumes disk usage $volumes_size = Volumes_Model::getDiskUsage($dbSql->db_link); $view->assign('volumes_size', CUtils::Get_Human_Size($volumes_size)); // Pools count $view->assign('pools_nb', Pools_Model::count($dbSql->db_link)); // Backup Job list $view->assign('jobs_list', Jobs_Model::get_Jobs_List($dbSql->db_link)); // Clients list $view->assign('clients_list', Clients_Model::getClients($dbSql->db_link)); // Count volumes $view->assign('volumes_nb', Volumes_Model::count($dbSql->db_link)); // ============================================================== // Last period <Job status graph> // ============================================================== $jobs_status = array('Running', 'Completed', 'Waiting', 'Failed', 'Canceled'); $jobs_status_data = array(); foreach ($jobs_status as $status) { $jobs_count = Jobs_Model::count_Jobs($dbSql->db_link, $custom_period, strtolower($status)); $jobs_status_data[] = array($status, $jobs_count); } $graph = new CGraph("dashboard-graph01.jpg"); $graph->SetData($jobs_status_data, 'pie');