本文整理汇总了PHP中w2p_Utilities_Date::setHour方法的典型用法代码示例。如果您正苦于以下问题:PHP w2p_Utilities_Date::setHour方法的具体用法?PHP w2p_Utilities_Date::setHour怎么用?PHP w2p_Utilities_Date::setHour使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类w2p_Utilities_Date
的用法示例。
在下文中一共展示了w2p_Utilities_Date::setHour方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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();
}
示例3: die
die('You should not access this file directly');
}
// @todo convert to template
// @todo remove database query
global $AppUI, $w2Pconfig, $cal_df, $cf;
// check permissions for this module
$perms =& $AppUI->acl();
$canView = canView($m);
$canAddProjects = $perms->checkModuleItem('projects', 'add');
if (!$canView) {
$AppUI->redirect(ACCESS_DENIED);
}
$AppUI->getTheme()->loadCalendarJS();
$today = new w2p_Utilities_Date();
$today->addDays(1);
$today->setHour($w2Pconfig['cal_day_start']);
$today->setMinute(0);
$view_options = __extract_from_projectdesigner1($AppUI);
$project_id = (int) w2PgetParam($_POST, 'project_id', 0);
$project_id = (int) w2PgetParam($_GET, 'project_id', $project_id);
$extra = array('where' => 'project_active = 1');
$project = new CProject();
$projects = $project->getAllowedRecords($AppUI->user_id, 'projects.project_id,project_name', 'project_name', null, $extra, 'projects');
$idx_companies = __extract_from_projectdesigner2();
foreach ($projects as $prj_id => $prj_name) {
$projects[$prj_id] = $idx_companies[$prj_id] . ': ' . $prj_name;
}
asort($projects);
$projects = arrayMerge(array('0' => $AppUI->_('(None)', UI_OUTPUT_RAW)), $projects);
$extra = array();
$task = new CTask();
示例4: 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;
}
示例5: strtotime
if ($bulk_task_start_date) {
$time = strtotime($bulk_task_start_date);
$upd_task->task_start_date = date('Y-m-d H:i:s', $time);
if ($add_task_bulk_time_keep) {
$tmp_start_date = new w2p_Utilities_Date($upd_task->task_start_date, $userTZ);
$tmp_start_date->setHour($start_date_old->getHour());
$tmp_start_date->setMinute($start_date_old->getMinute());
$upd_task->task_start_date = $tmp_start_date->format(FMT_DATETIME_MYSQL);
}
}
if ($bulk_task_end_date) {
$time = strtotime($bulk_task_end_date);
$upd_task->task_end_date = date('Y-m-d H:i:s', $time);
if ($add_task_bulk_time_keep) {
$tmp_end_date = new w2p_Utilities_Date($upd_task->task_end_date, $userTZ);
$tmp_end_date->setHour($end_date_old->getHour());
$tmp_end_date->setMinute($end_date_old->getMinute());
$upd_task->task_end_date = $tmp_end_date->format(FMT_DATETIME_MYSQL);
}
}
$result = $upd_task->store();
}
//Action: Modify Duration
if (isset($_POST['bulk_task_duration']) && $bulk_task_duration != '' && is_numeric($bulk_task_duration)) {
if ($upd_task->task_id) {
$upd_task->task_duration = $bulk_task_duration;
//set duration type to hours (1)
$upd_task->task_duration_type = $bulk_task_durntype ? $bulk_task_durntype : 1;
$result = $upd_task->store();
if (!$result) {
break;
示例6: updateTaskSummary
/**
* Updates the variable information on the task.
*
* @param int $notUsed not used
* @param int $task_id that task id of task this task log is for
*
* @return void
*
* @access protected
*/
protected function updateTaskSummary($notUsed = null, $task_id)
{
$task = new CTask();
$task->overrideDatabase($this->_query);
$task->load($task_id);
$q = $this->_getQuery();
if ($this->_perms->checkModuleItem('tasks', 'edit', $task_id)) {
if ($this->task_log_percent_complete <= 100) {
$q->addQuery('task_log_percent_complete, task_log_date');
$q->addTable('task_log');
$q->addWhere('task_log_task = ' . (int) $task_id);
$q->addOrder('task_log_date DESC, task_log_id DESC');
$q->setLimit(1);
$results = $q->loadHash();
$percentComplete = $results['task_log_percent_complete'];
} else {
$percentComplete = 100;
}
$old_end_date = new w2p_Utilities_Date($task->task_end_date);
$new_end_date = new w2p_Utilities_Date($this->task_log_task_end_date);
$new_end_date->setHour($old_end_date->getHour());
$new_end_date->setMinute($old_end_date->getMinute());
$task_end_date = $new_end_date->format(FMT_DATETIME_MYSQL);
/*
* We're using a database update here instead of store() because a
* bunch of other things happen when you call store().. like the
* processing of contacts, departments, etc.
*/
$q = $this->_getQuery();
$q->addTable('tasks');
$q->addUpdate('task_percent_complete', $percentComplete);
$q->addUpdate('task_end_date', $task_end_date);
$q->addWhere('task_id = ' . (int) $task_id);
$success = $q->exec();
if (!$success) {
$this->_AppUI->setMsg($task->getError(), UI_MSG_ERROR, true);
}
$task->pushDependencies($task_id, $task_end_date);
}
$q->addQuery('SUM(task_log_hours)');
$q->addTable('task_log');
$q->addWhere('task_log_task = ' . (int) $task_id);
$totalHours = $q->loadResult();
$task->updateHoursWorked2($task_id, $totalHours);
$task->updateDynamics();
}