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


PHP CDate::addSeconds方法代码示例

本文整理汇总了PHP中CDate::addSeconds方法的典型用法代码示例。如果您正苦于以下问题:PHP CDate::addSeconds方法的具体用法?PHP CDate::addSeconds怎么用?PHP CDate::addSeconds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CDate的用法示例。


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

示例1: displayWeeks

function displayWeeks($list, $task, $level, $fromPeriod, $toPeriod)
{
    //start of week
    $sd = new CDate($fromPeriod);
    $days_from_start = $sd->getDayOfWeek();
    for ($i = 0; $i < $days_from_start; $i++) {
        $stmp = $sd->getPrevDay();
        $sd = new CDate($stmp->format('%Y-%m-%d 00:00:00'));
    }
    //end of week
    $ed = new CDate($toPeriod);
    $days_spent = $ed->getDayOfWeek();
    for ($i = 6 - $days_spent; $i > 0; $i--) {
        $etmp = $ed->getNextDay();
        $ed = new CDate($etmp->format('%Y-%m-%d 23:59:59'));
    }
    $st = new CDate($task->task_start_date);
    $et = new CDate($task->task_end_date);
    $row = '';
    while ($sd->before($ed)) {
        $sd_end = new CDate($sd->format('%Y-%m-%d 00:00:00'));
        $sd_end->addSeconds(7 * 24 * 3600);
        //add one week
        if ($sd->after($st) && $sd_end->before($et) || $st->before($sd_end) && !$st->before($sd) || $et->after($sd) && !$et->after($sd_end)) {
            /*
             * generate visually distiguishable colors for up to 12 task levels
             * Color will just be blue (#0000FF) for levels 12th and up. 
             */
            $red_key = 12 - floor($level / 3) * 3;
            $red_key = $red_key > 15 ? 15 : ($red_key < 0 ? 0 : $red_key);
            $green_key_1 = $red_key + 4 - $level % 3 * 4;
            $green_key_1 = $green_key_1 > 15 ? 15 : ($green_key_1 < 0 ? 0 : $green_key_1);
            $green_key_2 = $green_key_1 == $red_key ? 0 : $green_key_1;
            $color_hex = mb_strtoupper('#' . dechex($red_key) . '0' . dechex($green_key_1) . dechex($green_key_2) . 'FF');
            $row .= '<td nowrap="nowrap" style="background:' . $color_hex . ';" >';
        } else {
            $row .= '<td nowrap="nowrap">';
        }
        $row .= '&nbsp;</td>';
        $sd->addSeconds(7 * 24 * 3600);
        //add one week
    }
    return $row;
}
开发者ID:srinivasulurao,项目名称:jonel,代码行数:44,代码来源:tasksperuser_sub.php

示例2: getEndWeek

function getEndWeek($d)
{
    $dn = intval($d->Format("%w"));
    if ($dn > 0) {
        $dn = 7 - $dn;
    }
    $dd = new CDate($d);
    $dd->addSeconds($dn * 24 * 3600);
    return intval($dd->Format("%U"));
}
开发者ID:Esleelkartea,项目名称:gestion-de-primeras-muestras,代码行数:10,代码来源:tasksperuser_sub.php

示例3: calcEndByStartAndDuration

function calcEndByStartAndDuration($task)
{
    $end_date = new CDate($task['task_start_date']);
    $end_date->addSeconds(@$task['task_duration'] * $task['task_duration_type'] * SEC_HOUR);
    return $end_date->format(FMT_DATETIME_MYSQL);
}
开发者ID:hoodoogurus,项目名称:dotprojecteap,代码行数:6,代码来源:tasks.class.php

示例4: clash_suggest

