Пример #1
0
function search($begin_date, $end_date)
{
    $dir = new DirectoryIterator("archive/");
    $files = array();
    foreach ($dir as $fileinfo) {
        if (!$fileinfo->isDot()) {
            $filename = $fileinfo->getFilename();
            $files[] = $filename;
        }
    }
    $return_obj = array();
    foreach ($files as $file) {
        $filedate = substr($file, 0, 8);
        $dates_array = dateRange($begin_date, $end_date);
        if (in_array($filedate, $dates_array)) {
            $json_file = json_decode(file_get_contents("archive/" . $file));
            foreach ($json_file as $json_obj) {
                $file_obj = array("category" => $json_obj->category, "location" => $json_obj->location);
                $return_obj[] = $file_obj;
            }
        }
    }
    header("Content-Type: application/json");
    return json_encode($return_obj);
}
Пример #2
0
 /**
  * @return array
  */
 public function getByDays()
 {
     $results = array();
     $databaseResults = $this->getEntityManager()->createQuery("SELECT\n                    DATE(v.timeCreated) AS date,\n                    COUNT(v.id) AS countNumber\n                FROM Application\\Entity\\VoteEntity v\n                GROUP BY date\n                ORDER BY date DESC")->getArrayResult();
     $firstDate = date('Y-m-d', strtotime('-4 weeks'));
     $lastDate = date('Y-m-d');
     $dates = dateRange($firstDate, $lastDate, '+ 1 day', 'Y-m-d');
     foreach ($dates as $date) {
         $count = 0;
         if ($databaseResults) {
             foreach ($databaseResults as $databaseResult) {
                 if ($databaseResult['date'] == $date) {
                     $count = (int) $databaseResult['countNumber'];
                 }
             }
         }
         $results[] = array('date' => $date, 'count' => $count);
     }
     return $results;
 }
Пример #3
0
         }
     }
     $jumlahcuti = $jumlahcuti1 - $hrmingggu - $liburcuti;
     if ($jumlahcuti <= 0) {
         $hasiljumlahcuti = 0;
     }
     if ($jumlahcuti > 0) {
         $hasiljumlahcuti = $jumlahcuti;
     }
 } else {
     $hasiljumlahcuti = 0;
 }
 /* -------------------------------------- */
 $uang_makan_transport = $objectdata->NOMINAL_UMT * $jumlahmasuk;
 $takehomepay = getthp($NIP) - ($hutang->hutangnya + $nominalpinjaman + $nominaltabungan);
 $hitungjumlahharikerja = dateRange($startp, $endp) - selisihHariMinggu($startp, $endp) - $jumlahlibur;
 /*----- $hasiljumlahcuti blm sesuai karena perubahan input proses menggunakan tgl periode ------- */
 $mangkir = $hitungjumlahharikerja - $jumlahmasuk - $hasiljumlahcuti;
 if ($mangkir <= 0) {
     $hasil = 0;
     if ($hasiljumlahcuti == 0) {
         $nominal_kehadiran_full = $valuefull;
     } else {
         $nominal_kehadiran_full = 0;
     }
 }
 if ($mangkir > 0) {
     $hasil = $mangkir;
     $nominal_kehadiran_full = 0;
 }
 $pot_mangkir = 0;
Пример #4
0
<!DOCTYPE html>
<html lang="EN">
	<head>
		<meta charset="UTF-8"/>
		<title>Kuupäeva funktsioon</title>	
	
	</head>
	<body>
		<?php 
