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


PHP createDateRangeArray函数代码示例

本文整理汇总了PHP中createDateRangeArray函数的典型用法代码示例。如果您正苦于以下问题:PHP createDateRangeArray函数的具体用法?PHP createDateRangeArray怎么用?PHP createDateRangeArray使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: dateRange

function dateRange($page = 1, $from_interval = 7)
{
    $to_days = ($page - 1) * $from_interval;
    $from_days = $page * $from_interval - 1;
    # create a range to fill in rows with no trips
    $date_to = date('Y-m-d', strtotime('-' . $to_days . ' days'));
    $date_from = date('Y-m-d', strtotime('-' . $from_days . ' days'));
    $dates = createDateRangeArray($date_from, $date_to);
    rsort($dates);
    return $dates;
}
开发者ID:rajneel,项目名称:calpalyn,代码行数:11,代码来源:Base.php

示例2: tablesToArr

/**
 * Nächste Woche funktioniert noch nicht, weil Datum nicht ermittelt wird...
 * @param  [type] $obj    [description]
 * @return [type]         [description]
 */
function tablesToArr($obj)
{
    $arr = array();
    $timeframe = explode(" - ", trim($obj->find('> text', 2), " \t\n\r\v()"));
    $dates[0] = createDateRangeArray($timeframe[0], $timeframe[1]);
    //$dates[1] = createDateRangeArray("14.12.15", "18.12.15");
    $tables = $obj->find('table');
    if (array_key_exists(0, $tables) && array_key_exists(1, $tables) && array_key_exists(0, $dates) && array_key_exists(1, $dates)) {
        return array_merge(tableToArr($tables[0], $dates[0]), tableToArr($tables[1], $dates[1]));
    } elseif (array_key_exists(0, $tables) && array_key_exists(0, $dates)) {
        return tableToArr($tables[0], $dates[0]);
    } else {
        return false;
    }
}
开发者ID:panic175,项目名称:mensa-parser,代码行数:20,代码来源:functions.php

示例3: get_sms_data

 public function get_sms_data()
 {
     $where = "";
     if (!DashboardCommon::is_su()) {
         $where = " AND gsm_number IN( " . $this->get_gsm_number() . " ) {$this->sms_data_limit_clause}\n                ORDER BY sms_dt DESC";
     }
     $dates = createDateRangeArray($this->from, $this->to);
     $data_array = array();
     foreach ($dates as $date) {
         $sql = "SELECT count(*) as total FROM sms ";
         $sql .= "WHERE sms_dt LIKE '%" . $date . "%' {$where}";
         // echo $sql;
         $res = DashboardCommon::db()->Execute($sql);
         $data_array[] = array('elapsed' => userdate($date), 'value' => $res->fields['total']);
     }
     return $data_array;
 }
开发者ID:mrimran,项目名称:dashboard,代码行数:17,代码来源:SMS.php

示例4: CollectData

