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


PHP Vtiger_Datetime_UIType::getDBDateTimeValue方法代码示例

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


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

示例1: createFollowupEvent

 public function createFollowupEvent(Vtiger_Request $request)
 {
     $recordId = $request->get('record');
     $recordModel = Vtiger_Record_Model::getInstanceById($recordId);
     $subject = $recordModel->get('subject');
     $followupSubject = "[Followup] " . $subject;
     $recordModel->set('subject', $followupSubject);
     //followup event is Planned
     $recordModel->set('eventstatus', "Planned");
     $activityType = $recordModel->get('activitytype');
     if ($activityType == "Call") {
         $eventDuration = $request->get('defaultCallDuration');
     } else {
         $eventDuration = $request->get('defaultOtherEventDuration');
     }
     $followupStartTime = Vtiger_Time_UIType::getTimeValueWithSeconds($request->get('followup_time_start'));
     $followupStartDateTime = Vtiger_Datetime_UIType::getDBDateTimeValue($request->get('followup_date_start') . " " . $followupStartTime);
     list($followupStartDate, $followupStartTime) = explode(' ', $followupStartDateTime);
     //Duration of followup event based on activitytype
     $durationMS = $eventDuration * 60;
     $followupStartDateTimeMS = strtotime($followupStartDateTime);
     $followupEndDateTimeMS = $followupStartDateTimeMS + $durationMS;
     $followupEndDateTime = date("Y-m-d H:i:s", $followupEndDateTimeMS);
     list($followupEndDate, $followupEndTime) = explode(' ', $followupEndDateTime);
     $recordModel->set('date_start', $followupStartDate);
     $recordModel->set('time_start', $followupStartTime);
     $recordModel->set('due_date', $followupEndDate);
     $recordModel->set('time_end', $followupEndTime);
     $recordModel->save();
     $response = new Vtiger_Response();
     $result = array('created' => true);
     $response->setResult($result);
     $response->emit();
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:34,代码来源:SaveFollowupAjax.php

示例2: saveRecord

 /**
  * Function to save record
  * @param <Vtiger_Request> $request - values of the record
  * @return <RecordModel> - record Model of saved record
  */
 public function saveRecord($request)
 {
     $adb = PearDatabase::getInstance();
     $recordModel = $this->getRecordModelFromRequest($request);
     $recordModel->save();
     $originalRecordId = $recordModel->getId();
     if ($request->get('relationOperation')) {
         $parentModuleName = $request->get('sourceModule');
         $parentModuleModel = Vtiger_Module_Model::getInstance($parentModuleName);
         $parentRecordId = $request->get('sourceRecord');
         $relatedModule = $recordModel->getModule();
         if ($relatedModule->getName() == 'Events') {
             $relatedModule = Vtiger_Module_Model::getInstance('Calendar');
         }
         $relatedRecordId = $recordModel->getId();
         $relationModel = Vtiger_Relation_Model::getInstance($parentModuleModel, $relatedModule);
         $relationModel->addRelation($parentRecordId, $relatedRecordId);
     }
     // Handled to save follow up event
     $followupMode = $request->get('followup');
     //Start Date and Time values
     $startTime = Vtiger_Time_UIType::getTimeValueWithSeconds($request->get('followup_time_start'));
     $startDateTime = Vtiger_Datetime_UIType::getDBDateTimeValue($request->get('followup_date_start') . " " . $startTime);
     list($startDate, $startTime) = explode(' ', $startDateTime);
     $subject = $request->get('subject');
     if ($followupMode == 'on' && $startTime != '' && $startDate != '') {
         $recordModel->set('eventstatus', 'Planned');
         $recordModel->set('subject', '[Followup] ' . $subject);
         $recordModel->set('date_start', $startDate);
         $recordModel->set('time_start', $startTime);
         $currentUser = Users_Record_Model::getCurrentUserModel();
         $activityType = $recordModel->get('activitytype');
         if ($activityType == 'Call') {
             $minutes = $currentUser->get('callduration');
         } else {
             $minutes = $currentUser->get('othereventduration');
         }
         $dueDateTime = date('Y-m-d H:i:s', strtotime("{$startDateTime}+{$minutes} minutes"));
         list($startDate, $startTime) = explode(' ', $dueDateTime);
         $recordModel->set('due_date', $startDate);
         $recordModel->set('time_end', $startTime);
         $recordModel->set('recurringtype', '');
         $recordModel->set('mode', 'create');
         $recordModel->save();
         $heldevent = true;
     }
     //TODO: remove the dependency on $_REQUEST
     if ($_REQUEST['recurringtype'] != '' && $_REQUEST['recurringtype'] != '--None--') {
         vimport('~modules/Calendar/RepeatEvents.php');
         $focus = new Activity();
         //get all the stored data to this object
         $focus->column_fields = $recordModel->getData();
         Calendar_RepeatEvents::repeatFromRequest($focus);
     }
     return $recordModel;
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:61,代码来源:Save.php

示例3: 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

示例4: 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;
 }
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:66,代码来源:Module.php

示例5: 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

示例6: getRecordModelFromRequest

 /**
  * Function to get the record model based on the request parameters
  * @param Vtiger_Request $request
  * @return Vtiger_Record_Model or Module specific Record Model instance
  */
 public function getRecordModelFromRequest(Vtiger_Request $request)
 {
     $recordModel = parent::getRecordModelFromRequest($request);
     $startDate = $request->get('date_start');
     if (!empty($startDate)) {
         //Start Date and Time values
         $startTime = Vtiger_Time_UIType::getTimeValueWithSeconds($request->get('time_start'));
         $startDate = Vtiger_Date_UIType::getDBInsertedValue($request->get('date_start'));
         if ($startTime) {
             $startDateTime = Vtiger_Datetime_UIType::getDBDateTimeValue($request->get('date_start') . " " . $startTime);
             list($startDate, $startTime) = explode(' ', $startDateTime);
         }
         $recordModel->set('date_start', $startDate);
         $recordModel->set('time_start', $startTime);
     }
     $endDate = $request->get('due_date');
     if (!empty($endDate)) {
         //End Date and Time values
         $endTime = $request->get('time_end');
         $endDate = Vtiger_Date_UIType::getDBInsertedValue($request->get('due_date'));
         if ($endTime) {
             $endTime = Vtiger_Time_UIType::getTimeValueWithSeconds($endTime);
             $endDateTime = Vtiger_Datetime_UIType::getDBDateTimeValue($request->get('due_date') . " " . $endTime);
             list($endDate, $endTime) = explode(' ', $endDateTime);
         }
         $recordModel->set('time_end', $endTime);
         $recordModel->set('due_date', $endDate);
     }
     $record = $request->get('record');
     if (!$record) {
         $activityType = $request->get('activitytype');
         $visibility = $request->get('visibility');
         if (empty($activityType)) {
             $recordModel->set('activitytype', 'Task');
             $visibility = 'Private';
             $recordModel->set('visibility', $visibility);
         }
     }
     if (empty($visibility)) {
         $assignedUserId = $recordModel->get('assigned_user_id');
         $sharedType = Calendar_Module_Model::getSharedType($assignedUserId);
         if ($sharedType == 'selectedusers') {
             $sharedType = 'public';
         }
         $recordModel->set('visibility', ucfirst($sharedType));
     }
     return $recordModel;
 }
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:53,代码来源:SaveAjax.php

示例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, $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

示例8: process

 public function process(Vtiger_Request $request)
 {
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $record = $request->get('record');
     if (!empty($record) && $request->get('isDuplicate') == true) {
         $recordModel = $this->record ? $this->record : Vtiger_Record_Model::getInstanceById($record, $moduleName);
         $viewer->assign('MODE', '');
         $recordModel->set('id', '');
         //While Duplicating record, If the related record is deleted then we are removing related record info in record model
         $mandatoryFieldModels = $recordModel->getModule()->getMandatoryFieldModels();
         foreach ($mandatoryFieldModels as $fieldModel) {
             if ($fieldModel->isReferenceField()) {
                 $fieldName = $fieldModel->get('name');
                 if (Vtiger_Util_Helper::checkRecordExistance($recordModel->get($fieldName))) {
                     $recordModel->set($fieldName, '');
                 }
             }
         }
     } else {
         if (!empty($record)) {
             $recordModel = $this->record ? $this->record : Vtiger_Record_Model::getInstanceById($record, $moduleName);
             $viewer->assign('RECORD_ID', $record);
             $viewer->assign('MODE', 'edit');
         } else {
             $recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
             $referenceId = $request->get('reference_id');
             if ($referenceId) {
                 $parentRecordModel = Vtiger_Record_Model::getInstanceById($referenceId);
                 $recordModel->setRecordFieldValues($parentRecordModel);
             }
             $viewer->assign('MODE', '');
         }
     }
     if (!$this->record) {
         $this->record = $recordModel;
     }
     $moduleModel = $recordModel->getModule();
     $fieldList = $moduleModel->getFields();
     $requestFieldList = array_intersect_key($request->getAll(), $fieldList);
     foreach ($requestFieldList as $fieldName => $fieldValue) {
         $fieldModel = $fieldList[$fieldName];
         $specialField = false;
         // We collate date and time part together in the EditView UI handling
         // so a bit of special treatment is required if we come from QuickCreate
         if ($moduleName == 'Calendar' && empty($record) && $fieldName == 'time_start' && !empty($fieldValue)) {
             $specialField = true;
             // Convert the incoming user-picked time to GMT time
             // which will get re-translated based on user-time zone on EditForm
             $fieldValue = DateTimeField::convertToDBTimeZone($fieldValue)->format("H:i");
         }
         if ($moduleName == 'Calendar' && empty($record) && $fieldName == 'date_start' && !empty($fieldValue)) {
             $startTime = Vtiger_Time_UIType::getTimeValueWithSeconds($requestFieldList['time_start']);
             $startDateTime = Vtiger_Datetime_UIType::getDBDateTimeValue($fieldValue . " " . $startTime);
             list($startDate, $startTime) = explode(' ', $startDateTime);
             $fieldValue = Vtiger_Date_UIType::getDisplayDateValue($startDate);
         }
         if ($fieldModel->isEditable() || $specialField) {
             $recordModel->set($fieldName, $fieldModel->getDBInsertValue($fieldValue));
         }
     }
     $recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($recordModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_EDIT);
     $picklistDependencyDatasource = Vtiger_DependencyPicklist::getPicklistDependencyDatasource($moduleName);
     $viewer->assign('PICKIST_DEPENDENCY_DATASOURCE', Zend_Json::encode($picklistDependencyDatasource));
     $mappingRelatedField = $moduleModel->getMappingRelatedField($moduleName);
     $viewer->assign('MAPPING_RELATED_FIELD', Zend_Json::encode($mappingRelatedField));
     $viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);
     $viewer->assign('RECORD_STRUCTURE', $recordStructureInstance->getStructure());
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('MODULE_TYPE', $moduleModel->getModuleType());
     $viewer->assign('RECORD', $recordModel);
     $viewer->assign('BLOCK_LIST', $moduleModel->getBlocks());
     $viewer->assign('CURRENTDATE', date('Y-n-j'));
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $viewer->assign('APIADDRESS', Settings_ApiAddress_Module_Model::getInstance('Settings:ApiAddress')->getConfig());
     $viewer->assign('APIADDRESS_ACTIVE', Settings_ApiAddress_Module_Model::isActive());
     $isRelationOperation = $request->get('relationOperation');
     //if it is relation edit
     $viewer->assign('IS_RELATION_OPERATION', $isRelationOperation);
     if ($isRelationOperation) {
         $viewer->assign('SOURCE_MODULE', $request->get('sourceModule'));
         $viewer->assign('SOURCE_RECORD', $request->get('sourceRecord'));
     }
     $viewer->assign('MAX_UPLOAD_LIMIT_MB', Vtiger_Util_Helper::getMaxUploadSize());
     $viewer->assign('MAX_UPLOAD_LIMIT', vglobal('upload_maxsize'));
     $viewer->view('EditView.tpl', $moduleName);
 }
