本文整理汇总了PHP中Vtiger_Functions::getDateTimeHoursDiff方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Functions::getDateTimeHoursDiff方法的具体用法?PHP Vtiger_Functions::getDateTimeHoursDiff怎么用?PHP Vtiger_Functions::getDateTimeHoursDiff使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Functions
的用法示例。
在下文中一共展示了Vtiger_Functions::getDateTimeHoursDiff方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEntity
public function getEntity()
{
$currentUser = Users_Record_Model::getCurrentUserModel();
$db = PearDatabase::getInstance();
$data = $this->getQuery();
$result = $db->pquery($data['query'], $data['params']);
$return = [];
while ($record = $db->fetch_array($result)) {
$item = [];
$crmid = $record['activityid'];
$activitytype = $record['activitytype'];
$item['id'] = $crmid;
$item['module'] = $this->getModuleName();
$item['title'] = $record['subject'];
$item['url'] = 'index.php?module=' . $this->getModuleName() . '&view=Detail&record=' . $crmid;
$item['set'] = $record['activitytype'] == 'Task' ? 'Task' : 'Event';
$item['lok'] = $record['location'];
$item['pri'] = $record['priority'];
$item['sta'] = $record['status'];
$item['vis'] = $record['visibility'];
$item['state'] = $record['state'];
$item['smownerid'] = Vtiger_Functions::getOwnerRecordLabel($record['smownerid']);
//translate
$item['labels']['sta'] = vtranslate($record['status'], $this->getModuleName());
$item['labels']['pri'] = vtranslate($record['priority'], $this->getModuleName());
$item['labels']['state'] = vtranslate($record['state'], $this->getModuleName());
//Relation
$item['link'] = $record['link'];
$item['linkl'] = $record['linklabel'];
$item['linkm'] = $record['linkmod'];
//Process
$item['process'] = $record['process'];
$item['procl'] = $record['processlabel'];
$item['procm'] = $record['processmod'];
//Subprocess
$item['subprocess'] = $record['subprocess'];
$item['subprocl'] = $record['subprocesslabel'];
$item['subprocm'] = $record['subprocessmod'];
if ($record['linkmod'] != 'Accounts' && (!empty($record['link']) || !empty($record['process']))) {
$findId = 0;
$findMod = '';
if (!empty($record['link'])) {
$findId = $record['link'];
$findMod = $record['linkmod'];
}
if (!empty($record['process'])) {
$findId = $record['process'];
$findMod = $record['processmod'];
}
$tabInfo = $this->relationAcounts[$findMod];
if ($tabInfo) {
$findResult = $db->pquery('SELECT accountid, accountname FROM vtiger_account ' . 'INNER JOIN ' . $tabInfo[0] . ' ON vtiger_account.accountid = ' . $tabInfo[0] . '.' . $tabInfo[2] . ' WHERE ' . $tabInfo[1] . ' = ?;', [$findId]);
if ($db->num_rows($findResult) > 0) {
$item['accid'] = $db->query_result_raw($findResult, 0, 'accountid');
$item['accname'] = $db->query_result_raw($findResult, 0, 'accountname');
}
}
}
$dateTimeFieldInstance = new DateTimeField($record['date_start'] . ' ' . $record['time_start']);
$userDateTimeString = $dateTimeFieldInstance->getFullcalenderDateTimevalue($currentUser);
$startDateTimeDisplay = $dateTimeFieldInstance->getDisplayDateTimeValue();
$startTimeDisplay = $dateTimeFieldInstance->getDisplayTime();
$dateTimeComponents = explode(' ', $userDateTimeString);
$dateComponent = $dateTimeComponents[0];
$startTimeFormated = $dateTimeComponents[1];
//Conveting the date format in to Y-m-d . since full calendar expects in the same format
$startDateFormated = DateTimeField::__convertToDBFormat($dateComponent, $currentUser->get('date_format'));
$dateTimeFieldInstance = new DateTimeField($record['due_date'] . ' ' . $record['time_end']);
$userDateTimeString = $dateTimeFieldInstance->getFullcalenderDateTimevalue($currentUser);
$endDateTimeDisplay = $dateTimeFieldInstance->getDisplayDateTimeValue();
$dateTimeComponents = explode(' ', $userDateTimeString);
$dateComponent = $dateTimeComponents[0];
$endTimeFormated = $dateTimeComponents[1];
//Conveting the date format in to Y-m-d . since full calendar expects in the same format
$endDateFormated = DateTimeField::__convertToDBFormat($dateComponent, $currentUser->get('date_format'));
$item['start'] = $startDateFormated . ' ' . $startTimeFormated;
$item['end'] = $endDateFormated . ' ' . $endTimeFormated;
// display date time values
$item['start_display'] = $startDateTimeDisplay;
$item['end_display'] = $endDateTimeDisplay;
$item['hour_start'] = $startTimeDisplay;
$hours = Vtiger_Functions::getDateTimeHoursDiff($item['start'], $item['end']);
$item['hours'] = Vtiger_Functions::decimalTimeFormat($hours)['short'];
$item['allDay'] = $record['allday'] == 1 ? true : false;
$item['className'] = ' userCol_' . $record['smownerid'] . ' calCol_' . $activitytype;
$return[] = $item;
}
return $return;
}