function CollectData($type_for_search, $username, $strDateFrom, $strDateTo)
{
    //$strDateFrom = date('Y-m-d', strtotime($year."W".$week_number.'-1'));
    //$strDateTo = date('Y-m-d', strtotime($year."W".$week_number.'-7'));
    //echo $strDateFrom;
    //echo $strDateTo;
    // $strDateFrom = date("Y-m-d",strtotime('monday this week'));
    // $strDateTo = date("Y-m-d",strtotime("sunday this week"));
    // echo 'from';
    // echo $strDateFrom;
    // echo 'to';
    // echo $strDateTo;
    $dates_array = createDateRangeArray($strDateFrom, $strDateTo);
    $daily_rank_sum_arr = array();
    foreach ($dates_array as &$value) {
        //echo $value;
        if (Get_Logged_users_id()) {
            if ($type_for_search != -1) {
                $SQL = "SELECT DISTINCT SUM(homeworks.Rank) FROM homeworks,user,uh,solvedhomeworks WHERE homeworks.Type = " . $type_for_search . " AND user.Name = '" . $username . "' AND uh.HWID = homeworks.UID AND uh.USERID = user.UID AND homeworks.Date = '" . $value . "' AND homeworks.UID NOT IN (SELECT solvedhomeworks.HWID FROM solvedhomeworks WHERE solvedhomeworks.USERID = " . Get_Logged_users_id() . ")";
            } else {
                $SQL = "SELECT DISTINCT SUM(homeworks.Rank) FROM homeworks,user,uh,solvedhomeworks WHERE user.Name = '" . $username . "' AND uh.HWID = homeworks.UID AND uh.USERID = user.UID AND homeworks.Date = '" . $value . "' AND homeworks.UID IN (SELECT solvedhomeworks.HWID FROM solvedhomeworks WHERE solvedhomeworks.USERID = " . Get_Logged_users_id() . ")";
            }
        } else {
            $SQL = "SELECT DISTINCT SUM(homeworks.Rank) FROM homeworks,user,uh WHERE homeworks.Type = " . $type_for_search . " AND user.Name = '" . $username . "' AND uh.HWID = homeworks.UID AND uh.USERID = user.UID AND homeworks.Date = '" . $value . "'";
        }
        //echo $SQL;
        $result = mysql_query($SQL);
        $daily_rank_sum = mysql_fetch_array($result);
        if ($daily_rank_sum[0] <= 0) {
            $daily_rank_sum[0] = 0;
        }
        array_push($daily_rank_sum_arr, $daily_rank_sum[0]);
    }
    unset($value);
    foreach ($daily_rank_sum_arr as &$value) {
        //echo $value;
    }
    unset($value);
    $done_array = array();
    for ($i = 0; $i < sizeof($dates_array); $i++) {
        array_push($done_array, array($dates_array[$i], $daily_rank_sum_arr[$i] * 10));
    }
    return $done_array;
    // NOW LET'S USE $dates_array and $daily_rank_sum_arr for the graph :D
}
开发者ID:Hideyoshi1,项目名称:DYH,代码行数:45,代码来源:collect_data.php

示例5: get_emails_data

 public function get_emails_data()
 {
     $where = "";
     if (!DashboardCommon::is_su()) {
         //$where = " AND emails.client_id='".$this->get_unbounce_id()."'  AND test_data=0
         //ORDER BY email_date DESC";
         $where = " AND emails.client_id IN ('" . implode('\',\'', $this->get_unbounce_ids()) . "')\n                AND test_data=0 ORDER BY email_date DESC";
     }
     $dates = createDateRangeArray($this->from, $this->to);
     $data_array = array();
     foreach ($dates as $date) {
         $sql = "SELECT count(*) as total FROM emails ";
         $sql .= "WHERE CONVERT_TZ(email_date,'+00:00','+04:00') LIKE '%" . $date . "%' {$where}";
         // echo $sql;
         $res = DashboardCommon::db()->Execute($sql);
         $data_array[] = array('elapsed' => userdate($date), 'value' => $res->fields['total']);
     }
     return $data_array;
 }
开发者ID:dasatti,项目名称:dashboard,代码行数:19,代码来源:Emails.php

示例6: get_calls_data

 public function get_calls_data()
 {
     $where = "";
     if (!DashboardCommon::is_su()) {
         $where = " AND gsm_number IN( " . $this->get_gsm_number() . " )  AND test_data=0 {$this->calls_data_limit_clause}";
     }
     $arr_calls = createDateRangeArray($this->from, $this->to);
     $json_array = array();
     foreach ($arr_calls as $arr_call) {
         $sql = "SELECT count(*) as total FROM calls ";
         $sql .= "WHERE call_start LIKE '%" . $arr_call . "%' {$where}";
         $res = DashboardCommon::db()->Execute($sql);
         $json_array[] = array('elapsed' => userdate($arr_call), 'value' => $res->fields['total']);
     }
     return $json_array;
     header('Content-Type: application/json');
     echo json_encode($json_array);
     die;
 }
开发者ID:dasatti,项目名称:dashboard,代码行数:19,代码来源:Calls_1.php