开发者ID:nikdejan,项目名称:YetiForceCRM,代码行数:87,代码来源:Edit.php

示例9: getRecordModelFromRequest

 /**
  * Function to get the record model based on the request parameters
  * @param Vtiger_Request $request
  * @return Vtiger_Record_Model or Module specific Record Model instance
  */
 protected function getRecordModelFromRequest(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $recordId = $request->get('record');
     $user = Users_Record_Model::getCurrentUserModel();
     $allDay = $request->get('allday');
     if ('on' == $allDay) {
         $request->set('time_start', $user->get('start_hour'));
         $request->set('time_end', $user->get('end_hour'));
     }
     $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
     if (!empty($recordId)) {
         $recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
         $modelData = $recordModel->getData();
         $recordModel->set('id', $recordId);
         $recordModel->set('mode', 'edit');
         //Due to dependencies on the activity_reminder api in Activity.php(5.x)
         $_REQUEST['mode'] = 'edit';
     } else {
         $recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
         $modelData = $recordModel->getData();
         $recordModel->set('mode', '');
     }
     $fieldModelList = $moduleModel->getFields();
     foreach ($fieldModelList as $fieldName => $fieldModel) {
         $fieldValue = $request->get($fieldName, null);
         // For custom time fields in Calendar, it was not converting to db insert format(sending as 10:00 AM/PM)
         $fieldDataType = $fieldModel->getFieldDataType();
         if ($fieldDataType == 'time') {
             $fieldValue = Vtiger_Time_UIType::getTimeValueWithSeconds($fieldValue);
         }
         // End
         if ($fieldValue !== null) {
             if (!is_array($fieldValue)) {
                 $fieldValue = trim($fieldValue);
             }
             $recordModel->set($fieldName, $fieldValue);
         }
     }
     //Start Date and Time values
     $startTime = Vtiger_Time_UIType::getTimeValueWithSeconds($request->get('time_start'));
     $startDate = Vtiger_Date_UIType::getDBInsertedValue($request->get('date_start'));
     if ($startTime) {
         $startTime = Vtiger_Time_UIType::getTimeValueWithSeconds($startTime);
         $startDateTime = Vtiger_Datetime_UIType::getDBDateTimeValue($request->get('date_start') . " " . $startTime);
         list($startDate, $startTime) = explode(' ', $startDateTime);
     }
     $recordModel->set('date_start', $startDate);
     $recordModel->set('time_start', $startTime);
     //End Date and Time values
     $endTime = $request->get('time_end');
     $endDate = Vtiger_Date_UIType::getDBInsertedValue($request->get('due_date'));
     if ($endTime) {
         $endTime = Vtiger_Time_UIType::getTimeValueWithSeconds($endTime);
         $endDateTime = Vtiger_Datetime_UIType::getDBDateTimeValue($request->get('due_date') . " " . $endTime);
         list($endDate, $endTime) = explode(' ', $endDateTime);
     }
     $recordModel->set('time_end', $endTime);
     $recordModel->set('due_date', $endDate);
     $activityType = $request->get('activitytype');
     if (empty($activityType)) {
         $recordModel->set('activitytype', 'Task');
         $recordModel->set('visibility', 'Private');
     }
     //Due to dependencies on the older code
     $setReminder = $request->get('set_reminder');
     if ($setReminder) {
         $_REQUEST['set_reminder'] = 'Yes';
     } else {
         $_REQUEST['set_reminder'] = 'No';
     }
     $time = strtotime($request->get('time_end')) - strtotime($request->get('time_start'));
     $diffinSec = strtotime($request->get('due_date')) - strtotime($request->get('date_start'));
     $diff_days = floor($diffinSec / (60 * 60 * 24));
     $hours = (double) $time / 3600 + $diff_days * 24;
     $minutes = ((double) $hours - (int) $hours) * 60;
     $recordModel->set('duration_hours', (int) $hours);
     $recordModel->set('duration_minutes', round($minutes, 0));
     return $recordModel;
 }