function clash_suggest()
{
    global $AppUI, $m, $a;
    $obj =& new CEvent();
    $obj->bind($_SESSION['add_event_post']);
    $start_date =& new CDate($obj->event_start_date);
    $end_date =& new CDate($obj->event_end_date);
    $df = $AppUI->getPref('SHDATEFORMAT');
    $start_secs = $start_date->getTime();
    $end_secs = $end_date->getTime();
    $duration = (int) (($end_secs - $start_secs) / 60);
    $titleBlock =& new CTitleBlock('Suggest Alternative Event Time', 'myevo-appointments.png', $m, $m . '.' . $a);
    $titleBlock->show();
    $calurl = DP_BASE_URL . '/index.php?m=calendar&a=clash&event_id=' . $obj->event_id;
    $times = array();
    $t = new CDate();
    $t->setTime(0, 0, 0);
    if (!defined('LOCALE_TIME_FORMAT')) {
        define('LOCALE_TIME_FORMAT', '%I:%M %p');
    }
    for ($m = 0; $m < 60; $m++) {
        $times[$t->format("%H%M%S")] = $t->format(LOCALE_TIME_FORMAT);
        $t->addSeconds(1800);
    }
    ?>
<script language="javascript">
var calendarField = '';

function popCalendar(field){
	calendarField = field;
	idate = eval('document.editFrm.event_' + field + '.value');
	window.open('index.php?m=public&a=calendar&dialog=1&callback=setCalendar&date=' + idate, 'calwin', 'top=250,left=250,width=250, height=220, scrollbars=no, status=no');
}

/**
 *	@param string Input date in the format YYYYMMDD
 *	@param string Formatted date
 */
function setCalendar(idate, fdate) {
	fld_date = eval('document.editFrm.event_' + calendarField);
	fld_fdate = eval('document.editFrm.' + calendarField);
	fld_date.value = idate;
	fld_fdate.value = fdate;
}

function set_clash_action(action) {
	document.editFrm.clash_action.value = action;
	document.editFrm.submit();
}

</script>
<form name='editFrm' method='POST' action='<?php 
    echo "{$calurl}&clash_action=process";
    ?>
'>
<table width='100%' class='std'>
<tr>
  <td width='50%' align='right'><?php 
    echo $AppUI->_('Earliest Date');
    ?>
:</td>
  <td width='50%' align='left' nowrap="nowrap">
    <input type="hidden" name="event_start_date" value="<?php 
    echo $start_date->format(FMT_TIMESTAMP_DATE);
    ?>
">
    <input type="text" name="start_date" value="<?php 
    echo $start_date->format($df);
    ?>
" class="text" disabled="disabled">
      <a href="#" onClick="popCalendar('start_date')">
	<img src="./images/calendar.gif" width="24" height="12" alt="<?php 
    echo $AppUI->_('Calendar');
    ?>
" border="0" />
      </a>
  </td>
</tr>
<tr>
  <td width='50%' align='right'><?php 
    echo $AppUI->_('Latest Date');
    ?>
:</td>
  <td width='50%' align='left' nowrap="nowrap">
    <input type="hidden" name="event_end_date" value="<?php 
    echo $end_date->format(FMT_TIMESTAMP_DATE);
    ?>
">
    <input type="text" name="end_date" value="<?php 
    echo $end_date->format($df);
    ?>
" class="text" disabled="disabled">
      <a href="#" onClick="popCalendar('end_date')">
	<img src="./images/calendar.gif" width="24" height="12" alt="<?php 
    echo $AppUI->_('Calendar');
    ?>
" border="0" />
      </a>
  </td>
</tr>
//.........这里部分代码省略.........
开发者ID:klr2003,项目名称:sourceread,代码行数:101,代码来源:clash.php

示例5: submitIt

        $seldate->setTime(dPgetConfig('cal_day_end'), 0, 0);
    }
    $obj->event_end_date = $seldate->format(FMT_TIMESTAMP);
}
$recurs = array('Never', 'Hourly', 'Daily', 'Weekly', 'Bi-Weekly', 'Monthly', 'Quarterly', 'Semi-Annually', 'Annually');
$remind = array('900' => '15 mins', '1800' => '30 mins', '3600' => '1 hour', '7200' => '2 hours', '14400' => '4 hours', '28800' => '8 hours', '56600' => '16 hours', '86400' => '1 day', '172800' => '2 days');
// build array of times in preference specified minute increments (default 30)
$times = array();
$t = new CDate();
$t->setTime(0, 0, 0);
//$m clashes with global $m (module)
$check = 24 * 60 / $inc;
$addMins = $inc * 60;
for ($minutes = 0; $minutes < $check; $minutes++) {
    $times[$t->format('%H%M%S')] = $t->format($AppUI->getPref('TIMEFORMAT'));
    $t->addSeconds($addMins);
}
?>

