本文整理汇总了PHP中DateTimeField::getDisplayDate方法的典型用法代码示例。如果您正苦于以下问题:PHP DateTimeField::getDisplayDate方法的具体用法?PHP DateTimeField::getDisplayDate怎么用?PHP DateTimeField::getDisplayDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateTimeField
的用法示例。
在下文中一共展示了DateTimeField::getDisplayDate方法的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: getListViewEntries
//.........这里部分代码省略.........
$value = ' --';
}
} elseif ($module == 'Documents' && $fieldName == 'filestatus') {
if ($value == 1) {
$value = getTranslatedString('yes', $module);
} elseif ($value == 0) {
$value = getTranslatedString('no', $module);
} else {
$value = '--';
}
} elseif ($module == 'Documents' && $fieldName == 'filetype') {
$downloadType = $db->query_result($result, $i, 'filelocationtype');
if ($downloadType == 'E' || $downloadType != 'I') {
$value = '--';
}
} elseif ($field->getUIType() == '27') {
if ($value == 'I') {
$value = getTranslatedString('LBL_INTERNAL', $module);
} elseif ($value == 'E') {
$value = getTranslatedString('LBL_EXTERNAL', $module);
} else {
$value = ' --';
}
} elseif ($field->getFieldDataType() == 'picklist') {
if ($value != '' && !$is_admin && $this->picklistRoleMap[$fieldName] && !in_array($value, $this->picklistValueMap[$fieldName])) {
$value = "<font color='red'>" . getTranslatedString('LBL_NOT_ACCESSIBLE', $module) . "</font>";
} else {
$value = getTranslatedString($value, $module);
$value = textlength_check($value);
}
} elseif ($field->getFieldDataType() == 'date' || $field->getFieldDataType() == 'datetime') {
if ($value != '' && $value != '0000-00-00') {
$date = new DateTimeField($value);
$value = $date->getDisplayDate();
if ($field->getFieldDataType() == 'datetime') {
$value .= ' ' . $date->getDisplayTime();
}
} elseif ($value == '0000-00-00') {
$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 = number_format($value, 2, '.', '');
$currencyValue = CurrencyField::convertToUserFormat($value, null, true);
$value = CurrencyField::appendCurrencySymbol($currencyValue, $currencySymbol);
} else {
//changes made to remove vtiger_currency symbol infront of each
//vtiger_potential amount
if ($value != 0) {
$value = CurrencyField::convertToUserFormat($value);
}
}
}
} elseif ($field->getFieldDataType() == 'url') {
$matchPattern = "^[\\w]+:\\/\\/^";
preg_match($matchPattern, $rawValue, $matches);
if (!empty($matches[0])) {
示例3: getDisplayValue
/**
* Function to retieve display value for a field
* @param <String> $fieldName - field name for which values need to get
* @return <String>
*/
public function getDisplayValue($fieldName, $recordId = false)
{
if (empty($recordId)) {
$recordId = $this->getId();
}
$fieldModel = $this->getModule()->getField($fieldName);
// For showing the "Date Sent" and "Time Sent" in email related list in user time zone
if ($fieldName == "time_start" && $this->getModule()->getName() == "Emails") {
$date = new DateTime();
$dateTime = new DateTimeField($date->format('Y-m-d') . ' ' . $this->get($fieldName));
$value = $dateTime->getDisplayTime();
$this->set($fieldName, $value);
return $value;
} else {
if ($fieldName == "date_start" && $this->getModule()->getName() == "Emails") {
$dateTime = new DateTimeField($this->get($fieldName) . ' ' . $this->get('time_start'));
$value = $dateTime->getDisplayDate();
$this->set($fieldName, $value);
return $value;
}
}
// End
if ($fieldModel) {
return $fieldModel->getDisplayValue($this->get($fieldName), $recordId, $this);
}
return false;
}
示例4: vglobal
/** Function used to get the Sales Stage history of the Potential
* @param $id - potentialid
* return $return_data - array with header and the entries in format Array('header'=>$header,'entries'=>$entries_list) where as $header and $entries_list are array which contains all the column values of an row
*/
function get_stage_history($id)
{
$log = vglobal('log');
$log->debug("Entering get_stage_history(" . $id . ") method ...");
$adb = PearDatabase::getInstance();
global $mod_strings;
global $app_strings;
$query = 'select vtiger_potstagehistory.*, vtiger_potential.potentialname from vtiger_potstagehistory inner join vtiger_potential on vtiger_potential.potentialid = vtiger_potstagehistory.potentialid inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_potential.potentialid where vtiger_crmentity.deleted = 0 and vtiger_potential.potentialid = ?';
$result = $adb->pquery($query, array($id));
$noofrows = $adb->num_rows($result);
$header[] = $app_strings['LBL_AMOUNT'];
$header[] = $app_strings['LBL_SALES_STAGE'];
$header[] = $app_strings['LBL_PROBABILITY'];
$header[] = $app_strings['LBL_CLOSE_DATE'];
$header[] = $app_strings['LBL_LAST_MODIFIED'];
//Getting the field permission for the current user. 1 - Not Accessible, 0 - Accessible
//Sales Stage, Expected Close Dates 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
$amount_access = getFieldVisibilityPermission('Potentials', $current_user->id, 'sum_invoices') != '0' ? 1 : 0;
$probability_access = getFieldVisibilityPermission('Potentials', $current_user->id, 'probability') != '0' ? 1 : 0;
$picklistarray = getAccessPickListValues('Potentials');
$potential_stage_array = $picklistarray['sales_stage'];
//- ==> picklist field is not permitted in profile
//Not Accessible - picklist is permitted in profile but picklist value is not permitted
$error_msg = 'Not Accessible';
while ($row = $adb->fetch_array($result)) {
$entries = array();
$entries[] = $amount_access != 1 ? $row['sum_invoices'] : 0;
$entries[] = in_array($row['stage'], $potential_stage_array) ? $row['stage'] : $error_msg;
$entries[] = $probability_access != 1 ? $row['probability'] : 0;
$entries[] = DateTimeField::convertToUserFormat($row['closedate']);
$date = new DateTimeField($row['lastmodified']);
$entries[] = $date->getDisplayDate();
$entries_list[] = $entries;
}
$return_data = array('header' => $header, 'entries' => $entries_list);
$log->debug("Exiting get_stage_history method ...");
return $return_data;
}
示例5: getListViewRecords
//.........这里部分代码省略.........
$value = getTranslatedString('LBL_INTERNAL', $module);
} elseif ($value == 'E') {
$value = getTranslatedString('LBL_EXTERNAL', $module);
} else {
$value = ' --';
}
$value = Vtiger_Functions::textLength($value);
} elseif ($field->getFieldDataType() == 'picklist') {
$value = Vtiger_Language_Handler::getTranslatedString($value, $module);
$value = textlength_check($value);
} elseif ($field->getFieldDataType() == 'date' || $field->getFieldDataType() == 'datetime') {
if ($value != '' && $value != '0000-00-00') {
$fieldDataType = $field->getFieldDataType();
if ($module == 'Calendar' && ($fieldName == 'date_start' || $fieldName == 'due_date')) {
if ($fieldName == 'date_start') {
$timeField = 'time_start';
} else {
if ($fieldName == 'due_date') {
$timeField = 'time_end';
}
}
$timeFieldValue = $this->db->query_result($result, $i, $timeField);
if (!empty($timeFieldValue)) {
$value .= ' ' . $timeFieldValue;
//TO make sure it takes time value as well
$fieldDataType = 'datetime';
}
}
if ($fieldDataType == 'datetime') {
$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);
示例6: getStandardCriterialSql
/** Function to get standardfilter for the given reportid
* @ param $reportid : Type Integer
* returns the query of columnlist for the selected columns
*/
function getStandardCriterialSql($reportid)
{
$adb = PearDatabase::getInstance();
global $modules;
$log = vglobal('log');
$sreportstdfiltersql = "select vtiger_reportdatefilter.* from vtiger_report";
$sreportstdfiltersql .= " inner join vtiger_reportdatefilter on vtiger_report.reportid = vtiger_reportdatefilter.datefilterid";
$sreportstdfiltersql .= " where vtiger_report.reportid = ?";
$result = $adb->pquery($sreportstdfiltersql, array($reportid));
$noofrows = $adb->num_rows($result);
for ($i = 0; $i < $noofrows; $i++) {
$fieldcolname = $adb->query_result($result, $i, "datecolumnname");
$datefilter = $adb->query_result($result, $i, "datefilter");
$startdate = $adb->query_result($result, $i, "startdate");
$enddate = $adb->query_result($result, $i, "enddate");
if ($fieldcolname != "none") {
$selectedfields = explode(":", $fieldcolname);
if ($selectedfields[0] == "vtiger_crmentity" . $this->primarymodule) {
$selectedfields[0] = "vtiger_crmentity";
}
if ($datefilter == "custom") {
if ($startdate != "0000-00-00" && $enddate != "0000-00-00" && $selectedfields[0] != "" && $selectedfields[1] != "" && $startdate != '' && $enddate != '') {
$startDateTime = new DateTimeField($startdate . ' ' . date('H:i:s'));
$startdate = $startDateTime->getDisplayDate();
$endDateTime = new DateTimeField($enddate . ' ' . date('H:i:s'));
$enddate = $endDateTime->getDisplayDate();
$sSQL .= $selectedfields[0] . "." . $selectedfields[1] . " between '" . $startdate . "' and '" . $enddate . "'";
}
} else {
$startenddate = $this->getStandarFiltersStartAndEndDate($datefilter);
$startDateTime = new DateTimeField($startenddate[0] . ' ' . date('H:i:s'));
$startdate = $startDateTime->getDisplayDate();
$endDateTime = new DateTimeField($startenddate[1] . ' ' . date('H:i:s'));
$enddate = $endDateTime->getDisplayDate();
if ($startenddate[0] != "" && $startenddate[1] != "" && $selectedfields[0] != "" && $selectedfields[1] != "") {
$sSQL .= $selectedfields[0] . "." . $selectedfields[1] . " between '" . $startdate . "' and '" . $enddate . "'";
}
}
}
}
$log->info("ReportRun :: Successfully returned getStandardCriterialSql" . $reportid);
return $sSQL;
}
示例7: getCVStdFilterSQL
/** to get the customview stdFilter Query for the given customview Id
* @param $cvid :: Type Integer
* @returns $stdfiltersql as a string
* This function will return the standard filter criteria for the given customfield
*
*/
function getCVStdFilterSQL($cvid)
{
global $adb;
$stdfiltersql = '';
$stdfilterlist = array();
$sSQL = "select vtiger_cvstdfilter.* from vtiger_cvstdfilter inner join vtiger_customview on vtiger_customview.cvid = vtiger_cvstdfilter.cvid";
$sSQL .= " where vtiger_cvstdfilter.cvid=?";
$result = $adb->pquery($sSQL, array($cvid));
$stdfilterrow = $adb->fetch_array($result);
$stdfilterlist = array();
$stdfilterlist["columnname"] = $stdfilterrow["columnname"];
$stdfilterlist["stdfilter"] = $stdfilterrow["stdfilter"];
if ($stdfilterrow["stdfilter"] == "custom" || $stdfilterrow["stdfilter"] == "") {
if ($stdfilterrow["startdate"] != "0000-00-00" && $stdfilterrow["startdate"] != "") {
$stdfilterlist["startdate"] = $stdfilterrow["startdate"];
}
if ($stdfilterrow["enddate"] != "0000-00-00" && $stdfilterrow["enddate"] != "") {
$stdfilterlist["enddate"] = $stdfilterrow["enddate"];
}
} else {
//if it is not custom get the date according to the selected duration
$datefilter = $this->getDateforStdFilterBytype($stdfilterrow["stdfilter"]);
$stdfilterlist["startdate"] = $datefilter[0];
$stdfilterlist["enddate"] = $datefilter[1];
}
if (isset($stdfilterlist)) {
foreach ($stdfilterlist as $columnname => $value) {
if ($columnname == "columnname") {
$filtercolumn = $value;
} elseif ($columnname == "stdfilter") {
$filtertype = $value;
} elseif ($columnname == "startdate") {
$startDateTime = new DateTimeField($value . ' ' . date('H:i:s'));
$userStartDate = $startDateTime->getDisplayDate();
$userStartDateTime = new DateTimeField($userStartDate . ' 00:00:00');
$startDateTime = $userStartDateTime->getDBInsertDateTimeValue();
} elseif ($columnname == "enddate") {
$endDateTime = new DateTimeField($value . ' ' . date('H:i:s'));
$userEndDate = $endDateTime->getDisplayDate();
$userEndDateTime = new DateTimeField($userEndDate . ' 23:59:00');
$endDateTime = $userEndDateTime->getDBInsertDateTimeValue();
}
if ($startDateTime != "" && $endDateTime != "") {
$columns = explode(":", $filtercolumn);
// Fix for http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/5423
if ($columns[1] == 'birthday') {
$tableColumnSql = "DATE_FORMAT(" . $columns[0] . "." . $columns[1] . ", '%m%d')";
$startDateTime = "DATE_FORMAT('{$startDate}', '%m%d')";
$endDateTime = "DATE_FORMAT('{$endDate}', '%m%d')";
$stdfiltersql = $tableColumnSql . " BETWEEN " . $startDateTime . " and " . $endDateTime;
} else {
if ($this->customviewmodule == 'Calendar' && ($columns[1] == 'date_start' || $columns[1] == 'due_date')) {
$tableColumnSql = '';
if ($columns[1] == 'date_start') {
$tableColumnSql = "CAST((CONCAT(date_start,' ',time_start)) AS DATETIME)";
} else {
$tableColumnSql = "CAST((CONCAT(due_date,' ',time_end)) AS DATETIME)";
}
} else {
$tableColumnSql = $columns[0] . "." . $columns[1];
}
$stdfiltersql = $tableColumnSql . " BETWEEN '" . $startDateTime . "' and '" . $endDateTime . "'";
}
}
}
}
return $stdfiltersql;
}
示例8: 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);
//.........这里部分代码省略.........
示例9: 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;
}
}
示例10: addOutgoingcallHistory
function addOutgoingcallHistory($current_user, $extension, $record, $adb)
{
global $log;
require_once 'modules/Calendar/Activity.php';
$date = new DateTimeField(null);
$currentDate = $date->getDisplayDate();
$currentTime = $date->getDisplayTime();
$focus = new Activity();
$focus->column_fields['subject'] = "Outgoing call from {$current_user->user_name} ({$extension})";
$focus->column_fields['activitytype'] = "Call";
$focus->column_fields['date_start'] = $currentDate;
$focus->column_fields['due_date'] = $currentDate;
$focus->column_fields['time_start'] = $currentTime;
$focus->column_fields['time_end'] = $currentTime;
$focus->column_fields['eventstatus'] = "Held";
$focus->column_fields['assigned_user_id'] = $current_user->id;
$focus->save('Calendar');
$focus->setActivityReminder('off');
$setype = $adb->pquery("SELECT setype FROM vtiger_crmentity WHERE crmid = ?", array($record));
$rows = $adb->num_rows($setype);
if ($rows > 0) {
$module = $adb->query_result($setype, 0, 'setype');
$tablename = array('Contacts' => 'vtiger_cntactivityrel', 'Accounts' => 'vtiger_seactivityrel', 'Leads' => 'vtiger_seactivityrel');
$sql = "insert into " . $tablename[$module] . " values (?,?)";
$params = array($record, $focus->id);
$adb->pquery($sql, $params);
$status = "success";
} else {
$status = "failure";
}
return $status;
}
示例11: getCalendarState
public static function getCalendarState($data = [])
{
if ($data) {
$activityStatus = $data['activitystatus'];
if (in_array($activityStatus, Calendar_Module_Model::getComponentActivityStateLabel('history'))) {
return false;
}
$dueDateTime = $data['due_date'] . ' ' . $data['time_end'];
$startDateTime = $data['date_start'] . ' ' . $data['time_start'];
$dates = ['start' => $startDateTime, 'end' => $dueDateTime, 'current' => null];
foreach ($dates as $key => $date) {
$date = new DateTimeField($date);
$userFormatedString = $date->getDisplayDate();
$timeFormatedString = $date->getDisplayTime();
$dBFomatedDate = DateTimeField::convertToDBFormat($userFormatedString);
$dates[$key] = strtotime($dBFomatedDate . " " . $timeFormatedString);
}
$activityStatusLabels = Calendar_Module_Model::getComponentActivityStateLabel();
$state = $activityStatusLabels['not_started'];
if ($dates['end'] > $dates['current'] && $dates['start'] < $dates['current']) {
$state = $activityStatusLabels['in_realization'];
} elseif ($dates['end'] > $dates['current']) {
$state = $activityStatusLabels['not_started'];
} elseif ($dates['end'] < $dates['current']) {
$state = $activityStatusLabels['overdue'];
}
return $state;
}
return false;
}
示例12: sanitizeDateFieldsForInsert
function sanitizeDateFieldsForInsert($row, $meta)
{
global $current_user;
$moduleFields = $meta->getModuleFields();
foreach ($moduleFields as $fieldName => $fieldObj) {
if ($fieldObj->getFieldDataType() == "date") {
if (!empty($row[$fieldName])) {
$dateFieldObj = new DateTimeField($row[$fieldName]);
$row[$fieldName] = $dateFieldObj->getDisplayDate($current_user);
}
}
}
return $row;
}
示例13: getValue
function getValue($field_result, $list_result, $fieldname, $focus, $module, $entity_id, $list_result_count, $mode, $popuptype, $returnset = '', $viewid = '')
{
global $log, $listview_max_textlength, $app_strings, $current_language, $currentModule;
$log->debug("Entering getValue(" . $field_result . "," . $list_result . "," . $fieldname . "," . get_class($focus) . "," . $module . "," . $entity_id . "," . $list_result_count . "," . $mode . "," . $popuptype . "," . $returnset . "," . $viewid . ") method ...");
global $adb, $current_user, $default_charset;
require 'user_privileges/user_privileges_' . $current_user->id . '.php';
$tabname = getParentTab();
$tabid = getTabid($module);
$current_module_strings = return_module_language($current_language, $module);
$uicolarr = $field_result[$fieldname];
foreach ($uicolarr as $key => $value) {
$uitype = $key;
$colname = $value;
}
//added for getting event status in Custom view - Jaguar
if ($module == 'Calendar' && ($colname == "status" || $colname == "eventstatus")) {
$colname = "activitystatus";
}
//Ends
$field_val = $adb->query_result($list_result, $list_result_count, $colname);
if ($uitype != 8) {
$temp_val = html_entity_decode($field_val, ENT_QUOTES, $default_charset);
} else {
$temp_val = $field_val;
}
// vtlib customization: New uitype to handle relation between modules
if ($uitype == '10') {
$parent_id = $field_val;
if (!empty($parent_id)) {
$parent_module = getSalesEntityType($parent_id);
$valueTitle = $parent_module;
if ($app_strings[$valueTitle]) {
$valueTitle = $app_strings[$valueTitle];
}
$displayValueArray = getEntityName($parent_module, $parent_id);
if (!empty($displayValueArray)) {
foreach ($displayValueArray as $key => $value) {
$value = $value;
}
}
$value = "<a href='index.php?module={$parent_module}&action=DetailView&record={$parent_id}' title='{$valueTitle}'>" . textlength_check($value) . "</a>";
} else {
$value = '';
}
} else {
if ($uitype == 53) {
$value = $adb->query_result($list_result, $list_result_count, 'user_name');
// When Assigned To field is used in Popup window
if ($value == '') {
$user_id = $adb->query_result($list_result, $list_result_count, 'smownerid');
if ($user_id != null && $user_id != '') {
$value = getOwnerName($user_id);
$value = textlength_check($value);
}
}
} elseif ($uitype == 52) {
$value = getOwnerName($adb->query_result($list_result, $list_result_count, $colname));
$value = textlength_check($value);
} elseif ($uitype == 51) {
//Accounts - Member Of
$parentid = $adb->query_result($list_result, $list_result_count, "parentid");
if ($module == 'Accounts') {
$entity_name = textlength_check(getAccountName($parentid));
} elseif ($module == 'Products') {
$entity_name = textlength_check(getProductName($parentid));
}
$value = '<a href="index.php?module=' . $module . '&action=DetailView&record=' . $parentid . '&parenttab=' . $tabname . '" style="' . $P_FONT_COLOR . '">' . $entity_name . '</a>';
} elseif ($uitype == 77) {
$value = getOwnerName($adb->query_result($list_result, $list_result_count, 'inventorymanager'));
$value = textlength_check($value);
} elseif ($uitype == 5 || $uitype == 6 || $uitype == 23 || $uitype == 70) {
$temp_val = trim($temp_val);
$timeField = 'time_start';
if ($fieldname == 'due_date') {
$timeField = 'time_end';
}
if ($temp_val != '' && $module == 'Calendar' && ($uitype == 23 || $uitype == 6) && $timeField != '' && ($fieldname == 'date_start' || $fieldname == 'due_date')) {
$time = $adb->query_result($list_result, $list_result_count, $timeField);
if (empty($time)) {
$time = getSingleFieldValue('vtiger_activity', $timeField, 'activityid', $entity_id);
}
}
if ($temp_val == '0000-00-00' || empty($temp_val)) {
$value = '';
} else {
if (empty($time) && strpos($temp_val, ' ') == false) {
$value = DateTimeField::convertToUserFormat($temp_val);
} else {
if (!empty($time)) {
$date = new DateTimeField($temp_val . ' ' . $time);
$value = $date->getDisplayDate();
} else {
$date = new DateTimeField($temp_val);
$value = $date->getDisplayDateTimeValue();
}
}
}
} elseif ($uitype == 15 || $uitype == 55 && $fieldname == "salutationtype") {
$temp_val = decode_html($adb->query_result($list_result, $list_result_count, $colname));
if ($is_admin == false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $temp_val != '') {
//.........这里部分代码省略.........
示例14: homepage_getPendingActivities
/**
* function to get pending activities for today
* @param integer $maxval - the maximum number of records to display
* @param integer $calCnt - returns the count query if this is set
* return array $values - activities record in array format
*/
function homepage_getPendingActivities($maxval, $calCnt)
{
require_once "data/Tracker.php";
require_once "include/utils/utils.php";
require_once 'include/utils/CommonUtils.php';
global $adb;
global $current_user;
$today = date("Y-m-d", time());
$pending_condition = " AND (due_date = '{$today}' OR vtiger_recurringevents.recurringdate = '{$today}')";
$list_query = "select vtiger_crmentity.crmid,vtiger_crmentity.smownerid,vtiger_crmentity." . "setype, vtiger_recurringevents.recurringdate, vtiger_activity.* from vtiger_activity " . "inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid LEFT " . "JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid left outer join " . "vtiger_recurringevents on vtiger_recurringevents.activityid=vtiger_activity.activityid" . ($list_query .= getNonAdminAccessControlQuery('Calendar', $current_user));
$list_query .= "WHERE vtiger_crmentity.deleted=0 and (vtiger_activity.activitytype not in " . "('Emails')) AND (vtiger_activity.status is NULL OR vtiger_activity.status not in " . "('Completed','Deferred')) and (vtiger_activity.eventstatus is NULL OR vtiger_activity." . "eventstatus not in ('Held','Not Held')) " . $pending_condition;
$list_query .= " GROUP BY vtiger_activity.activityid";
$list_query .= " ORDER BY date_start,time_start ASC";
$list_query .= " limit {$maxval}";
$res = $adb->query($list_query);
$noofrecords = $adb->num_rows($res);
if ($calCnt == 'calculateCnt') {
return $noofrecords;
}
$open_activity_list = array();
$noofrows = $adb->num_rows($res);
if (count($res) > 0) {
for ($i = 0; $i < $noofrows; $i++) {
$dateValue = $adb->query_result($res, $i, 'date_start') . ' ' . $adb->query_result($res, $i, 'time_start');
$endDateValue = $adb->query_result($res, $i, 'due_date') . ' ' . $adb->query_result($res, $i, 'time_end');
$recurringDateValue = $adb->query_result($res, $i, 'due_date') . ' ' . $adb->query_result($res, $i, 'time_start');
$date = new DateTimeField($dateValue);
$endDate = new DateTimeField($endDateValue);
$recurringDate = new DateTimeField($recurringDateValue);
$open_activity_list[] = array('name' => $adb->query_result($res, $i, 'subject'), 'id' => $adb->query_result($res, $i, 'activityid'), 'type' => $adb->query_result($res, $i, 'activitytype'), 'module' => $adb->query_result($res, $i, 'setype'), 'date_start' => $date->getDisplayDate(), 'due_date' => $endDate->getDisplayDate(), 'recurringdate' => $recurringDate->getDisplayDate(), 'priority' => $adb->query_result($res, $i, 'priority'));
}
}
$values = getActivityEntries($open_activity_list);
$values['ModuleName'] = 'Calendar';
$values['search_qry'] = "&action=ListView&from_homepage=pending_activities";
return $values;
}
示例15: convertDateTimeIntoUsersDisplayFormat
/**
* Function to get the datetime value in user preferred hour format
* @param <DateTime> $dateTime
* @param <Vtiger_Users_Model> $userObject
* @return <String> date and time with hour format
*/
public static function convertDateTimeIntoUsersDisplayFormat($dateTime, $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();
}
$date = new DateTime($dateTime);
$dateTimeField = new DateTimeField($date->format('Y-m-d H:i:s'));
$date = $dateTimeField->getDisplayDate($userModel);
$time = $dateTimeField->getDisplayTime($userModel);
return $date . ' ' . $time;
}