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


PHP CDate类代码示例

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


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

示例1: getEventLinks

/**
* Sub-function to collect events within a period
* @param Date the starting date of the period
* @param Date the ending date of the period
* @param array by-ref an array of links to append new items to
* @param int the length to truncate entries by
* @author Andrew Eddie <eddieajau@users.sourceforge.net>
*/
function getEventLinks($startPeriod, $endPeriod, &$links, $strMaxLen)
{
    global $AppUI, $event_filter;
    $events = CEvent::getEventsForPeriod($startPeriod, $endPeriod, $event_filter);
    // assemble the links for the events
    foreach ($events as $row) {
        $start = new CDate($row['event_start_date']);
        $end = new CDate($row['event_end_date']);
        $date = $start;
        $date->setTime(0, 0, 0);
        $cwd = explode(',', $GLOBALS['dPconfig']['cal_working_days']);
        for ($i = 0, $x = $end->dateDiff($start); $i <= $x; $i++) {
            // the link
            // optionally do not show events on non-working days
            if ($row['event_cwd'] && in_array($date->getDayOfWeek(), $cwd) || !$row['event_cwd']) {
                $link['href'] = '?m=calendar&a=view&event_id=' . $row['event_id'];
                $link['alt'] = $row['event_description'];
                $link['text'] = dPshowImage(dPfindImage('event' . $row['event_type'] . '.png', 'calendar'), 16, 16) . htmlspecialchars($row['event_title']);
                if ($i == 0) {
                    $link['alt'] .= ' [' . $AppUI->_('START') . ']';
                }
                if ($i == $x) {
                    $link['alt'] .= ' [' . $AppUI->_('END') . ']';
                }
                $links[$date->format(FMT_TIMESTAMP_DATE)][] = $link;
            }
            $date = $date->getNextDay();
        }
    }
}
开发者ID:illuminate3,项目名称:dotproject,代码行数:38,代码来源:links_events.php

示例2: getEventLinks

/**
 * Sub-function to collect events within a period
 * @param Date the starting date of the period
 * @param Date the ending date of the period
 * @param array by-ref an array of links to append new items to
 * @param int the length to truncate entries by
 * @author Andrew Eddie <eddieajau@users.sourceforge.net>
 */
function getEventLinks($startPeriod, $endPeriod, &$links, $strMaxLen, $minical = false)
{
    global $event_filter;
    $events = CEvent::getEventsForPeriod($startPeriod, $endPeriod, $event_filter);
    $cwd = explode(',', w2PgetConfig('cal_working_days'));
    // assemble the links for the events
    foreach ($events as $row) {
        $start = new CDate($row['event_start_date']);
        $end = new CDate($row['event_end_date']);
        $date = $start;
        for ($i = 0, $i_cmp = $start->dateDiff($end); $i <= $i_cmp; $i++) {
            // the link
            // optionally do not show events on non-working days
            if ($row['event_cwd'] && in_array($date->getDayOfWeek(), $cwd) || !$row['event_cwd']) {
                if ($minical) {
                    $link = array();
                } else {
                    $url = '?m=calendar&a=view&event_id=' . $row['event_id'];
                    $link['href'] = '';
                    $link['alt'] = '';
                    $link['text'] = w2PtoolTip($row['event_title'], getEventTooltip($row['event_id']), true) . w2PshowImage('event' . $row['event_type'] . '.png', 16, 16, '', '', 'calendar') . '</a>&nbsp;' . '<a href="' . $url . '"><span class="event">' . $row['event_title'] . '</span></a>' . w2PendTip();
                }
                $links[$date->format(FMT_TIMESTAMP_DATE)][] = $link;
            }
            $date = $date->getNextDay();
        }
    }
}
开发者ID:joly,项目名称:web2project,代码行数:36,代码来源:links_events.php