开发者ID:awflu,项目名称:YetiForceCRM,代码行数:85,代码来源:Save.php

示例10: Events

 function Events($request, $moduleName)
 {
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $viewer = $this->getViewer($request);
     $record = $request->get('record');
     if (!empty($record) && $request->get('isDuplicate') == true) {
         $recordModel = Vtiger_Record_Model::getInstanceById($record, $moduleName);
         $viewer->assign('MODE', '');
     } else {
         if (!empty($record)) {
             $recordModel = Vtiger_Record_Model::getInstanceById($record, $moduleName);
             $viewer->assign('MODE', 'edit');
             $viewer->assign('RECORD_ID', $record);
         } else {
             $recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
             $viewer->assign('MODE', '');
         }
     }
     $eventModule = Vtiger_Module_Model::getInstance($moduleName);
     $recordModel->setModuleFromInstance($eventModule);
     $moduleModel = $recordModel->getModule();
     $fieldList = $moduleModel->getFields();
     $requestFieldList = array_intersect_key($request->getAll(), $fieldList);
     foreach ($requestFieldList as $fieldName => $fieldValue) {
         $fieldModel = $fieldList[$fieldName];
         $specialField = false;
         // We collate date and time part together in the EditView UI handling
         // so a bit of special treatment is required if we come from QuickCreate
         if (empty($record) && ($fieldName == 'time_start' || $fieldName == 'time_end') && !empty($fieldValue)) {
             $specialField = true;
             // Convert the incoming user-picked time to GMT time
             // which will get re-translated based on user-time zone on EditForm
             $fieldValue = DateTimeField::convertToDBTimeZone($fieldValue)->format("H:i");
         }
         if (empty($record) && ($fieldName == 'date_start' || $fieldName == 'due_date') && !empty($fieldValue)) {
             if ($fieldName == 'date_start') {
                 $startTime = Vtiger_Time_UIType::getTimeValueWithSeconds($requestFieldList['time_start']);
                 $startDateTime = Vtiger_Datetime_UIType::getDBDateTimeValue($fieldValue . " " . $startTime);
                 list($startDate, $startTime) = explode(' ', $startDateTime);
                 $fieldValue = Vtiger_Date_UIType::getDisplayDateValue($startDate);
             } else {
                 $endTime = Vtiger_Time_UIType::getTimeValueWithSeconds($requestFieldList['time_end']);
                 $endDateTime = Vtiger_Datetime_UIType::getDBDateTimeValue($fieldValue . " " . $endTime);
                 list($endDate, $endTime) = explode(' ', $endDateTime);
                 $fieldValue = Vtiger_Date_UIType::getDisplayDateValue($endDate);
             }
         }
         if ($fieldModel->isEditable() || $specialField) {
             $recordModel->set($fieldName, $fieldModel->getDBInsertValue($fieldValue));
         }
     }
     $recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($recordModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_EDIT);
     $viewMode = $request->get('view_mode');
     if (!empty($viewMode)) {
         $viewer->assign('VIEW_MODE', $viewMode);
     }
     $userChangedEndDateTime = $request->get('userChangedEndDateTime');
     //If followup value is passed from request to process the value and sent to client
     $requestFollowUpDate = $request->get('followup_date_start');
     $requestFollowUpTime = $request->get('followup_time_start');
     $followUpStatus = $request->get('followup');
     $eventStatus = $request->get('eventstatus');
     if (!empty($requestFollowUpDate)) {
         $followUpDate = $requestFollowUpDate;
     }
     if (!empty($requestFollowUpTime)) {
         $followUpTime = $requestFollowUpTime;
     }
     if ($followUpStatus == 'on') {
         $viewer->assign('FOLLOW_UP_STATUS', TRUE);
     }
     if ($eventStatus == 'Held') {
         $viewer->assign('SHOW_FOLLOW_UP', TRUE);
     } else {
         $viewer->assign('SHOW_FOLLOW_UP', FALSE);
     }
     $viewer->assign('USER_CHANGED_END_DATE_TIME', $userChangedEndDateTime);
     $viewer->assign('FOLLOW_UP_DATE', $followUpDate);
     $viewer->assign('FOLLOW_UP_TIME', $followUpTime);
     $viewer->assign('RECURRING_INFORMATION', $recordModel->getRecurrenceInformation());
     $viewer->assign('TOMORROWDATE', Vtiger_Date_UIType::getDisplayDateValue(date('Y-m-d', time() + 86400)));
     $viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);
     $viewer->assign('RECORD_STRUCTURE', $recordStructureInstance->getStructure());
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('CURRENTDATE', date('Y-n-j'));
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $existingRelatedContacts = $recordModel->getRelatedContactInfo();
     //To add contact ids that is there in the request . Happens in gotoFull form mode of quick create
     $requestContactIdValue = $request->get('contact_id');
     if (!empty($requestContactIdValue)) {
         $existingRelatedContacts[] = array('name' => Vtiger_Util_Helper::getRecordName($requestContactIdValue), 'id' => $requestContactIdValue);
     }
     $viewer->assign('RELATED_CONTACTS', $existingRelatedContacts);
     $isRelationOperation = $request->get('relationOperation');
     //if it is relation edit
     $viewer->assign('IS_RELATION_OPERATION', $isRelationOperation);
     if ($isRelationOperation) {
         $viewer->assign('SOURCE_MODULE', $request->get('sourceModule'));
         $viewer->assign('SOURCE_RECORD', $request->get('sourceRecord'));
     }
