本文整理汇总了PHP中Vtiger_Time_UIType::getTimeValueInAMorPM方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Time_UIType::getTimeValueInAMorPM方法的具体用法?PHP Vtiger_Time_UIType::getTimeValueInAMorPM怎么用?PHP Vtiger_Time_UIType::getTimeValueInAMorPM使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Time_UIType
的用法示例。
在下文中一共展示了Vtiger_Time_UIType::getTimeValueInAMorPM方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDisplayDateTimeValue
/**
* Function to get Date and Time value for Display
* @param <type> $date
* @return <String>
*/
public static function getDisplayDateTimeValue($date)
{
$date = new DateTimeField($date);
$dateValue = $date->getDisplayDateTimeValue();
list($dateInUserFormat, $timeInUserFormat) = explode(' ', $dateValue);
$currentUser = Users_Record_Model::getCurrentUserModel();
if ($currentUser->get('hour_format') == '12') {
$timeInUserFormat = Vtiger_Time_UIType::getTimeValueInAMorPM($timeInUserFormat);
}
return $dateInUserFormat . ' ' . $timeInUserFormat;
}
示例2: if
<?php if ($_valid && !is_callable('content_56059e760aa14')) {function content_56059e760aa14($_smarty_tpl) {?>
<?php $_smarty_tpl->tpl_vars["dateFormat"] = new Smarty_variable($_smarty_tpl->tpl_vars['USER_MODEL']->value->get('date_format'), null, 0);?>
<?php $_smarty_tpl->tpl_vars["currentDate"] = new Smarty_variable(Vtiger_Date_UIType::getDisplayDateValue(''), null, 0);?>
<?php $_smarty_tpl->tpl_vars["time"] = new Smarty_variable(Vtiger_Time_UIType::getDisplayTimeValue(null), null, 0);?>
<?php $_smarty_tpl->tpl_vars["currentTimeInVtigerFormat"] = new Smarty_variable(Vtiger_Time_UIType::getTimeValueInAMorPM($_smarty_tpl->tpl_vars['time']->value), null, 0);?>
<?php if ($_smarty_tpl->tpl_vars['COUNTER']->value==2){?>
</tr><tr class="<?php if (!($_smarty_tpl->tpl_vars['SHOW_FOLLOW_UP']->value)){?>hide <?php }?>followUpContainer massEditActiveField">
<?php $_smarty_tpl->tpl_vars['COUNTER'] = new Smarty_variable(1, null, 0);?>
<?php }else{ ?>
<?php $_smarty_tpl->tpl_vars['COUNTER'] = new Smarty_variable($_smarty_tpl->tpl_vars['COUNTER']->value+1, null, 0);?>
<?php }?>
<?php ob_start();?><?php echo vtranslate('LBL_HOLD_FOLLOWUP_ON',$_smarty_tpl->tpl_vars['MODULE']->value);?>
<?php $_tmp1=ob_get_clean();?><?php $_smarty_tpl->tpl_vars['FOLLOW_UP_LABEL'] = new Smarty_variable($_tmp1, null, 0);?>
<td class="fieldLabel">
<label class="muted pull-right marginRight10px">
<input name="followup" type="checkbox" class="alignTop" <?php if ($_smarty_tpl->tpl_vars['FOLLOW_UP_STATUS']->value){?> checked<?php }?>/>
<?php echo $_smarty_tpl->tpl_vars['FOLLOW_UP_LABEL']->value;?>
</label>
</td>
<?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['FOLLOW_UP_LABEL']->value;?>
<?php $_tmp2=ob_get_clean();?><?php $_smarty_tpl->createLocalArrayVariable('FIELD_INFO', null, 0);
$_smarty_tpl->tpl_vars['FIELD_INFO']->value['label'] = $_tmp2;?>
<td class="fieldValue">
<div>
<div class="input-append row-fluid">
<div class="span10 row-fluid date">
<input name="followup_date_start" type="text" class="span9 dateField" data-date-format="<?php echo $_smarty_tpl->tpl_vars['dateFormat']->value;?>
" type="text" data-fieldinfo= '<?php echo Vtiger_Util_Helper::toSafeHTML(ZEND_JSON::encode($_smarty_tpl->tpl_vars['FIELD_INFO']->value));?>
'
value="<?php if (!empty($_smarty_tpl->tpl_vars['FOLLOW_UP_DATE']->value)){?><?php echo $_smarty_tpl->tpl_vars['FOLLOW_UP_DATE']->value;?>
<?php }else{ ?><?php echo $_smarty_tpl->tpl_vars['currentDate']->value;?>
<?php }?>" data-validation-engine="validate[funcCall[Vtiger_greaterThanDependentField_Validator_Js.invokeValidation]]" />
<span class="add-on"><i class="icon-calendar"></i></span>
</div>
</div>
</div>
<div>
<div class="input-append time">
<input type="text" name="followup_time_start" class="timepicker-default input-small"
value="<?php if (!empty($_smarty_tpl->tpl_vars['FOLLOW_UP_TIME']->value)){?><?php echo $_smarty_tpl->tpl_vars['FOLLOW_UP_TIME']->value;?>
<?php }else{ ?><?php echo $_smarty_tpl->tpl_vars['currentTimeInVtigerFormat']->value;?>
<?php }?>" />
<span class="add-on cursorPointer">
<i class="icon-time"></i>
</span>
</div>
</div>
</td>
<td></td><td></td><?php }} ?>
开发者ID:jeremyevans6,项目名称:kulturedTiger-,代码行数:50,代码来源:049059a7f7cc56add07f33ccecce5661b1f7109b.file.FollowUp.tpl.php
示例3: getDisplayValue
/**
* Customize the display value for detail view.
*/
public function getDisplayValue($value, $record = false, $recordInstance = false)
{
if ($recordInstance) {
if ($this->getName() == 'due_date') {
$displayValue = $value . ' ' . $recordInstance->get('time_end');
$value = $this->getUITypeModel()->getDisplayValue($displayValue);
list($endDate, $endTime) = explode(' ', $value);
$currentUser = Users_Record_Model::getCurrentUserModel();
if ($currentUser->get('hour_format') == '12') {
$endTime = Vtiger_Time_UIType::getTimeValueInAMorPM($endTime);
}
return $endDate . ' ' . $endTime;
}
}
return parent::getDisplayValue($value, $record, $recordInstance);
}
示例4: getDisplayTimeDifferenceValue
/**
* Function to get the calendar event call duration value in hour format
* @param type $fieldName
* @param type $value
* @return <Vtiger_Time_UIType> - getTimeValue
*/
public function getDisplayTimeDifferenceValue($fieldName, $value)
{
$userModel = Users_Privileges_Model::getCurrentUserModel();
$date = new DateTime($value);
//No need to set the time zone as DateTimeField::getDisplayTime API is already doing this
/*if(empty($value)) {
$timeZone = $userModel->get('time_zone');
$targetTimeZone = new DateTimeZone($timeZone);
$date->setTimezone($targetTimeZone);
}*/
if ($fieldName == 'time_end' && empty($value)) {
$date->modify("+15 minutes");
}
$dateTimeField = new DateTimeField($date->format('Y-m-d H:i:s'));
$value = $dateTimeField->getDisplayTime();
if ($userModel->get('hour_format') == '12') {
return Vtiger_Time_UIType::getTimeValueInAMorPM($value);
}
return $value;
}
示例5: getListViewRecords
//.........这里部分代码省略.........
} 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') {
$value = Vtiger_Datetime_UIType::getDateTimeValue($value);
} else {
if ($fieldDataType == 'date') {
$date = new DateTimeField($value);
$value = $date->getDisplayDate();
}
}
} elseif ($value == '0000-00-00') {
$value = '';
}
} elseif ($field->getFieldDataType() == 'time') {
if (!empty($value)) {
$userModel = Users_Privileges_Model::getCurrentUserModel();
if ($userModel->get('hour_format') == '12') {
$value = Vtiger_Time_UIType::getTimeValueInAMorPM($value);
}
}
} elseif ($field->getFieldDataType() == 'currency') {
if ($value != '') {
if ($field->getUIType() == 72) {
if ($fieldName == 'unit_price') {
$currencyId = getProductBaseCurrency($recordId, $module);
$cursym_convrate = getCurrencySymbolandCRate($currencyId);
$currencySymbol = $cursym_convrate['symbol'];
} else {
$currencyInfo = getInventoryCurrencyInfo($module, $recordId);
$currencySymbol = $currencyInfo['currency_symbol'];
}
$value = CurrencyField::convertToUserFormat($value, null, true);
$row['currencySymbol'] = $currencySymbol;
$value = CurrencyField::appendCurrencySymbol($value, $currencySymbol);
} else {
if (!empty($value)) {
$value = CurrencyField::convertToUserFormat($value);
$currencyModal = new CurrencyField($value);
$currencyModal->initialize();
$value = $currencyModal->appendCurrencySymbol($value, $currencyModal->currencySymbol);
}
}
}
} elseif ($field->getFieldDataType() == 'url') {
$matchPattern = "^[\\w]+:\\/\\/^";
preg_match($matchPattern, $rawValue, $matches);
if (!empty($matches[0])) {
$value = '<a class="urlField cursorPointer" title="' . $rawValue . '" href="' . $rawValue . '" target="_blank">' . textlength_check($value) . '</a>';
} else {
$value = '<a class="urlField cursorPointer" title="' . $rawValue . '" href="http://' . $rawValue . '" target="_blank">' . textlength_check($value) . '</a>';
示例6: getReportFieldValue
/**
*
* @global Users $current_user
* @param ReportRun $report
* @param Array $picklistArray
* @param ADOFieldObject $dbField
* @param Array $valueArray
* @param String $fieldName
* @return String
*/
function getReportFieldValue($report, $picklistArray, $dbField, $valueArray, $fieldName)
{
global $current_user, $default_charset;
$db = PearDatabase::getInstance();
$value = $valueArray[$fieldName];
$fld_type = $dbField->type;
list($module, $fieldLabel) = explode('__', $dbField->name, 2);
$fieldInfo = getFieldByReportLabel($module, $fieldLabel);
$fieldType = null;
$fieldvalue = $value;
if (!empty($fieldInfo)) {
$field = WebserviceField::fromArray($db, $fieldInfo);
$fieldType = $field->getFieldDataType();
}
if ($fieldType == 'currency' && $value != '') {
// Some of the currency fields like Unit Price, Total, Sub-total etc of Inventory modules, do not need currency conversion
if ($field->getUIType() == '72') {
$curid_value = explode("::", $value);
$currency_id = $curid_value[0];
$currency_value = $curid_value[1];
$cur_sym_rate = getCurrencySymbolandCRate($currency_id);
if ($value != '') {
if ($dbField->name == 'Products_Unit_Price') {
// need to do this only for Products Unit Price
if ($currency_id != 1) {
$currency_value = (double) $cur_sym_rate['rate'] * (double) $currency_value;
}
}
$formattedCurrencyValue = CurrencyField::convertToUserFormat($currency_value, null, true);
$fieldvalue = CurrencyField::appendCurrencySymbol($formattedCurrencyValue, $cur_sym_rate['symbol']);
}
} else {
$currencyField = new CurrencyField($value);
$fieldvalue = $currencyField->getDisplayValue();
}
} elseif ($dbField->name == "PriceBooks_Currency") {
if ($value != '') {
$fieldvalue = getTranslatedCurrencyString($value);
}
} elseif (in_array($dbField->name, $report->ui101_fields) && !empty($value)) {
$entityNames = getEntityName('Users', $value);
$fieldvalue = $entityNames[$value];
} elseif ($fieldType == 'date' && !empty($value)) {
if ($module == 'Calendar' && $field->getFieldName() == 'due_date') {
$endTime = $valueArray['calendar_end_time'];
if (empty($endTime)) {
$recordId = $valueArray['calendar_id'];
$endTime = getSingleFieldValue('vtiger_activity', 'time_end', 'activityid', $recordId);
}
$date = new DateTimeField($value . ' ' . $endTime);
$fieldvalue = $date->getDisplayDate();
} else {
if (!($field->getUIType() == '5')) {
$date = new DateTimeField($fieldvalue);
$fieldvalue = $date->getDisplayDateTimeValue();
}
}
} elseif ($fieldType == "datetime" && !empty($value)) {
$date = new DateTimeField($value);
$fieldvalue = $date->getDisplayDateTimeValue();
} elseif ($fieldType == 'time' && !empty($value) && $field->getFieldName() != 'duration_hours') {
if ($field->getFieldName() == "time_start" || $field->getFieldName() == "time_end") {
$date = new DateTimeField($value);
$fieldvalue = $date->getDisplayTime();
} else {
$userModel = Users_Privileges_Model::getCurrentUserModel();
if ($userModel->get('hour_format') == '12') {
$value = Vtiger_Time_UIType::getTimeValueInAMorPM($value);
}
$fieldvalue = $value;
}
} elseif ($fieldType == "picklist" && !empty($value)) {
if (is_array($picklistArray)) {
if (is_array($picklistArray[$dbField->name]) && $field->getFieldName() != 'activitytype' && !in_array($value, $picklistArray[$dbField->name])) {
$fieldvalue = $app_strings['LBL_NOT_ACCESSIBLE'];
} else {
$fieldvalue = getTranslatedString($value, $module);
}
} else {
$fieldvalue = getTranslatedString($value, $module);
}
} elseif ($fieldType == "multipicklist" && !empty($value)) {
if (is_array($picklistArray[1])) {
$valueList = explode(' |##| ', $value);
$translatedValueList = array();
foreach ($valueList as $value) {
if (is_array($picklistArray[1][$dbField->name]) && !in_array($value, $picklistArray[1][$dbField->name])) {
$translatedValueList[] = $app_strings['LBL_NOT_ACCESSIBLE'];
} else {
$translatedValueList[] = getTranslatedString($value, $module);
//.........这里部分代码省略.........
示例7: convertTimeIntoUsersDisplayFormat
/**
* Function to get the time value in user preferred hour format
* @param <Time> $time
* @param <Vtiger_Users_Model> $userObject
* @return <String> time with hour format
*/
public static function convertTimeIntoUsersDisplayFormat($time, $userObject = null) {
require_once 'includes/runtime/LanguageHandler.php';
require_once 'includes/runtime/Globals.php';
if ($userObject) {
$userModel = Users_Privileges_Model::getInstanceFromUserObject($userObject);
} else {
$userModel = Users_Privileges_Model::getCurrentUserModel();
}
if($userModel->get('hour_format') == '12') {
$time = Vtiger_Time_UIType::getTimeValueInAMorPM($time);
}
return $time;
}
示例8: getDisplayTime
function getDisplayTime($user = null)
{
$log = vglobal('log');
$log->debug('Start ' . __CLASS__ . ':' . __FUNCTION__ . '(' . $this->datetime . ')');
$date = self::convertToUserTimeZone($this->datetime, $user);
$time = $date->format("H:i:s");
//Convert time to user preferred value
$userModel = Users_Privileges_Model::getCurrentUserModel();
if ($userModel->get('hour_format') == '12') {
$time = Vtiger_Time_UIType::getTimeValueInAMorPM($time);
}
$log->debug('End ' . __CLASS__ . ':' . __FUNCTION__);
return $time;
}
示例9: content_567aca6bd2404
function content_567aca6bd2404($_smarty_tpl)
{
$_smarty_tpl->tpl_vars["dateFormat"] = new Smarty_variable($_smarty_tpl->tpl_vars['USER_MODEL']->value->get('date_format'), null, 0);
$_smarty_tpl->tpl_vars["currentDate"] = new Smarty_variable(Vtiger_Date_UIType::getDisplayDateValue(''), null, 0);
$_smarty_tpl->tpl_vars["time"] = new Smarty_variable(Vtiger_Time_UIType::getDisplayTimeValue(null), null, 0);
$_smarty_tpl->tpl_vars["currentTimeInVtigerFormat"] = new Smarty_variable(Vtiger_Time_UIType::getTimeValueInAMorPM($_smarty_tpl->tpl_vars['time']->value), null, 0);
if ($_smarty_tpl->tpl_vars['COUNTER']->value == 2) {
?>
</tr><tr class="<?php
if (!$_smarty_tpl->tpl_vars['SHOW_FOLLOW_UP']->value) {
?>
hide <?php
}
?>
followUpContainer massEditActiveField">
<?php
$_smarty_tpl->tpl_vars['COUNTER'] = new Smarty_variable(1, null, 0);
} else {
?>
<?php
$_smarty_tpl->tpl_vars['COUNTER'] = new Smarty_variable($_smarty_tpl->tpl_vars['COUNTER']->value + 1, null, 0);
}
?>
<td class="fieldLabel">
<label class="muted pull-right marginRight10px">
<input name="followup" type="checkbox" class="alignTop" <?php
if ($_smarty_tpl->tpl_vars['FOLLOW_UP_STATUS']->value) {
?>
checked<?php
}
?>
/>
<?php
echo vtranslate('LBL_HOLD_FOLLOWUP_ON', $_smarty_tpl->tpl_vars['MODULE']->value);
?>
</label>
</td>
<td class="fieldValue">
<div>
<div class="input-append row-fluid">
<div class="span10 row-fluid date">
<input name="followup_date_start" type="text" class="span9 dateField" data-date-format="<?php
echo $_smarty_tpl->tpl_vars['dateFormat']->value;
?>
" type="text"
value="<?php
if (!empty($_smarty_tpl->tpl_vars['FOLLOW_UP_DATE']->value)) {
echo $_smarty_tpl->tpl_vars['FOLLOW_UP_DATE']->value;
} else {
echo $_smarty_tpl->tpl_vars['currentDate']->value;
}
?>
" />
<span class="add-on"><i class="icon-calendar"></i></span>
</div>
</div>
</div>
<div>
<div class="input-append time">
<input type="text" name="followup_time_start" class="timepicker-default input-small"
value="<?php
if (!empty($_smarty_tpl->tpl_vars['FOLLOW_UP_TIME']->value)) {
echo $_smarty_tpl->tpl_vars['FOLLOW_UP_TIME']->value;
} else {
echo $_smarty_tpl->tpl_vars['currentTimeInVtigerFormat']->value;
}
?>
" />
<span class="add-on cursorPointer">
<i class="icon-time"></i>
</span>
</div>
</div>
</td>
<td></td><td></td><?php
}
开发者ID:jmangarret,项目名称:vtigercrm,代码行数:77,代码来源:0887e6951381aa013f381b73b6b23a8c495026b3.file.FollowUp.tpl.php
示例10: getDisplayTime
function getDisplayTime($user = null)
{
global $log;
$log->debug("Entering getDisplayTime(" . $this->datetime . ") method ...");
$date = self::convertToUserTimeZone($this->datetime, $user);
$time = $date->format("H:i:s");
$log->debug("Exiting getDisplayTime method ...");
//Convert time to user preferred value
$userModel = Users_Privileges_Model::getCurrentUserModel();
if ($userModel->get('hour_format') == '12') {
$time = Vtiger_Time_UIType::getTimeValueInAMorPM($time);
}
return $time;
}
示例11: getReportFieldValue
/**
*
* @global Users $current_user
* @param ReportRun $report
* @param Array $picklistArray
* @param ADOFieldObject $dbField
* @param Array $valueArray
* @param String $fieldName
* @return String
*/
function getReportFieldValue($report, $picklistArray, $dbField, $valueArray, $fieldName)
{
global $current_user, $default_charset;
$db = PearDatabase::getInstance();
$value = $valueArray[$fieldName];
$fld_type = $dbField->type;
list($module, $fieldLabel) = explode('_', $dbField->name, 2);
$fieldInfo = getFieldByReportLabel($module, $fieldLabel);
$fieldType = null;
$fieldvalue = $value;
if (!empty($fieldInfo)) {
$field = WebserviceField::fromArray($db, $fieldInfo);
$fieldType = $field->getFieldDataType();
}
if ($fieldType == 'currency' && $value != '') {
// Some of the currency fields like Unit Price, Total, Sub-total etc of Inventory modules, do not need currency conversion
if ($field->getUIType() == '72') {
$curid_value = explode("::", $value);
$currency_id = $curid_value[0];
$currency_value = $curid_value[1];
$cur_sym_rate = getCurrencySymbolandCRate($currency_id);
if ($value != '') {
if ($dbField->name == 'Products_Unit_Price') {
// need to do this only for Products Unit Price
if ($currency_id != 1) {
$currency_value = (double) $cur_sym_rate['rate'] * (double) $currency_value;
}
}
$formattedCurrencyValue = CurrencyField::convertToUserFormat($currency_value, null, true);
$fieldvalue = CurrencyField::appendCurrencySymbol($formattedCurrencyValue, $cur_sym_rate['symbol']);
}
} else {
$currencyField = new CurrencyField($value);
$fieldvalue = $currencyField->getDisplayValue();
}
} elseif ($dbField->name == "PurchaseOrder_Currency" || $dbField->name == "SalesOrder_Currency" || $dbField->name == "Invoice_Currency" || $dbField->name == "Quotes_Currency" || $dbField->name == "PriceBooks_Currency") {
if ($value != '') {
$fieldvalue = getTranslatedCurrencyString($value);
}
} elseif (in_array($dbField->name, $report->ui101_fields) && !empty($value)) {
$entityNames = getEntityName('Users', $value);
$fieldvalue = $entityNames[$value];
} elseif ($fieldType == 'date' && !empty($value)) {
if ($module == 'Calendar' && $field->getFieldName() == 'due_date') {
$endTime = $valueArray['calendar_end_time'];
if (empty($endTime)) {
$recordId = $valueArray['calendar_id'];
$endTime = getSingleFieldValue('vtiger_activity', 'time_end', 'activityid', $recordId);
}
$date = new DateTimeField($value . ' ' . $endTime);
$fieldvalue = $date->getDisplayDate();
} else {
if (!($field->getUIType() == '5')) {
$date = new DateTimeField($fieldvalue);
$fieldvalue = $date->getDisplayDateTimeValue();
}
}
} elseif ($fieldType == "datetime" && !empty($value)) {
$date = new DateTimeField($value);
$fieldvalue = $date->getDisplayDateTimeValue();
} elseif ($fieldType == 'time' && !empty($value) && $field->getFieldName() != 'duration_hours') {
if ($field->getFieldName() == "time_start" || $field->getFieldName() == "time_end") {
$date = new DateTimeField($value);
$fieldvalue = $date->getDisplayTime();
} else {
$userModel = Users_Privileges_Model::getCurrentUserModel();
if ($userModel->get('hour_format') == '12') {
$value = Vtiger_Time_UIType::getTimeValueInAMorPM($value);
}
$fieldvalue = $value;
}
} elseif ($fieldType == "picklist" && !empty($value)) {
if (is_array($picklistArray)) {
if (is_array($picklistArray[$dbField->name]) && $field->getFieldName() != 'activitytype' && !in_array($value, $picklistArray[$dbField->name])) {
$fieldvalue = $app_strings['LBL_NOT_ACCESSIBLE'];
} else {
$fieldvalue = getTranslatedString($value, $module);
}
} else {
$fieldvalue = getTranslatedString($value, $module);
}
} elseif ($fieldType == "multipicklist" && !empty($value)) {
if (is_array($picklistArray[1])) {
$valueList = explode(' |##| ', $value);
$translatedValueList = array();
foreach ($valueList as $value) {
if (is_array($picklistArray[1][$dbField->name]) && !in_array($value, $picklistArray[1][$dbField->name])) {
$translatedValueList[] = $app_strings['LBL_NOT_ACCESSIBLE'];
} else {
$translatedValueList[] = getTranslatedString($value, $module);
//.........这里部分代码省略.........
示例12: process
public function process(Vtiger_Request $request)
{
$user = Users_Record_Model::getCurrentUserModel();
$allDay = $request->get('allday');
if ('on' == $allDay) {
$request->set('time_start', NULL);
$request->set('time_end', NULL);
}
$recordModel = $this->saveRecord($request);
$fieldModelList = $recordModel->getModule()->getFields();
$result = array();
foreach ($fieldModelList as $fieldName => $fieldModel) {
$fieldValue = Vtiger_Util_Helper::toSafeHTML($recordModel->get($fieldName));
$result[$fieldName] = array();
if ($fieldName == 'date_start') {
$timeStart = $recordModel->get('time_start');
$dateTimeFieldInstance = new DateTimeField($fieldValue . ' ' . $timeStart);
$userDateTimeString = $dateTimeFieldInstance->getDisplayDateTimeValue();
$dateTimeComponents = explode(' ', $userDateTimeString);
$dateComponent = $dateTimeComponents[0];
//Conveting the date format in to Y-m-d . since full calendar expects in the same format
$dataBaseDateFormatedString = DateTimeField::__convertToDBFormat($dateComponent, $user->get('date_format'));
$result[$fieldName]['value'] = $dataBaseDateFormatedString;
$result[$fieldName]['display_value'] = $fieldValue;
} else {
if ($fieldName == 'due_date') {
$timeEnd = $recordModel->get('time_end');
$dateTimeFieldInstance = new DateTimeField($fieldValue . ' ' . $timeEnd);
$userDateTimeString = $dateTimeFieldInstance->getDisplayDateTimeValue();
$dateTimeComponents = explode(' ', $userDateTimeString);
$dateComponent = $dateTimeComponents[0];
//Conveting the date format in to Y-m-d . since full calendar expects in the same format
$dataBaseDateFormatedString = DateTimeField::__convertToDBFormat($dateComponent, $user->get('date_format'));
$result[$fieldName]['value'] = $dataBaseDateFormatedString;
$result[$fieldName]['display_value'] = $fieldValue;
} else {
if ($fieldName == 'time_end') {
$dueDate = $recordModel->get('due_date');
$dateTimeFieldInstance = new DateTimeField($dueDate . ' ' . $fieldValue);
$userDateTimeString = $dateTimeFieldInstance->getDisplayDateTimeValue();
$dateTimeComponents = explode(' ', $userDateTimeString);
if ($user->get('hour_format') == '12') {
$dateTimeComponents[1] = Vtiger_Time_UIType::getTimeValueInAMorPM($dateTimeComponents[1]);
}
$result[$fieldName]['value'] = $fieldValue;
$result[$fieldName]['display_value'] = $dateTimeComponents[1];
} else {
if ($fieldName == 'time_start') {
$startDate = $recordModel->get('date_start');
$dateTimeFieldInstance = new DateTimeField($startDate . ' ' . $fieldValue);
$userDateTimeString = $dateTimeFieldInstance->getDisplayDateTimeValue();
$dateTimeComponents = explode(' ', $userDateTimeString);
if ($user->get('hour_format') == '12') {
$dateTimeComponents[1] = Vtiger_Time_UIType::getTimeValueInAMorPM($dateTimeComponents[1]);
}
$result[$fieldName]['value'] = $fieldValue;
$result[$fieldName]['display_value'] = $dateTimeComponents[1];
} else {
if ('time_start' != $fieldName && 'time_end' != $fieldName && 'duration_hours' != $fieldName) {
$result[$fieldName]['value'] = $fieldValue;
$result[$fieldName]['display_value'] = decode_html($fieldModel->getDisplayValue($fieldValue));
} else {
$result[$fieldName]['value'] = $result[$fieldName]['display_value'] = $fieldValue;
}
}
}
}
}
}
$result['_recordLabel'] = $recordModel->getName();
$result['_recordId'] = $recordModel->getId();
// Handled to save follow up event
$followupMode = $request->get('followup');
if ($followupMode == 'on') {
//Start Date and Time values
$startTime = Vtiger_Time_UIType::getTimeValueWithSeconds($request->get('followup_time_start'));
$startDateTime = Vtiger_Datetime_UIType::getDBDateTimeValue($request->get('followup_date_start') . " " . $startTime);
list($startDate, $startTime) = explode(' ', $startDateTime);
$subject = $request->get('subject');
if ($startTime != '' && $startDate != '') {
$recordModel->set('eventstatus', 'Planned');
$recordModel->set('subject', '[Followup] ' . $subject);
$recordModel->set('date_start', $startDate);
$recordModel->set('time_start', $startTime);
$currentUser = Users_Record_Model::getCurrentUserModel();
$activityType = $recordModel->get('activitytype');
if ($activityType == 'Call') {
$minutes = $currentUser->get('callduration');
} else {
$minutes = $currentUser->get('othereventduration');
}
$dueDateTime = date('Y-m-d H:i:s', strtotime("{$startDateTime}+{$minutes} minutes"));
list($endDate, $endTime) = explode(' ', $dueDateTime);
$recordModel->set('due_date', $endDate);
$recordModel->set('time_end', $endTime);
$recordModel->set('mode', 'create');
$recordModel->save();
}
}
$response = new Vtiger_Response();
//.........这里部分代码省略.........
示例13: getListViewRecords
//.........这里部分代码省略.........
}
}
} 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') {
$value = Vtiger_Datetime_UIType::getDateTimeValue($value);
} else {
if ($fieldDataType == 'date') {
$date = new DateTimeField($value);
$value = $date->getDisplayDate();
}
}
} elseif ($value == '0000-00-00') {
$value = '';
}
} elseif ($field->getFieldDataType() == 'time') {
if (!empty($value)) {
$value = Vtiger_Time_UIType::getTimeValueInAMorPM($value);
}
} elseif ($field->getFieldDataType() == 'currency') {
if ($value != '') {
if ($field->getUIType() == 72) {
if ($fieldName == 'unit_price') {
$currencyId = getProductBaseCurrency($recordId, $module);
$cursym_convrate = getCurrencySymbolandCRate($currencyId);
$currencySymbol = $cursym_convrate['symbol'];
} else {
$currencyInfo = getInventoryCurrencyInfo($module, $recordId);
$currencySymbol = $currencyInfo['currency_symbol'];
}
$value = CurrencyField::convertToUserFormat($value, null, true);
$row['currencySymbol'] = $currencySymbol;
// $value = CurrencyField::appendCurrencySymbol($currencyValue, $currencySymbol);
} else {
if (!empty($value)) {
$value = CurrencyField::convertToUserFormat($value);
}
}
}
} elseif ($field->getFieldDataType() == 'url') {
$matchPattern = "^[\\w]+:\\/\\/^";
preg_match($matchPattern, $rawValue, $matches);
if (!empty($matches[0])) {
$value = '<a class="urlField cursorPointer" href="' . $rawValue . '" target="_blank">' . textlength_check($value) . '</a>';
} else {
$value = '<a class="urlField cursorPointer" href="http://' . $rawValue . '" target="_blank">' . textlength_check($value) . '</a>';
}
} elseif ($field->getFieldDataType() == 'email') {
global $current_user;
if ($current_user->internal_mailer == 1) {