本文整理汇总了PHP中DateTimeField::getDisplayDateTimeValue方法的典型用法代码示例。如果您正苦于以下问题:PHP DateTimeField::getDisplayDateTimeValue方法的具体用法?PHP DateTimeField::getDisplayDateTimeValue怎么用?PHP DateTimeField::getDisplayDateTimeValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateTimeField
的用法示例。
在下文中一共展示了DateTimeField::getDisplayDateTimeValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRequestedToData
function getRequestedToData()
{
$mail_data = array();
$mail_data['user_id'] = $_REQUEST["task_assigned_user_id"];
$mail_data['subject'] = $_REQUEST['task_subject'];
$mail_data['status'] = $_REQUEST['activity_mode'] == 'Task' ? $_REQUEST['taskstatus'] : $_REQUEST['eventstatus'];
$mail_data['activity_mode'] = $_REQUEST['activity_mode'];
$mail_data['taskpriority'] = $_REQUEST['taskpriority'];
$mail_data['relatedto'] = $_REQUEST['task_parent_name'];
$mail_data['contact_name'] = $_REQUEST['task_contact_name'];
$mail_data['description'] = $_REQUEST['task_description'];
$mail_data['assign_type'] = $_REQUEST['task_assigntype'];
$mail_data['group_name'] = getGroupName($_REQUEST['task_assigned_group_id']);
$mail_data['mode'] = $_REQUEST['task_mode'];
$startTime = $_REQUEST['task_time_start'];
$date = new DateTimeField($_REQUEST['task_date_start'] . " " . $startTime);
$endTime = $_REQUEST['task_time_end'];
$endDate = new DateTimeField($_REQUEST['task_due_date'] . " " . $startTime);
$startTime = $date->getDisplayTime();
$endTime = $endDate->getDisplayTime();
$value = getaddEventPopupTime($startTime, $endTime, '24');
$start_hour = $value['starthour'] . ':' . $value['startmin'] . '' . $value['startfmt'];
$mail_data['st_date_time'] = $date->getDisplayDateTimeValue();
$mail_data['end_date_time'] = $endDate->getDisplayDate();
return $mail_data;
}
示例2: getEntity
public function getEntity()
{
$db = PearDatabase::getInstance();
$module = 'Calendar';
$currentUser = Users_Record_Model::getCurrentUserModel();
$query = getListQuery($module);
$params = array();
if ($this->get('start') && $this->get('end')) {
$dbStartDateOject = DateTimeField::convertToDBTimeZone($this->get('start'));
$dbStartDateTime = $dbStartDateOject->format('Y-m-d H:i:s');
$dbEndDateObject = DateTimeField::convertToDBTimeZone($this->get('end'));
$dbEndDateTime = $dbEndDateObject->format('Y-m-d H:i:s');
$query .= " AND (concat(date_start, ' ', time_start) >= ? AND concat(due_date, ' ', time_end) <= ?) ";
$params[] = $dbStartDateTime;
$params[] = $dbEndDateTime;
}
if ($this->get('types')) {
$query .= " AND vtiger_activity.activitytype IN ('" . implode("','", $this->get('types')) . "')";
}
if ($this->get('user')) {
if (is_array($this->get('user'))) {
$query .= ' AND vtiger_crmentity.smownerid IN (' . implode(",", $this->get('user')) . ')';
} else {
$query .= ' AND vtiger_crmentity.smownerid IN (' . $this->get('user') . ')';
}
}
$query .= ' ORDER BY date_start,time_start ASC';
$queryResult = $db->pquery($query, $params);
$result = array();
for ($i = 0; $i < $db->num_rows($queryResult); $i++) {
$record = $db->raw_query_result_rowdata($queryResult, $i);
$item = array();
$crmid = $record['activityid'];
$activitytype = $record['activitytype'];
$item['id'] = $crmid;
$item['title'] = $record['subject'];
$item['url'] = 'index.php?module=' . $module . '&view=Detail&record=' . $crmid;
$dateTimeFieldInstance = new DateTimeField($record['date_start'] . ' ' . $record['time_start']);
$userDateTimeString = $dateTimeFieldInstance->getDisplayDateTimeValue($currentUser);
$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->getDisplayDateTimeValue($currentUser);
$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;
$item['allDay'] = $record['allday'] == 1 ? true : false;
$item['className'] = ' userCol_' . $record['smownerid'] . ' calCol_' . $activitytype;
$result[] = $item;
}
return $result;
}
示例3: getEntity
public function getEntity()
{
$db = PearDatabase::getInstance();
$module = 'Reservations';
$currentUser = Users_Record_Model::getCurrentUserModel();
$query = getListQuery($module);
$params = array();
if ($this->get('start') && $this->get('end')) {
$query .= ' AND vtiger_reservations.date_start >= ? AND vtiger_reservations.due_date <= ?';
$params[] = $this->get('start');
$params[] = $this->get('end');
}
if ($this->get('types')) {
$query .= " AND vtiger_reservations.type IN ('" . implode("','", $this->get('types')) . "')";
}
if ($this->get('user')) {
if (is_array($this->get('user'))) {
$query .= ' AND vtiger_crmentity.smownerid IN (' . implode(",", $this->get('user')) . ')';
} else {
$query .= ' AND vtiger_crmentity.smownerid IN (' . $this->get('user') . ')';
}
}
$instance = CRMEntity::getInstance($module);
$securityParameter = $instance->getUserAccessConditionsQuerySR($module, $currentUser);
if ($securityParameter != '') {
$query .= ' AND ' . $securityParameter;
}
$query .= ' ORDER BY date_start,time_start ASC';
$queryResult = $db->pquery($query, $params);
$result = array();
for ($i = 0; $i < $db->num_rows($queryResult); $i++) {
$record = $db->raw_query_result_rowdata($queryResult, $i);
$item = array();
$crmid = $record['reservationsid'];
$item['id'] = $crmid;
$item['title'] = vtranslate($record['name'], $module);
$item['url'] = 'index.php?module=Reservations&view=Detail&record=' . $crmid;
$dateTimeFieldInstance = new DateTimeField($record['date_start'] . ' ' . $record['time_start']);
$userDateTimeString = $dateTimeFieldInstance->getDisplayDateTimeValue($currentUser);
$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, $currentUser->get('date_format'));
$item['start'] = $dataBaseDateFormatedString . ' ' . $dateTimeComponents[1];
$dateTimeFieldInstance = new DateTimeField($record['due_date'] . ' ' . $record['time_end']);
$userDateTimeString = $dateTimeFieldInstance->getDisplayDateTimeValue($currentUser);
$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, $currentUser->get('date_format'));
$item['end'] = $dataBaseDateFormatedString . ' ' . $dateTimeComponents[1];
$item['className'] = ' userCol_' . $record['smownerid'] . ' calCol_' . $record['type'];
$result[] = $item;
}
return $result;
}
示例4: 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;
}
示例5: 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'] = $fieldValue;
$result[$fieldName]['display_value'] = $dataBaseDateFormatedString;
} 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'] = $fieldValue;
$result[$fieldName]['display_value'] = $dataBaseDateFormatedString;
} else {
if ($fieldName == 'time_end') {
$dueDate = $recordModel->get('due_date');
$dateTimeFieldInstance = new DateTimeField($dueDate . ' ' . $fieldValue);
$userDateTimeString = $dateTimeFieldInstance->getDisplayDateTimeValue();
$dateTimeComponents = explode(' ', $userDateTimeString);
$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);
$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();
$response->setEmitType(Vtiger_Response::$EMIT_JSON);
$response->setResult($result);
$response->emit();
}
示例6: getPDFMakerFieldValue
public function getPDFMakerFieldValue($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 = $this->getFieldByPDFMakerLabel($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, $this->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 {
$fieldvalue = DateTimeField::convertToUserFormat($value);
}
} 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 {
$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 = $this->getTranslatedString($value, $module);
}
} else {
$fieldvalue = $this->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[] = $this->getTranslatedString($value, $module);
}
}
}
if (!is_array($picklistArray[1]) || !is_array($picklistArray[1][$dbField->name])) {
$fieldvalue = str_replace(' |##| ', ', ', $value);
} else {
implode(', ', $translatedValueList);
}
} elseif ($fieldType == 'double') {
if ($current_user->truncate_trailing_zeros == true) {
$fieldvalue = decimalFormat($fieldvalue);
}
}
if ($fieldvalue == "") {
return "-";
}
$fieldvalue = str_replace("<", "<", $fieldvalue);
//.........这里部分代码省略.........
示例7: vglobal
/** Function used to get the Status history of the Purchase Order
* @param $id - purchaseorder id
* @return $return_data - array with header and the entries in format Array('header'=>$header,'entries'=>$entries_list) where as $header and $entries_list are arrays which contains header values and all column values of all entries
*/
function get_postatushistory($id)
{
$log = vglobal('log');
$log->debug("Entering get_postatushistory(" . $id . ") method ...");
$adb = PearDatabase::getInstance();
global $mod_strings;
global $app_strings;
$query = 'select vtiger_postatushistory.*, vtiger_purchaseorder.purchaseorder_no from vtiger_postatushistory inner join vtiger_purchaseorder on vtiger_purchaseorder.purchaseorderid = vtiger_postatushistory.purchaseorderid inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_purchaseorder.purchaseorderid where vtiger_crmentity.deleted = 0 and vtiger_purchaseorder.purchaseorderid = ?';
$result = $adb->pquery($query, array($id));
$noofrows = $adb->num_rows($result);
$header[] = $app_strings['Order No'];
$header[] = $app_strings['Vendor Name'];
$header[] = $app_strings['LBL_AMOUNT'];
$header[] = $app_strings['LBL_PO_STATUS'];
$header[] = $app_strings['LBL_LAST_MODIFIED'];
//Getting the field permission for the current user. 1 - Not Accessible, 0 - Accessible
//Vendor, Total are mandatory fields. So no need to do security check to these fields.
$current_user = vglobal('current_user');
//If field is accessible then getFieldVisibilityPermission function will return 0 else return 1
$postatus_access = getFieldVisibilityPermission('PurchaseOrder', $current_user->id, 'postatus') != '0' ? 1 : 0;
$picklistarray = getAccessPickListValues('PurchaseOrder');
$postatus_array = $postatus_access != 1 ? $picklistarray['postatus'] : array();
//- ==> picklist field is not permitted in profile
//Not Accessible - picklist is permitted in profile but picklist value is not permitted
$error_msg = $postatus_access != 1 ? 'Not Accessible' : '-';
while ($row = $adb->fetch_array($result)) {
$entries = array();
//Module Sequence Numbering
//$entries[] = $row['purchaseorderid'];
$entries[] = $row['purchaseorder_no'];
// END
$entries[] = $row['vendorname'];
$entries[] = $row['total'];
$entries[] = in_array($row['postatus'], $postatus_array) ? $row['postatus'] : $error_msg;
$date = new DateTimeField($row['lastmodified']);
$entries[] = $date->getDisplayDateTimeValue();
$entries_list[] = $entries;
}
$return_data = array('header' => $header, 'entries' => $entries_list);
$log->debug("Exiting get_postatushistory method ...");
return $return_data;
}
示例8: getFullNameFromArray
$userName = getFullNameFromArray('Users', $current_user->column_fields);
$smarty_obj = new vtigerCRM_Smarty();
$header_array = getHeaderArray();
$smarty_obj->assign("HEADERS", $header_array);
$smarty_obj->assign("THEME", $theme);
$smarty_obj->assign("IMAGEPATH", $image_path);
$smarty_obj->assign("USER", $userName);
$qc_modules = getQuickCreateModules();
$smarty_obj->assign("QCMODULE", $qc_modules);
$smarty_obj->assign("APP", $app_strings);
$cnt = count($qc_modules);
$smarty_obj->assign("CNT", $cnt);
$smarty_obj->assign("PRINT_URL", "phprint.php?jt=" . session_id() . $GLOBALS['request_string']);
$smarty_obj->assign("MODULE_NAME", $currentModule);
$date = new DateTimeField(null);
$smarty_obj->assign("DATE", $date->getDisplayDateTimeValue());
$smarty_obj->assign("CURRENT_USER_MAIL", $current_user->email1);
$smarty_obj->assign("CURRENT_USER", $current_user->user_name);
$smarty_obj->assign("CURRENT_USER_ID", $current_user->id);
$smarty_obj->assign("MODULELISTS", $app_list_strings['moduleList']);
$smarty_obj->assign("CATEGORY", getParentTab());
$smarty_obj->assign("CALC", get_calc($image_path));
$smarty_obj->assign("MENUSTRUCTURE", getMenuStructure($currentModule));
$smarty_obj->assign("ANNOUNCEMENT", get_announcements());
$smarty_obj->assign("USE_ASTERISK", get_use_asterisk($current_user->id));
if (is_admin($current_user)) {
$smarty_obj->assign("ADMIN_LINK", "<a href='index.php?module=Settings&action=index'>" . $app_strings['LBL_SETTINGS'] . "</a>");
}
$module_path = "modules/" . $currentModule . "/";
require_once 'include/Menu.php';
//Assign the entered global search string to a variable and display it again
示例9: getAdvFilterByCvid
/** to get the Advanced filter for the given customview Id
* @param $cvid :: Type Integer
* @returns $advfilterlist Array
*/
function getAdvFilterByCvid($cvid)
{
global $adb, $log, $default_charset, $current_user, $currentModule, $mod_strings;
$advft_criteria = array();
$sql = 'SELECT * FROM vtiger_cvadvfilter_grouping WHERE cvid = ? ORDER BY groupid';
$groupsresult = $adb->pquery($sql, array($cvid));
$i = 1;
$j = 0;
while ($relcriteriagroup = $adb->fetch_array($groupsresult)) {
$groupId = $relcriteriagroup["groupid"];
$groupCondition = $relcriteriagroup["group_condition"];
$ssql = 'select vtiger_cvadvfilter.* from vtiger_customview
inner join vtiger_cvadvfilter on vtiger_cvadvfilter.cvid = vtiger_customview.cvid
left join vtiger_cvadvfilter_grouping on vtiger_cvadvfilter.cvid = vtiger_cvadvfilter_grouping.cvid
and vtiger_cvadvfilter.groupid = vtiger_cvadvfilter_grouping.groupid';
$ssql .= " where vtiger_customview.cvid = ? AND vtiger_cvadvfilter.groupid = ? order by vtiger_cvadvfilter.columnindex";
$result = $adb->pquery($ssql, array($cvid, $groupId));
$noOfColumns = $adb->num_rows($result);
if ($noOfColumns <= 0) {
continue;
}
while ($relcriteriarow = $adb->fetch_array($result)) {
$columnIndex = $relcriteriarow["columnindex"];
$criteria = array();
$criteria['columnname'] = html_entity_decode($relcriteriarow["columnname"], ENT_QUOTES, $default_charset);
$criteria['comparator'] = $relcriteriarow["comparator"];
$advfilterval = html_entity_decode($relcriteriarow["value"], ENT_QUOTES, $default_charset);
$col = explode(":", $relcriteriarow["columnname"]);
$uitype_value = getUItypeByFieldName($this->customviewmodule, $col[2]);
if ($uitype_value == '15' || $uitype_value == '16' || $uitype_value == '33') {
if (!isValueInPicklist($advfilterval, $col[2])) {
$advfilterval = getTranslationKeyFromTranslatedValue($this->customviewmodule, $advfilterval);
}
}
$temp_val = explode(",", $relcriteriarow["value"]);
if ($col[4] == 'D' || $col[4] == 'T' && $col[1] != 'time_start' && $col[1] != 'time_end' || $col[4] == 'DT') {
$val = array();
for ($x = 0; $x < count($temp_val); $x++) {
if ($col[4] == 'D') {
$date = new DateTimeField(trim($temp_val[$x]));
$val[$x] = $date->getDisplayDate();
} elseif ($col[4] == 'DT') {
$date = new DateTimeField(trim($temp_val[$x]));
$val[$x] = $date->getDisplayDateTimeValue();
} else {
$date = new DateTimeField(trim($temp_val[$x]));
$val[$x] = $date->getDisplayTime();
}
}
$advfilterval = implode(",", $val);
}
if (($col[1] == 'smownerid' || $col[1] == 'smcreatorid' || $col[1] == 'modifiedby') && $advfilterval == 'current_user' && $_REQUEST['action'] != 'CustomView' && empty($_REQUEST['record'])) {
$advfilterval = trim($current_user->first_name . ' ' . $current_user->last_name);
}
$criteria['value'] = $advfilterval;
$criteria['column_condition'] = $relcriteriarow["column_condition"];
$advft_criteria[$i]['columns'][$j] = $criteria;
$advft_criteria[$i]['condition'] = $groupCondition;
$j++;
}
if (!empty($advft_criteria[$i]['columns'][$j - 1]['column_condition'])) {
$advft_criteria[$i]['columns'][$j - 1]['column_condition'] = '';
}
$i++;
}
// Clear the condition (and/or) for last group, if any.
if (!empty($advft_criteria[$i - 1]['condition'])) {
$advft_criteria[$i - 1]['condition'] = '';
}
return $advft_criteria;
}
示例10: vttooltip_processResult
/**
* this function processes the given result and returns the value :: for now we are getting the values for the
* reference, owner fields, booleans and currency fields; other processing might be added later if required
* @param array $result - the webservices result object
* @param array $descObj - the webservices describe object
* @return array $result - the processes webservices result object
*/
function vttooltip_processResult($result, $descObj)
{
global $current_user;
foreach ($descObj['fields'] as $field) {
$name = $field['name'];
$value = $result[0][$name];
if ($field['type']['name'] == 'reference') {
$name = $field['name'];
if (!empty($value)) {
$result[0][$name] = vtws_getName($value, $current_user);
} else {
$result[0][$name] = '';
}
} elseif ($field['type']['name'] == 'owner') {
list($info, $id) = explode("x", $value);
$result[0][$name] = getOwnerName($id);
} elseif ($field['type']['name'] == 'boolean') {
if ($result[0][$name] == 1) {
$result[0][$name] = "on";
} else {
$result[0][$name] = "off";
}
} elseif ($field['type']['name'] == 'picklist') {
$temp = '';
foreach ($field['type']['picklistValues'] as $value) {
if (strcmp($value['value'], $result[0][$name]) == 0) {
$temp = $value['value'];
}
}
$result[0][$name] = $temp;
} elseif ($field['type']['name'] == 'date') {
$result[0][$name] = DateTimeField::convertToUserFormat($value);
} elseif ($field['type']['name'] == 'datetime') {
$date = new DateTimeField($value);
$result[0][$name] = $date->getDisplayDateTimeValue();
} elseif ($field['type']['name'] == 'time') {
$date = new DateTimeField($value);
$result[0][$name] = $date->getDisplayTime();
} elseif ($field['type']['name'] == 'currency') {
$currencyField = new CurrencyField($value);
$result[0][$name] = $currencyField->getDisplayValueWithSymbol();
}
}
return $result;
}
示例11: getFAQComments
/** Function to get the list of comments for the given FAQ id
* @param int $faqid - FAQ id
* @return list $list - return the list of comments and comment informations as a html output where as these comments and comments informations will be formed in div tag.
**/
function getFAQComments($faqid)
{
global $log, $default_charset;
$log->debug("Entering getFAQComments(" . $faqid . ") method ...");
global $mod_strings;
$sql = "select * from vtiger_faqcomments where faqid=?";
$result = $this->db->pquery($sql, array($faqid));
$noofrows = $this->db->num_rows($result);
//In ajax save we should not add this div
if ($_REQUEST['action'] != 'FaqAjax') {
$list .= '<div id="comments_div" style="overflow: auto;height:200px;width:100%;">';
$enddiv = '</div>';
}
for ($i = 0; $i < $noofrows; $i++) {
$comment = $this->db->query_result($result, $i, 'comments');
$date = new DateTimeField($this->db->query_result($result, $i, 'createdtime'));
$createdtime = $date->getDisplayDateTimeValue();
if ($comment != '') {
//this div is to display the comment
if ($_REQUEST['action'] == 'FaqAjax') {
$comment = htmlentities($comment, ENT_QUOTES, $default_charset);
}
$list .= '<div valign="top" style="width:99%;padding-top:10px;" class="dataField">' . make_clickable(nl2br($comment)) . '</div>';
//this div is to display the created time
$list .= '<div valign="top" style="width:99%;border-bottom:1px dotted #CCCCCC;padding-bottom:5px;" class="dataLabel"><font color=darkred>' . $mod_strings['Created Time'];
$list .= ' : ' . $createdtime . '</font></div>';
}
}
$list .= $enddiv;
$log->debug("Exiting getFAQComments method ...");
return $list;
}
示例12: getModifiedOn
function getModifiedOn() {
$changedOn = new DateTimeField($this->changedon);
return $changedOn->getDisplayDateTimeValue();
}
示例13: getHistory
/** Function to get related list entries in detailed array format
* @param $parentmodule -- parentmodulename:: Type string
* @param $query -- query:: Type string
* @param $id -- id:: Type string
* @returns $return_data -- return data:: Type string array
*/
function getHistory($parentmodule, $query, $id)
{
global $log;
$log->debug("Entering getHistory(" . $parentmodule . "," . $query . "," . $id . ") method ...");
$parentaction = vtlib_purify($_REQUEST['action']);
global $theme;
$theme_path = "themes/" . $theme . "/";
$image_path = $theme_path . "images/";
global $adb;
global $mod_strings;
global $app_strings;
//Appending the security parameter
global $current_user;
$rel_tab_id = getTabid("Calendar");
global $current_user;
require 'user_privileges/user_privileges_' . $current_user->id . '.php';
require 'user_privileges/sharing_privileges_' . $current_user->id . '.php';
$tab_id = getTabid('Calendar');
if ($is_admin == false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[$tab_id] == 3) {
$sec_parameter = getListViewSecurityParameter('Calendar');
$query .= ' ' . $sec_parameter;
}
$query .= ' ' . "ORDER BY vtiger_activity.date_start DESC,vtiger_activity.time_start DESC";
$result = $adb->query($query);
$noofrows = $adb->num_rows($result);
if ($noofrows == 0) {
//There is no entries for history
} else {
//Form the header columns
$header[] = $app_strings['LBL_TYPE'];
$header[] = $app_strings['LBL_SUBJECT'];
$header[] = $app_strings['LBL_RELATED_TO'];
$header[] = $app_strings['LBL_START_DATE'] . " & " . $app_strings['LBL_TIME'];
$header[] = $app_strings['LBL_END_DATE'] . " & " . $app_strings['LBL_TIME'];
//$header[] = $app_strings['LBL_DESCRIPTION'];
$header[] = $app_strings['LBL_STATUS'];
$header[] = $app_strings['LBL_ASSIGNED_TO'];
$i = 1;
while ($row = $adb->fetch_array($result)) {
$entries = array();
if ($row['activitytype'] == 'Task') {
$activitymode = 'Task';
$icon = 'Tasks.gif';
$status = $row['status'];
$status = $app_strings[$status];
} else {
$activitymode = 'Events';
$icon = 'Activities.gif';
$status = $row['eventstatus'];
$status = $app_strings[$status];
}
$typeofactivity = $row['activitytype'];
$typeofactivity = getTranslatedString($typeofactivity, 'Calendar');
$entries[] = $typeofactivity;
$activity = '<a href="index.php?module=Calendar4You&action=EventDetailView&return_module=' . $parentmodule . '&return_action=DetailView&record=' . $row["activityid"] . '&activity_mode=' . $activitymode . '&return_id=' . vtlib_purify($_REQUEST['record']) . '&parenttab=' . vtlib_purify($_REQUEST['parenttab']) . '">' . $row['subject'] . '</a></td>';
$entries[] = $activity;
$parentname = getRelatedTo('Calendar', $result, $i - 1);
$entries[] = $parentname;
$date = new DateTimeField($row['date_start'] . ' ' . $row['time_start']);
$entries[] = $date->getDisplayDateTimeValue();
$date = new DateTimeField($row['due_date'] . ' ' . $row['time_end']);
$entries[] = $date->getDisplayDate();
$entries[] = $status;
if ($row['user_name'] == null && $row['groupname'] != null) {
$entries[] = $row['groupname'];
} else {
$entries[] = $row['user_name'];
}
$i++;
$entries_list[] = $entries;
}
$return_data = array('header' => $header, 'entries' => $entries_list);
$log->debug("Exiting getHistory method ...");
return $return_data;
}
}
示例14: getAdvancedCriteria
/**
* Function to get the list of advanced filter conditions for the current custom view
* @return <Array> - All the advanced filter conditions for the custom view, grouped by the condition grouping
*/
public function getAdvancedCriteria()
{
$db = PearDatabase::getInstance();
$default_charset = vglobal('default_charset');
$cvId = $this->getId();
$advft_criteria = array();
if (empty($cvId)) {
return $advft_criteria;
}
$sql = 'SELECT * FROM vtiger_cvadvfilter_grouping WHERE cvid = ? ORDER BY groupid';
$groupsresult = $db->pquery($sql, array($this->getId()));
$i = 1;
$j = 0;
while ($relcriteriagroup = $db->fetch_array($groupsresult)) {
$groupId = $relcriteriagroup["groupid"];
$groupCondition = $relcriteriagroup["group_condition"];
$ssql = 'select vtiger_cvadvfilter.* from vtiger_customview
inner join vtiger_cvadvfilter on vtiger_cvadvfilter.cvid = vtiger_customview.cvid
left join vtiger_cvadvfilter_grouping on vtiger_cvadvfilter.cvid = vtiger_cvadvfilter_grouping.cvid
and vtiger_cvadvfilter.groupid = vtiger_cvadvfilter_grouping.groupid';
$ssql .= " where vtiger_customview.cvid = ? AND vtiger_cvadvfilter.groupid = ? order by vtiger_cvadvfilter.columnindex";
$result = $db->pquery($ssql, array($this->getId(), $groupId));
$noOfColumns = $db->num_rows($result);
if ($noOfColumns <= 0) {
continue;
}
while ($relcriteriarow = $db->fetch_array($result)) {
$criteria = array();
$criteria['columnname'] = html_entity_decode($relcriteriarow["columnname"], ENT_QUOTES, $default_charset);
$criteria['comparator'] = $relcriteriarow["comparator"];
$advfilterval = html_entity_decode($relcriteriarow["value"], ENT_QUOTES, $default_charset);
$col = explode(":", $relcriteriarow["columnname"]);
$temp_val = explode(",", $relcriteriarow["value"]);
if ($col[4] == 'D' || $col[4] == 'T' && $col[1] != 'time_start' && $col[1] != 'time_end' || $col[4] == 'DT') {
$val = array();
for ($x = 0; $x < count($temp_val); $x++) {
if ($col[4] == 'D') {
/** while inserting in db for due_date it was taking date and time values also as it is
* date time field. We only need to take date from that value
*/
if ($col[0] == 'vtiger_activity' && $col[1] == 'due_date') {
$originalValue = $temp_val[$x];
$dateTime = explode(' ', $originalValue);
$temp_val[$x] = $dateTime[0];
}
$date = new DateTimeField(trim($temp_val[$x]));
$val[$x] = $date->getDisplayDate();
} elseif ($col[4] == 'DT') {
$comparator = array('e', 'n', 'b', 'a');
if (in_array($criteria['comparator'], $comparator)) {
$originalValue = $temp_val[$x];
$dateTime = explode(' ', $originalValue);
$temp_val[$x] = $dateTime[0];
}
$date = new DateTimeField(trim($temp_val[$x]));
$val[$x] = $date->getDisplayDateTimeValue();
} else {
$date = new DateTimeField(trim($temp_val[$x]));
$val[$x] = $date->getDisplayTime();
}
}
$advfilterval = implode(",", $val);
}
$criteria['value'] = Vtiger_Util_Helper::toSafeHTML(decode_html($advfilterval));
$criteria['column_condition'] = $relcriteriarow["column_condition"];
$groupId = $relcriteriarow['groupid'];
$advft_criteria[$groupId]['columns'][$j] = $criteria;
$advft_criteria[$groupId]['condition'] = $groupCondition;
$j++;
}
if (!empty($advft_criteria[$groupId]['columns'][$j - 1]['column_condition'])) {
$advft_criteria[$groupId]['columns'][$j - 1]['column_condition'] = '';
}
$i++;
}
// Clear the condition (and/or) for last group, if any.
if (!empty($advft_criteria[$i - 1]['condition'])) {
$advft_criteria[$i - 1]['condition'] = '';
}
return $advft_criteria;
}
示例15: getAdvftCriteria
function getAdvftCriteria($relcriteriarow)
{
$columnIndex = $relcriteriarow['columnindex'];
$criteria = array();
$criteria['columnname'] = html_entity_decode($relcriteriarow["columnname"], ENT_QUOTES, $default_charset);
$criteria['comparator'] = $relcriteriarow["comparator"];
$advfilterval = html_entity_decode($relcriteriarow["value"], ENT_QUOTES, $default_charset);
$col = explode(":", $relcriteriarow["columnname"]);
$temp_val = explode(",", $relcriteriarow["value"]);
if ($col[4] == 'D' || $col[4] == 'T' && $col[1] != 'time_start' && $col[1] != 'time_end' || $col[4] == 'DT') {
$val = array();
for ($x = 0; $x < count($temp_val); $x++) {
if ($col[4] == 'D') {
/** while inserting in db for due_date it was taking date and time values also as it is
* date time field. We only need to take date from that value
*/
if ($col[0] == "vtiger_activity" && $col[1] == "due_date") {
$values = explode(' ', $temp_val[$x]);
$temp_val[$x] = $values[0];
}
$date = new DateTimeField(trim($temp_val[$x]));
$val[$x] = $date->getDisplayDate();
} elseif ($col[4] == 'DT') {
$comparator = array('e', 'n', 'b', 'a');
if (in_array($criteria['comparator'], $comparator)) {
$originalValue = $temp_val[$x];
$dateTime = explode(' ', $originalValue);
$temp_val[$x] = $dateTime[0];
}
$date = new DateTimeField(trim($temp_val[$x]));
$val[$x] = $date->getDisplayDateTimeValue();
} else {
$date = new DateTimeField(trim($temp_val[$x]));
$val[$x] = $date->getDisplayTime();
}
}
$advfilterval = implode(",", $val);
}
$criteria['value'] = $advfilterval;
$criteria['column_condition'] = $relcriteriarow["column_condition"];
return $criteria;
}