示例7: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $date = new \DateTime();
     $date->modify('+3 days');
     $formatted_date_from = $date->format('Y-m-d');
     $date->modify('+6 days');
     $formatted_date_to = $date->format('Y-m-d');
     $dates = createDateRangeArray(strtotime($formatted_date_from), strtotime($formatted_date_to));
     $bases = Base::where('center', 1)->get();
     $current_gen = Gen::getCurrentGen();
     $shiftSessions = ShiftSession::where('active', 1)->get();
     $lastShift = Shift::where('gen_id', $current_gen->id)->orderBy('week', 'desc')->first();
     $week = $lastShift ? $lastShift->week : 0;
     foreach ($dates as $date) {
         foreach ($bases as $base) {
             foreach ($shiftSessions as $shiftSession) {
                 $shift = new Shift();
                 $shift->gen_id = $current_gen->id;
                 $shift->base_id = $base->id;
                 $shift->shift_session_id = $shiftSession->id;
                 $shift->week = $week + 1;
                 $shift->date = $date;
                 $shift->save();
             }
         }
     }
     $role_ids = Tab::find(35)->roles->pluck('id')->unique()->toArray();
     $roles = Role::whereIn('id', $role_ids)->get();
     if ($week == 0) {
         $week = 1;
     }
     foreach ($roles as $role) {
         $users = $role->users;
         foreach ($users as $user) {
             send_mail_regis_shift($user, $week, $current_gen, ['colorme.vn.test@gmail.com']);
         }
     }
     $this->info('done');
 }
开发者ID:Kaelcao,项目名称:colormev2,代码行数:44,代码来源:CreateShifts.php

示例8: getLeadsChartDataClient

 public function getLeadsChartDataClient($period)
 {
     require_once dirname(__FILE__) . '/Client.php';
     $campaigns = Client::get_campaigns();
     $first_campaign_start = Client::getFirstCampaignStartDate();
     //if(empty($campaigns))            return array();
     $union_array = array();
     foreach ($campaigns as $campaign) {
         $sql = "(SELECT * FROM calls WHERE gsm_number='" . $campaign['gsm_number'] . "'";
         if ($campaign['start_date'] != '0000-00-00') {
             //if($date < $campaign['start_date']) continue;
             $sql .= " AND call_start>='" . $campaign['start_date'] . "'";
         }
         if ($campaign['end_date'] != '0000-00-00') {
             //if($date > $campaign['end_date']) continue;
             $sql .= " AND call_end<='" . $campaign['end_date'] . "'";
         }
         $sql .= ")";
         $union_array[] = $sql;
     }
     $inner_sql = implode(" UNION ", $union_array);
     if ($inner_sql == '') {
         $inner_sql = "(SELECT * FROM calls WHERE id = NULL)";
     }
     $client_calls_where = "  AND test_data=0 ORDER BY call_start DESC";
     $client_email_where = " AND client_id  IN ('" . implode('\',\'', $this->get_unbounce_ids()) . "')  AND test_data=0\n                                ORDER BY email_date DESC";
     $data = array();
     $period_days = array();
     $date_filter = "Y-m-d";
     if ($period == 'lifetime') {
         $period_days = getMonths($this->from, $this->to);
         $date_filter = "Y-m";
     } elseif ($period == 'last_30_days' || $period == 'last_7_days' || $period == 'yesterday' || $period == 'month' || $period == 'daily' || $period == 'today' || $period == 'this_month' || $period == 'custom' || $period == 'last_month') {
         $period_days = createDateRangeArray($this->from, $this->to);
     } else {
         $period_days = createDateRangeArray($this->from, $this->to);
     }
     $campaign_start_limit = "";
     if ($first_campaign_start != '') {
         $campaign_start_limit = "WHERE call_start>='{$first_campaign_start}'";
     }
     if (!empty($period_days)) {
         foreach ($period_days as $date) {
             if ($date_filter === 'Y-m-d') {
                 $date_filtered = $date;
             } else {
                 $date_filtered = date_format($date, "{$date_filter}");
             }
             $q1 = "SELECT count(*) as  total_calls FROM ({$inner_sql}) AS calls WHERE call_start LIKE '%" . $date_filtered . "%' {$client_calls_where} ";
             $c_total = 0;
             $c_total = DashboardCommon::executeAndReturnSingleColResultAndCache($q1, 'total_calls');
             $q2 = "SELECT count(*) as total_emails FROM emails WHERE \n                    CONVERT_TZ(email_date,'+00:00','+04:00') LIKE '" . $date_filtered . "%' {$client_email_where}";
             $e_total = DashboardCommon::executeAndReturnSingleColResultAndCache($q2, 'total_emails');
             $sql_leads = "SELECT * , tcalls+temails as total_leads\n                    FROM\n                    (SELECT \n                        /*COUNT(DISTINCT  /*DATE_FORMAT(call_start,'%y-%m-%d') ,// gsm_number) as tcalls*/\n                        COUNT(*) AS tcalls\n                        FROM ({$inner_sql}) AS calls \n                        WHERE\n                        id IN (  SELECT id FROM calls {$campaign_start_limit} GROUP BY callerid HAVING MIN(call_start)  ) AND\n                        call_start LIKE '%" . $date_filtered . "%' {$client_calls_where}\n                    ) as a , \n                    (SELECT \n                        COUNT(*) as temails\n                        FROM emails \n                        WHERE\n                        CONVERT_TZ(email_date,'+00:00','+04:00') LIKE '" . $date_filtered . "%' {$client_email_where}\n                    ) as b";
             //echo $sql_leads; die();
             $tot_leads = DashboardCommon::executeAndReturnSingleColResultAndCache($q1, 'total_leads');
             $row = array('y' => $date_filtered, 'a' => $c_total, 'b' => $e_total, 'c' => $tot_leads);
             $data[] = $row;
         }
     }
     return $data;
 }