示例3: testConvertTZ

 public function testConvertTZ()
 {
     $myDate1 = new CDate('', 'US/Eastern');
     $this->assertEquals($myDate1, new CDate('', 'US/Eastern'));
     $myDate2 = new CDate('', 'CST');
     $myDate2->convertTZ('EST');
     //This tweaks the test data in case the +1 is across the day change.
     $tmpHour = $myDate1->hour + 1 >= 24 ? $myDate1->hour + 1 - 24 : $myDate1->hour + 1;
     $this->assertEquals($tmpHour, $myDate2->hour);
     $this->assertEquals($myDate1->minute, $myDate2->minute);
     $myDate2->convertTZ('PST');
     $tmpHour = $myDate1->hour - 2 < 0 ? $myDate1->hour - 2 + 24 : $myDate1->hour - 2;
     $this->assertEquals($tmpHour, $myDate2->hour);
 }
开发者ID:joly,项目名称:web2project,代码行数:14,代码来源:date.test.php

示例4: create

	function create($sitemap_name = '') {
		
		if(!$sitemap_name) $sitemap_name = SS_ADMIN_TO_USERFILE . "/sitemap.xml";
		
		if(empty($sitemap_name)) $sitemap_name = "sitemap_" . $rep_name . ".xml";
		$changefreq 	= array('daily', 'weekly', 'monthly');
		$priority		= array('0.1', '0.5', '1.0');
		$tab_archive	= array();

		rsort($tab_archive);
		$xml = simplexml_load_file(SS_ADMIN_TO_USERFILE . '/google/sitemap_base.xml');
		
		//scan bdd
		$sql = "SELECT * FROM page WHERE etat = 1";
		$res = CBdd::select($sql);
		while($page = mysql_fetch_array($res)) {
			$url = $xml->addChild('url');
			$url->addChild('loc', CUrl::get_urlsite() . "/" . CFunction::formate_chaine(utf8_decode($page['nom']), '-') . "_p" . $page['id']. ".html");
			$url->addChild('lastmod', CDate::formate_date($page['date']));
			$url->addChild('changefreq', $changefreq[rand(0, 2)]);
			$url->addChild('priority', $priority[rand(0, 2)]);
		}

		$html = $xml->asXML();
		file_put_contents($sitemap_name, $html);
	}
开发者ID:rakotobe,项目名称:Rakotobe,代码行数:26,代码来源:CSitemap.php

示例5: showchilddept_maintenance

function showchilddept_maintenance(&$a, $level = 0)
{
    global $AppUI, $df, $rownum;
    if (strlen($a["dept_batching_maintenance"]) == 0) {
        $batching_expire_date = null;
    } else {
        $batching_expire_date = new CDate($a["dept_batching_maintenance"]);
    }
    $s .= '<td><a href="?m=departments&amp;a=view&amp;dept_id=' . $a['dept_id'] . '">' . $a['dept_name'] . '</a>';
    $s .= '<input type="hidden" name="dept_id[]" id="dept_id' . $rownum . '" value="' . $a['dept_id'] . '" />';
    $s .= '</td>';
    $s .= '<td> <input type="text" class="text" name="batching_maintenance[]" id="batching_maintenance' . $rownum . '" disabled="disabled" value="' . ($batching_expire_date ? $batching_expire_date->format($df) : '') . '"/>';
    $s .= '<input type="hidden" name="dept_batching_maintenance[]" id="dept_batching_maintenance' . $rownum . '" value="' . ($batching_expire_date ? $batching_expire_date->format(FMT_TIMESTAMP_DATE) : '') . '" />';
    $s .= '<a href="#" onclick="javascript:popCalendar(getRow(event))"> <img src="./images/calendar.gif" name="img_expiredate" width="24" height="12" alt="' . $AppUI->_('Calendar') . '" border="0" /></a>';
    $s .= '</td>';
    $dept_checked = time() > strtotime($a['dept_batching_maintenance']) ? "checked='checked'" : "";
    //checked for expired dept.
    $s .= "<td align='center'><input type='checkbox' value='{$a['dept_id']}' {$dept_checked} name='select_dept[]'></td>";
    echo '<tr>' . $s . '</tr>';
    $rownum = $rownum + 1;
}
开发者ID:srinivasulurao,项目名称:jonel,代码行数:21,代码来源:batching-maintenance-report.php

