function GetAppointments($account_id, $beg_date, $end_date)
{
    global $bd;
    global $cfg;
    $query = "SELECT * FROM accounts WHERE account_id = '{$account_id}'";
    $result = $bd->Query($query);
    $role = $bd->FetchResult($result, 0, 'role');
    $var_type = $role . '_type';
    $var_color = $role . '_color';
    $var_image = $role . '_icon';
    $array_type = $cfg[$var_type];
    $array_color = $cfg[$var_color];
    $array_image = $cfg[$var_image];
    $apps = Retrieve_Appointments($account_id, $beg_date, $end_date, '', '', '', $cfg['time'], $array_type, $array_color, $array_image, $cfg['days'], $fake, $bd);
    return $apps;
}
Example #2
0
function Retrieve_Appointments_Groups($group, $beg_date, $end_date, $beg_time, $end_time, $app_times, $app_types, $app_colors, $app_images, $days_of_week, $fake, $bd)
{
    $members = List_Members($group, 0, $bd);
    $apps = array();
    for ($i = 0; $i < count($members); $i++) {
        $user = $members[$i][0];
        $apps[$i] = Retrieve_Appointments($user, $beg_date, $end_date, $beg_time, $end_time, '', $app_times, $app_types, $app_colors, $app_images, $days_of_week, $fake, $bd);
    }
    return $apps;
}
Example #3
0
    $span_end_month_name = date('F', $u_end_date);
    for ($u_date = $u_beg_date; $u_date <= $u_end_date; $u_date += 24 * 60 * 60, $num_day++) {
        $days[$num_day - $first_day_week][0] = $num_day;
        $days[$num_day - $first_day_week][1] = $num_week;
        $days[$num_day - $first_day_week][2] = date('d', $u_date);
        $days[$num_day - $first_day_week][3] = date('m', $u_date);
        $days[$num_day - $first_day_week][4] = date('Y', $u_date);
        if (($num_day + 1) % 7 == 0) {
            $num_week++;
            $weeks[$num_week] = $num_week;
        }
        $days[$num_day - $first_day_week][5] = date('w', $u_date);
        $day_of_week = $days[$num_day][5];
        $days[$num_day - $first_day_week][6] = $cfg['days'][$day_of_week];
    }
    $apps = Retrieve_Appointments($account_id, $beg_day, $end_day, '', '', '', $cfg['time'], $array_type, $array_color, $array_image, $cfg['days'], $fake, $bd);
    $unauth_apps = List_Appointments($account_id, '', '', 0, '', '', '', '', '', $owner, '', '', '', '', '', $bd);
} else {
    $error[$num_errors++] = "Invalid Session ID";
    include "logout.php";
    exit;
}
$time_count = count($cfg['time']);
for ($i = 0; $i < $time_count - 1; $i++) {
    $new_time[$i] = $cfg['time'][$i];
}
$smarty->assign("nrpTransform", $result_xsl);
$smarty->assign("nrpMainTime", $new_time);
$smarty->assign("nrpMainErrors", $error);
$smarty->assign("nrpMainAlerts", $alert);
$smarty->assign("nrpSpanStart", $span_start);
ImageTTFText($im, 12, 90, 25, 215, $green, $cfg['font'], substr($cfg['days'][3], 0, 3));
ImageTTFText($im, 12, 90, 25, 256, $green, $cfg['font'], substr($cfg['days'][4], 0, 3));
ImageTTFText($im, 12, 90, 25, 304, $green, $cfg['font'], substr($cfg['days'][5], 0, 3));
ImageTTFText($im, 12, 90, 25, 348, $green, $cfg['font'], substr($cfg['days'][6], 0, 3));
// Start positions
$x_ret_ini = 40;
$y_ret_ini = 45;
$u_beg_date = mktime(1, 1, 1, $span_start_month, $span_start_day, $span_start_year);
$u_end_date = mktime(1, 1, 1, $span_end_month, $span_end_day, $span_end_year);
$legend = array();
for ($date = $u_beg_date; $date <= $u_end_date; $date += 24 * 60 * 60) {
    $day = date('d', $date);
    $month = date('m', $date);
    $year = date('Y', $date);
    $cur_date = "{$year}-{$month}-{$day}";
    $apps = Retrieve_Appointments($account_id, $cur_date, $cur_date, '', '', '', $cfg['time'], $array_type, $array_color, $array_image, $cfg['days'], 0, $bd);
    // If there are no appointments in the current day
    if (count($apps) == 0) {
        $white = imagecolorallocate($im, 255, 255, 255);
        $columns = $num_blocks - 1;
        imagefilledrectangle($im, $x_ret_ini, $y_ret_ini, $x_ret_ini + 30 + 35 * ($columns - 1), $y_ret_ini + 40, $white);
    } else {
        for ($i = 0; $i < count($apps); $i++) {
            $before = $apps[$i][22];
            $after = $apps[$i][23];
            $length = $apps[$i][3];
            $description = $apps[$i][2];
            $color_hexa = $apps[$i][13];
            $color_r = hexdec(substr($color_hexa, 0, 2));
            $color_g = hexdec(substr($color_hexa, 2, 2));
            $color_b = hexdec(substr($color_hexa, 4, 2));