开发者ID:dasatti,项目名称:dashboard,代码行数:62,代码来源:Leads_2.php

示例9: date

            
            $(document).ready(function()
            {
            
                // Morris.js Graphs
                if(typeof Morris != 'undefined')
                {
                    
                    // Area Chart
                    Morris.Area({
                        element: 'chart_life_time',
                        data: [
                            <?php 
        $roi_date_from = $res_roi_graph->fields['roi_date'];
        $roi_date_to = date('Y-m-d');
        $arr_rois = createDateRangeArray($roi_date_from, $roi_date_to);
        $i = 0;
        foreach ($arr_rois as $arr_roi) {
            $i++;
            $qry_roi_month = "SELECT SUM(avg_sale_revenue) as total_lifetime FROM roi WHERE roi_date LIKE '%" . $arr_roi . "%'";
            $res_roi_month = $db->Execute($qry_roi_month);
            $roi_total = $res_roi_month->fields['total_lifetime'];
            if ($roi_total == '') {
                $roi_total = 0;
            }
            ?>
                            { y: '<?php 
            echo $arr_roi;
            ?>
', a: <?php 
            echo $roi_total;
开发者ID:mrimran,项目名称:dashboard,代码行数:30,代码来源:ajax(2014-11-20).php

示例10: getbkSortedDates

function getbkSortedDates($booking_days)
{
    if (strpos($booking_days, ' - ') !== FALSE) {
        $booking_days = explode(' - ', $booking_days);
        $booking_days = createDateRangeArray($booking_days[0], $booking_days[1]);
    }
    $days_array = explode(',', $booking_days);
    $only_days = array();
    foreach ($days_array as $new_day) {
        if (!empty($new_day)) {
            $new_day = trim($new_day);
            if (strpos($new_day, '.') !== false) {
                $new_day = explode('.', $new_day);
            } else {
                $new_day = explode('-', $new_day);
            }
            $only_days[] = $new_day[2] . '-' . $new_day[1] . '-' . $new_day[0] . ' 00:00:00';
        }
    }
    if (!empty($only_days)) {
        sort($only_days);
    }
    return $only_days;
}
开发者ID:dev-lav,项目名称:htdocs,代码行数:24,代码来源:wpdev-booking-functions.php

示例11: date

    if ($i < count($arr_calls)) {
        echo ",";
    }
    ?>
				
	<?php 
}
?>
			];
			
			
var today_data = [
	<?php 
$calls_date_from = date('Y-m-d');
$calls_date_to = date('Y-m-d');
$arr_calls = createDateRangeArray($calls_date_from, $calls_date_to);
$i = 0;
foreach ($arr_calls as $arr_call) {
    $i++;
    $qry_calls_month = "SELECT count(*) as month_calls_total FROM calls WHERE call_start LIKE '%" . $arr_call . "%' AND gsm_number IN( " . $client_id . " ) AND test_data=0 {$calls_data_limit_clause}";
    $res_calls_month = $db->Execute($qry_calls_month);
    ?>
	
				{"elapsed": "<?php 
    echo userdate($arr_call);
    ?>
", "value": <?php 
    echo $res_calls_month->fields['month_calls_total'];
    ?>
} <?php 
    if ($i < count($arr_calls)) {
开发者ID:mrimran,项目名称:dashboard,代码行数:31,代码来源:managecalls_.php

示例12: foreach

 $weeks = '';
 //-- Start the Date loop
 $var = 0;
 foreach ($arrEventDates as $e) {
     $oDetails = $arrEventsDetail[$e['eventId'] . '-' . $e['eventRepId']];
     //Get original event (parent) details
     $oDetails['startdate'] = $e['date'];
     $oDetails['enddate'] = $e['end'];
     if (($oDetails['startdate'] >= $elStartDate || $oDetails['enddate'] >= $elStartDate) && $oDetails['enddate'] <= $elEndDate || $displayType == 'detail' || $elDirectional) {
         $oDetails['startdate_fstamp'] = $oDetails['startdate'];
         $oDetails['enddate_fstamp'] = $oDetails['enddate'];
         $oDetails['detailURL'] = $modx->makeUrl(!empty($ajaxResourceId) && (bool) $modalView === true ? $ajaxResourceId : $did, '', array('detail' => $e['eventId'], 'r' => $e['eventRepId']));
         if (strftime('%Y-%m-%d', $e['date']) == strftime('%Y-%m-%d', $e['end'])) {
             $events[strftime('%Y-%m-%d', $e['date'])][] = $oDetails;
         } else {
             $spandates = createDateRangeArray(strftime('%Y-%m-%d', $e['date']), strftime('%Y-%m-%d', $e['end']));
             foreach ($spandates as $spD) {
                 $events[$spD][] = $oDetails;
             }
         }
         // $output.= $e['date']. '<br/>';
     }
 }
 do {
     // Week Start date
     $iWeek = strtotime('+ ' . $var . ' week', $startMonthCalDate);
     $diw = 0;
     $days = '';
     do {
         // Get the week's days
         $iDay = strtotime('+ ' . $diw . ' day', $iWeek);
开发者ID:blue148,项目名称:GCCalendar2,代码行数:31,代码来源:gcCal.php

示例13: createDateRangeArray

function createDateRangeArray($start, $end)
{
    $range = array();
    if (is_string($start) === true) {
        $start = strtotime($start);
    }
    if (is_string($end) === true) {
        $end = strtotime($end);
    }
    if ($start > $end) {
        return createDateRangeArray($end, $start);
    }
    do {
        $range[] = date('Y-m-d', $start);
        $start = strtotime("+ 1 day", $start);
    } while ($start <= $end);
    return $range;
}
开发者ID:nagbaba,项目名称:poledance,代码行数:18,代码来源:userfunctions_helper.php

示例14: mysql_query

    $table_name = "meals_" . $type;
    $result_db = mysql_query("SELECT * FROM {$table_name} ORDER BY idx ASC");
    $total = 0;
    foreach ($c1 as $val) {
        $row = mysql_fetch_array($result_db);
        $total = $total + $val * $row['price'];
    }
    return $total;
}
$t1 = get_total_cpw($c1, 'b');
$t2 = get_total_cpw($c2, 'l');
$t3 = get_total_cpw($c3, 's');
$t4 = get_total_cpw($c4, 'd');
$grtotal = $t1 + $t2 + $t3 + $t4;
mysql_query("UPDATE choices SET `cost_per_week_nobasic` = {$grtotal} WHERE s_id = '" . $student_id . "';");
$montharr = createDateRangeArray(date("Y-m-d", mktime(0, 0, 0, $month, 1, $year)), date("Y-m-d", mktime(0, 0, 0, $month + 1, 1, $year)));
$grtotal = 0;
foreach ($montharr as $val) {
    $grtotal = $grtotal + get_total_cpd($c1, 'b', $val);
}
foreach ($montharr as $val) {
    $grtotal = $grtotal + get_total_cpd($c2, 'l', $val);
}
foreach ($montharr as $val) {
    $grtotal = $grtotal + get_total_cpd($c3, 's', $val);
}
foreach ($montharr as $val) {
    $grtotal = $grtotal + get_total_cpd($c4, 'd', $val);
}
mysql_query("UPDATE choices SET `cost_month_nobasic` = {$grtotal} WHERE s_id = '" . $student_id . "';");
echo $grtotal;
开发者ID:rohanraja,项目名称:patel_mess,代码行数:31,代码来源:save_choices.php

示例15: getCommaSeparatedDates

 private function getCommaSeparatedDates($event_dates_start, $event_dates_end)
 {
     if (isset($event_dates_start['date']) && isset($event_dates_end['date'])) {
         //$start_date = date_i18n('Y-m-d',   $this->iso_to_ts( $event_dates_start['date'] )  );
         //$end_date   = date_i18n('Y-m-d', ( $this->iso_to_ts( $event_dates_end['date'] ) - 86400 ) );
         $start_date = $this->iso_to_ts($event_dates_start['date']);
         $end_date = $this->iso_to_ts($event_dates_end['date']) - 86400;
         $range_time = '00:00 - 00:00';
     }
     if (isset($event_dates_start['dateTime']) && isset($event_dates_end['dateTime'])) {
         $start_date = $this->iso_to_ts($event_dates_start['dateTime']);
         $end_date = $this->iso_to_ts($event_dates_end['dateTime']);
         $range_time = date_i18n('H:i', $start_date) . ' - ' . date_i18n('H:i', $end_date);
         //$start_date = date_i18n('Y-m-d', $start_date );
         //$end_date   = date_i18n('Y-m-d', $end_date );
     }
     $dates_comma = createDateRangeArray(date_i18n("d.m.Y", $start_date), date_i18n("d.m.Y", $end_date));
     //$dates = wpdevbkGetDaysBetween($start_date, $end_date );
     //$dates_comma = implode(', ', $dates);
     //        // Get Times
     //        $start_time  = $this->iso_to_ts( $event_dates[0]['startTime'] );
     //
     //        if ( date_i18n('H:i', $this->iso_to_ts( $event_dates[ (count($event_dates)-1) ]['endTime'] ) ) == '00:00' )
     //            $end_time = $this->iso_to_ts( $event_dates[ (count($event_dates)-1) ]['endTime'] ) - 86400; // 24 hours - 60*60*24 = 86400
     //        else
     //            $end_time = $this->iso_to_ts( $event_dates[ (count($event_dates)-1) ]['endTime'] );
     //
     //
     //        $range_time  = date_i18n('H:i', $start_time ) . ' - ' . date_i18n('H:i', $end_time );
     if ($range_time != '00:00 - 00:00') {
         $bktype = $this->getResource();
         $range_time = "select-one^rangetime{$bktype}^{$range_time}~";
     } else {
         $range_time = '';
     }
     return array($dates_comma, $range_time);
 }
开发者ID:ahmedalaahagag,项目名称:HospitalManagementSystem,代码行数:37,代码来源:wpbc-gcal-class.php


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