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


PHP Vtiger_Functions::getDateTimeHoursDiff方法代码示例

本文整理汇总了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;
 }
开发者ID:reeid,项目名称:YetiForceCRM,代码行数:89,代码来源:Calendar.php


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