示例6: addHelpDeskTaskLog

 function addHelpDeskTaskLog()
 {
     global $AppUI, $helpdesk_available;
     if ($helpdesk_available && $this->file_helpdesk_item != 0) {
         // create task log with information about the file that was uploaded
         $task_log = new CHDTaskLog();
         $task_log->task_log_help_desk_id = $this->_hditem->item_id;
         if ($this->_message != 'deleted') {
             $task_log->task_log_name = 'File ' . $this->file_name . ' uploaded';
         } else {
             $task_log->task_log_name = 'File ' . $this->file_name . ' deleted';
         }
         $task_log->task_log_description = $this->file_description;
         $task_log->task_log_creator = $AppUI->user_id;
         $date = new CDate();
         $task_log->task_log_date = $date->format(FMT_DATETIME_MYSQL);
         if ($msg = $task_log->store()) {
             $AppUI->setMsg($msg, UI_MSG_ERROR);
         }
     }
     return NULL;
 }
开发者ID:hoodoogurus,项目名称:dotprojecteap,代码行数:22,代码来源:files.class.php

示例7: showchilddept_maintenance

function showchilddept_maintenance(&$a, $level = 0)
{
    global $AppUI, $df, $rownum;
    if (strlen($a["dept_batching_maintenance"]) == 0) {
        $batching_expire_date = null;
    } else {
        $batching_expire_date = new CDate($a["dept_batching_maintenance"]);
    }
    $s .= '<td align="center"><a href="?m=departments&amp;a=view&amp;dept_id=' . $a['dept_id'] . '">' . $a['dept_name'] . '</a>';
    $s .= '<input type="hidden" name="dept_id[]" id="dept_id' . $rownum . '" value="' . $a['dept_id'] . '" />';
    $s .= '</td>';
    $s .= '<td align="center"> <input type="text" class="text" name="batching_maintenance[]" id="batching_maintenance' . $rownum . '" disabled="disabled" value="' . ($batching_expire_date ? $batching_expire_date->format($df) : '') . '"/>';
    $s .= '<input type="hidden" name="dept_batching_maintenance[]" id="dept_batching_maintenance' . $rownum . '" value="' . ($batching_expire_date ? $batching_expire_date->format(FMT_TIMESTAMP_DATE) : '') . '" />';
    $s .= '<a href="#" onclick="javascript:popCalendar(getRow(event))"> <img src="./images/calendar.gif" name="img_expiredate" width="24" height="12" alt="' . $AppUI->_('Calendar') . '" border="0" /></a>';
    $s .= '</td>';
    $calAdder = '<a href="javascript:void(0)" onclick="javascript:popCalendarAccept(getRow(event))"> <img src="./images/calendar.gif" name="img_expiredate2" width="24" height="12" alt="' . $AppUI->_('Calendar') . '" border="0" /></a>';
    $last_report_generation_date = $a['last_report_generation_date'] == "0000-00-00 00:00:00" ? "Not Generated Yet" : date("d/M/Y", strtotime($a['last_report_generation_date']));
    $last_report_accept_date = date("d/M/Y", strtotime($a['last_report_accept_date']));
    $last_report_accept_date_hidden = date("Ymd", strtotime($a['last_report_accept_date']));
    $s .= "<td align='center'>{$last_report_generation_date}</td><td align='center'><input class='text' id='last_report_accept_date_hidden{$rownum}' name='last_report_accept_date_hidden[]' value='{$last_report_accept_date_hidden}' type='hidden'><input type='text' name='last_report_accept_date[]' id='last_report_accept_date{$rownum}' class='text' value='{$last_report_accept_date}' disabled>{$calAdder}</td>";
    echo '<tr>' . $s . '</tr>';
    $rownum = $rownum + 1;
}
开发者ID:srinivasulurao,项目名称:jonel,代码行数:23,代码来源:ae_batching_maintenance.php