<script type="text/javascript" language="javascript">
function submitIt() {
	var form = document.editFrm;
	if (form.event_title.value.length < 1) {
		alert('<?php 
echo $AppUI->_('Please enter a valid event title', UI_OUTPUT_JS);
?>
');
		form.event_title.focus();
		return;
	}
	if (form.event_start_date.value.length < 1) {
开发者ID:srinivasulurao,项目名称:jonel,代码行数:31,代码来源:addedit.php

示例6: doSaveEvent

        $obj->event_end_date = $seldate->format(FMT_TIMESTAMP);
    }
}
$recurs = array('Never', 'Hourly', 'Daily', 'Weekly', 'Bi-Weekly', 'Monthly', 'Quarterly', 'Semi-Annually', 'Annually');
$remind = array("900" => '15 mins', "1800" => '30 mins', "3600" => '1 hour', "7200" => '2 hours', "14400" => '4 hours', "28800" => '8 hours', "56600" => '16 hours', "86400" => '1 day', "172800" => '2 days');
// build array of times in 30 minute increments
$times = array();
$t = new CDate();
$t->setTime(0, 0, 0);
if (!defined('LOCALE_TIME_FORMAT')) {
    define('LOCALE_TIME_FORMAT', '%I:%M %p');
}
//$m clashes with global $m (module)
for ($minutes = 0; $minutes < 24 * 60 / $inc; $minutes++) {
    $times[$t->format("%H%M%S")] = $t->format(LOCALE_TIME_FORMAT);
    $t->addSeconds($inc * 60);
}
?>

<script language="javascript">
function doSaveEvent(){
	var form = document.editFrm;
	if (form.event_title.value.length < 1) {
		alert('<?php 
echo $AppUI->_('Please enter a valid event title', UI_OUTPUT_JS);
?>
');
		form.event_title.focus();
		return;
	}
	if (form.event_start_date.value.length < 1){
开发者ID:n2i,项目名称:xvnkb,代码行数:31,代码来源:addedit.php

示例7: clash_process

function clash_process()
{
    global $AppUI, $do_include;
    $obj =& new CEvent();
    $obj->bind($_SESSION['add_event_post']);
    $attendees = $_SESSION['add_event_attendees'];
    $users = array();
    if (isset($attendees) && $attendees) {
        $users = explode(',', $attendees);
    }
    array_push($users, $obj->event_owner);
    // First remove any duplicates
    $users = array_unique($users);
    // Now remove any null entries, so implode doesn't create a dud SQL
    // Foreach is safer as it works on a copy of the array.
    foreach ($users as $key => $user) {
        if (!$user) {
            unset($users[$key]);
        }
    }
    // First find any events in the range requested.
    $start_date = new CDate($_POST['event_start_date'] . $_POST['start_time']);
    $end_date = new CDate($_POST['event_start_date'] . $_POST['start_time']);
    $end_date->addSeconds($_POST['duration'] * 60);
    $final_date = new CDate($_POST['event_end_date'] . $_POST['end_time']);
    $original_event_start = $obj->event_start_date;
    $original_event_end = $obj->event_end_date;
    $user_list = implode(',', $users);
    // Now we grab the events, in date order, and compare against the
    // required start and end times.
    // Working in 30 minute increments from the start time, and remembering
    // the end time stipulation, find the first hole in the times.
    // Determine the duration in hours/minutes.
    $start_hour = (int) ($_POST['start_time'] / 10000);
    $start_minutes = (int) ($_POST['start_time'] % 10000 / 100);
    $start_min_offset = $start_hour * 60 + $start_minutes;
    $end_hour = (int) ($_POST['end_time'] / 10000);
    $end_minutes = (int) ($_POST['end_time'] % 10000 / 100);
    $end_min_offset = $end_hour * 60 + $end_minutes - $_POST['duration'];
    // First, build a set of "slots" that give us the duration
    // and start/end times we need
    $first_day = $start_date->format('%E');
    $end_day = $final_date->format('%E');
    $oneday =& new Date_Span(array(1, 0, 0, 0));
    $slots = array();
    $curr_date = new CDate($start_date);
    $curr_date->setTime(0, 0, 0);
    $inc = intval(dPgetConfig('cal_day_increment')) ? intval(dPgetConfig('cal_day_increment')) : 30;
    for ($i = 0; $i <= $end_day - $first_day; $i++) {
        if ($curr_date->isWorkingDay()) {
            for ($j = $start_min_offset; $j <= $end_min_offset; $j += $inc) {
                $is_committed = false;
                $slot_start_date = new CDate($curr_date);
                $slot_start_date->addSeconds($j * 60);
                $slot_end_date = new CDate($slot_start_date);
                $slot_end_date->addSeconds($_POST['duration'] * 60);
                $obj->event_start_date = $slot_start_date->format('%Y-%m-%d %T');
                $obj->event_end_date = $slot_end_date->format('%Y-%m-%d %T');
                if (!($clash = $obj->checkClash($user_list))) {
                    $_SESSION['add_event_post'] = get_object_vars($obj);
                    $AppUI->setMsg('First available time slot', UI_MSG_OK);
                    $_SESSION['event_is_clash'] = true;
                    $_GET['event_id'] = $obj->event_id;
                    $do_include = DP_BASE_DIR . '/modules/calendar/addedit.php';
                    return;
                }
            }
        }
        $curr_date->addSpan($oneday);
        $curr_date->setTime(0, 0, 0);
    }
    // If we get here we have found no available slots
    $obj->event_start_date = $original_event_start;
    $obj->event_end_date = $original_event_end;
    clear_clash();
    $AppUI->setMsg('No times match your parameters', UI_MSG_ALERT);
    $AppUI->redirect();
}
开发者ID:illuminate3,项目名称:dotproject,代码行数:78,代码来源:clash.php

示例8: clash_suggest

function clash_suggest()
{
    global $AppUI, $dPconfig;
    $obj =& new CEvent();
    $obj->bind($_SESSION['add_event_post']);
    $start_date =& new CDate($obj->event_start_date);
    $end_date =& new CDate($obj->event_end_date);
    $df = $AppUI->getPref('SHDATEFORMAT');
    $start_secs = $start_date->getTime();
    $end_secs = $end_date->getTime();
    $duration = (int) (($end_secs - $start_secs) / 60);
    $titleBlock =& new CTitleBlock("Suggest Alternative Event Time");
    $titleBlock->show();
    $calurl = $dPconfig['base_url'] . "/index.php?m=calendar&a=clash&event_id=" . $obj->event_id;
    $times = array();
    $t = new CDate();
    $t->setTime(0, 0, 0);
    if (!defined('LOCALE_TIME_FORMAT')) {
        define('LOCALE_TIME_FORMAT', '%I:%M %p');
    }
    for ($m = 0; $m < 60; $m++) {
        $times[$t->format("%H%M%S")] = $t->format(LOCALE_TIME_FORMAT);
        $t->addSeconds(1800);
    }
    ?>
<script language="javascript">
function set_clash_action(action) {
	document.editFrm.clash_action.value = action;
	document.editFrm.submit();
}

Calendar.enabled = true;
</script>
<form name='editFrm' method='POST' action='<?php 
    echo "{$calurl}&clash_action=process";
    ?>
'>
<table width='100%' class='std'>
<tr>
	<td width='50%' align='right'><?php 
    echo $AppUI->_('Earliest Date');
    ?>
:</td>
	<td width='50%' align='left' nowrap="nowrap">
		<input id="idDateStart" type="hidden" name="event_start_date" value="<?php 
    echo $start_date->format(FMT_TIMESTAMP_DATE);
    ?>
">
		<input id="idDateStartD" type="text" name="start_date" value="<?php 
    echo $start_date->format($df);
    ?>
" class="text" disabled="disabled">
		<img id="idDateStartB" src="images/calendar.gif" width="24" height="12" alt="<?php 
    echo $AppUI->_('Calendar');
    ?>
" border="0" />
	</td>
</tr>
<tr>
	<td width='50%' align='right'><?php 
    echo $AppUI->_('Latest Date');
    ?>
:</td>
	<td width='50%' align='left' nowrap="nowrap">
		<input id="idDateEnd" type="hidden" name="event_end_date" value="<?php 
    echo $end_date->format(FMT_TIMESTAMP_DATE);
    ?>
">
		<input id="idDateEndD" type="text" name="end_date" value="<?php 
    echo $end_date->format($df);
    ?>
" class="text" disabled="disabled">
		<img id="idDateEndB" src="images/calendar.gif" width="24" height="12" alt="<?php 
    echo $AppUI->_('Calendar');
    ?>
" border="0" />
	</td>
</tr>
<tr>
	<td width='50%' align='right'><?php 
    echo $AppUI->_('Earliest Start Time');
    ?>
:</td>
	<td width='50%' align='left'>
		<?php 
    echo arraySelect($times, 'start_time', 'size="1" class="text"', $start_date->format("%H%M%S"));
    ?>
	</td>
</tr>
<tr>
	<td width='50%' align='right'><?php 
    echo $AppUI->_('Latest Finish Time');
    ?>
:</td>
	<td width='50%' align='left'>
		<?php 
    echo arraySelect($times, 'end_time', 'size="1" class="text"', $end_date->format("%H%M%S"));
    ?>
	</td>
</tr>
//.........这里部分代码省略.........
开发者ID:n2i,项目名称:xvnkb,代码行数:101,代码来源:clash.php

示例9: clash_suggest

function clash_suggest()
{
    global $AppUI, $m, $a;
    $obj = new CEvent();
    $obj->bind($_SESSION['add_event_post']);
    $start_date = new CDate($obj->event_start_date);
    $end_date = new CDate($obj->event_end_date);
    $df = $AppUI->getPref('SHDATEFORMAT');
    $start_secs = $start_date->getTime();
    $end_secs = $end_date->getTime();
    $duration = (int) (($end_secs - $start_secs) / 60);
    $titleBlock = new CTitleBlock('Suggest Alternative Event Time', 'myevo-appointments.png', $m, $m . '.' . $a);
    $titleBlock->show();
    $calurl = W2P_BASE_URL . '/index.php?m=calendar&a=clash&event_id=' . $obj->event_id;
    $times = array();
    $t = new CDate();
    $t->setTime(0, 0, 0);
    if (!defined('LOCALE_TIME_FORMAT')) {
        define('LOCALE_TIME_FORMAT', '%I:%M %p');
    }
    for ($m = 0; $m < 60; $m++) {
        $times[$t->format('%H%M%S')] = $t->format(LOCALE_TIME_FORMAT);
        $t->addSeconds(1800);
    }
    ?>
<script language="javascript">
function setDate( frm_name, f_date ) {
	fld_date = eval( 'document.' + frm_name + '.' + f_date );
	fld_real_date = eval( 'document.' + frm_name + '.' + 'event_' + f_date );
	if (fld_date.value.length>0) {
      if ((parseDate(fld_date.value))==null) {
            alert('The Date/Time you typed does not match your prefered format, please retype.');
            fld_real_date.value = '';
            fld_date.style.backgroundColor = 'red';
        } else {
        	fld_real_date.value = formatDate(parseDate(fld_date.value), 'yyyyMMdd');
        	fld_date.value = formatDate(parseDate(fld_date.value), '<?php 
    echo $cal_sdf;
    ?>
');
            fld_date.style.backgroundColor = '';
  		}
	} else {
      	fld_real_date.value = '';
	}
}

function set_clash_action(action) {
	document.editFrm.clash_action.value = action;
	document.editFrm.submit();
}

</script>
<form name="editFrm" method="POST" action="<?php 
    echo $calurl . '&clash_action=process';
    ?>
" accept-charset="utf-8">
<table width='100%' class='std'>
<tr>
  <td width='50%' align='right'><?php 
    echo $AppUI->_('Earliest Date');
    ?>
:</td>
  <td width='50%' align='left' nowrap="nowrap">
	<input type="hidden" name="event_start_date" id="event_start_date" value="<?php 
    echo $start_date ? $start_date->format(FMT_TIMESTAMP_DATE) : '';
    ?>
" />
	<input type="text" name="start_date" id="start_date" onchange="setDate('editFrm', 'start_date');" value="<?php 
    echo $start_date ? $start_date->format($df) : '';
    ?>
" class="text" />
	<a href="javascript: void(0);" onclick="return showCalendar('start_date', '<?php 
    echo $df;
    ?>
', 'editFrm', null, true)">
	<img src="<?php 
    echo w2PfindImage('calendar.gif');
    ?>
" width="24" height="12" alt="<?php 
    echo $AppUI->_('Calendar');
    ?>
" border="0" />
      </a>
  </td>
</tr>
<tr>
  <td width='50%' align='right'><?php 
    echo $AppUI->_('Latest Date');
    ?>
:</td>
  <td width='50%' align='left' nowrap="nowrap">
	<input type="hidden" name="event_end_date" id="event_end_date" value="<?php 
    echo $end_date ? $end_date->format(FMT_TIMESTAMP_DATE) : '';
    ?>
" />
	<input type="text" name="end_date" id="end_date" onchange="setDate('editFrm', 'end_date');" value="<?php 
    echo $end_date ? $end_date->format($df) : '';
    ?>
" class="text" />
//.........这里部分代码省略.........
开发者ID:joly,项目名称:web2project,代码行数:101,代码来源:clash.php

示例10: submitIt

    $start_date->setTime(8, 0, 0);
    $end_date = new CDate($date);
    $end_date->setTime(17, 0, 0);
}
$recurs = array('Never', 'Hourly', 'Daily', 'Weekly', 'Bi-Weekly', 'Every Month', 'Quarterly', 'Every 6 months', 'Every Year');
$remind = array("900" => '15 mins', "1800" => '30 mins', "3600" => '1 hour', "7200" => '2 hours', "14400" => '4 hours', "28800" => '8 hours', "56600" => '16 hours', "86400" => '1 day', "172800" => '2 days');
// build array of times in 30 minute increments
$times = array();
$t = new CDate();
$t->setTime(0, 0, 0);
if (!defined('LOCALE_TIME_FORMAT')) {
    define('LOCALE_TIME_FORMAT', '%I:%M %p');
}
for ($m = 0; $m < 60; $m++) {
    $times[$t->format("%H%M%S")] = $t->format(LOCALE_TIME_FORMAT);
    $t->addSeconds(1800);
}
?>

<script language="javascript">
function submitIt(){
	var form = document.editFrm;
	if (form.event_title.value.length < 1) {
		alert('<?php 
echo $AppUI->_('Please enter a valid event title', UI_OUTPUT_JS);
?>
');
		form.event_title.focus();
		return;
	}
	if (form.event_start_date.value.length < 1){
开发者ID:juliogallardo1326,项目名称:proc,代码行数:31,代码来源:addedit.php


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