当前位置: 首页>>代码示例>>PHP>>正文


PHP Vtiger_Datetime_UIType::getDisplayDateValue方法代码示例

本文整理汇总了PHP中Vtiger_Datetime_UIType::getDisplayDateValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Datetime_UIType::getDisplayDateValue方法的具体用法?PHP Vtiger_Datetime_UIType::getDisplayDateValue怎么用?PHP Vtiger_Datetime_UIType::getDisplayDateValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Vtiger_Datetime_UIType的用法示例。


在下文中一共展示了Vtiger_Datetime_UIType::getDisplayDateValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getCalendarActivities

 /**
  * Function returns the Calendar Events for the module
  * @param <Vtiger_Paging_Model> $pagingModel
  * @return <Array>
  */
 public function getCalendarActivities($mode, $pagingModel, $user, $recordId = false)
 {
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $db = PearDatabase::getInstance();
     if (!$user) {
         $user = $currentUser->getId();
     }
     $nowInUserFormat = Vtiger_Datetime_UIType::getDisplayDateValue(date('Y-m-d H:i:s'));
     $nowInDBFormat = Vtiger_Datetime_UIType::getDBDateTimeValue($nowInUserFormat);
     list($currentDate, $currentTime) = explode(' ', $nowInDBFormat);
     $query = "SELECT vtiger_crmentity.crmid, crmentity2.crmid AS contact_id, 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\tINNER JOIN vtiger_cntactivityrel ON vtiger_cntactivityrel.activityid = vtiger_activity.activityid\n\t\t\t\t\tINNER JOIN vtiger_crmentity AS crmentity2 ON vtiger_cntactivityrel.contactid = crmentity2.crmid AND crmentity2.deleted = 0 AND crmentity2.setype = ?\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 ($recordId) {
         $query .= " AND vtiger_cntactivityrel.contactid = ?";
     } elseif ($mode === 'upcoming') {
         $query .= " AND due_date >= '{$currentDate}'";
     } elseif ($mode === 'overdue') {
         $query .= " AND due_date < '{$currentDate}'";
     }
     $params = array($this->getName());
     if ($recordId) {
         array_push($params, $recordId);
     }
     if ($user != 'all' && $user != '') {
         if ($user === $currentUser->id) {
             $query .= " AND vtiger_crmentity.smownerid = ?";
             array_push($params, $user);
         }
     }
     $query .= " ORDER BY date_start, time_start LIMIT " . $pagingModel->getStartIndex() . ", " . ($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;
 }
开发者ID:nouphet,项目名称:vtigercrm-6.0.0-ja,代码行数:55,代码来源:Module.php

示例2: 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, $recordId = false)
 {
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $db = PearDatabase::getInstance();
     if (!$user) {
         $user = $currentUser->getId();
     }
     $nowInUserFormat = Vtiger_Datetime_UIType::getDisplayDateValue(date('Y-m-d H:i:s'));
     $nowInDBFormat = Vtiger_Datetime_UIType::getDBDateTimeValue($nowInUserFormat);
     list($currentDate, $currentTime) = explode(' ', $nowInDBFormat);
     $query = "SELECT vtiger_crmentity.crmid, crmentity2.crmid AS parent_id, 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\tINNER JOIN vtiger_seactivityrel ON vtiger_seactivityrel.activityid = vtiger_activity.activityid\n\t\t\t\t\tINNER JOIN vtiger_crmentity AS crmentity2 ON vtiger_seactivityrel.crmid = crmentity2.crmid AND crmentity2.deleted = 0 AND crmentity2.setype = ?\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 ($recordId) {
         $query .= " AND vtiger_seactivityrel.crmid = ?";
     } elseif ($mode === 'upcoming') {
         $query .= " AND due_date >= '{$currentDate}'";
     } elseif ($mode === 'overdue') {
         $query .= " AND due_date < '{$currentDate}'";
     }
     $params = array($this->getName());
     if ($user != 'all' && $user != '') {
         if ($user === $currentUser->id) {
             $query .= " AND vtiger_crmentity.smownerid = ?";
             array_push($params, $user);
         }
     }
     $query .= " ORDER BY date_start, time_start LIMIT " . $pagingModel->getStartIndex() . ", " . ($pagingModel->getPageLimit() + 1);
     if ($recordId) {
         array_push($params, $recordId);
     }
     $result = $db->pquery($query, $params);
     $numOfRows = $db->num_rows($result);
     $groupsIds = Vtiger_Util_Helper::getGroupsIdsForUsers($currentUser->getId());
     $activities = array();
     for ($i = 0; $i < $numOfRows; $i++) {
         $newRow = $db->query_result_rowdata($result, $i);
         $model = Vtiger_Record_Model::getCleanInstance('Calendar');
         $ownerId = $newRow['smownerid'];
         $currentUser = Users_Record_Model::getCurrentUserModel();
         $visibleFields = array('activitytype', 'date_start', 'time_start', 'due_date', 'time_end', 'assigned_user_id', 'visibility', 'smownerid', 'crmid');
         $visibility = true;
         if (in_array($ownerId, $groupsIds)) {
             $visibility = false;
         } else {
             if ($ownerId == $currentUser->getId()) {
                 $visibility = false;
             }
         }
         if (!$currentUser->isAdminUser() && $newRow['activitytype'] != 'Task' && $newRow['visibility'] == 'Private' && $ownerId && $visibility) {
             foreach ($newRow as $data => $value) {
                 if (in_array($data, $visibleFields) != -1) {
                     unset($newRow[$data]);
                 }
             }
             $newRow['subject'] = vtranslate('Busy', 'Events') . '*';
         }
         if ($newRow['activitytype'] == 'Task') {
             unset($newRow['visibility']);
         }
         $model->setData($newRow);
         $model->setId($newRow['crmid']);
         $activities[] = $model;
     }
     $pagingModel->calculatePageRange($activities);
     if ($numOfRows > $pagingModel->getPageLimit()) {
         array_pop($activities);
         $pagingModel->set('nextPageExists', true);
     } else {
         $pagingModel->set('nextPageExists', false);
     }
     return $activities;
 }
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:81,代码来源:Module.php

