Ejemplo n.º 1
0
/**
 * @brief summarize monthly actions
 */
function summarizeMonthlyActions() {
    require_once 'include/action.php';
    
    $action = new action();
    Database::get()->queryFunc("SELECT id FROM course", function($course) use (&$action) {
        $min_time = ($res = Database::get()->querySingle("SELECT MIN(day) as min_time FROM actions_daily WHERE course_id = ?d", intval($course->id))) ? $res->min_time : time();
        if ($min_time + get_config('actions_expire_interval') * 30 * 24 * 3600 < time()) {
            $action->summarize($course->id);
        }
    });
}
Ejemplo n.º 2
0
    $u_date_end = $date_end->format('Y-m-d H:i');
    $user_date_end = $date_end->format('d-m-Y H:i');        
}


$result = Database::get()->queryArray("SELECT MIN(day) AS min_time FROM actions_daily WHERE course_id = ?d", $course_id);
foreach ($result as $row) {
    if (!empty($row->min_time)) {
        $min_time = strtotime($row->min_time);
    } else
        break;
}

if ($min_time + get_config('actions_expire_interval') * 30 * 24 * 3600 < time()) { // actions more than X months old
    $action = new action();
    $action->summarize();     // move data to action_summary
}

$result = Database::get()->queryArray("SELECT MIN(day) AS min_time FROM actions_daily WHERE course_id = ?d", $course_id);
foreach ($result as $row) {
    if (!empty($row->min_time)) {
        $min_time = strtotime($row->min_time);
    } else
        break;
}

$min_t = date("d-m-Y", $min_time);

$made_chart = true;
//make chart
require_once 'modules/graphics/plotter.php';