//.........这里部分代码省略.........
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:101,代码来源:Edit.php

示例11: process

 public function process(Vtiger_Request $request)
 {
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $record = $request->get('record');
     if (!empty($record) && $request->get('isDuplicate') == true) {
         $recordModel = $this->record ? $this->record : Vtiger_Record_Model::getInstanceById($record, $moduleName);
         $viewer->assign('MODE', '');
         //While Duplicating record, If the related record is deleted then we are removing related record info in record model
         $mandatoryFieldModels = $recordModel->getModule()->getMandatoryFieldModels();
         foreach ($mandatoryFieldModels as $fieldModel) {
             if ($fieldModel->isReferenceField()) {
                 $fieldName = $fieldModel->get('name');
                 if (Vtiger_Util_Helper::checkRecordExistance($recordModel->get($fieldName))) {
                     $recordModel->set($fieldName, '');
                 }
             }
         }
     } else {
         if (!empty($record)) {
             $recordModel = $this->record ? $this->record : Vtiger_Record_Model::getInstanceById($record, $moduleName);
             $viewer->assign('RECORD_ID', $record);
             $viewer->assign('MODE', 'edit');
         } else {
             $recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
             $viewer->assign('MODE', '');
         }
     }
     if (!$this->record) {
         $this->record = $recordModel;
     }
     $moduleModel = $recordModel->getModule();
     $fieldList = $moduleModel->getFields();
     $requestFieldList = array_intersect_key($request->getAll(), $fieldList);
     foreach ($requestFieldList as $fieldName => $fieldValue) {
         $fieldModel = $fieldList[$fieldName];
         $specialField = false;
         // We collate date and time part together in the EditView UI handling
         // so a bit of special treatment is required if we come from QuickCreate
         if ($moduleName == 'Calendar' && empty($record) && $fieldName == 'time_start' && !empty($fieldValue)) {
             $specialField = true;
             // Convert the incoming user-picked time to GMT time
             // which will get re-translated based on user-time zone on EditForm
             $fieldValue = DateTimeField::convertToDBTimeZone($fieldValue)->format("H:i");
         }
         if ($moduleName == 'Calendar' && empty($record) && $fieldName == 'date_start' && !empty($fieldValue)) {
             $startTime = Vtiger_Time_UIType::getTimeValueWithSeconds($requestFieldList['time_start']);
             $startDateTime = Vtiger_Datetime_UIType::getDBDateTimeValue($fieldValue . " " . $startTime);
             list($startDate, $startTime) = explode(' ', $startDateTime);
             $fieldValue = Vtiger_Date_UIType::getDisplayDateValue($startDate);
         }
         if ($fieldModel->isEditable() || $specialField) {
             $recordModel->set($fieldName, $fieldModel->getDBInsertValue($fieldValue));
         }
     }
     // SalesPlatform.ru begin Unifying method for EditView preparing
     $recordModel = prepareEditView($recordModel, $_REQUEST, $viewer);
     // SalesPlatform.ru end
     // SalesPlatform.ru begin Set company
     if ($request->get('relationOperation')) {
         $sourceRecordModel = Vtiger_Record_Model::getInstanceById($request->get('sourceRecord'));
         if ($sourceRecordModel->get('spcompany') != null && $sourceRecordModel->get('spcompany') != '') {
             if ($recordModel->getField('spcompany')) {
                 $recordModel->set('spcompany', $sourceRecordModel->get('spcompany'));
             }
         }
     }
     // SalesPlatform.ru end
     $recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($recordModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_EDIT);
     $picklistDependencyDatasource = Vtiger_DependencyPicklist::getPicklistDependencyDatasource($moduleName);
     // SalesPlatform.ru begin Field Validation Information
     $tabid = getTabid($moduleName);
     $validationData = getDBValidationData($recordModel->get('tab_name'), $tabid);
     $validationArray = split_validationdataArray($validationData);
     $viewer->assign("VALIDATION_DATA_FIELDNAME", $validationArray['fieldname']);
     $viewer->assign("VALIDATION_DATA_FIELDDATATYPE", $validationArray['datatype']);
     $viewer->assign("VALIDATION_DATA_FIELDLABEL", $validationArray['fieldlabel']);
     $viewer->assign('ID', $record);
     // SalesPlatform.ru end
     $viewer->assign('PICKIST_DEPENDENCY_DATASOURCE', Zend_Json::encode($picklistDependencyDatasource));
     $viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);
     $viewer->assign('RECORD_STRUCTURE', $recordStructureInstance->getStructure());
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('CURRENTDATE', date('Y-n-j'));
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $isRelationOperation = $request->get('relationOperation');
     //if it is relation edit
     $viewer->assign('IS_RELATION_OPERATION', $isRelationOperation);
     if ($isRelationOperation) {
         $viewer->assign('SOURCE_MODULE', $request->get('sourceModule'));
         $viewer->assign('SOURCE_RECORD', $request->get('sourceRecord'));
     }
     $viewer->assign('MAX_UPLOAD_LIMIT_MB', Vtiger_Util_Helper::getMaxUploadSize());
     $viewer->assign('MAX_UPLOAD_LIMIT', vglobal('upload_maxsize'));
     // SalesPlatform.ru begin enable/disable button Import
     $instance = Vtiger_Module::getInstance('SPSocialConnector');
     $fl_import_button = true;
     if (empty($record) || $instance->presence == 1) {
         $fl_import_button = false;
     }
