本文整理汇总了PHP中Vtiger_Time_UIType类的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Time_UIType类的具体用法?PHP Vtiger_Time_UIType怎么用?PHP Vtiger_Time_UIType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Vtiger_Time_UIType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRecordModelFromRequest
protected function getRecordModelFromRequest(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$recordId = $request->get('record');
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
if (!empty($recordId)) {
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
$modelData = $recordModel->getData();
$recordModel->set('id', $recordId);
$recordModel->set('mode', 'edit');
} else {
$recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
$modelData = $recordModel->getData();
$recordModel->set('mode', '');
}
$fieldModelList = $moduleModel->getFields();
foreach ($fieldModelList as $fieldName => $fieldModel) {
if (in_array($fieldName, array('header_content', 'content', 'footer_content'))) {
$fieldValue = $request->getRaw($fieldName, null);
} else {
$fieldValue = $request->get($fieldName, null);
}
$fieldDataType = $fieldModel->getFieldDataType();
if ($fieldDataType == 'time') {
$fieldValue = Vtiger_Time_UIType::getTimeValueWithSeconds($fieldValue);
}
if ($fieldValue !== null) {
if (!is_array($fieldValue)) {
$fieldValue = trim($fieldValue);
}
$recordModel->set($fieldName, $fieldValue);
}
}
return $recordModel;
}
示例2: getRecordModelsFromRequest
/**
* Function to get the record model based on the request parameters
* @param Vtiger_Request $request
* @return Vtiger_Record_Model or Module specific Record Model instance
*/
public function getRecordModelsFromRequest(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$recordIds = $this->getRecordsListFromRequest($request);
$recordModels = array();
$fieldModelList = $moduleModel->getFields();
foreach ($recordIds as $recordId) {
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleModel);
$recordModel->set('id', $recordId);
$recordModel->set('mode', 'edit');
foreach ($fieldModelList as $fieldName => $fieldModel) {
$fieldValue = $request->get($fieldName, null);
$fieldDataType = $fieldModel->getFieldDataType();
if ($fieldDataType == 'time') {
$fieldValue = Vtiger_Time_UIType::getTimeValueWithSeconds($fieldValue);
} else {
if ($fieldDataType === 'date') {
$fieldValue = $fieldModel->getUITypeModel()->getDBInsertValue($fieldValue);
}
}
if (isset($fieldValue) && $fieldValue != null && !is_array($fieldValue)) {
$fieldValue = trim($fieldValue);
$recordModel->set($fieldName, $fieldValue);
}
}
$recordModels[$recordId] = $recordModel;
}
return $recordModels;
}
示例3: createFollowupEvent
public function createFollowupEvent(Vtiger_Request $request)
{
$recordId = $request->get('record');
$recordModel = Vtiger_Record_Model::getInstanceById($recordId);
$subject = $recordModel->get('subject');
$followupSubject = "[Followup] " . $subject;
$recordModel->set('subject', $followupSubject);
//followup event is Planned
$recordModel->set('eventstatus', "Planned");
$activityType = $recordModel->get('activitytype');
if ($activityType == "Call") {
$eventDuration = $request->get('defaultCallDuration');
} else {
$eventDuration = $request->get('defaultOtherEventDuration');
}
$followupStartTime = Vtiger_Time_UIType::getTimeValueWithSeconds($request->get('followup_time_start'));
$followupStartDateTime = Vtiger_Datetime_UIType::getDBDateTimeValue($request->get('followup_date_start') . " " . $followupStartTime);
list($followupStartDate, $followupStartTime) = explode(' ', $followupStartDateTime);
//Duration of followup event based on activitytype
$durationMS = $eventDuration * 60;
$followupStartDateTimeMS = strtotime($followupStartDateTime);
$followupEndDateTimeMS = $followupStartDateTimeMS + $durationMS;
$followupEndDateTime = date("Y-m-d H:i:s", $followupEndDateTimeMS);
list($followupEndDate, $followupEndTime) = explode(' ', $followupEndDateTime);
$recordModel->set('date_start', $followupStartDate);
$recordModel->set('time_start', $followupStartTime);
$recordModel->set('due_date', $followupEndDate);
$recordModel->set('time_end', $followupEndTime);
$recordModel->save();
$response = new Vtiger_Response();
$result = array('created' => true);
$response->setResult($result);
$response->emit();
}
示例4: saveRecord
/**
* Function to save record
* @param <Vtiger_Request> $request - values of the record
* @return <RecordModel> - record Model of saved record
*/
public function saveRecord($request)
{
$adb = PearDatabase::getInstance();
$recordModel = $this->getRecordModelFromRequest($request);
$recordModel->save();
$originalRecordId = $recordModel->getId();
if ($request->get('relationOperation')) {
$parentModuleName = $request->get('sourceModule');
$parentModuleModel = Vtiger_Module_Model::getInstance($parentModuleName);
$parentRecordId = $request->get('sourceRecord');
$relatedModule = $recordModel->getModule();
if ($relatedModule->getName() == 'Events') {
$relatedModule = Vtiger_Module_Model::getInstance('Calendar');
}
$relatedRecordId = $recordModel->getId();
$relationModel = Vtiger_Relation_Model::getInstance($parentModuleModel, $relatedModule);
$relationModel->addRelation($parentRecordId, $relatedRecordId);
}
// Handled to save follow up event
$followupMode = $request->get('followup');
//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 ($followupMode == 'on' && $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($startDate, $startTime) = explode(' ', $dueDateTime);
$recordModel->set('due_date', $startDate);
$recordModel->set('time_end', $startTime);
$recordModel->set('recurringtype', '');
$recordModel->set('mode', 'create');
$recordModel->save();
$heldevent = true;
}
//TODO: remove the dependency on $_REQUEST
if ($_REQUEST['recurringtype'] != '' && $_REQUEST['recurringtype'] != '--None--') {
vimport('~modules/Calendar/RepeatEvents.php');
$focus = new Activity();
//get all the stored data to this object
$focus->column_fields = $recordModel->getData();
Calendar_RepeatEvents::repeatFromRequest($focus);
}
return $recordModel;
}
示例5: 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;
}
示例6: 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
示例7: getRecordModelsFromRequest
/**
* Function to get the record model based on the request parameters
* @param Vtiger_Request $request
* @return Vtiger_Record_Model or Module specific Record Model instance
*/
function getRecordModelsFromRequest(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$recordIds = $this->getRecordsListFromRequest($request);
if (empty($recordIds) && $request->get('selected_ids') == 'all') {
$db = PearDatabase::getInstance();
$sql = "SELECT `id` FROM `vtiger_users`";
$result = $db->query($sql, true);
$uNum = $db->num_rows($result);
if ($uNum > 0) {
$recordIds = array();
for ($i = 0; $i < $uNum; $i++) {
$recordIds[] = $db->query_result($result, $i, 'id');
}
}
}
$recordModels = array();
$fieldModelList = $moduleModel->getFields();
foreach ($recordIds as $recordId) {
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleModel);
$recordModel->set('id', $recordId);
$recordModel->set('mode', 'edit');
foreach ($fieldModelList as $fieldName => $fieldModel) {
$fieldValue = $request->get($fieldName, null);
$fieldDataType = $fieldModel->getFieldDataType();
if ($fieldDataType == 'time') {
$fieldValue = Vtiger_Time_UIType::getTimeValueWithSeconds($fieldValue);
}
if (isset($fieldValue) && $fieldValue != null) {
if (!is_array($fieldValue)) {
$fieldValue = trim($fieldValue);
}
$recordModel->set($fieldName, $fieldValue);
} else {
$uiType = $fieldModel->get('uitype');
if ($uiType == 70) {
$recordModel->set($fieldName, $recordModel->get($fieldName));
} else {
$uiTypeModel = $fieldModel->getUITypeModel();
$recordModel->set($fieldName, $uiTypeModel->getUserRequestValue($recordModel->get($fieldName)));
}
}
}
$recordModels[$recordId] = $recordModel;
}
return $recordModels;
}
示例8: 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);
}
示例9: 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;
}
示例10: getRecordModelsFromRequest
/**
* Function to get the record model based on the request parameters
* @param Vtiger_Request $request
* @return Vtiger_Record_Model or Module specific Record Model instance
*/
function getRecordModelsFromRequest(Vtiger_Request $request)
{
global $log;
$log->debug("Entering ./actions/MassSave.php::getRecordModelsFromRequest");
$moduleName = $request->getModule();
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$recordIds = $this->getRecordsListFromRequest($request);
$recordModels = array();
$fieldModelList = $moduleModel->getFields();
foreach ($recordIds as $recordId) {
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleModel);
$recordModel->set('id', $recordId);
$recordModel->set('mode', 'edit');
foreach ($fieldModelList as $fieldName => $fieldModel) {
$fieldValue = $request->get($fieldName, null);
$fieldDataType = $fieldModel->getFieldDataType();
if ($fieldDataType == 'time') {
$fieldValue = Vtiger_Time_UIType::getTimeValueWithSeconds($fieldValue);
}
if (isset($fieldValue) && $fieldValue != null) {
if (!is_array($fieldValue)) {
$fieldValue = trim($fieldValue);
}
$recordModel->set($fieldName, $fieldValue);
} else {
$uiType = $fieldModel->get('uitype');
if ($uiType == 70) {
$recordModel->set($fieldName, $recordModel->get($fieldName));
} else {
$uiTypeModel = $fieldModel->getUITypeModel();
$recordModel->set($fieldName, $uiTypeModel->getUserRequestValue($recordModel->get($fieldName)));
}
}
}
$recordModels[$recordId] = $recordModel;
}
return $recordModels;
}
示例11: getRecordModelFromRequest
/**
* Function to get the record model based on the request parameters
* @param Vtiger_Request $request
* @return Vtiger_Record_Model or Module specific Record Model instance
*/
public function getRecordModelFromRequest(Vtiger_Request $request)
{
$recordModel = parent::getRecordModelFromRequest($request);
$startDate = $request->get('date_start');
if (!empty($startDate)) {
//Start Date and Time values
$startTime = Vtiger_Time_UIType::getTimeValueWithSeconds($request->get('time_start'));
$startDate = Vtiger_Date_UIType::getDBInsertedValue($request->get('date_start'));
if ($startTime) {
$startDateTime = Vtiger_Datetime_UIType::getDBDateTimeValue($request->get('date_start') . " " . $startTime);
list($startDate, $startTime) = explode(' ', $startDateTime);
}
$recordModel->set('date_start', $startDate);
$recordModel->set('time_start', $startTime);
}
$endDate = $request->get('due_date');
if (!empty($endDate)) {
//End Date and Time values
$endTime = $request->get('time_end');
$endDate = Vtiger_Date_UIType::getDBInsertedValue($request->get('due_date'));
if ($endTime) {
$endTime = Vtiger_Time_UIType::getTimeValueWithSeconds($endTime);
$endDateTime = Vtiger_Datetime_UIType::getDBDateTimeValue($request->get('due_date') . " " . $endTime);
list($endDate, $endTime) = explode(' ', $endDateTime);
}
$recordModel->set('time_end', $endTime);
$recordModel->set('due_date', $endDate);
}
$record = $request->get('record');
if (!$record) {
$activityType = $request->get('activitytype');
$visibility = $request->get('visibility');
if (empty($activityType)) {
$recordModel->set('activitytype', 'Task');
$visibility = 'Private';
$recordModel->set('visibility', $visibility);
}
}
if (empty($visibility)) {
$assignedUserId = $recordModel->get('assigned_user_id');
$sharedType = Calendar_Module_Model::getSharedType($assignedUserId);
if ($sharedType == 'selectedusers') {
$sharedType = 'public';
}
$recordModel->set('visibility', ucfirst($sharedType));
}
return $recordModel;
}
示例12: save
function save()
{
//Time should changed to 24hrs format
$_REQUEST['time_start'] = Vtiger_Time_UIType::getTimeValueWithSeconds($_REQUEST['time_start']);
$_REQUEST['time_end'] = Vtiger_Time_UIType::getTimeValueWithSeconds($_REQUEST['time_end']);
parent::save();
}
示例13: process
public function process(Vtiger_Request $request)
{
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$record = $request->get('record');
if (!empty($record) && $request->get('isDuplicate') == true) {
$recordModel = $this->record ? $this->record : Vtiger_Record_Model::getInstanceById($record, $moduleName);
$viewer->assign('MODE', '');
$recordModel->set('id', '');
//While Duplicating record, If the related record is deleted then we are removing related record info in record model
$mandatoryFieldModels = $recordModel->getModule()->getMandatoryFieldModels();
foreach ($mandatoryFieldModels as $fieldModel) {
if ($fieldModel->isReferenceField()) {
$fieldName = $fieldModel->get('name');
if (Vtiger_Util_Helper::checkRecordExistance($recordModel->get($fieldName))) {
$recordModel->set($fieldName, '');
}
}
}
} else {
if (!empty($record)) {
$recordModel = $this->record ? $this->record : Vtiger_Record_Model::getInstanceById($record, $moduleName);
$viewer->assign('RECORD_ID', $record);
$viewer->assign('MODE', 'edit');
} else {
$recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
$referenceId = $request->get('reference_id');
if ($referenceId) {
$parentRecordModel = Vtiger_Record_Model::getInstanceById($referenceId);
$recordModel->setRecordFieldValues($parentRecordModel);
}
$viewer->assign('MODE', '');
}
}
if (!$this->record) {
$this->record = $recordModel;
}
$moduleModel = $recordModel->getModule();
$fieldList = $moduleModel->getFields();
$requestFieldList = array_intersect_key($request->getAll(), $fieldList);
foreach ($requestFieldList as $fieldName => $fieldValue) {
$fieldModel = $fieldList[$fieldName];
$specialField = false;
// We collate date and time part together in the EditView UI handling
// so a bit of special treatment is required if we come from QuickCreate
if ($moduleName == 'Calendar' && empty($record) && $fieldName == 'time_start' && !empty($fieldValue)) {
$specialField = true;
// Convert the incoming user-picked time to GMT time
// which will get re-translated based on user-time zone on EditForm
$fieldValue = DateTimeField::convertToDBTimeZone($fieldValue)->format("H:i");
}
if ($moduleName == 'Calendar' && empty($record) && $fieldName == 'date_start' && !empty($fieldValue)) {
$startTime = Vtiger_Time_UIType::getTimeValueWithSeconds($requestFieldList['time_start']);
$startDateTime = Vtiger_Datetime_UIType::getDBDateTimeValue($fieldValue . " " . $startTime);
list($startDate, $startTime) = explode(' ', $startDateTime);
$fieldValue = Vtiger_Date_UIType::getDisplayDateValue($startDate);
}
if ($fieldModel->isEditable() || $specialField) {
$recordModel->set($fieldName, $fieldModel->getDBInsertValue($fieldValue));
}
}
$recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($recordModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_EDIT);
$picklistDependencyDatasource = Vtiger_DependencyPicklist::getPicklistDependencyDatasource($moduleName);
$viewer->assign('PICKIST_DEPENDENCY_DATASOURCE', Zend_Json::encode($picklistDependencyDatasource));
$mappingRelatedField = $moduleModel->getMappingRelatedField($moduleName);
$viewer->assign('MAPPING_RELATED_FIELD', Zend_Json::encode($mappingRelatedField));
$viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);
$viewer->assign('RECORD_STRUCTURE', $recordStructureInstance->getStructure());
$viewer->assign('MODULE', $moduleName);
$viewer->assign('MODULE_TYPE', $moduleModel->getModuleType());
$viewer->assign('RECORD', $recordModel);
$viewer->assign('BLOCK_LIST', $moduleModel->getBlocks());
$viewer->assign('CURRENTDATE', date('Y-n-j'));
$viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
$viewer->assign('APIADDRESS', Settings_ApiAddress_Module_Model::getInstance('Settings:ApiAddress')->getConfig());
$viewer->assign('APIADDRESS_ACTIVE', Settings_ApiAddress_Module_Model::isActive());
$isRelationOperation = $request->get('relationOperation');
//if it is relation edit
$viewer->assign('IS_RELATION_OPERATION', $isRelationOperation);
if ($isRelationOperation) {
$viewer->assign('SOURCE_MODULE', $request->get('sourceModule'));
$viewer->assign('SOURCE_RECORD', $request->get('sourceRecord'));
}
$viewer->assign('MAX_UPLOAD_LIMIT_MB', Vtiger_Util_Helper::getMaxUploadSize());
$viewer->assign('MAX_UPLOAD_LIMIT', vglobal('upload_maxsize'));
$viewer->view('EditView.tpl', $moduleName);
}
示例14: 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);
//.........这里部分代码省略.........
示例15: transferListSearchParamsToFilterCondition
public static function transferListSearchParamsToFilterCondition($listSearchParams, $moduleModel) {
if(empty($listSearchParams)) {
$listSearchParams = array();
}
$advFilterConditionFormat = array();
$glueOrder = array('and','or');
$groupIterator = 0;
foreach($listSearchParams as $groupInfo){
if(empty($groupInfo)){
continue;
}
$groupConditionInfo = array();
$groupColumnsInfo = array();
$groupConditionGlue = $glueOrder[$groupIterator];
foreach($groupInfo as $fieldSearchInfo){
$advFilterFieldInfoFormat = array();
$fieldName = $fieldSearchInfo[0];
$operator = $fieldSearchInfo[1];
$fieldValue = $fieldSearchInfo[2];
$fieldInfo = $moduleModel->getField($fieldName);
//Request will be having in terms of AM and PM but the database will be having in 24 hr format so converting
//Database format
if($fieldInfo->getFieldDataType() == "time") {
$fieldValue = Vtiger_Time_UIType::getTimeValueWithSeconds($fieldValue);
}
if($fieldName == 'amount' && $fieldInfo->getFieldDataType() == 'currency'){
$fieldValue = CurrencyField::convertToDBFormat($fieldValue);
}
if($fieldName == 'date_start' || $fieldName == 'due_date' || $fieldInfo->getFieldDataType() == "datetime" ) {
$dateValues = explode(',', $fieldValue);
//Indicate whether it is fist date in the between condition
$isFirstDate = true;
foreach($dateValues as $key => $dateValue) {
$dateTimeCompoenents = explode(' ', $dateValue);
if(empty($dateTimeCompoenents[1])) {
if($isFirstDate)
$dateTimeCompoenents[1] = '00:00:00';
else
$dateTimeCompoenents[1] = '23:59:59';
}
$dateValue = implode(' ',$dateTimeCompoenents);
$dateValues[$key] = $dateValue;
$isFirstDate = false;
}
$fieldValue = implode(',',$dateValues);
}
$advFilterFieldInfoFormat['columnname'] = $fieldInfo->getCustomViewColumnName();
$advFilterFieldInfoFormat['comparator'] = $operator;
$advFilterFieldInfoFormat['value'] = $fieldValue;
$advFilterFieldInfoFormat['column_condition'] = $groupConditionGlue;
$groupColumnsInfo[] = $advFilterFieldInfoFormat;
}
$noOfConditions = count($groupColumnsInfo);
//to remove the last column condition
$groupColumnsInfo[$noOfConditions-1]['column_condition'] = '';
$groupConditionInfo['columns'] = $groupColumnsInfo;
$groupConditionInfo['condition'] = 'and';
$advFilterConditionFormat[] = $groupConditionInfo;
$groupIterator++;
}
//We aer removing last condition since this condition if there is next group and this is the last group
unset($advFilterConditionFormat[count($advFilterConditionFormat)-1]['condition']);
return $advFilterConditionFormat;
}