function getDayOfMonth($year, $month, $day)
 {
     $stamp = getdate(mkTime(0, 0, 0, $month, $day, $year));
     // macht ein Timestamp am 1. des jeweiligen Monats im jeweiligen Jahr
     $this->dayOfMonth = $stamp['mday'];
     return $this->dayOfMonth;
     // Rueckgabe ist der jeweilige Tag des Monats
 }
 function test_calendar()
 {
     $cal = new tx_rnbase_util_Calendar();
     $cal->setTime(mkTime(20, 0, 0, 1, 1, 2005));
     $this->assertEquals($cal->getTime(), 1104606000, 'Zeit falsch');
     $this->assertEquals(strftime('%d.%m.%Y %H:%M:%S', $cal->getTime()), '01.01.2005 20:00:00', 'Zeit falsch');
     $cal->clear(CALENDAR_HOUR);
     $this->assertEquals(strftime('%d.%m.%Y %H:%M:%S', $cal->getTime()), '01.01.2005 00:00:00', 'Zeit falsch');
     $cal->add(CALENDAR_MONTH, -1);
     $this->assertEquals(strftime('%d.%m.%Y %H:%M:%S', $cal->getTime()), '01.12.2004 00:00:00', 'Zeit falsch');
     $cal->add(CALENDAR_YEAR, 3);
     $this->assertEquals(strftime('%d.%m.%Y %H:%M:%S', $cal->getTime()), '01.12.2007 00:00:00', 'Zeit falsch');
     $cal->add(CALENDAR_DAY_OF_MONTH, -1);
     $this->assertEquals(strftime('%d.%m.%Y %H:%M:%S', $cal->getTime()), '30.11.2007 00:00:00', 'Zeit falsch, ADD DAY_OF_MONTH');
 }
	`channel` NOT LIKE \'Local/%\' AND
	`dstchannel` NOT LIKE \'SIP/gs-0%\' AND
	`dst`<>\'s\' AND
	`dst`<>\'h\'';
