本文整理汇总了PHP中calcEndByStartAndDuration函数的典型用法代码示例。如果您正苦于以下问题:PHP calcEndByStartAndDuration函数的具体用法?PHP calcEndByStartAndDuration怎么用?PHP calcEndByStartAndDuration使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了calcEndByStartAndDuration函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array_csort
function array_csort()
{
$args = func_get_args();
$marray = array_shift($args);
if (empty($marray)) {
return array();
}
$i = 0;
$msortline = 'return(array_multisort(';
$sortarr = array();
foreach ($args as $arg) {
if ($i % 3) {
$msortline .= $arg . ', ';
} else {
foreach ($marray as $j => $item) {
/* we have to calculate the end_date via start_date+duration for
** end='0000-00-00 00:00:00' before sorting, see mantis #1509:
** Task definition writes the following to the DB:
** A without start date: start = end = NULL
** B with start date and empty end date: start = startdate,
end = '0000-00-00 00:00:00'
** C start + end date: start= startdate, end = end date
** A the end_date for the middle task (B) is ('dynamically') calculated on display
** via start_date+duration, it may be that the order gets wrong due to the fact
** that sorting has taken place _before_.
*/
if ($item['task_end_date'] == '0000-00-00 00:00:00') {
$item['task_end_date'] = calcEndByStartAndDuration($marray[$j]);
}
$sortarr[$i][$j] = $marray[$j][$arg];
}
$msortline .= '$sortarr[' . $i . '], ';
}
$i++;
}
$msortline .= '$marray));';
eval($msortline);
return $marray;
}
示例2: array_csort
if ($task_sort_item1 != '') {
if ($task_sort_item2 != '' && $task_sort_item1 != $task_sort_item2) {
$p['tasks'] = array_csort($p['tasks'], $task_sort_item1, $task_sort_order1, $task_sort_type1, $task_sort_item2, $task_sort_order2, $task_sort_type2);
} else {
$p['tasks'] = array_csort($p['tasks'], $task_sort_item1, $task_sort_order1, $task_sort_type1);
}
} else {
/* we have to calculate the end_date via start_date+duration for
** end='0000-00-00 00:00:00' if array_csort function is not used
** as it is normally done in array_csort function in order to economise
** cpu time as we have to go through the array there anyway
*/
if (is_array($p['tasks'])) {
foreach ($p['tasks'] as $j => $task_change_end_date) {
if ($task_change_end_date['task_end_date'] == '0000-00-00 00:00:00') {
$task_change_end_date['task_end_date'] = calcEndByStartAndDuration($task_change_end_date);
}
}
}
}
global $tasks_filtered, $children_of;
//get list of task ids and set-up array of children
if (is_array($p['tasks'])) {
foreach ($p['tasks'] as $i => $t) {
$tasks_filtered[] = $t['task_id'];
$children_of[$t['task_parent']] = $children_of[$t['task_parent']] ? $children_of[$t['task_parent']] : array();
if ($t['task_parent'] != $t['task_id']) {
array_push($children_of[$t['task_parent']], $t['task_id']);
}
}
}
示例3: calcEndByStartAndDuration
}
} else {
// All this appears to already be handled in todo.php ... should consider deleting this else block
/* we have to calculate the end_date via start_date+duration for
** end='0000-00-00 00:00:00' if array_csort function is not used
** as it is normally done in array_csort function in order to economise
** cpu time as we have to go through the array there anyway
*/
for ($j = 0, $j_cmp = count($tasks); $j < $j_cmp; $j++) {
if ($tasks[$j]['task_end_date'] == '0000-00-00 00:00:00' || $tasks[$j]['task_end_date'] == '') {
if ($tasks[$j]['task_start_date'] == '0000-00-00 00:00:00' || $tasks[$j]['task_start_date'] == '') {
$tasks[$j]['task_start_date'] = '0000-00-00 00:00:00';
//just to be sure start date is "zeroed"
$tasks[$j]['task_end_date'] = '0000-00-00 00:00:00';
} else {
$tasks[$j]['task_end_date'] = calcEndByStartAndDuration($tasks[$j]);
}
}
}
}
$history_active = false;
// showing tasks
foreach ($tasks as $task) {
echo showtask($task, 0, false, true);
}
if (w2PgetConfig('direct_edit_assignment')) {
?>
<tr>
<td colspan="9" align="right" height="30">
<input type="submit" class="button" value="<?php
echo $AppUI->_('update task');
示例4: array_csort
function array_csort()
{
//coded by Ichier2003
$args = func_get_args();
$marray = array_shift($args);
if (empty($marray)) {
return array();
}
$i = 0;
$msortline = "return(array_multisort(";
$sortarr = array();
foreach ($args as $arg) {
$i++;
if (is_string($arg)) {
for ($j = 0; $j < count($marray); $j++) {
/* we have to calculate the end_date via start_date+duration for
** end='0000-00-00 00:00:00' before sorting, see mantis #1509:
** Task definition writes the following to the DB:
** A without start date: start = end = NULL
** B with start date and empty end date: start = startdate, end = "0000-00-00 00:00:00"
** C start + end date: start= startdate, end = end date
** A the end_date for the middle task (B) is ('dynamically') calculated on display
** via start_date+duration, it may be that the order gets wrong due to the fact
** that sorting has taken place _before_.
*/
if ($marray[$j]['task_end_date'] == '0000-00-00 00:00:00') {
$marray[$j]['task_end_date'] = calcEndByStartAndDuration($marray[$j]);
}
$sortarr[$i][] = $marray[$j][$arg];
}
} else {
$sortarr[$i] = $arg;
}
$msortline .= "\$sortarr[" . $i . "],";
}
$msortline .= "\$marray));";
eval($msortline);
return $marray;
}