//.........这里部分代码省略.........
开发者ID:gitter-badger,项目名称:openshift-salesplatform,代码行数:101,代码来源:Edit.php

示例12: process

 public function process(Vtiger_Request $request)
 {
     $adb = PearDatabase::getInstance();
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $record = $request->get('record');
     if (!empty($record) && $request->get('isDuplicate') == true) {
         $recordModel = $this->record ? $this->record : Vtiger_Record_Model::getInstanceById($record, $moduleName);
         $viewer->assign('MODE', '');
     } else {
         if (!empty($record)) {
             $recordModel = $this->record ? $this->record : Vtiger_Record_Model::getInstanceById($record, $moduleName);
             $viewer->assign('RECORD_ID', $record);
             $viewer->assign('MODE', 'edit');
         } else {
             $recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
             $viewer->assign('MODE', '');
         }
     }
     if (!$this->record) {
         $this->record = $recordModel;
     }
     $moduleModel = $recordModel->getModule();
     $fieldList = $moduleModel->getFields();
     $requestFieldList = array_intersect_key($request->getAll(), $fieldList);
     foreach ($requestFieldList as $fieldName => $fieldValue) {
         $fieldModel = $fieldList[$fieldName];
         $specialField = false;
         // We collate date and time part together in the EditView UI handling
         // so a bit of special treatment is required if we come from QuickCreate
         if ($moduleName == 'Calendar' && empty($record) && $fieldName == 'time_start' && !empty($fieldValue)) {
             $specialField = true;
             // Convert the incoming user-picked time to GMT time
             // which will get re-translated based on user-time zone on EditForm
             $fieldValue = DateTimeField::convertToDBTimeZone($fieldValue)->format("H:i");
         }
         if ($moduleName == 'Calendar' && empty($record) && $fieldName == 'date_start' && !empty($fieldValue)) {
             $startTime = Vtiger_Time_UIType::getTimeValueWithSeconds($requestFieldList['time_start']);
             $startDateTime = Vtiger_Datetime_UIType::getDBDateTimeValue($fieldValue . " " . $startTime);
             list($startDate, $startTime) = explode(' ', $startDateTime);
             $fieldValue = Vtiger_Date_UIType::getDisplayDateValue($startDate);
         }
         if ($fieldModel->isEditable() || $specialField) {
             $recordModel->set($fieldName, $fieldModel->getDBInsertValue($fieldValue));
         }
     }
     $recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($recordModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_EDIT);
     $picklistDependencyDatasource = Vtiger_DependencyPicklist::getPicklistDependencyDatasource($moduleName);
     $viewer->assign('PICKIST_DEPENDENCY_DATASOURCE', Zend_Json::encode($picklistDependencyDatasource));
     $mappingRelatedField = $moduleModel->getMappingRelatedField($moduleName);
     $viewer->assign('MAPPING_RELATED_FIELD', Zend_Json::encode($mappingRelatedField));
     $viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);
     $viewer->assign('RECORD_STRUCTURE', $recordStructureInstance->getStructure());
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('BLOCK_LIST', $moduleModel->getBlocks());
     $viewer->assign('CURRENTDATE', date('Y-n-j'));
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $viewer->assign('RECORD_MODEL', $recordModel);
     $isRelationOperation = $request->get('relationOperation');
     //if it is relation edit
     $viewer->assign('IS_RELATION_OPERATION', $isRelationOperation);
     if ($isRelationOperation) {
         $viewer->assign('SOURCE_MODULE', $request->get('sourceModule'));
         $viewer->assign('SOURCE_RECORD', $request->get('sourceRecord'));
     }
     $viewer->assign('MAX_UPLOAD_LIMIT_MB', vglobal('upload_maxsize') / 1000000);
     $viewer->assign('MAX_UPLOAD_LIMIT', vglobal('upload_maxsize'));
     // check if passwords are encrypted
     if (file_exists('modules/OSSPasswords/config.ini')) {
         // encryption key exists so passwords are encrypted
         $config = parse_ini_file('modules/OSSPasswords/config.ini');
         // let smarty know that passwords are encrypted
         $viewer->assign('ENCRYPTED', true);
         $viewer->assign('ENC_KEY', $config['key']);
         $viewer->assign('RECORD', $_GET['record']);
         $viewer->assign('VIEW', $_GET['view']);
     } else {
         $viewer->assign('ENCRYPTED', false);
         $viewer->assign('ENC_KEY', '');
         $viewer->assign('RECORD', $_GET['record']);
         $viewer->assign('VIEW', $_GET['view']);
     }
     // widget button
     // get min, max, allow_chars from vtiger_passwords_config
     $result = $adb->query("SELECT * FROM vtiger_passwords_config WHERE 1 LIMIT 1", true);
     $min = $adb->query_result($result, 0, 'pass_length_min');
     $max = $adb->query_result($result, 0, 'pass_length_max');
     $allow_chars = $adb->query_result($result, 0, 'pass_allow_chars');
     $GenerateButton = 'Generate Password';
     $ConfigureButton = 'LBL_ConfigurePass';
     $viewer = $this->getViewer($request);
     $viewer->assign('GENERATEPASS', $GenerateButton);
     $viewer->assign('GENERATEONCLICK', 'generate_password(' . $min . ',' . $max . ',\'' . $allow_chars . '\');');
     $viewer->view('EditView.tpl', $moduleName);
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:95,代码来源:Edit.php