$rs = $CDR_DB->execute($sql_query);
//echo "START date : $t_day.$t_month.$t_year<br>\n";
for ($hour = $h_start; $hour <= $h_end; $hour = $hour + 0.5) {
    $hour_t_start = (int) mkTime(0, 0, 0, $t_month, $t_day, $t_year) + 3600 * $hour;
    $hour_t_end = $hour_t_start + 1799;
    $time_str = date('H:i', $hour_t_start);
    $sql_time = '(`timestamp`>=' . $hour_t_start . ' AND `timestamp`<=' . $hour_t_end . ')';
    $style_wd = '';
    echo '<tr>', "\n";
    echo '<td class="r"', $style_wd, '>', $time_str, '</td>', "\n";
    for ($day = 0; $day < 5; $day++) {
        $hour_t_start = (int) mkTime(0, 0, 0, $t_month, $t_day + $day, $t_year) + 3600 * $hour;
        $hour_t_end = $hour_t_start + 1799;
        $time_str = date('H:i', $hour_t_start);
        $sql_time = '(`a`.`timestamp`>=' . $hour_t_start . ' AND `a`.`timestamp`<=' . $hour_t_end . ') AND (`b`.`timestamp`>=' . $hour_t_start . ' AND `b`.`timestamp`<=' . ($hour_t_end + 86400) . ')';
        $queue_num_connected = (int) @$CDR_DB->executeGetOne('SELECT COUNT(*) FROM `queue_log` `a`, `queue_log` `b` WHERE
		`a`.`queue_id`=' . $queue_id . '
		AND `a`.`ast_call_id` = `b`.`ast_call_id`
		AND `a`.`event`=\'_ENTER\'
		AND `b`.`event`=\'_CONNECT\'
		AND ' . $sql_time);
        $sql_time = '(`timestamp`>=' . $hour_t_start . ' AND `timestamp`<=' . $hour_t_end . ')';
        $num_entered = (int) @$CDR_DB->executeGetOne('SELECT COUNT(DISTINCT(`ast_call_id`)) FROM `queue_log` WHERE
	`queue_id`=' . $queue_id . '
	AND `event`=\'_ENTER\'
	AND ' . $sql_time);
        if ($exts_sql) {
Exemple #4
0
$Samedi = $Lundi + 432000;
//5 * 86400
//Date du debut de la semaine courante
$datdebut = date('Ymd', $Lundi);
//Date de la fin de la semaine courante
$datfin = date('Ymd', $Samedi);
//Recherche des devoirs programmes pour la semaine courante
$rq = "SELECT id_ds, DATE_FORMAT(date,'%d'),DATE_FORMAT(date,'%m'),DATE_FORMAT(date,'%Y'),\ncreneau, matiere, sujet,  login, durée FROM devoir WHERE date>='{$datdebut}' AND date<='{$datfin}'  AND classe= '{$clas}' ORDER BY date asc , creneau asc";
$res = mysqli_query($GLOBALS["___mysqli_ston"], $rq);
$nb = mysqli_num_rows($res);
//si des devoirs ont ete programmes
if ($nb > 0) {
    //pour chaque devoir programme
    while ($row = mysqli_fetch_array($res, MYSQLI_NUM)) {
        //determination du timestamp du jour du devoir
        $tsmp = mkTime(8, 0, 0, $row[2], $row[1], $row[3]);
        // on parcourt les jours de la semaine
        for ($j = 0; $j <= 5; $j++) {
            $jour = $Lundi + $j * 86400;
            // on parcourt les heures de la  journee
            for ($h = 0; $h <= 9; $h++) {
                //si un devoir est programme pour ce creneau
                if ($jour == $tsmp && $row[4] == $h) {
                    $col = 0;
                    if (isset($plan[$j][$h][$col])) {
                        $col = 1;
                    }
                    //on memorise les donnees dans des tableaux a 3 dimensions
                    $num[$j][$h][$col] = $row[0];
                    //numero
                    $plan[$j][$h][$col] = "R";
function lLastDayMon($lMonth, $lYear)
{
    //---------------------------------------------------------------------
    //  return an integer representing the last day of the specified month
    //---------------------------------------------------------------------
    return date('t', mkTime(0, 0, 0, $lMonth, 1, $lYear));
}
    $totals['num_wait_ok'] += $num_wait_ok;
    # waittime > $waittime_level
    #
    $num_wait_fail = (int) @$CDR_DB->executeGetOne('SELECT COUNT(*) FROM `queue_log` WHERE
    `queue_id`=' . $queue_id . '
AND `event` IN (\'_COMPLETE\', \'_EXIT\')
AND `waittime` IS NOT NULL
AND `waittime`>' . (int) $waittime_level . '
AND ' . $sql_time);
    echo '<td class="r"', $style_wd, '>', $num_wait_fail, '</td>', "\n";
    $totals['num_wait_fail'] += $num_wait_fail;
    echo '</tr>', "\n";
}
--$day;
$month_t_start = (int) mkTime(0, 0, 0, $m, 1, $y);
$month_t_end = (int) mkTime(23, 59, 59, $m, $day, $y);
$sql_time_month = '(`timestamp`>=' . $month_t_start . ' AND `timestamp`<=' . $month_t_end . ')';
$sum_calldur_month = (int) @$CDR_DB->executeGetOne('SELECT SUM(`calldur`) FROM `queue_log` WHERE
    `queue_id`=' . $queue_id . '
AND `event`=\'_COMPLETE\'
AND `reason`<>\'INCOMPAT\'
AND `calldur` IS NOT NULL
AND ' . $sql_time_month);
$avg_calldur_month = $totals['num_connected'] > 0 ? $sum_calldur_month / $totals['num_connected'] : 0;
$pct_connected_month = $totals['num_connected'] > 0 ? $totals['num_connected'] / $totals['num_entered'] : 0.0;
$pct_connected_month = round($pct_connected_month * 100);
$style = 'style="border-top:3px solid #b90; background:#feb; line-height:2.5em;"';
echo '<tr>', "\n";
echo '<td class="r" ', $style, '><b>&sum;</b></td>', "\n";
echo '<td class="r" ', $style, '>', $totals['num_entered'], '</td>', "\n";
echo '<td class="r" ', $style, '>', $totals['num_connected'], '</td>', "\n";
Exemple #7
0
    }
}
$action = @$_REQUEST['action'];
if ($action === 'report') {
    $fr_y = abs((int) lTrim(@$_REQUEST['fr_y'], '0'));
    $fr_m = abs((int) lTrim(@$_REQUEST['fr_m'], '0'));
    $fr_d = abs((int) lTrim(@$_REQUEST['fr_d'], '0'));
    $to_y = abs((int) lTrim(@$_REQUEST['to_y'], '0'));
    $to_m = abs((int) lTrim(@$_REQUEST['to_m'], '0'));
    $to_d = abs((int) lTrim(@$_REQUEST['to_d'], '0'));
    _check_range($fr_y, 1980, 2030);
    _check_range($to_y, 1980, 2030);
    _check_range($fr_m, 1, 12);
    _check_range($to_m, 1, 12);
    _check_range($fr_d, 1, (int) date('t', mkTime(12, 1, 1, $fr_m, 15, $fr_y)));
    _check_range($to_d, 1, (int) date('t', mkTime(12, 1, 1, $to_m, 15, $to_y)));
} else {
    $action = '';
    $now = time();
    $default_to = $now;
    $default_fr = $now - 7 * 24 * 3600;
    $fr_y = (int) date('Y', $default_fr);
    $fr_m = (int) date('n', $default_fr);
    $fr_d = (int) date('j', $default_fr);
    $to_y = (int) date('Y', $default_to);
    $to_m = (int) date('n', $default_to);
    $to_d = (int) date('j', $default_to);
}
?>

<form method="get" action="<?php 
Exemple #8
0
        $datetampon = $enrg[3];
    }
}
//recuperation du parametre timestamp pour memorisation
if (isset($_GET['tsmp'])) {
    $tsmp = $_GET['tsmp'];
}
// si OK a ete cliquer
if (isset($_POST['valider'])) {
    // Traiter le formulaire
    if (isset($_POST['Option1'])) {
        $sens = $_POST['Option1'];
    }
    //la date, le timestamp
    $date_c = $_POST['an_c'] . $_POST['mois_c'] . $_POST['jour_c'];
    $tsmp = mkTime(0, 0, 1, $_POST['mois_c'], $_POST['jour_c'], $_POST['an_c']) + 2592000;
    // Connexion a la base de donnees
    require_once '../Includes/config.inc.php';
    //creer la requete
    if ($cible != "") {
        //elaboration de la date limite a partir de la date selectionnee
        $dat = date('Ymd', $tsmp - 2592000);
        //2592000=nbre de secondes dans 30 jours
    }
    /*************************************************************************
       creation d'un tableau trie contenant les donnees a afficher
       **************************************************************************/
    include_once "/usr/share/lcs/Plugins/Cdt/Includes/fonctions.inc.php";
    $cib = $cible;
    $i = $j = $k = 0;
    $list_art = $list_seq = $Sekance = array();
        $queue_stats = gs_queue_status($queue['host'], $queue['ext'], true, true);
        /*
        echo "<pre>";
        print_r($queue_stats);
        echo "</pre>";
        */
        $queue_title = trim(@$queue['title']) != '' ? trim(@$queue['title']) : '';
        if ($get_queue_stats_from_db) {
            # override $queue_stats['calls'|'completed'|'abandoned'|'holdtime']
            #
            $t = time();
            $now_y = (int) date('Y', $t);
            $now_m = (int) date('n', $t);
            $now_d = (int) date('j', $t);
            $day_t_start = (int) mkTime(0, 0, 0, $now_m, $now_d, $now_y);
            $day_t_end = (int) mkTime(23, 59, 59, $now_m, $now_d, $now_y);
            $sql_qlog_today = '(`timestamp`>=' . $day_t_start . ' AND `timestamp`<=' . $day_t_end . ')';
            $queue_stats['calls'] = (int) @$CDR_DB->executeGetOne('SELECT COUNT(*) FROM `queue_log` WHERE `queue_id`=' . $queue['id'] . '
AND ' . $sql_qlog_today . '
AND `event`=\'_ENTER\'');
            $queue_stats['completed'] = (int) @$CDR_DB->executeGetOne('SELECT COUNT(*) FROM `queue_log` WHERE `queue_id`=' . $queue['id'] . '
AND ' . $sql_qlog_today . '
AND `event`=\'_CONNECT\'');
            $queue_stats['abandoned'] = (int) @$CDR_DB->executeGetOne('SELECT COUNT(*) FROM `queue_log` WHERE `queue_id`=' . $queue['id'] . '
AND ' . $sql_qlog_today . '
AND `event`=\'_EXIT\' AND `reason`=\'ABANDON\'');
            $queue_stats['_timeout'] = (int) @$CDR_DB->executeGetOne('SELECT COUNT(*) FROM `queue_log` WHERE `queue_id`=' . $queue['id'] . '
AND ' . $sql_qlog_today . '
AND `event`=\'_EXIT\' AND `reason`=\'TIMEOUT\'');
            $queue_stats['_empty'] = (int) @$CDR_DB->executeGetOne('SELECT COUNT(*) FROM `queue_log` WHERE `queue_id`=' . $queue['id'] . '
AND ' . $sql_qlog_today . '
Exemple #10
0
echo __('von intern');
?>
</th>
			<th style="width:50px;" class="r"><?php 
echo __('von extern');
?>
</th>
		</tr>
		</thead>
		<tbody>
		<?php 
$now = time();
$y = (int) date('Y', $now);
$m = (int) date('n', $now);
$d = (int) date('j', $now);
$t_from = mkTime(0, 0, 0, $m, $d, $y);
$exts_sql = _users_sql_to_exts_sql($users_sql);
$n_calls_bysrc_answ_i = _num_calls_cdr_bysrc_since($exts_sql, $t_from, 'ANSWERED', false);
$n_calls_bysrc_answ_e = _num_calls_cdr_bysrc_since($exts_sql, $t_from, 'ANSWERED', true);
$n_calls_bysrc_busy_i = _num_calls_cdr_bysrc_since($exts_sql, $t_from, 'BUSY', false);
$n_calls_bysrc_busy_e = _num_calls_cdr_bysrc_since($exts_sql, $t_from, 'BUSY', true);
$n_calls_bysrc_noan_i = _num_calls_cdr_bysrc_since($exts_sql, $t_from, 'NO ANSWER', false);
$n_calls_bysrc_noan_e = _num_calls_cdr_bysrc_since($exts_sql, $t_from, 'NO ANSWER', true);
$n_calls_bysrc_fail_i = _num_calls_cdr_bysrc_since($exts_sql, $t_from, 'FAILED', false);
$n_calls_bysrc_fail_e = _num_calls_cdr_bysrc_since($exts_sql, $t_from, 'FAILED', true);
$n_calls_bydst_answ_i = _num_calls_cdr_bydst_since($exts_sql, $t_from, 'ANSWERED', false);
$n_calls_bydst_answ_e = _num_calls_cdr_bydst_since($exts_sql, $t_from, 'ANSWERED', true);
$n_calls_bydst_busy_i = _num_calls_cdr_bydst_since($exts_sql, $t_from, 'BUSY', false);
$n_calls_bydst_busy_e = _num_calls_cdr_bydst_since($exts_sql, $t_from, 'BUSY', true);
$n_calls_bydst_noan_i = _num_calls_cdr_bydst_since($exts_sql, $t_from, 'NO ANSWER', false);
$n_calls_bydst_noan_e = _num_calls_cdr_bydst_since($exts_sql, $t_from, 'NO ANSWER', true);
Exemple #11
0
    for ($index = 0; $index < count($data); $index++) {
        fputs($fichier, "\$classe[{$index}]=\"{$data[$index]}\";\n");
    }
    fputs($fichier, " ?>\n");
    fclose($fichier);
    exec("/usr/bin/sudo /usr/share/lcs/scripts/chaccess_cdt.sh NoWritable data");
}
//si clic sur Enregistrer
if (isset($_POST['Enregistrer'])) {
    $crenoff = $_POST['crenoff'];
    $nom_fichier = "../Includes/creneau.inc.php";
    exec("/usr/bin/sudo /usr/share/lcs/scripts/chaccess_cdt.sh Writable creneau");
    $fichier = fopen($nom_fichier, "w");
    fputs($fichier, "<?php \n");
    for ($index = 0; $index < 10; $index++) {
        fputs($fichier, "\$deb[{$index}]=" . mkTime($_POST["hd" . $index], $_POST["md" . $index], 0) . ";\$fin[{$index}]=" . mkTime($_POST["hf" . $index], $_POST["mf" . $index], 0) . ";\$dif[{$index}]=" . (mkTime($_POST["hd" . $index], $_POST["md" . $index], 0) - mkTime(8, 0, 0)) . ";\n");
    }
    $i = 0;
    if (in_array("M4", $crenoff)) {
        fputs($fichier, "\$cren_off[{$i}]=\"M4\";\n");
        $i++;
        fputs($fichier, "\$cren_off[{$i}]=\"M5\";\n");
        $i++;
    } elseif (in_array("M5", $crenoff)) {
        fputs($fichier, "\$cren_off[{$i}]=\"M5\";\n");
        $i++;
    }
    if (in_array("S4", $crenoff)) {
        fputs($fichier, "\$cren_off[{$i}]=\"S4\";\n");
        $i++;
        fputs($fichier, "\$cren_off[{$i}]=\"S5\";\n");
Exemple #12
0
//Date de la fin de la semaine courante
$datfin = date('Ymd', $Samedi);
$datd = getdate($Lundi);
$dtdebut = date('Y', $datd['0']) . "/" . date('m', $datd['0']) . "/" . date('d', $datd['0']);
$datf = getdate($Samedi);
$dtdfin = date('Y', $datf['0']) . "/" . date('m', $datf['0']) . "/" . date('d', $datf['0']);
//Recherche des absences /retards pour la semaine courante
$rq = "SELECT M1,M2,M3,M4,M5,S1,S2,S3,S4,S5,DATE_FORMAT(date,'%d'),DATE_FORMAT(date,'%m'),DATE_FORMAT(date,'%Y'),\nmotifM1,motifM2,motifM3,motifM4,motifM5,motifS1,motifS2,motifS3,motifS4,motifS5 FROM absences WHERE\n uideleve='{$potache}' AND date >='{$dtdebut}' AND date<='{$dtdfin}' ORDER BY date ASC";
$res = mysqli_query($GLOBALS["___mysqli_ston"], $rq);
$nb = mysqli_num_rows($res);
//si des absences/retards ont ete programmes
if ($nb > 0) {
    //pour chaque absence/retard programme
    while ($row = mysqli_fetch_array($res, MYSQLI_NUM)) {
        //determination du timestamp
        $tsmp = mkTime(8, 0, 0, $row[11], $row[10], $row[12]);
        //tsmp=mkTime(8,0,0,$row[2],$row[1],$row[3]);
        // on parcourt les jours de la semaine
        for ($j = 0; $j <= 5; $j++) {
            $jour = $Lundi + $j * 86400;
            // on parcourt les heures de la  journee
            for ($h = 0; $h <= 9; $h++) {
                if ($jour == $tsmp) {
                    if ($row[$h] != "") {
                        $plan[$j][$h] = $row[$h];
                        $why[$j][$h] = utf8_encode($row[$h + 13]);
                    }
                }
            }
        }
    }
Exemple #13
0
function dtint($d)
{
    return mkTime(0, 0, 0, substr($d, 5, 2), substr($d, 8, 2), substr($d, 0, 4));
}
Exemple #14
0
    $height = 180;
}
$padt = 12;
$padb = 22;
$padl = 40;
$padr = 14;
$cw = $width - $padl - $padr;
$ch = $height - $padt - $padb;
$fr_y = (int) lTrim(@$_REQUEST['fy'], '0-');
$fr_m = (int) lTrim(@$_REQUEST['fm'], '0-');
$fr_d = (int) lTrim(@$_REQUEST['fd'], '0-');
$to_y = (int) lTrim(@$_REQUEST['ty'], '0-');
$to_m = (int) lTrim(@$_REQUEST['tm'], '0-');
$to_d = (int) lTrim(@$_REQUEST['td'], '0-');
$fr = mkTime(0, 0, 0, $fr_m, $fr_d, $fr_y);
$to = mkTime(23, 59, 59, $to_m, $to_d, $to_y);
if ($to < $fr) {
    $tmp = $fr;
    $fr = $to;
    $to = $tmp;
}
$time_range = $to - $fr;
$time_range_days = $time_range / (60 * 60 * 24);
if ($time_range_days <= 2) {
    $xtstr = '+1 hours';
    $xdfmt = 'H';
} elseif ($time_range_days <= 31) {
    $xtstr = '+1 days';
    $xdfmt = 'j';
} elseif ($time_range_days <= 31 * 2) {
    $xtstr = '+1 weeks';
 /**
  * Retrieves the start date for the series of weeks, given a year of the season start.
  * @param array $args Form arguments array, containing start setting (ddmm format) and optional weekday (full name day of week).
  * @param int $yr Year
  * @return timestamp Start date
  */
 private static function getStartDateForYear($args, $yr)
 {
     $day = substr($args['season_start'], 0, 2);
     $month = substr($args['season_start'], 2, 2);
     $proposedStart = mkTime(0, 0, 0, $month, $day, $yr);
     if ($args['weekday']) {
         $dateArr = getdate($proposedStart);
         if (strtolower($dateArr['weekday']) !== strtolower($args['weekday'])) {
             $proposedStart = strtotime('Last ' . $args['weekday'], $proposedStart);
         }
     }
     return $proposedStart;
 }
Exemple #16
0
            $val_annee = $enrg[2];
            $cours = utf8_encode($enrg[3]);
            $afaire = utf8_encode($enrg[4]);
            $val_jouraf = $enrg[5];
            $val_moisaf = $enrg[6];
            $val_anneeaf = $enrg[7];
            $val_moisv = $enrg[9];
            $val_jourv = $enrg[8];
            $val_anneev = $enrg[10];
            //calcul du timestamp correspondant a la date de l'article
            $tsmp = mkTime(0, 0, 1, $val_mois, $val_jour, $val_annee);
            //calcul du timestamp correspondant a la date "a faire" de l'article
            $tsmp2 = mkTime(0, 0, 1, $val_moisaf, $val_jouraf, $val_anneeaf);
            // - 604800 604800 pour compenser offset 7 jours
            //calcul du timestamp correspondant a la date de vsisbilite
            $tsmp3 = mkTime(0, 0, 1, $val_moisv, $val_jourv, $val_anneev);
            $Seq = $enrg[11];
        }
    }
}
//recherche de la mati&egrave;ere et la classe de la rubrique active du cahier de textes
if (isset($cible)) {
    $rq = "SELECT classe,matiere FROM onglets\n    WHERE id_prof='{$cible}'  ";
    // lancer la requ&egrave;ete
    $result = @mysqli_query($GLOBALS["___mysqli_ston"], $rq) or die(is_object($dbc) ? mysqli_error($dbc) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false));
    // Combien y a-t-il d'enregistrements ?
    $nb = mysqli_num_rows($result);
    //on recupere les donnees
    while ($enrg = mysqli_fetch_array($result, MYSQLI_NUM)) {
        $classe_active = $enrg[0];
        //classe