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


PHP Vtiger_Datetime_UIType类代码示例

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


在下文中一共展示了Vtiger_Datetime_UIType类的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: 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 ($fieldName == 'login_time' || $fieldName == 'logout_time') {
         if ($this->get($fieldName) != '0000-00-00 00:00:00') {
             return Vtiger_Datetime_UIType::getDateTimeValue($this->get($fieldName));
         } else {
             return '---';
         }
     } else {
         return $this->get($fieldName);
     }
 }
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:17,代码来源:Record.php

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

示例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;
        
		/**
		 * 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;
	}
开发者ID:jeremyevans6,项目名称:kulturedTiger-,代码行数:31,代码来源:Util.php

示例6: 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 '';
     }
 }
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:19,代码来源:Record.php

示例7: 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 '';
     }
 }
开发者ID:nouphet,项目名称:vtigercrm-6.0.0-ja,代码行数:11,代码来源:Record.php

示例8: process

 public function process(Vtiger_Request $request)
 {
     $log = vglobal('log');
     $log->debug('Start ' . __CLASS__ . ':' . __FUNCTION__);
     $db = PearDatabase::getInstance();
     $qualifiedModule = $request->getModule(false);
     $moduleModel = Settings_CurrencyUpdate_Module_Model::getCleanInstance();
     $currentUser = Users_Record_Model::getCurrentUserModel();
     // synchronise bank list
     $moduleModel->refreshBanks();
     $downloadBtn = !$request->isEmpty('download') ? $request->get('download') : false;
     $date = !$request->isEmpty('duedate') ? Vtiger_Datetime_UIType::getDBInsertedValue($request->get('duedate')) : false;
     $dateCur = '';
     if ($date) {
         // if its future date change it to present one
         if (strtotime($date) > strtotime(date('Y-m-d'))) {
             $date = date('Y-m-d');
         }
         $dateCur = $date;
     } else {
         $dateCur = date('Y-m-d');
     }
     // take currency rates for yesterday
     if (strcmp(date('Y-m-d'), $dateCur) == 0) {
         $dateCur = strtotime("-1 day", strtotime($dateCur));
         $dateCur = date('Y-m-d', $dateCur);
     }
     $dateCur = Vtiger_Functions::getLastWorkingDay($dateCur);
     // get currency if not already archived
     if ($downloadBtn) {
         $moduleModel->fetchCurrencyRates($dateCur);
     }
     $selectBankId = $moduleModel->getActiveBankId();
     $history = $moduleModel->getRatesHistory($selectBankId, $dateCur, $request);
     $bankTab = array();
     $bankSQL = "SELECT * FROM yetiforce_currencyupdate_banks";
     $bankResult = $db->query($bankSQL, true);
     $i = 0;
     while ($row = $db->fetchByAssoc($bankResult)) {
         $bankTab[$i]['id'] = $row['id'];
         $bankName = $row['bank_name'];
         $bankTab[$i]['bank_name'] = $bankName;
         $bankTab[$i]['active'] = $row['active'];
         $i++;
     }
     // number of currencies
     $curr_num = $moduleModel->getCurrencyNum();
     // get info about main currency
     $mainCurrencyInfo = Vtiger_Functions::getDefaultCurrencyInfo();
     $viewer = $this->getViewer($request);
     $viewer->assign('QUALIFIED_MODULE', $qualifiedModule);
     $viewer->assign('USER_MODEL', $currentUser);
     $viewer->assign('MODULE_MODEL', $moduleModel);
     $viewer->assign('MODULENAME', 'CurrencyUpdate');
     $viewer->assign('DATE', $request->has('duedate') ? Vtiger_Date_UIType::getDisplayValue($dateCur) : '');
     $viewer->assign('CURRNUM', $curr_num);
     $viewer->assign('BANK', $bankTab);
     $viewer->assign('HISTORIA', $history);
     $viewer->assign('MAINCURR', $mainCurrencyInfo);
     $viewer->assign('SUPPORTED_CURRENCIES', $moduleModel->getSupportedCurrencies());
     $viewer->assign('UNSUPPORTED_CURRENCIES', $moduleModel->getUnSupportedCurrencies());
     $viewer->view('Index.tpl', $qualifiedModule);
     $log->debug('End ' . __CLASS__ . ':' . __FUNCTION__);
 }
开发者ID:yozhi,项目名称:YetiForceCRM,代码行数:64,代码来源:Index.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


//.........这里部分代码省略.........
                     $parent = $request->get('_mlinkto');
                     $foldername = $request->get('_folder');
                     if (!empty($foldername)) {
                         // This is to handle larger uploads
                         $memory_limit = MailManager_Config_Model::get('MEMORY_LIMIT');
                         ini_set('memory_limit', $memory_limit);
                         $connector = $this->getConnector($foldername);
                         $mail = $connector->openMail($request->get('_msgno'));
                         $attachments = $mail->attachments();
                         // Initialize attachments
                     }
                     $linkedto = MailManager_Relate_Action::getSalesEntityInfo($parent);
                     $recordModel = Vtiger_Record_Model::getCleanInstance($linkModule);
                     $fields = $recordModel->getModule()->getFields();
                     foreach ($fields as $fieldName => $fieldModel) {
                         if ($request->has($fieldName)) {
                             $fieldValue = $request->get($fieldName);
                             $fieldDataType = $fieldModel->getFieldDataType();
                             if ($fieldDataType == 'time') {
                                 $fieldValue = Vtiger_Time_UIType::getTimeValueWithSeconds($fieldValue);
                             }
                             $recordModel->set($fieldName, $fieldValue);
                         }
                     }
                     switch ($linkModule) {
                         case 'Calendar':
                             $activityType = $recordModel->get('activitytype');
                             if (!$activityType) {
                                 $activityType = 'Task';
                             }
                             $recordModel->set('activitytype', $activityType);
                             //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
                             $endDate = Vtiger_Date_UIType::getDBInsertedValue($request->get('due_date'));
                             if ($activityType != 'Task') {
                                 $endTime = Vtiger_Time_UIType::getTimeValueWithSeconds($request->get('time_end'));
                                 $endDateTime = Vtiger_Datetime_UIType::getDBDateTimeValue($request->get('due_date') . " " . $endTime);
                                 list($endDate, $endTime) = explode(' ', $endDateTime);
                             } else {
                                 $endTime = '';
                             }
                             $recordModel->set('time_end', $endTime);
                             $recordModel->set('due_date', $endDate);
                             if ($parent) {
                                 if ($linkedto['module'] == 'Contacts') {
                                     $recordModel->set('contact_id', $parent);
                                 } else {
                                     $recordModel->set('parent_id', $parent);
                                 }
                             }
                             $recordModel->set('visibility', 'Public');
                             break;
                         case 'HelpDesk':
                             $from = $mail->from();
                             if ($parent) {
                                 if ($linkedto['module'] == 'Contacts') {
                                     $referenceFieldName = 'contact_id';
                                 } elseif ($linkedto['module'] == 'Accounts') {
                                     $referenceFieldName = 'parent_id';
                                 }
                             }
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:67,代码来源:Relation.php

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

示例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));
     }
     return $recordModel;
 }
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:53,代码来源:SaveAjax.php

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

示例15: 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;
 }
开发者ID:HoererUndFlamme,项目名称:YetiForceCRM,代码行数:41,代码来源:RelationListView.php


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