本文整理汇总了PHP中Vtiger_Datetime_UIType::getDisplayDateTimeValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Datetime_UIType::getDisplayDateTimeValue方法的具体用法?PHP Vtiger_Datetime_UIType::getDisplayDateTimeValue怎么用?PHP Vtiger_Datetime_UIType::getDisplayDateTimeValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Datetime_UIType
的用法示例。
在下文中一共展示了Vtiger_Datetime_UIType::getDisplayDateTimeValue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: formatDateTimeIntoDayString
/**
* Function to parse dateTime into Days
* @param <DateTime> $dateTime
* @return <String>
*/
public static function formatDateTimeIntoDayString($dateTime) {
$currentUser = Users_Record_Model::getCurrentUserModel();
$dateTimeInUserFormat = Vtiger_Datetime_UIType::getDisplayDateTimeValue($dateTime);
list($dateInUserFormat, $timeInUserFormat,$meridiem) = explode(' ', $dateTimeInUserFormat);
list($hours, $minutes, $seconds) = explode(':', $timeInUserFormat);
$displayTime = $hours .':'. $minutes .' '. $meridiem;
/**
* To support strtotime() for 'mm-dd-yyyy' format the seperator should be '/'
* For more referrences
* http://php.net/manual/en/datetime.formats.date.php
*/
if ($currentUser->get('date_format') === 'mm-dd-yyyy') {
$dateInUserFormat = str_replace('-', '/', $dateInUserFormat);
}
$date = strtotime($dateInUserFormat);
//Adding date details
$formatedDate = vtranslate('LBL_'.date('D', $date)). ', ' .vtranslate('LBL_'.date('M', $date)). ' ' .date('d', $date). ', ' .date('Y', $date);
//Adding time details
$formatedDate .= ' ' .vtranslate('LBL_AT'). ' ' .$displayTime;
return $formatedDate;
}
示例2: getAssignedProjectsTasks
/**
* Function returns the Calendar Events for the module
* @param <String> $mode - upcoming/overdue mode
* @param <Vtiger_Paging_Model> $pagingModel - $pagingModel
* @param <String> $user - all/userid
* @param <String> $recordId - record id
* @return <Array>
*/
function getAssignedProjectsTasks($mode, $pagingModel, $user, $recordId = false)
{
$currentUser = Users_Record_Model::getCurrentUserModel();
$db = PearDatabase::getInstance();
if (!$user) {
$user = $currentUser->getId();
}
$nowInUserFormat = Vtiger_Datetime_UIType::getDisplayDateTimeValue(date('Y-m-d H:i:s'));
$nowInDBFormat = Vtiger_Datetime_UIType::getDBDateTimeValue($nowInUserFormat);
list($currentDate, $currentTime) = explode(' ', $nowInDBFormat);
$instance = CRMEntity::getInstance('ProjectTask');
$UserAccessConditions = $instance->getUserAccessConditionsQuerySR('ProjectTask');
$params = array();
$query = "SELECT vtiger_crmentity.crmid, vtiger_crmentity.smownerid, vtiger_crmentity.setype, vtiger_projecttask.*\n\t\t\tFROM vtiger_projecttask\n\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_projecttask.projecttaskid\n\t\t\tWHERE vtiger_crmentity.deleted=0 AND vtiger_crmentity.smcreatorid = ?";
$params[] = $currentUser->getId();
$query .= $UserAccessConditions;
if ($mode === 'upcoming') {
$query .= " AND targetenddate >= ?";
} elseif ($mode === 'overdue') {
$query .= " AND targetenddate < ?";
}
$params[] = $currentDate;
$accessibleUsers = $currentUser->getAccessibleUsers();
$accessibleGroups = $currentUser->getAccessibleGroups();
if ($user != 'all' && $user != '' && (array_key_exists($user, $accessibleUsers) || array_key_exists($user, $accessibleGroups))) {
$query .= " AND vtiger_crmentity.smownerid = ?";
$params[] = $user;
}
$query .= " ORDER BY targetenddate LIMIT ?, ?";
$params[] = $pagingModel->getStartIndex();
$params[] = $pagingModel->getPageLimit() + 1;
$result = $db->pquery($query, $params);
$numOfRows = $db->num_rows($result);
$projecttasks = array();
for ($i = 0; $i < $numOfRows; $i++) {
$row = $db->query_result_rowdata($result, $i);
$model = Vtiger_Record_Model::getCleanInstance('ProjectTask');
$model->setData($row);
$model->setId($row['crmid']);
if ($row['projectid']) {
if (isRecordExists($row['projectid'])) {
$record = Vtiger_Record_Model::getInstanceById($row['projectid'], 'Project');
if (isRecordExists($record->get('linktoaccountscontacts'))) {
$model->set('account', '<a href="index.php?module=' . Vtiger_Functions::getCRMRecordType($record->get('linktoaccountscontacts')) . '&view=Detail&record=' . $record->get('linktoaccountscontacts') . '">' . Vtiger_Functions::getCRMRecordLabel($record->get('linktoaccountscontacts')) . '</a>');
}
}
}
$projecttasks[] = $model;
}
$pagingModel->calculatePageRange($projecttasks);
if ($numOfRows > $pagingModel->getPageLimit()) {
array_pop($projecttasks);
$pagingModel->set('nextPageExists', true);
} else {
$pagingModel->set('nextPageExists', false);
}
return $projecttasks;
}
示例3: getLastEndDateTime
/**
* Get the user datetimefeild
*/
function getLastEndDateTime()
{
if ($this->get('lastend') != NULL) {
$lastScannedTime = Vtiger_Datetime_UIType::getDisplayDateTimeValue(date('Y-m-d H:i:s', $this->get('lastend')));
$userModel = Users_Record_Model::getCurrentUserModel();
$hourFormat = $userModel->get('hour_format');
if ($hourFormat == '24') {
return $lastScannedTime;
} else {
$dateTimeList = explode(" ", $lastScannedTime);
return $dateTimeList[0] . " " . date('g:i:sa', strtotime($dateTimeList[1]));
}
} else {
return '';
}
}
示例4: getLastEndDateTime
/**
* Get the user datetimefeild
*/
function getLastEndDateTime()
{
if ($this->get('lastend') != NULL) {
return Vtiger_Datetime_UIType::getDisplayDateTimeValue(date('Y-m-d H:i:s', $this->get('lastend')));
} else {
return '';
}
}
示例5: formatDateTimeIntoDayString
/**
* Function to parse dateTime into Days
* @param <DateTime> $dateTime
* @return <String>
*/
public static function formatDateTimeIntoDayString($dateTime)
{
$currentUser = Users_Record_Model::getCurrentUserModel();
$dateTimeInUserFormat = Vtiger_Datetime_UIType::getDisplayDateTimeValue($dateTime);
list($dateInUserFormat, $timeInUserFormat, $meridiem) = explode(' ', $dateTimeInUserFormat);
list($hours, $minutes, $seconds) = explode(':', $timeInUserFormat);
$displayTime = $hours . ':' . $minutes . ' ' . $meridiem;
$dateDay = vtranslate(DateTimeField::getDayFromDate($dateTime), 'Calendar');
$formatedDate = $dateInUserFormat . ' ' . vtranslate('LBL_AT') . ' ' . $displayTime . " ({$dateDay})";
return $formatedDate;
}
示例6: getTreeEntries
public function getTreeEntries()
{
$db = PearDatabase::getInstance();
$recordId = $this->getParentRecordModel()->getId();
$relModuleId = $this->getRelatedModuleModel()->getId();
$relModuleName = $this->getRelatedModuleModel()->getName();
$treeViewModel = $this->getTreeViewModel();
$relationModel = $this->getRelationModel();
$fields = $treeViewModel->getTreeField();
$template = $treeViewModel->getTemplate();
$result = $db->pquery('SELECT tr.*,rel.crmid,rel.rel_created_time,rel.rel_created_user,rel.rel_comment FROM vtiger_trees_templates_data tr ' . 'INNER JOIN u_yf_crmentity_rel_tree rel ON rel.tree = tr.tree ' . 'WHERE tr.templateid = ? AND rel.crmid = ? AND rel.relmodule = ?', [$template, $recordId, $relModuleId]);
$trees = [];
while ($row = $db->getRow($result)) {
$treeID = $row['tree'];
$pieces = explode('::', $row['parenttrre']);
end($pieces);
$parent = prev($pieces);
$parentName = '';
if ($row['depth'] > 0) {
$result2 = $db->pquery('SELECT name FROM vtiger_trees_templates_data WHERE templateid = ? AND tree = ?', [$template, $parent]);
$parentName = $db->getSingleValue($result2);
$parentName = '(' . vtranslate($parentName, $relModuleName) . ') ';
}
$tree = ['id' => $treeID, 'name' => $parentName . vtranslate($row['name'], $relModuleName), 'parent' => $parent == 0 ? '#' : $parent];
if ($relationModel->showCreatorDetail()) {
$tree['relCreatedUser'] = getOwnerName($row['rel_created_user']);
$tree['relCreatedTime'] = Vtiger_Datetime_UIType::getDisplayDateTimeValue($row['rel_created_time']);
}
if ($relationModel->showComment()) {
if (strlen($row['rel_comment']) > AppConfig::relation('COMMENT_MAX_LENGTH')) {
$tree['relCommentFull'] = $row['rel_comment'];
}
$tree['relComment'] = Vtiger_Functions::textLength($row['rel_comment'], AppConfig::relation('COMMENT_MAX_LENGTH'));
}
if (!empty($row['icon'])) {
$tree['icon'] = $row['icon'];
}
$trees[] = $tree;
}
return $trees;
}
示例7: getCalendarActivities
/**
* Function returns the Calendar Events for the module
* @param <String> $mode - upcoming/overdue mode
* @param <Vtiger_Paging_Model> $pagingModel - $pagingModel
* @param <String> $user - all/userid
* @param <String> $recordId - record id
* @return <Array>
*/
function getCalendarActivities($mode, $pagingModel, $user)
{
$currentUser = Users_Record_Model::getCurrentUserModel();
$db = PearDatabase::getInstance();
if (!$user) {
$user = $currentUser->getId();
}
$nowInUserFormat = Vtiger_Datetime_UIType::getDisplayDateTimeValue(date('Y-m-d H:i:s'));
$nowInDBFormat = Vtiger_Datetime_UIType::getDBDateTimeValue($nowInUserFormat);
list($currentDate, $currentTime) = explode(' ', $nowInDBFormat);
$query = "SELECT vtiger_crmentity.crmid, vtiger_crmentity.smownerid, vtiger_crmentity.setype, vtiger_activity.* FROM vtiger_activity\n\t\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_activity.activityid\n\t\t\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid";
$query .= Users_Privileges_Model::getNonAdminAccessControlQuery('Calendar');
$query .= " WHERE vtiger_crmentity.deleted=0\n\t\t\t\t\tAND (vtiger_activity.activitytype NOT IN ('Emails'))\n\t\t\t\t\tAND (vtiger_activity.status is NULL OR vtiger_activity.status NOT IN ('Completed', 'Deferred'))\n\t\t\t\t\tAND (vtiger_activity.eventstatus is NULL OR vtiger_activity.eventstatus NOT IN ('Held'))";
if ($mode === 'upcoming') {
$query .= " AND due_date >= '{$currentDate}'";
} elseif ($mode === 'overdue') {
$query .= " AND due_date < '{$currentDate}'";
}
$params = array();
if ($user != 'all' && $user != '') {
if ($user === $currentUser->id) {
$query .= " AND vtiger_crmentity.smownerid = ?";
$params[] = $user;
}
}
$query .= " ORDER BY date_start, time_start LIMIT ?, ?";
$params[] = $pagingModel->getStartIndex();
$params[] = $pagingModel->getPageLimit() + 1;
$result = $db->pquery($query, $params);
$numOfRows = $db->num_rows($result);
$activities = array();
for ($i = 0; $i < $numOfRows; $i++) {
$row = $db->query_result_rowdata($result, $i);
$model = Vtiger_Record_Model::getCleanInstance('Calendar');
$model->setData($row);
$model->setId($row['crmid']);
$activities[] = $model;
}
$pagingModel->calculatePageRange($activities);
if ($numOfRows > $pagingModel->getPageLimit()) {
array_pop($activities);
$pagingModel->set('nextPageExists', true);
} else {
$pagingModel->set('nextPageExists', false);
}
return $activities;
}