示例13: getRecordModelFromRequest

 /**
  * Function to get the record model based on the request parameters
  * @param Vtiger_Request $request
  * @return Vtiger_Record_Model or Module specific Record Model instance
  */
 public function getRecordModelFromRequest(Vtiger_Request $request)
 {
     $recordModel = parent::getRecordModelFromRequest($request);
     $startDate = $request->get('date_start');
     if (!empty($startDate)) {
         //Start Date and Time values
         $startTime = Vtiger_Time_UIType::getTimeValueWithSeconds($request->get('time_start'));
         $startDate = Vtiger_Date_UIType::getDBInsertedValue($request->get('date_start'));
         if ($startTime) {
             $startDateTime = Vtiger_Datetime_UIType::getDBDateTimeValue($request->get('date_start') . " " . $startTime);
             list($startDate, $startTime) = explode(' ', $startDateTime);
         }
         $recordModel->set('date_start', $startDate);
         $recordModel->set('time_start', $startTime);
     }
     $endDate = $request->get('due_date');
     if (!empty($endDate)) {
         //End Date and Time values
         $endTime = $request->get('time_end');
         $endDate = Vtiger_Date_UIType::getDBInsertedValue($request->get('due_date'));
         if ($endTime) {
             $endTime = Vtiger_Time_UIType::getTimeValueWithSeconds($endTime);
             $endDateTime = Vtiger_Datetime_UIType::getDBDateTimeValue($request->get('due_date') . " " . $endTime);
             list($endDate, $endTime) = explode(' ', $endDateTime);
         }
         $recordModel->set('time_end', $endTime);
         $recordModel->set('due_date', $endDate);
     }
     $record = $request->get('record');
     if (!$record) {
         $activityType = $request->get('activitytype');
         $visibility = $request->get('visibility');
         if (empty($activityType)) {
             $recordModel->set('activitytype', 'Task');
             $visibility = 'Private';
             $recordModel->set('visibility', $visibility);
         }
     }
     if (empty($visibility)) {
         $assignedUserId = $recordModel->get('assigned_user_id');
         $sharedType = Calendar_Module_Model::getSharedType($assignedUserId);
         if ($sharedType == 'selectedusers') {
             $sharedType = 'public';
         }
         $recordModel->set('visibility', ucfirst($sharedType));
     }
     $time = strtotime($endTime) - strtotime($startTime);
     $diffinSec = strtotime($endDate) - strtotime($startDate);
     $diff_days = floor($diffinSec / (60 * 60 * 24));
     $hours = (double) $time / 3600 + $diff_days * 24;
     $minutes = ((double) $hours - (int) $hours) * 60;
     $recordModel->set('duration_hours', (int) $hours);
     $recordModel->set('duration_minutes', round($minutes, 0));
     return $recordModel;
 }