date_default_timezone_set('Europe/Tallinn');
function dateRange($start, $end)
{
    $range;
    if (date("Y", $start) == date("Y", $end) && date("m", $start) == date("m", $end) && date("d", $start) == date("d", $end) && date("i", $start) != date("i", $end)) {
        $range = date("d.m.Y", strtotime($start)) . ' ' . date("H", strtotime($start)) . ':' . date("i", strtotime($start)) . '-' . date("H", strtotime($end) . ':' . date("i", strtotime($end)));
        echo 'minutid erinevad';
    } else {
        if (date("Y", $start) == date("Y", $end) && date("m", $start) == date("m", $end) && date("d", $start) == date("d", $end) && date("i", $start) == date("i", $end)) {
            $range = date("d.m.Y", strtotime($start)) . ' ' . date("H", strtotime($start)) . '-' . date("H", strtotime($end));
            echo 'minutid samad';
        }
    }
    return $range;
}
echo dateRange("2014-03-03 22:10:00", "2015-03-03 23:00:00") . '<br/>';
echo dateRange("2015-02-02 12:00:00", "2015-03-03 23:50:00");
?>
		
	
		
		
            }
        }
    }
    if ($jumlahcuti <= 0) {
        $hasiljumlahcuti = 0;
    }
    if ($jumlahcuti > 0) {
        $hasiljumlahcuti = $jumlahcuti;
    }
} else {
    $hasiljumlahcuti = 0;
}
if ($KODE_JAM_KERJA == 1) {
    $hitungjumlahharikerja = dateRange($start, $end) - selisihHariMinggu($start, $end) - $jumlahlibur;
} else {
    $hitungjumlahharikerja = dateRange($start, $end) - $hari_libur_outlet_outlet - $jumlahlibur;
}
//$hitungjumlahharikerja=$jumlahlibur;
$mangkir = $hitungjumlahharikerja - $jumlahmasuk - $hasiljumlahcuti;
//$mangkir=$hitungjumlahharikerja;
if ($mangkir <= 0) {
    header('Content-Type: application/json');
    echo json_encode(array('hasil' => '0', 'ket' => 'nol'));
}
if ($mangkir > 0) {
    if ($mangkir < $JML) {
        header('Content-Type: application/json');
        echo json_encode(array('hasil' => $mangkir, 'ket' => 'lebih'));
    } else {
        if ($mangkir >= $JML) {
            $okin = 0 + $jumlahmasuk + $JML;
Пример #6
0
<?php

header("Content-Type: text/plain");
function dateRange($b, $e)
{
    $begin = substr($b, 0, 4) . "-" . substr($b, 4, 2) . "-" . substr($b, 6, 2);
    $end = substr($e, 0, 4) . "-" . substr($e, 4, 2) . "-" . substr($e, 6, 2);
    $range = array();
    #change below to make top redundant, i.e. replace substr to pull from original
    $iDateFrom = mktime(1, 0, 0, substr($begin, 5, 2), substr($begin, 8, 2), substr($begin, 0, 4));
    $iDateTo = mktime(1, 0, 0, substr($end, 5, 2), substr($end, 8, 2), substr($end, 0, 4));
    if ($iDateTo >= $iDateFrom) {
        array_push($range, date('Ymd', $iDateFrom));
        // first entry
        while ($iDateFrom < $iDateTo) {
            $iDateFrom += 86400;
            // add 24 hours
            array_push($range, date('Ymd', $iDateFrom));
        }
    }
    return array_reverse($range);
}
$dates = dateRange('20140101', '20141029');
foreach ($dates as $date) {
    echo $date . "\n";
}
fclose($file);
Пример #7
0
function getDates($type, $range, $gap, $selMonth1, $selDay1, $selYear1, $selMonth2, $selDay2, $selYear2)
{
    $dt1 = mktime(0, 0, 0, $selMonth1, $selDay1, $selYear1);
    $dt2 = mktime(0, 0, 0, $selMonth2, $selDay2, $selYear2);
    $mult = $gap * $range;
    $unit_gap = 24 * 60 * 60;
    $total_gap = $unit_gap * $mult;
    // total gap in seconds
    if ($dt1 == $dt2) {
        $dt1 = $dt1 - $total_gap;
        //logger("Coinciding start and end data, stepping $mult day(s) back... ");
        $selMonth1 = strftime("%m", $dt1);
        $selDay1 = strftime("%d", $dt1);
        $selYear1 = strftime("%G", $dt1);
        // Selecting ISO year number
    }
    $DATERANGE = dateRange($type, $selMonth1, $selDay1, $selYear1, $selMonth2, $selDay2, $selYear2);
    logger("Date Range - " . $DATERANGE);
    return $DATERANGE;
}
Пример #8
0
$query = "select group_concat(urlhash) from {$gUrlsTable} where (urlOrig like '%{$term}%' or urlFixed like '%{$term}%');";
$sUrlhashes = doSimpleQuery($query);
// It's possible the list ends in "," which is bad (eg, if urlhash is null).
if ("," === substr($sUrlhashes, -1)) {
    $sUrlhashes = substr($sUrlhashes, 0, -1);
}
// It's possible that we don't have any results for some of these URLs:
// they could have a low rank (> 300K) or always return errors.
// So we have to look for actual results.
// The tricky part of this is doing "group by url" but figuring out what to order on.
// If we order by "rank asc" then NULL gets listed first.
// We fix that by ordering by "brank, rank asc" but that might not match the LATEST results - only the aggregate.
// So it's possible we'll put something too high in the order that USED TO BE ranked but is now NULL.
// TODO - better ordering?
// TODO - could also save the newest pageid to urls table (altho is that mobile or desktop?) or just a boolean bAreThereAnyResultsForThisURL
$query = "select url, urlhash, max(pageid) as pageid, min(rank is null) as brank, min(rank) as rank from {$gPagesTable} " . "where " . dateRange(true) . " and archive='{$gArchive}' and urlhash in ({$sUrlhashes}) and urlShort like '%{$term}%' group by url order by brank, rank asc limit {$maxLimit};";
$result = doQuery($query);
$numUrls = mysql_num_rows($result);
// Only return $maxResults results.
// If there are more results, return a message with the remaining number.
$aSites = array();
while (count($aSites) < $maxResults && ($row = mysql_fetch_assoc($result))) {
    $url = $row['url'];
    array_push($aSites, array("label" => $url, "value" => $url, "data-urlhash" => $row['urlhash'], "data-pageid" => $row['pageid']));
}
mysql_free_result($result);
if ($numUrls > count($aSites)) {
    $remaining = $numUrls - count($aSites);
    array_push($aSites, array("label" => ($remaining > 100 ? "100+ more URLs" : "{$remaining} more URLs") . ", refine further", "value" => "0"));
}
//echo JSON to our jQueryUI auto-complete box
Пример #9
0
<?php

require_once '../../includes/classes/core.php';
$action = $_REQUEST['act'];
$user_id = $_SESSION['USERID'];
$error = '';
$data = '';
switch ($action) {
    case 'get_list1':
        $data3 .= '<table style="font-weight: bold; width: 1800px"><tr><td><table style="width: 200px;">';
        $dates = dateRange($_REQUEST[start], $_REQUEST[end]);
        $time = array('00:00', '01:00', '02:00', '03:00', '04:00', '05:00', '06:00', '07:00', '08:00', '09:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00', '20:00', '21:00', '22:00', '23:00');
        foreach ($dates as &$date) {
            $result = mysql_query("SELECT  COALESCE(p0.id,p1.id) as id1,\r\n                                          crystal_users.`name`,\r\n                            \t\t\t  crystal_users.`id`,\r\n                                          DATE('{$date}') AS `date`,\r\n                                          time(COALESCE(p0.`start`,IF(NOT ISNULL(p1.`end`),'00:00',''))) AS `start`,\r\n                            \t\t\t  time(COALESCE(p1.`end`,  IF(NOT ISNULL(p0.`start`),'24:00',''))) AS `end`\t\t\r\n                            FROM  crystal_users\r\n                            left JOIN    person_work_graphic AS p0  ON crystal_users.id = p0.person_id   and  p0.`status` = 1 AND \r\n                            \t\t\t\t\t\t(DATE(p0.`start`)='{$date}') AND p0.actived=1\r\n                            left JOIN    person_work_graphic AS p1 ON crystal_users.id = p1.person_id   and  p1.`status` = 1 AND \r\n                            \t\t\t\t\t\t(DATE(p1.`end`)='{$date}') AND p1.actived=1\r\n                            WHERE crystal_users.group_id=1 and crystal_users.`id`!=613");
            $data1 .= '<td><table style="font-weight: bold; ">';
            $data1 .= '<tr style="height:30px; ">               
                    <td colspan ="24" style="text-align: center; vertical-align: middle;"> ' . $date . '</td>
               </tr>';
            for ($i = 0; $i < sizeof($time); $i++) {
                $data1 .= '<td><div style="transform: rotate(270deg);margin: 12px -7px;" >' . $time[$i] . '</div></td>';
            }
            $data1 .= '</tr>';
            $data2 = '<tr style="height:68px; ">               
                    <td></td>
               </tr>';
            while ($row = mysql_fetch_array($result)) {
                $data1 .= '<tr style="height:20px">';
                $data2 .= '<tr style="height:20px"><td>' . $row['name'] . '<td></tr>';
                for ($i = 0; $i < sizeof($time); $i++) {
                    switch ($time[$i]) {
                        case $time[$i] >= substr($row['start'], 0, 5) && $time[$i] < substr($row['end'], 0, 5):
Пример #10
0
                        update_post_meta($id, 'cb_views_count', 0);
                        echo 'clean';
                    }
                    $cb_vote_details = get_post_meta($id, 'cb_vote_details', true);
                    $cb_views_details = get_post_meta($id, 'cb_views_details', true);
                    if (is_array($cb_vote_details)) {
                        ?>
<table class="votes_table">
		<?php 
                        $size = sizeof($cb_vote_details) - 1;
                        echo '<thead><th>#</th><th>' . __('Vote Day/Time', 'cb_votes') . '</th><th>' . __('User or IP', 'cb_votes') . '</th></thead>';
                        $size2 = '';
                        $daty = dateRange(date("m/d/Y", $cb_vote_details[0]['time']), date("m/d/Y", $cb_vote_details[$size]['time']));
                        if (is_array($cb_views_details)) {
                            $size2 = sizeof($cb_views_details);
                            $daty2 = dateRange(date("m/d/Y", $cb_views_details[0]['time']), date("m/d/Y", $cb_views_details[$size2 - 1]['time']));
                            $daty = array_merge((array) $daty, (array) $daty2);
                        }
                        for ($i = $size; $i >= 0; $i--) {
                            if (is_numeric($cb_vote_details[$i]['IP'])) {
                                $user_data = get_user_by('id', $cb_vote_details[$i]['IP']);
                                $user = '******' . get_edit_user_link($cb_vote_details[$i]['IP']) . '">' . $user_data->display_name . '</a>';
                            } else {
                                $user = $cb_vote_details[$i]['IP'];
                            }
                            echo '<tr><td>' . ($i + 1) . '</td><td>' . date("F j, Y, g:i a", $cb_vote_details[$i]['time']) . '</td><td>' . $user . '</td></tr>';
                            if (is_array($daty[date("d/m/Y", $cb_vote_details[$i]['time'])])) {
                                $daty[date("d/m/Y", $cb_vote_details[$i]['time'])]['votes']++;
                            }
                        }
                        for ($i = 0; $i < $size2; $i++) {
Пример #11
0
                $booking_info = "(" . Translate("No details", 1) . ")";
            }
            $booking_duration = strtotime($bookings_["book_end"]) - strtotime($bookings_["book_start"]);
            if (strtotime($bookings_["book_start"]) <= $current_day_start) {
                $booking_start = 0;
            } else {
                $booking_start = strtotime($bookings_["book_start"]) - $current_day_start;
            }
            if (strtotime($bookings_["book_end"]) >= $current_day_start + 86400) {
                $booking_end = 86400;
            } else {
                $booking_end = strtotime($bookings_["book_end"]) - $current_day_start;
            }
            $booking_left = round($booking_start / 86400 * $day_width);
            $booking_width = round(($booking_end - $booking_start) / 86400 * $day_width);
            $booking_dates = dateRange($bookings_["book_start"], $bookings_["book_end"]);
            $html .= "<div class=\"booking_line\" style=\"background:#" . $booking_color . "; height:" . $bookline_height . "px; left:" . $booking_left . "px; width:" . $booking_width . "px\" ";
            $html .= "onMouseOver=\"ShowInfos(event,'" . $booking_user_name . "','" . $booking_dates . "','" . $booking_info . "')\" onMouseOut=\"HideInfos()\"></div>\n";
        }
        $html .= "</div>\n";
        $html .= "</td>\n";
    }
    $html .= "</tr>\n";
}
$html .= "</table>\n";
$html .= "</div>\n";
echo $html;
?>

<div id="booking_infos"></div>
Пример #12
0
 public function meStatisticsAction(Request $request, Application $app)
 {
     $now = new \Datetime('now');
     $today = new \Datetime('today');
     $yesterday = new \Datetime('yesterday');
     $thisWeek = new \Datetime('last monday');
     $lastWeek = clone $thisWeek;
     $lastWeek = $lastWeek->modify('-1 week');
     $thisMonth = new \Datetime(date('Y-m-01 00:00:00'));
     $lastMonth = new \Datetime(date('Y-' . ((int) date('m') - 1) . '-01 00:00:00'));
     $thisYear = new \Datetime(date('Y-01-01 00:00:00'));
     $hoursWorkedPerDay = array_fill_keys(dateRange('-2 weeks', 'now'), 0);
     // Today
     $hoursWorkedToday = 0;
     $result = $app['orm.em']->createQuery("SELECT SUM(TIMESTAMPDIFF(MINUTE, wt.timeStarted, wt.timeEnded)) AS minutesTotal\n                FROM Application\\Entity\\WorkingTimeEntity wt\n                WHERE wt.user = :user\n                    AND wt.timeEnded IS NOT NULL\n                    AND wt.timeStarted >= :timeFrom")->setParameter(':user', $app['user'])->setParameter(':timeFrom', $today->format(DATE_ATOM))->getResult();
     if (isset($result[0]['minutesTotal'])) {
         $hoursWorkedToday = round($result[0]['minutesTotal'] / 60, 2);
     }
     // Yesterday
     $hoursWorkedYesterday = 0;
     $result = $app['orm.em']->createQuery("SELECT SUM(TIMESTAMPDIFF(MINUTE, wt.timeStarted, wt.timeEnded)) AS minutesTotal\n                FROM Application\\Entity\\WorkingTimeEntity wt\n                WHERE wt.user = :user\n                    AND wt.timeEnded IS NOT NULL\n                    AND wt.timeStarted >= :timeFrom\n                    AND wt.timeStarted <= :timeTo")->setParameter(':user', $app['user'])->setParameter(':timeFrom', $yesterday->format(DATE_ATOM))->setParameter(':timeTo', $today->format(DATE_ATOM))->getResult();
     if (isset($result[0]['minutesTotal'])) {
         $hoursWorkedYesterday = round($result[0]['minutesTotal'] / 60, 2);
     }
     // This Week
     $hoursWorkedThisWeek = 0;
     $result = $app['orm.em']->createQuery("SELECT SUM(TIMESTAMPDIFF(MINUTE, wt.timeStarted, wt.timeEnded)) AS minutesTotal\n                FROM Application\\Entity\\WorkingTimeEntity wt\n                WHERE wt.user = :user\n                    AND wt.timeEnded IS NOT NULL\n                    AND wt.timeStarted >= :timeFrom")->setParameter(':user', $app['user'])->setParameter(':timeFrom', $thisWeek->format(DATE_ATOM))->getResult();
     if (isset($result[0]['minutesTotal'])) {
         $hoursWorkedThisWeek = round($result[0]['minutesTotal'] / 60, 2);
     }
     // Last Week
     $hoursWorkedLastWeek = 0;
     $result = $app['orm.em']->createQuery("SELECT SUM(TIMESTAMPDIFF(MINUTE, wt.timeStarted, wt.timeEnded)) AS minutesTotal\n                FROM Application\\Entity\\WorkingTimeEntity wt\n                WHERE wt.user = :user\n                    AND wt.timeEnded IS NOT NULL\n                    AND wt.timeStarted >= :timeFrom\n                    AND wt.timeStarted <= :timeTo")->setParameter(':user', $app['user'])->setParameter(':timeFrom', $lastWeek->format(DATE_ATOM))->setParameter(':timeTo', $thisWeek->format(DATE_ATOM))->getResult();
     if (isset($result[0]['minutesTotal'])) {
         $hoursWorkedLastWeek = round($result[0]['minutesTotal'] / 60, 2);
     }
     // This Month
     $hoursWorkedThisMonth = 0;
     $result = $app['orm.em']->createQuery("SELECT SUM(TIMESTAMPDIFF(MINUTE, wt.timeStarted, wt.timeEnded)) AS minutesTotal\n                FROM Application\\Entity\\WorkingTimeEntity wt\n                WHERE wt.user = :user\n                    AND wt.timeEnded IS NOT NULL\n                    AND wt.timeStarted >= :timeFrom")->setParameter(':user', $app['user'])->setParameter(':timeFrom', $thisMonth->format(DATE_ATOM))->getResult();
     if (isset($result[0]['minutesTotal'])) {
         $hoursWorkedThisMonth = round($result[0]['minutesTotal'] / 60, 2);
     }
     // Last Month
     $hoursWorkedLastMonth = 0;
     $result = $app['orm.em']->createQuery("SELECT SUM(TIMESTAMPDIFF(MINUTE, wt.timeStarted, wt.timeEnded)) AS minutesTotal\n                FROM Application\\Entity\\WorkingTimeEntity wt\n                WHERE wt.user = :user\n                    AND wt.timeEnded IS NOT NULL\n                    AND wt.timeStarted >= :timeFrom\n                    AND wt.timeStarted <= :timeTo")->setParameter(':user', $app['user'])->setParameter(':timeFrom', $lastMonth->format(DATE_ATOM))->setParameter(':timeTo', $thisMonth->format(DATE_ATOM))->getResult();
     if (isset($result[0]['minutesTotal'])) {
         $hoursWorkedLastMonth = round($result[0]['minutesTotal'] / 60, 2);
     }
     // This Year
     $hoursWorkedThisYear = 0;
     $result = $app['orm.em']->createQuery("SELECT SUM(TIMESTAMPDIFF(MINUTE, wt.timeStarted, wt.timeEnded)) AS minutesTotal\n                FROM Application\\Entity\\WorkingTimeEntity wt\n                WHERE wt.user = :user\n                    AND wt.timeEnded IS NOT NULL\n                    AND wt.timeStarted >= :timeFrom")->setParameter(':user', $app['user'])->setParameter(':timeFrom', $thisYear->format(DATE_ATOM))->getResult();
     if (isset($result[0]['minutesTotal'])) {
         $hoursWorkedThisYear = round($result[0]['minutesTotal'] / 60, 2);
     }
     // Hours Worked per Day
     $hoursWorkedPerDayResults = $app['orm.em']->createQuery("SELECT\n                    DATE(wt.timeStarted) AS date,\n                    SUM(TIMESTAMPDIFF(MINUTE, wt.timeStarted, wt.timeEnded)) AS minutesTotal\n                FROM Application\\Entity\\WorkingTimeEntity wt\n                WHERE wt.user = :user\n                    AND wt.timeEnded IS NOT NULL\n                GROUP BY date\n                ORDER BY wt.timeStarted DESC")->setParameter(':user', $app['user'])->getResult();
     if (!empty($hoursWorkedPerDayResults)) {
         $hoursWorkedPerDayTmp = array();
         foreach ($hoursWorkedPerDay as $date => $hours) {
             $hours = 0;
             foreach ($hoursWorkedPerDayResults as $hoursWorkedPerDayResult) {
                 if ($hoursWorkedPerDayResult['date'] == $date) {
                     $hours = round($hoursWorkedPerDayResult['minutesTotal'] / 60, 2);
                     break;
                 }
             }
             $hoursWorkedPerDayTmp[$date] = $hours;
         }
         $hoursWorkedPerDay = $hoursWorkedPerDayTmp;
     }
     return $app->json(array('hours_worked' => array('today' => $hoursWorkedToday, 'yesterday' => $hoursWorkedYesterday, 'this_week' => $hoursWorkedThisWeek, 'last_week' => $hoursWorkedLastWeek, 'this_month' => $hoursWorkedThisMonth, 'last_month' => $hoursWorkedLastMonth, 'this_year' => $hoursWorkedThisYear), 'hours_worked_per_day' => $hoursWorkedPerDay, 'hours_worked_per_day_keys' => array_keys($hoursWorkedPerDay), 'hours_worked_per_day_values' => array_values($hoursWorkedPerDay)));
 }
function selisihHariMinggu($tglAwal, $tglAkhir)
{
    $pecah1 = explode("-", $tglAwal);
    $date1 = $pecah1[2];
    $month1 = $pecah1[1];
    $year1 = $pecah1[0];
    $pecah2 = explode("-", $tglAkhir);
    $date2 = $pecah2[2];
    $month2 = $pecah2[1];
    $year2 = $pecah2[0];
    $jd1 = GregorianToJD($month1, $date1, $year1);
    $jd2 = GregorianToJD($month2, $date2, $year2);
    $selisih = dateRange($tglAwal, $tglAkhir);
    for ($i = 1; $i <= $selisih; $i++) {
        $tanggal = mktime(0, 0, 0, $month1, $date1 + $i, $year1);
        $tglstr = date("Y-m-d", $tanggal);
        if (date("N", $tanggal) == 1) {
            $libur2++;
        }
    }
    return $libur2;
}
Пример #14
0
     						LEFT JOIN person_work_graphic ON week_day.id=DAYOFWEEK(person_work_graphic.date) AND person_work_graphic.user_id=$user_id
     			  			AND  WEEKOFYEAR(person_work_graphic.date + INTERVAL 1 DAY) =WEEKOFYEAR(('".date('Y-m-d', strtotime($_REQUEST[date]))."'+ INTERVAL 1 DAY))
     						LEFT JOIN work_graphic ON person_work_graphic.work_graphic_id=work_graphic.id AND work_graphic.actived=1
     
     			  			"); */
     $rResult = mysql_query("\r\n\r\n\t\t\t  \t\t\tSELECT\t\t\tweek_day.id ,\r\n\t\t\t\t\t\t\t\t\t\tweek_day.`name`\r\n\t\t\t\t\t\tFROM `week_day`\r\n\t\t\t  \t\t\t");
     $data = array("aaData" => array());
     while ($aRow = mysql_fetch_array($rResult)) {
         $data['aaData'][] = $aRow;
     }
     break;
 case "get_edit_page":
     $data['page'][] = page();
     break;
 case 'getworc':
     $code[] = dateRange($_REQUEST[start], $_REQUEST[end]);
     print_r($code);
     break;
     /////////////////////////////////////////////////////////////////////9999999999999999999999999999999999
 /////////////////////////////////////////////////////////////////////9999999999999999999999999999999999
 case 'disable':
     mysql_query("UPDATE `work_graphic` SET `actived`='0' WHERE (`id`='{$_REQUEST['id']}')");
     break;
 case 'get_add_page':
     $data['page'][] = page1();
     break;
 case 'get_list1':
     $count = $_REQUEST['count'];
     $hidden = $_REQUEST['hidden'];
     $res1 = mysql_fetch_array(mysql_query("SELECT work_graphic_id\r\n\t\t\t\tFROM person_work_graphic\r\n\t\t\t\tWHERE `date`=\r\n\t\t\t\t ('" . date('Y-m-d', strtotime($_REQUEST[date])) . "') + INTERVAL {$_REQUEST['id']}-1 DAY\r\n\t\t\t\t AND user_id={$user_id}"));
     //return 0;