示例8: getEventLinks

/**
* Sub-function to collect events within a period
* @param Date the starting date of the period
* @param Date the ending date of the period
* @param array by-ref an array of links to append new items to
* @param int the length to truncate entries by
* @author Andrew Eddie <eddieajau@users.sourceforge.net>
*/
function getEventLinks($startPeriod, $endPeriod, &$links, $strMaxLen)
{
    global $event_filter;
    $events = CEvent::getEventsForPeriod($startPeriod, $endPeriod, $event_filter);
    // assemble the links for the events
    foreach ($events as $row) {
        $start = new CDate($row['event_start_date']);
        $end = new CDate($row['event_end_date']);
        $date = $start;
        $cwd = explode(",", $GLOBALS["dPconfig"]['cal_working_days']);
        for ($i = 0; $i <= $start->dateDiff($end); $i++) {
            // the link
            // optionally do not show events on non-working days
            if ($row['event_cwd'] && in_array($date->getDayOfWeek(), $cwd) || !$row['event_cwd']) {
                $url = '?m=calendar&a=view&event_id=' . $row['event_id'];
                $link['href'] = '';
                $link['alt'] = $row['event_description'];
                $link['text'] = '<table cellspacing="0" cellpadding="0" border="0"><tr>' . '<td><a href=' . $url . '>' . dPshowImage(dPfindImage('event' . $row['event_type'] . '.png', 'calendar'), 16, 16, '') . '</a></td>' . '<td><a href="' . $url . '" title="' . $row['event_description'] . '"><span class="event">' . $row['event_title'] . '</span></a>' . '</td></tr></table>';
                $links[$date->format(FMT_TIMESTAMP_DATE)][] = $link;
            }
            $date = $date->getNextDay();
        }
    }
}
开发者ID:magsilva,项目名称:dotproject,代码行数:32,代码来源:links_events.php

示例9: CDate

    $AppUI->redirect();
}
require_once $AppUI->getSystemClass('CustomFields');
//一些转化
// convert dates to SQL format first
if ($obj->project_start_date) {
    $date = new CDate($obj->project_start_date);
    $obj->project_start_date = $date->format(FMT_DATETIME_MYSQL);
}
if ($obj->project_end_date) {
    $date = new CDate($obj->project_end_date);
    $date->setTime(23, 59, 59);
    $obj->project_end_date = $date->format(FMT_DATETIME_MYSQL);
}
if ($obj->project_actual_end_date) {
    $date = new CDate($obj->project_actual_end_date);
    $obj->project_actual_end_date = $date->format(FMT_DATETIME_MYSQL);
}
// let's check if there are some assigned departments to project
//部门分配
if (!dPgetParam($_POST, "project_departments", 0)) {
    //返回一个部门的id
    $obj->project_departments = implode(",", dPgetParam($_POST, "dept_ids", array()));
}
$del = dPgetParam($_POST, 'del', 0);
// prepare (and translate) the module name ready for the suffix
if ($del) {
    $project_id = dPgetParam($_POST, 'project_id', 0);
    $canDelete = $obj->canDelete($msg, $project_id);
    if (!$canDelete) {
        $AppUI->setMsg($msg, UI_MSG_ERROR);
开发者ID:klr2003,项目名称:sourceread,代码行数:31,代码来源:do_project_aed.php

示例10: DBQuery

        $bar->setColor('darkgray');
        $bar->SetFillColor('darkgray');
        $bar->SetPattern(BAND_SOLID, 'gray');
        $bar->progress->SetFillColor('darkgray');
        $bar->progress->SetPattern(BAND_SOLID, 'gray', 98);
    }
    $q = new DBQuery();
    $q->addTable('task_dependencies');
    $q->addQuery('dependencies_task_id');
    $q->addWhere('dependencies_req_task_id=' . (int) $a['task_id']);
    $query = $q->loadList();
    foreach ($query as $dep) {
        // find row num of dependencies
        for ($d = 0, $d_cmp = count($gantt_arr); $d < $d_cmp; $d++) {
            if ($gantt_arr[$d][0]['task_id'] == $dep['dependencies_task_id']) {
                $bar->SetConstrain($d, CONSTRAIN_ENDSTART);
            }
        }
    }
    unset($query);
    $q->clear();
    $graph->Add($bar);
}
unset($gantt_arr);
$today = new CDate();
$vline = new GanttVLine($today->format(FMT_TIMESTAMP_DATE), $AppUI->_('Today', UI_OUTPUT_RAW));
if (is_file(TTF_DIR . 'FreeSans.ttf')) {
    $vline->title->SetFont(FF_CUSTOM, FS_BOLD, 10);
}
$graph->Add($vline);
$graph->Stroke();
开发者ID:joly,项目名称:web2project,代码行数:31,代码来源:gantt.php

