[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 <?php 2 /*+*********************************************************************************** 3 * The contents of this file are subject to the vtiger CRM Public License Version 1.0 4 * ("License"); You may not use this file except in compliance with the License 5 * The Original Code is: vtiger CRM Open Source 6 * The Initial Developer of the Original Code is vtiger. 7 * Portions created by vtiger are Copyright (C) vtiger. 8 * All Rights Reserved. 9 *************************************************************************************/ 10 11 class Vtiger_Date_UIType extends Vtiger_Base_UIType { 12 13 /** 14 * Function to get the Template name for the current UI Type object 15 * @return <String> - Template Name 16 */ 17 public function getTemplateName() { 18 return 'uitypes/Date.tpl'; 19 } 20 21 /** 22 * Function to get the Display Value, for the current field type with given DB Insert Value 23 * @param <Object> $value 24 * @return <Object> 25 */ 26 public function getDisplayValue($value) { 27 if(empty($value)){ 28 return $value; 29 } else { 30 $dateValue = self::getDisplayDateValue($value); 31 } 32 33 if($dateValue == '--') { 34 return ""; 35 } else { 36 return $dateValue; 37 } 38 } 39 40 /** 41 * Function to get the Value of the field in the format, the user provides it on Save 42 * @param <Object> $value 43 * @return <Object> 44 */ 45 public function getUserRequestValue($value) { 46 return $this->getDisplayValue($value); 47 } 48 49 /** 50 * Function to get the DB Insert Value, for the current field type with given User Value 51 * @param <Object> $value 52 * @return <Object> 53 */ 54 public function getDBInsertValue($value) { 55 return self::getDBInsertedValue($value); 56 } 57 58 /** 59 * Function converts the date to database format 60 * @param <String> $value 61 * @return <String> 62 */ 63 public static function getDBInsertedValue($value) { 64 return DateTimeField::convertToDBFormat($value); 65 } 66 67 /** 68 * Function to get the display value in edit view 69 * @param $value 70 * @return converted value 71 */ 72 public function getEditViewDisplayValue($value) { 73 if (empty($value) || $value === ' ') { 74 $value = trim($value); 75 $fieldInstance = $this->get('field')->getWebserviceFieldObject(); 76 $moduleName = $this->get('field')->getModule()->getName(); 77 $fieldName = $fieldInstance->getFieldName(); 78 79 //Restricted Fields for to show Default Value 80 if (($fieldName === 'birthday' && $moduleName === 'Contacts') 81 || ($fieldName === 'validtill' && $moduleName === 'Quotes') 82 || $moduleName === 'Products' ) { 83 return $value; 84 } 85 86 //Special Condition for field 'support_end_date' in Contacts Module 87 if ($fieldName === 'support_end_date' && $moduleName === 'Contacts') { 88 $value = DateTimeField::convertToUserFormat(date('Y-m-d', strtotime("+1 year"))); 89 } elseif ($fieldName === 'support_start_date' && $moduleName === 'Contacts') { 90 $value = DateTimeField::convertToUserFormat(date('Y-m-d')); 91 } 92 } else { 93 $value = DateTimeField::convertToUserFormat($value); 94 } 95 return $value; 96 } 97 98 /** 99 * Function to get Date value for Display 100 * @param <type> $date 101 * @return <String> 102 */ 103 public static function getDisplayDateValue($date) { 104 $date = new DateTimeField($date); 105 return $date->getDisplayDate(); 106 } 107 108 /** 109 * Function to get DateTime value for Display 110 * @param <type> $dateTime 111 * @return <String> 112 */ 113 public static function getDisplayDateTimeValue($dateTime) { 114 $date = new DateTimeField($dateTime); 115 return $date->getDisplayDateTimeValue(); 116 } 117 118 public function getListSearchTemplateName() { 119 return 'uitypes/DateFieldSearchView.tpl'; 120 } 121 122 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |