当前位置: 首页>>代码示例>>PHP>>正文


PHP DateTimeUtil::getLastDaysIntervals方法代码示例

本文整理汇总了PHP中DateTimeUtil::getLastDaysIntervals方法的典型用法代码示例。如果您正苦于以下问题:PHP DateTimeUtil::getLastDaysIntervals方法的具体用法?PHP DateTimeUtil::getLastDaysIntervals怎么用?PHP DateTimeUtil::getLastDaysIntervals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DateTimeUtil的用法示例。


在下文中一共展示了DateTimeUtil::getLastDaysIntervals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Exception

 // Backup job name
 if (!is_null(CHttpRequest::get_value('backupjob_name'))) {
     $backupjob_name = CHttpRequest::get_value('backupjob_name');
 } else {
     throw new Exception("Error: Backup job name not specified");
 }
 // Generate Backup Job report period string
 $backupjob_period = "From " . date("Y-m-d", NOW - WEEK) . " to " . date("Y-m-d", NOW);
 // Stored Bytes on the defined period
 $backupjob_bytes = Jobs_Model::getStoredBytes($dbSql->db_link, array(LAST_WEEK, NOW), $backupjob_name);
 $backupjob_bytes = CUtils::Get_Human_Size($backupjob_bytes);
 // Stored files on the defined period
 $backupjob_files = Jobs_Model::getStoredFiles($dbSql->db_link, array(LAST_WEEK, NOW), $backupjob_name);
 $backupjob_files = CUtils::format_Number($backupjob_files);
 // Get the last 7 days interval (start and end)
 $days = DateTimeUtil::getLastDaysIntervals(7);
 // ===============================================================
 // Last 7 days stored Bytes graph
 // ===============================================================
 $graph = new CGraph("backupjobreport-graph01.jpg");
 foreach ($days as $day) {
     $stored_bytes = Jobs_Model::getStoredBytes($dbSql->db_link, array($day['start'], $day['end']), $backupjob_name);
     $days_stored_bytes[] = array(date("m-d", $day['start']), $stored_bytes);
 }
 $graph->SetData($days_stored_bytes, 'bars', true);
 // Graph rendering
 $view->assign('graph_stored_bytes', $graph->Render());
 unset($graph);
 // ===============================================================
 // Getting last 7 days stored files graph
 // ===============================================================
开发者ID:ektich,项目名称:bacula-web,代码行数:31,代码来源:backupjob-report.php

示例2: foreach

     $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);
 // Get the last n days interval (start and end)
 $days = DateTimeUtil::getLastDaysIntervals($period);
 // ===============================================================
 // Last n days stored Bytes graph
 // ===============================================================
 $graph = new CGraph("clientreport-graph01.jpg");
 foreach ($days as $day) {
     $stored_bytes = Jobs_Model::getStoredBytes($dbSql->db_link, array($day['start'], $day['end']), 'ALL', $clientid);
     $days_stored_bytes[] = array(date("m-d", $day['start']), $stored_bytes);
 }
 $graph->SetData($days_stored_bytes, 'bars', true);
 // Graph rendering
 $view->assign('graph_stored_bytes', $graph->Render());
 unset($graph);
 // ===============================================================
 // Getting last n days stored files graph
 // ===============================================================
开发者ID:ektich,项目名称:bacula-web,代码行数:31,代码来源:client-report.php


注:本文中的DateTimeUtil::getLastDaysIntervals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。