本文整理汇总了PHP中Vtiger_Functions::decimalTimeFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Functions::decimalTimeFormat方法的具体用法?PHP Vtiger_Functions::decimalTimeFormat怎么用?PHP Vtiger_Functions::decimalTimeFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Functions
的用法示例。
在下文中一共展示了Vtiger_Functions::decimalTimeFormat方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
public function process($instance)
{
$log = vglobal('log');
$log->debug("Entering SumTimeProjectTask::process() method ...");
$sum_time = Vtiger_Functions::decimalTimeFormat($instance->get('sum_time_pt'));
$log->debug("Exiting SumTimeProjectTask::process() method ...");
return $sum_time['short'];
}
示例2: getDisplayValue
/**
* Function to get the Display Value, for the current field type with given DB Insert Value
* @param <Object> $value
* @return <Object>
*/
public function getDisplayValue($value)
{
if ($this->get('field')->getFieldName() == 'sum_time') {
$return = Vtiger_Functions::decimalTimeFormat($value);
return $return['short'];
} else {
return decimalFormat($value);
}
}
示例3: process
public function process($instance)
{
$adb = PearDatabase::getInstance();
$timecontrol = 'SELECT SUM(sum_time) as sum FROM vtiger_osstimecontrol
INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid=vtiger_osstimecontrol.osstimecontrolid
WHERE vtiger_crmentity.deleted=0 AND vtiger_osstimecontrol.accountid = ? AND osstimecontrol_status = ?';
$result_timecontrol = $adb->pquery($timecontrol, array($instance->getId(), 'Accepted'));
$decimalTimeFormat = Vtiger_Functions::decimalTimeFormat($adb->query_result($result_timecontrol, 0, 'sum'));
return $decimalTimeFormat['short'];
}
示例4: process
public function process($instance)
{
$log = vglobal('log');
$log->debug("Entering TotalTimeWorked::process() method ...");
$adb = PearDatabase::getInstance();
$timecontrol = 'SELECT SUM(sum_time) as sum FROM vtiger_osstimecontrol
INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid=vtiger_osstimecontrol.osstimecontrolid
WHERE vtiger_crmentity.deleted=0 AND vtiger_osstimecontrol.link = ?';
$result_timecontrol = $adb->pquery($timecontrol, array($instance->getId()));
$decimalTimeFormat = Vtiger_Functions::decimalTimeFormat($adb->query_result($result_timecontrol, 0, 'sum'));
$log->debug("Exiting TotalTimeWorked::process() method ...");
return $decimalTimeFormat['short'];
}
示例5: process
public function process($moduleName, $id, Vtiger_PDF_Model $pdf)
{
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$fields = $moduleModel->getFields();
$ids = $pdf->getRecordIds();
if (!is_array($ids)) {
$ids = [$ids];
}
$html = '<br><style>' . '.table {width: 100%; border-collapse: collapse;}' . '.table thead th {border-bottom: 1px solid grey;}' . '.table tbody tr {border-bottom: 1px solid grey}' . '.table tbody tr:nth-child(even) {background-color: #F7F7F7;}' . '.center {text-align: center;}' . '.summary {border-top: 1px solid grey;}' . '</style>';
$html .= '<table class="table"><thead><tr>';
foreach ($this->columnNames as $column) {
$fieldModel = $fields[$column];
$html .= '<th><span>' . vtranslate($fieldModel->get('label'), $moduleName) . '</span> </th>';
}
$html .= '</tr></thead><tbody>';
$summary = [];
foreach ($ids as $recordId) {
$html .= '<tr>';
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
foreach ($this->columnNames as $key => $column) {
$fieldModel = $fields[$column];
$class = '';
if (in_array($column, ['time_start', 'time_end', 'due_date', 'date_start', 'sum_time'])) {
$class = 'class="center"';
}
$html .= '<td ' . $class . '>' . $recordModel->getDisplayValue($fieldModel->getName(), $recordId, true) . '</td>';
if ($column == 'sum_time') {
$summary['sum_time'] += $recordModel->get($fieldModel->getName());
}
}
$html .= '</tr>';
}
$html .= '</tbody><tfoot><tr>';
foreach ($this->columnNames as $key => $column) {
$class = $content = '';
if ($column == 'sum_time') {
$time = Vtiger_Functions::decimalTimeFormat($summary['sum_time']);
$content = '<strong>' . $time['short'] . '</strong>';
$class = 'center';
} elseif ($column == 'name') {
$content = '<strong>' . vtranslate('LBL_SUMMARY', $moduleName) . ':' . '</strong>';
}
$html .= '<td class="summary ' . $class . '">' . $content . '</td>';
}
$html .= '</tr></tfoot></table>';
return $html;
}
示例6: process
public function process($moduleName, $id, Vtiger_PDF_Model $pdf)
{
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$fields = $moduleModel->getFields();
$html = '<br><style>' . '.table {width: 100%; border-collapse: collapse;}' . '.table thead th {border-bottom: 1px solid grey;}' . '.table tbody tr {border-bottom: 1px solid grey}' . '.table tbody tr:nth-child(even) {background-color: #F7F7F7;}' . '.center {text-align: center;}' . '.summary {border-top: 1px solid grey;}' . '</style>';
$html .= '<table class="table"><thead><tr>';
$html .= '<th>Nazwa użytkownika</th>';
$html .= '<th class="center">Dział</th>';
$html .= '<th class="center">Czas pracy</th>';
$html .= '</tr></thead><tbody>';
$summary = [];
foreach ($this->getUserList($pdf, $moduleName) as $user => $data) {
$html .= '<tr>';
$html .= '<td>' . $user . '</td>';
$html .= '<td class="center">' . $data['role'] . '</td>';
$time = Vtiger_Functions::decimalTimeFormat($data['time']);
$html .= '<td class="center">' . $time['short'] . '</td>';
$html .= '</tr>';
}
$html .= '</tbody></table>';
return $html;
}
示例7: getListViewRecords
//.........这里部分代码省略.........
}
}
$value = $fileicon . $value;
} elseif ($module == 'Documents' && $fieldName == 'filesize') {
$downloadType = $db->query_result($result, $i, 'filelocationtype');
if ($downloadType == 'I') {
$filesize = $value;
if ($filesize < 1024) {
$value = $filesize . ' B';
} elseif ($filesize > 1024 && $filesize < 1048576) {
$value = round($filesize / 1024, 2) . ' KB';
} else {
if ($filesize > 1048576) {
$value = round($filesize / (1024 * 1024), 2) . ' MB';
}
}
} else {
$value = ' --';
}
} elseif ($module == 'Documents' && $fieldName == 'filestatus') {
if ($value == 1) {
$value = getTranslatedString('yes', $module);
} elseif ($value == 0) {
$value = getTranslatedString('no', $module);
} else {
$value = '--';
}
} elseif ($module == 'Documents' && $fieldName == 'filetype') {
$downloadType = $db->query_result($result, $i, 'filelocationtype');
if ($downloadType == 'E' || $downloadType != 'I') {
$value = '--';
}
} elseif ($module == 'OSSTimeControl' && $fieldName == 'sum_time') {
$value = Vtiger_Functions::decimalTimeFormat($value);
$value = $value['short'];
} elseif ($field->getUIType() == '27') {
if ($value == 'I') {
$value = getTranslatedString('LBL_INTERNAL', $module);
} elseif ($value == 'E') {
$value = getTranslatedString('LBL_EXTERNAL', $module);
} else {
$value = ' --';
}
$value = Vtiger_Functions::textLength($value);
} elseif ($field->getFieldDataType() == 'picklist') {
$value = Vtiger_Language_Handler::getTranslatedString($value, $module);
$value = textlength_check($value);
} elseif ($field->getFieldDataType() == 'date' || $field->getFieldDataType() == 'datetime') {
if ($value != '' && $value != '0000-00-00') {
$fieldDataType = $field->getFieldDataType();
if ($module == 'Calendar' && ($fieldName == 'date_start' || $fieldName == 'due_date')) {
if ($fieldName == 'date_start') {
$timeField = 'time_start';
} else {
if ($fieldName == 'due_date') {
$timeField = 'time_end';
}
}
$timeFieldValue = $this->db->query_result($result, $i, $timeField);
if (!empty($timeFieldValue)) {
$value .= ' ' . $timeFieldValue;
//TO make sure it takes time value as well
$fieldDataType = 'datetime';
}
}
if ($fieldDataType == 'datetime') {
示例8: 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;
}