本文整理汇总了PHP中w2p_Utilities_Date::getDate方法的典型用法代码示例。如果您正苦于以下问题:PHP w2p_Utilities_Date::getDate方法的具体用法?PHP w2p_Utilities_Date::getDate怎么用?PHP w2p_Utilities_Date::getDate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类w2p_Utilities_Date
的用法示例。
在下文中一共展示了w2p_Utilities_Date::getDate方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
}
$gantt->setDateRange($start_date, $end_date);
$row = 0;
if (!is_array($projects) || 0 == count($projects)) {
$d = new w2p_Utilities_Date();
$columnValues = array('project_name' => $AppUI->_('No projects found'), 'start_date' => $d->getDate(), 'end_date' => $d->getDate(), 'actual_end' => '');
$gantt->addBar($columnValues, ' ', 0.6, 'red');
} else {
foreach ($projects as $p) {
$pname = $p['project_name'];
$pname = mb_strlen($pname) > 30 ? mb_substr($pname, 0, 25) . '...' : $pname;
//using new jpGraph determines using Date object instead of string
$start = $p['project_start_date'] > '1969-12-31 19:00:00' ? $p['project_start_date'] : '';
$end_date = $p['project_end_date'] > '1969-12-31 19:00:00' ? $p['project_end_date'] : $p['project_actual_end_date'];
$end_date = new w2p_Utilities_Date($end_date);
$end = $end_date->getDate();
$start = new w2p_Utilities_Date($start);
$start = $start->getDate();
$progress = (int) $p['project_percent_complete'];
$caption = '';
if (!$start || $start == '0000-00-00') {
$start = !$end ? date('Y-m-d') : $end;
$caption .= $AppUI->_('(no start date)');
}
if (!$end) {
$end = $start;
$caption .= ' ' . $AppUI->_('(no end date)');
} else {
$cap = '';
}
if ($showLabels) {
示例2: date
// cycle for tasks for each project
for ($i = 0, $i_cmp = count($gantt_arr[$p['project_id']]); $i < $i_cmp; $i++) {
$t = $gantt_arr[$p['project_id']][$i][0];
$level = $gantt_arr[$p['project_id']][$i][1];
if ($t['task_end_date'] == null) {
$t['task_end_date'] = $t['task_start_date'];
}
$tStart = $t['task_start_date'] > '0000-00-00 00:00:00' ? $t['task_start_date'] : date('Y-m-d H:i:s');
$tEnd = $t['task_end_date'] > '0000-00-00 00:00:00' ? $t['task_end_date'] : date('Y-m-d H:i:s');
$tStartObj = new w2p_Utilities_Date($tStart);
$tEndObj = new w2p_Utilities_Date($tEnd);
if ($t['task_milestone'] != 1) {
$advance = str_repeat(' ', $level + 2);
$name = mb_strlen($advance . $t['task_name']) > 35 ? mb_substr($advance . $t['task_name'], 0, 33) . '...' : $advance . $t['task_name'];
$height = $t['task_dynamic'] == 1 ? 0.1 : 0.6;
$columnValues = array('project_name' => $name, 'start_date' => $tStartObj->getDate(), 'end_date' => $tEndObj->getDate(), 'actual_end' => '');
$gantt->addBar($columnValues, '', $height, $p['project_color_identifier'], $p['project_active'], $progress, $p['project_id']);
} else {
$name = $advance . '* ' . $t['task_name'];
$milestone = substr($t['task_start_date'], 0, 10);
$milestoneDate = new w2p_Utilities_Date($milestone);
$gantt->addMilestone(array($name, '', $milestoneDate->format($df)), $t['task_start_date']);
}
// End of insert workers for each task into Gantt Chart
}
// End of insert tasks into Gantt Chart
}
// End of if showAllGant checkbox is checked
}
}
// End of check for valid projects array.
示例3: date
$caption .= $rw['contact_display_name'] . ';';
break;
default:
$caption .= $rw['contact_display_name'] . ' [' . $rw['perc_assignment'] . '%];';
break;
}
}
$q->clear();
$caption = mb_substr($caption, 0, mb_strlen($caption) - 1);
}
if ($flags == 'm') {
// if hide milestones is ticked this bit is not processed//////////////////////////////////////////
if ($showNoMilestones != '1') {
$start = new w2p_Utilities_Date($start_date);
$start->addDays(0);
$start_mile = $start->getDate();
$s = $start_date->format($df);
$today_date = date('m/d/Y');
$today_date_stamp = strtotime($today_date);
$mile_date = $start_date->format($df);
$mile_date_stamp = strtotime($mile_date);
// honour the choice to show task names only///////////////////////////////////////////////////
if ($showTaskNameOnly == '1') {
$fieldArray = array($name);
} else {
if ($caller == 'todo') {
$fieldArray = array($name, $pname, '', $s, $s);
} else {
$fieldArray = array($name, '', $s, $s);
}
}
示例4: store
public function store(CAppUI $AppUI)
{
$perms = $AppUI->acl();
$stored = false;
if (!$this->event_recurs) {
$this->event_times_recuring = 0;
} else {
//If the event recurs then set the end date day to be equal to the start date day and keep the hour:minute of the end date
//so that the event starts recurring from the start day onwards n times after the start date for the period given
//Meaning: The event end date day is useless as far as recurring events are concerned.
$start_date = new w2p_Utilities_Date($this->event_start_date);
$end_date = new w2p_Utilities_Date($this->event_end_date);
$hour = $end_date->getHour();
$minute = $end_date->getMinute();
$end_date->setDate($start_date->getDate());
$end_date->setHour($hour);
$end_date->setMinute($minute);
$this->event_end_date = $end_date->format(FMT_DATETIME_MYSQL);
}
// ensure changes to check boxes and select lists are honoured
$this->event_private = (int) $this->event_private;
$this->event_type = (int) $this->event_type;
$this->event_cwd = (int) $this->event_cwd;
$this->_error = $this->check();
if (count($this->_error)) {
return $this->_error;
}
$this->event_start_date = $AppUI->convertToSystemTZ($this->event_start_date);
$this->event_end_date = $AppUI->convertToSystemTZ($this->event_end_date);
/*
* TODO: I don't like the duplication on each of these two branches, but I
* don't have a good idea on how to fix it at the moment...
*/
if ($this->event_id && $perms->checkModuleItem('events', 'edit', $this->event_id)) {
if ($msg = parent::store()) {
return $msg;
}
$stored = true;
}
if (0 == $this->event_id && $perms->checkModuleItem('events', 'add')) {
if ($msg = parent::store()) {
return $msg;
}
$stored = true;
}
if ($stored) {
// TODO: I *really* don't like using the POST inside here..
$this->updateAssigned(explode(',', $_POST['event_assigned']));
$custom_fields = new w2p_Core_CustomFields('calendar', 'addedit', $this->event_id, 'edit');
$custom_fields->bind($_POST);
$sql = $custom_fields->store($this->event_id);
// Store Custom Fields
}
return $stored;
}
示例5: array
}
}
}
$gantt = new w2p_Output_GanttRenderer($AppUI, $width);
$gantt->localize();
$tableTitle = $statusFilter == '-1' ? $AppUI->_('All Projects') : $projectStatus[$statusFilter];
$gantt->setTitle($tableTitle);
$columnNames = array('Project name', 'Start Date', 'Finish', 'Actual End');
$columnSizes = array(160, 75, 75, 75);
$gantt->setColumnHeaders($columnNames, $columnSizes);
$gantt->setProperties(array('showhgrid' => true));
$gantt->setDateRange($start_date, $end_date);
$row = 0;
if (!is_array($projects) || 0 == count($projects)) {
$d = new w2p_Utilities_Date();
$columnValues = array('project_name' => $AppUI->_('No projects found'), 'start_date' => $d->getDate(), 'end_date' => $d->getDate(), 'actual_end' => '');
$gantt->addBar($columnValues, ' ', 0.6, 'red');
} else {
foreach ($projects as $p) {
$pname = $p['project_name'];
$pname = mb_strlen($pname) > 30 ? mb_substr($pname, 0, 25) . '...' : $pname;
//using new jpGraph determines using Date object instead of string
$start_date = (int) $p['project_start_date'] ? new w2p_Utilities_Date($AppUI->formatTZAwareTime($p['project_start_date'], '%Y-%m-%d %T')) : new w2p_Utilities_Date();
$start = $start_date->getDate();
$end_date = (int) $p['project_end_date'] ? new w2p_Utilities_Date($AppUI->formatTZAwareTime($p['project_end_date'], '%Y-%m-%d %T')) : new w2p_Utilities_Date();
$end = $end_date->getDate();
$actual_end = (int) $p['project_actual_end_date'] ? new w2p_Utilities_Date($AppUI->formatTZAwareTime($p['project_actual_end_date'], '%Y-%m-%d %T')) : $end_date;
$actual_end = $actual_end->getDate();
$progress = (int) $p['project_percent_complete'];
$caption = '';
if (!$start || $start == '0000-00-00') {
示例6: hook_preStore
protected function hook_preStore()
{
parent::hook_preStore();
if (!$this->event_recurs) {
$this->event_times_recuring = 0;
} else {
//If the event recurs then set the end date day to be equal to the start date day and keep the hour:minute of the end date
//so that the event starts recurring from the start day onwards n times after the start date for the period given
//Meaning: The event end date day is useless as far as recurring events are concerned.
$start_date = new w2p_Utilities_Date($this->event_start_date);
$end_date = new w2p_Utilities_Date($this->event_end_date);
$hour = $end_date->getHour();
$minute = $end_date->getMinute();
$end_date->setDate($start_date->getDate());
$end_date->setHour($hour);
$end_date->setMinute($minute);
$this->event_end_date = $end_date->format(FMT_DATETIME_MYSQL);
}
// ensure changes to check boxes and select lists are honoured
$this->event_private = (int) $this->event_private;
$this->event_type = (int) $this->event_type;
$this->event_cwd = (int) $this->event_cwd;
$this->event_creator = (int) $this->event_creator ? $this->event_creator : $this->_AppUI->user_id;
$this->event_owner = (int) $this->event_owner ? $this->event_owner : $this->_AppUI->user_id;
$q = $this->_getQuery();
$this->event_updated = $q->dbfnNowWithTZ();
}
示例7: testSubtractSecondsAcrossYear
/**
* Tests subtractSeconds when crossing over a year
*/
public function testSubtractSecondsAcrossYear()
{
$date = new w2p_Utilities_Date('2011-01-01 00:00:10');
$date->subtractSeconds(11);
$this->assertEquals('2010-12-31 23:59:59', $date->getDate(DATE_FORMAT_ISO));
}
示例8: strtotime
}
}
$caption = mb_substr($caption, 0, mb_strlen($caption) - 1);
}
if ($flags == 'm') {
// if hide milestones is ticked this bit is not processed//////////////////////////////////////////
if ($showNoMilestones != '1') {
$start = new w2p_Utilities_Date($start);
$start->addDays(0);
$start_mile = $start->getDate();
$s = $start->format($df);
$mile_date = $start->format($df . ' ' . $AppUI->getPref('TIMEFORMAT'));
$mile_date_stamp = strtotime($start_mile);
$today = new w2p_Utilities_Date();
$today->convertTZ($AppUI->getPref('TIMEZONE'));
$today_mile = $today->getDate();
$today_date = $today->format($df . ' ' . $AppUI->getPref('TIMEFORMAT'));
$today_date_stamp = strtotime($today_mile);
// honour the choice to show task names only///////////////////////////////////////////////////
if ($showTaskNameOnly == '1') {
$fieldArray = array($name);
} else {
if ($caller == 'todo') {
$fieldArray = array($name, $pname, '', $s, $s);
} else {
$fieldArray = array($name, '', $s, $s);
}
}
///////////////////////////////////////////////////////////////////////////////////////
//set color for milestone according to progress
//red for 'not started' #990000
示例9: store
public function store()
{
$stored = false;
$q = $this->_getQuery();
if (!$this->event_recurs) {
$this->event_times_recuring = 0;
} else {
//If the event recurs then set the end date day to be equal to the start date day and keep the hour:minute of the end date
//so that the event starts recurring from the start day onwards n times after the start date for the period given
//Meaning: The event end date day is useless as far as recurring events are concerned.
$start_date = new w2p_Utilities_Date($this->event_start_date);
$end_date = new w2p_Utilities_Date($this->event_end_date);
$hour = $end_date->getHour();
$minute = $end_date->getMinute();
$end_date->setDate($start_date->getDate());
$end_date->setHour($hour);
$end_date->setMinute($minute);
$this->event_end_date = $end_date->format(FMT_DATETIME_MYSQL);
}
// ensure changes to check boxes and select lists are honoured
$this->event_private = (int) $this->event_private;
$this->event_type = (int) $this->event_type;
$this->event_cwd = (int) $this->event_cwd;
$this->event_start_date = $this->_AppUI->convertToSystemTZ($this->event_start_date);
$this->event_end_date = $this->_AppUI->convertToSystemTZ($this->event_end_date);
/*
* TODO: I don't like the duplication on each of these two branches, but I
* don't have a good idea on how to fix it at the moment...
*/
if ($this->{$this->_tbl_key} && $this->canEdit()) {
$this->event_updated = $q->dbfnNowWithTZ();
$stored = parent::store();
}
if (0 == $this->{$this->_tbl_key} && $this->canCreate()) {
$this->event_created = $q->dbfnNowWithTZ();
$this->event_updated = $this->event_created;
$stored = parent::store();
}
return $stored;
}