开发者ID:rcrrich,项目名称:YetiForceCRM,代码行数:60,代码来源:SaveAjax.php

示例14: getRecordModelFromRequest

 /**
  * Function to get the record model based on the request parameters
  * @param Vtiger_Request $request
  * @return Vtiger_Record_Model or Module specific Record Model instance
  */
 protected function getRecordModelFromRequest(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $recordId = $request->get('record');
     $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
     if (!empty($recordId)) {
         $recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
         $modelData = $recordModel->getData();
         $recordModel->set('id', $recordId);
         $recordModel->set('mode', 'edit');
         //Due to dependencies on the activity_reminder api in Activity.php(5.x)
         $_REQUEST['mode'] = 'edit';
     } else {
         $recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
         $modelData = $recordModel->getData();
         $recordModel->set('mode', '');
     }
     $fieldModelList = $moduleModel->getFields();
     foreach ($fieldModelList as $fieldName => $fieldModel) {
         $fieldValue = $request->get($fieldName, null);
         if ($fieldValue !== null) {
             if (!is_array($fieldValue)) {
                 $fieldValue = trim($fieldValue);
             }
             $recordModel->set($fieldName, $fieldValue);
         }
     }
     //Start Date and Time values
     $startTime = Vtiger_Time_UIType::getTimeValueWithSeconds($request->get('time_start'));
     $startDateTime = Vtiger_Datetime_UIType::getDBDateTimeValue($request->get('date_start') . " " . $startTime);
     list($startDate, $startTime) = explode(' ', $startDateTime);
     $recordModel->set('date_start', $startDate);
     $recordModel->set('time_start', $startTime);
     //End Date and Time values
     $endTime = $request->get('time_end');
     $endDate = Vtiger_Date_UIType::getDBInsertedValue($request->get('due_date'));
     if ($endTime) {
         $endTime = Vtiger_Time_UIType::getTimeValueWithSeconds($endTime);
         $endDateTime = Vtiger_Datetime_UIType::getDBDateTimeValue($request->get('due_date') . " " . $endTime);
         list($endDate, $endTime) = explode(' ', $endDateTime);
     }
     $recordModel->set('time_end', $endTime);
     $recordModel->set('due_date', $endDate);
     $activityType = $request->get('activitytype');
     if (empty($activityType)) {
         $recordModel->set('activitytype', 'Task');
         $recordModel->set('visibility', 'Private');
     }
     //Due to dependencies on the older code
     $setReminder = $request->get('set_reminder');
     if ($setReminder == 'on') {
         $_REQUEST['set_reminder'] = 'Yes';
     } else {
         $_REQUEST['set_reminder'] = 'No';
     }
     $time = strtotime($request->get('due_date')) - strtotime($request->get('date_start'));
     $hours = (double) $time / 3600;
     $minutes = ((double) $hours - (int) $hours) * 60;
     $recordModel->set('duration_hours', (int) $hours);
     $recordModel->set('duration_minutes', $minutes);
     return $recordModel;
 }
开发者ID:nouphet,项目名称:vtigercrm-6.0.0-ja,代码行数:67,代码来源:Save.php

示例15: 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::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 CASE WHEN vtiger_activity.activitytype='Task' THEN due_date >= '{$currentDate}' ELSE CONCAT(due_date,' ',time_end) >= '{$nowInDBFormat}' END";
     } elseif ($mode === 'overdue') {
         $query .= " AND CASE WHEN vtiger_activity.activitytype='Task' THEN due_date < '{$currentDate}' ELSE CONCAT(due_date,' ',time_end) < '{$nowInDBFormat}' END";
     }
     $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);
         if ($row['activitytype'] == 'Task') {
             $due_date = $row["due_date"];
             $dayEndTime = "23:59:59";
             $EndDateTime = Vtiger_Datetime_UIType::getDBDateTimeValue($due_date . " " . $dayEndTime);
             $dueDateTimeInDbFormat = explode(' ', $EndDateTime);
             $dueTimeInDbFormat = $dueDateTimeInDbFormat[1];
             $model->set('time_end', $dueTimeInDbFormat);
         }
         $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:cannking,项目名称:vtigercrm-debug,代码行数:63,代码来源:Module.php


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