示例3: 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, $recordId = false)
 {
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $db = PearDatabase::getInstance();
     if (!$user) {
         $user = $currentUser->getId();
     }
     $currentActivityLabels = Calendar_Module_Model::getComponentActivityStateLabel('current');
     $nowInUserFormat = Vtiger_Datetime_UIType::getDisplayDateValue(date('Y-m-d H:i:s'));
     $nowInDBFormat = Vtiger_Datetime_UIType::getDBDateTimeValue($nowInUserFormat);
     list($currentDate, $currentTime) = explode(' ', $nowInDBFormat);
     if (in_array($this->getName(), ['Accounts', 'Leads', 'Contacts', 'Vendors', 'OSSEmployees'])) {
         $relationField = 'link';
     }
     if (in_array($this->getName(), ['Campaigns', 'HelpDesk', 'Potentials', 'Project', 'ServiceContracts'])) {
         $relationField = 'process';
     }
     $query = "SELECT vtiger_crmentity.crmid, crmentity2.crmid AS parent_id, vtiger_crmentity.description as description, vtiger_crmentity.smownerid, vtiger_crmentity.smcreatorid, 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\tINNER JOIN vtiger_crmentity AS crmentity2 ON vtiger_activity." . $relationField . " = crmentity2.crmid AND crmentity2.deleted = 0 AND crmentity2.setype = ?\n\t\t\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid WHERE vtiger_crmentity.deleted=0";
     $params = [$this->getName()];
     if ($recordId) {
         $query .= ' AND vtiger_activity.' . $relationField . ' = ?';
         array_push($params, $recordId);
     }
     if ($mode === 'current') {
         $query .= " AND (vtiger_activity.activitytype NOT IN ('Emails') AND vtiger_activity.status IN (" . generateQuestionMarks($currentActivityLabels) . "))";
         $params = array_merge($params, $currentActivityLabels);
     } elseif ($mode === 'history') {
         $query .= " AND (vtiger_activity.activitytype NOT IN ('Emails') AND vtiger_activity.status NOT IN (" . generateQuestionMarks($currentActivityLabels) . "))";
         $params = array_merge($params, $currentActivityLabels);
     } elseif ($mode === 'upcoming') {
         $query .= " AND (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'))";
         $query .= " AND due_date >= '{$currentDate}'";
     } elseif ($mode === 'overdue') {
         $query .= " AND (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'))";
         $query .= " AND due_date < '{$currentDate}'";
     }
     if ($user != 'all' && $user != '') {
         if ($user === $currentUser->id) {
             $query .= " AND vtiger_crmentity.smownerid = ?";
             array_push($params, $user);
         }
     }
     $moduleName = 'Calendar';
     $instance = CRMEntity::getInstance($moduleName);
     $securityParameter = $instance->getUserAccessConditionsQuerySR($moduleName, $currentUser, $recordId);
     if ($securityParameter != '') {
         $query .= $securityParameter;
     }
     $query .= " ORDER BY date_start, time_start LIMIT " . $pagingModel->getStartIndex() . ", " . ($pagingModel->getPageLimit() + 1);
     $result = $db->pquery($query, $params);
     $numOfRows = $db->num_rows($result);
     $groupsIds = Vtiger_Util_Helper::getGroupsIdsForUsers($currentUser->getId());
     $activities = array();
     for ($i = 0; $i < $numOfRows; $i++) {
         $newRow = $db->query_result_rowdata($result, $i);
         $model = Vtiger_Record_Model::getCleanInstance('Calendar');
         $ownerId = $newRow['smownerid'];
         $currentUser = Users_Record_Model::getCurrentUserModel();
         $visibleFields = array('activitytype', 'date_start', 'time_start', 'due_date', 'time_end', 'assigned_user_id', 'visibility', 'smownerid', 'crmid');
         $visibility = true;
         if (in_array($ownerId, $groupsIds)) {
             $visibility = false;
         } else {
             if ($ownerId == $currentUser->getId()) {
                 $visibility = false;
             }
         }
         if (!$currentUser->isAdminUser() && $newRow['activitytype'] != 'Task' && $newRow['visibility'] == 'Private' && $ownerId && $visibility) {
             foreach ($newRow as $data => $value) {
                 if (in_array($data, $visibleFields) != -1) {
                     unset($newRow[$data]);
                 }
             }
             $newRow['subject'] = vtranslate('Busy', 'Events') . '*';
         }
         if ($newRow['activitytype'] == 'Task') {
             unset($newRow['visibility']);
         }
         $sql = "SELECT * FROM vtiger_invitees WHERE activityid = '" . $newRow['crmid'] . "'";
         $result_invitees = $db->query($sql);
         while ($recordinfo = $db->fetch_array($result_invitees)) {
             $newRow['selectedusers'][] = $recordinfo['inviteeid'];
         }
         $model->setData($newRow);
         $model->setId($newRow['crmid']);
         $activities[] = $model;
     }
     $pagingModel->calculatePageRange($activities);
     if ($numOfRows > $pagingModel->getPageLimit()) {
         array_pop($activities);
         $pagingModel->set('nextPageExists', true);
     } else {
//.........这里部分代码省略.........
开发者ID:noclav,项目名称:UpdatePackages,代码行数:101,代码来源:Module.php


注:本文中的Vtiger_Datetime_UIType::getDisplayDateValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。