示例11: CDate

    $s .= $CR . "</td>";
    $s .= $CR . '<td width="99%"><a href="?m=helpdesk&a=view&item_id=' . $row["item_id"] . '">' . $row["item_title"] . '</a></td>';
    $s .= $CR . "<td nowrap align=\"center\">";
    if ($row["assigned_email"]) {
        $s .= $CR . "<a href=\"mailto:" . $row["assigned_email"] . "\">" . $row['assigned_fullname'] . "</a>";
    } else {
        $s .= $CR . $row['assigned_fullname'];
    }
    $s .= $CR . "</td>";
    $s .= $CR . '<td align="center" nowrap>' . $AppUI->_($ist[@$row["item_status"]]) . '</td>';
    $s .= $CR . '<td align="center" nowrap>' . $AppUI->_($ipr[@$row["item_priority"]]) . '</td>';
    //Lets retrieve the updated date
    //	$sql = "SELECT MAX(status_date) status_date FROM helpdesk_item_status WHERE status_item_id =".$row['item_id'];
    //	$sdrow = db_loadList( $sql );
    //	$dateu = new CDate( $sdrow[0]['status_date'] );
    $dateu = new CDate($row['item_updated']);
    $s .= $CR . '<td align="center" nowrap>' . @$dateu->format($format) . '</td>';
    if ($row['project_id']) {
        $s .= $CR . '<td align="center" style="background-color: #' . $row['project_color_identifier'] . ';" nowrap><a href="./index.php?m=projects&a=view&project_id=' . $row['project_id'] . '" style="color: ' . bestColor(@$row["project_color_identifier"]) . ';">' . $row['project_name'] . '</a></td>';
    } else {
        $s .= $CR . '<td align="center">-</td>';
    }
    $s .= $CR . '</tr></form>';
}
print "{$s}\n";
// Pagination
$pages = 0;
if ($total_results > $items_per_page) {
    $pages_per_side = $HELPDESK_CONFIG['pages_per_side'];
    $pages = ceil($total_results / $items_per_page) - 1;
    if ($page < $pages_per_side) {
开发者ID:slawekmikula,项目名称:dotproject,代码行数:31,代码来源:list.php

示例12: getTaskLinks

/**
* Sub-function to collect tasks within a period
*
* @param Date the starting date of the period
* @param Date the ending date of the period
* @param array by-ref an array of links to append new items to
* @param int the length to truncate entries by
* @param int the company id to filter by
* @author Andrew Eddie <eddieajau@users.sourceforge.net>
*/
function getTaskLinks($startPeriod, $endPeriod, &$links, $strMaxLen, $company_id = 0)
{
    global $a, $AppUI, $dPconfig;
    $tasks = CTask::getTasksForPeriod($startPeriod, $endPeriod, $company_id, $AppUI->user_id, true);
    $durnTypes = dPgetSysVal('TaskDurationType');
    $link = array();
    $sid = 3600 * 24;
    // assemble the links for the tasks
    foreach ($tasks as $row) {
        // the link
        $link['href'] = "?m=tasks&a=view&task_id=" . $row['task_id'];
        $link['alt'] = $row['project_name'] . ":\n" . $row['task_name'];
        // the link text
        if (strlen($row['task_name']) > $strMaxLen) {
            $row['task_name'] = substr($row['task_name'], 0, $strMaxLen) . '...';
        }
        $link['text'] = '<span style="color:' . bestColor($row['color']) . ';background-color:#' . $row['color'] . '">' . $row['task_name'] . '</span>';
        // determine which day(s) to display the task
        $start = new CDate($row['task_start_date']);
        $end = $row['task_end_date'] ? new CDate($row['task_end_date']) : null;
        $durn = $row['task_duration'];
        $durnType = $row['task_duration_type'];
        if (($start->after($startPeriod) || $start->equals($startPeriod)) && ($start->before($endPeriod) || $start->equals($endPeriod))) {
            $temp = $link;
            $temp['alt'] = "START [" . $row['task_duration'] . ' ' . $AppUI->_($durnTypes[$row['task_duration_type']]) . "]\n" . $link['alt'];
            if ($a != 'day_view') {
                $temp['text'] = dPshowImage(dPfindImage('block-start-16.png')) . $temp['text'];
            }
            $links[$start->format(FMT_TIMESTAMP_DATE)][] = $temp;
        }
        if ($end && $end->after($startPeriod) && $end->before($endPeriod) && $start->before($end)) {
            $temp = $link;
            $temp['alt'] = "FINISH\n" . $link['alt'];
            if ($a != 'day_view') {
                $temp['text'] .= dPshowImage(dPfindImage('block-end-16.png'));
            }
            $links[$end->format(FMT_TIMESTAMP_DATE)][] = $temp;
        }
        // convert duration to days
        if ($durnType < 24.0) {
            if ($durn > $dPconfig['daily_working_hours']) {
                $durn /= $dPconfig['daily_working_hours'];
            } else {
                $durn = 0.0;
            }
        } else {
            $durn *= $durnType / 24.0;
        }
        // fill in between start and finish based on duration
        // notes:
        // start date is not in a future month, must be this or past month
        // start date is counted as one days work
        // business days are not taken into account
        $target = $start;
        $target->addSeconds($durn * $sid);
        if (Date::compare($target, $startPeriod) < 0) {
            continue;
        }
        if (Date::compare($start, $startPeriod) > 0) {
            $temp = $start;
            $temp->addSeconds($sid);
        } else {
            $temp = $startPeriod;
        }
        // Optimised for speed, AJD.
        while (Date::compare($endPeriod, $temp) > 0 && Date::compare($target, $temp) > 0 && ($end == null || $temp->before($end))) {
            $links[$temp->format(FMT_TIMESTAMP_DATE)][] = $link;
            $temp->addSeconds($sid);
        }
    }
}
开发者ID:klr2003,项目名称:sourceread,代码行数:81,代码来源:links_tasks.php

示例13: db_dateTime2locale

/**
* Document::db_dateTime2locale()
*
* { Description }
*
*/
function db_dateTime2locale($dateTime, $format)
{
    if (intval($dateTime)) {
        $date = new CDate($dateTime);
        return $date->format($format);
    } else {
        return null;
    }
}
开发者ID:Esleelkartea,项目名称:gestion-de-primeras-muestras,代码行数:15,代码来源:db_connect.php

示例14: showWeeks

function showWeeks()
{
    global $allocated_hours_sum, $end_date, $start_date, $AppUI, $user_list, $user_names, $user_usage, $hideNonWd, $table_header, $table_rows, $df, $working_days_count, $total_hours_capacity, $total_hours_capacity_all;
    $working_days_count = 0;
    $allocated_hours_sum = 0;
    $ed = new CDate(Date_Calc::endOfWeek($end_date->day, $end_date->month, $end_date->year));
    $sd = new CDate(Date_Calc::beginOfWeek($start_date->day, $start_date->month, $start_date->year));
    $week_difference = ceil($ed->workingDaysInSpan($sd) / count(explode(",", dPgetConfig("cal_working_days"))));
    $actual_date = $sd;
    $table_header = "<tr><th>" . $AppUI->_("User") . "</th>";
    for ($i = 0; $i < $week_difference; $i++) {
        $table_header .= "<th>" . Date_Calc::weekOfYear($actual_date->day, $actual_date->month, $actual_date->year) . "<br><table><td style='font-weight:normal; font-size:70%'>" . $actual_date->format($df) . "</td></table></th>";
        $actual_date->addSeconds(168 * 3600);
        // + one week
    }
    $table_header .= "<th nowrap='nowrap' colspan='2'>" . $AppUI->_("Allocated") . "</th></tr>";
    $table_rows = "";
    foreach ($user_list as $user_id => $user_data) {
        @($user_names[$user_id] = $user_data["user_username"]);
        if (isset($user_usage[$user_id])) {
            $table_rows .= "<tr><td nowrap='nowrap'>(" . $user_data["user_username"] . ") " . $user_data["contact_first_name"] . " " . $user_data["contact_last_name"] . "</td>";
            $actual_date = $sd;
            for ($i = 0; $i < $week_difference; $i++) {
                $awoy = $actual_date->year . Date_Calc::weekOfYear($actual_date->day, $actual_date->month, $actual_date->year);
                $table_rows .= "<td align='right'>";
                if (isset($user_usage[$user_id][$awoy])) {
                    $hours = number_format($user_usage[$user_id][$awoy], 2);
                    $table_rows .= $hours;
                    $percentage_used = round($hours / (dPgetConfig("daily_working_hours") * count(explode(",", dPgetConfig("cal_working_days")))) * 100);
                    $bar_color = "blue";
                    if ($percentage_used > 100) {
                        $bar_color = "red";
                        $percentage_used = 100;
                    }
                    $table_rows .= "<div style='height:2px;width:{$percentage_used}%; background-color:{$bar_color}'>&nbsp;</div>";
                } else {
                    $table_rows .= "&nbsp;";
                }
                $table_rows .= "</td>";
                $actual_date->addSeconds(168 * 3600);
                // + one week
            }
            $array_sum = array_sum($user_usage[$user_id]);
            $average_user_usage = number_format($array_sum / ($week_difference * count(explode(",", dPgetConfig("cal_working_days"))) * dPgetConfig("daily_working_hours")) * 100, 2);
            $allocated_hours_sum += $array_sum;
            $bar_color = "blue";
            if ($average_user_usage > 100) {
                $bar_color = "red";
                $average_user_usage = 100;
            }
            $table_rows .= "<td ><div align='left'>" . round($array_sum, 2) . " " . $AppUI->_("hours") . "</td> <td align='right'> " . $average_user_usage;
            $table_rows .= "%</div>";
            $table_rows .= "<div align='left' style='height:2px;width:{$average_user_usage}%; background-color:{$bar_color}'>&nbsp;</div></td>";
            $table_rows .= "</tr>";
        }
    }
    $total_hours_capacity = $week_difference * count(explode(",", dPgetConfig("cal_working_days"))) * dPgetConfig("daily_working_hours") * count($user_usage);
    $total_hours_capacity_all = $week_difference * count(explode(",", dPgetConfig("cal_working_days"))) * dPgetConfig("daily_working_hours") * count($user_list);
}
开发者ID:n2i,项目名称:xvnkb,代码行数:59,代码来源:allocateduserhours.php

示例15: formatTime

function formatTime($uts)
{
    global $AppUI;
    $date = new CDate();
    $date->setDate($uts, DATE_FORMAT_UNIXTIME);
    return $date->format($AppUI->getPref('SHDATEFORMAT'));
}
开发者ID:n2i,项目名称:xvnkb,代码行数:7,代码来源:main_functions.php


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