[Vtigercrm-commits] [vtiger-commits] r6232 - /vtigercrm/trunk/modules/Calendar/CalendarCommon.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Sat May 20 10:09:02 EDT 2006


Author: saraj
Date: Sat May 20 08:08:58 2006
New Revision: 6232

Log:
function getaddEventPopupTime has been added

Modified:
    vtigercrm/trunk/modules/Calendar/CalendarCommon.php

Modified: vtigercrm/trunk/modules/Calendar/CalendarCommon.php
==============================================================================
--- vtigercrm/trunk/modules/Calendar/CalendarCommon.php (original)
+++ vtigercrm/trunk/modules/Calendar/CalendarCommon.php Sat May 20 08:08:58 2006
@@ -226,5 +226,60 @@
 	return $user_details;
 }
 
+function getaddEventPopupTime($starttime,$endtime,$format)
+{
+	$timearr = Array();
+	list($sthr,$stmin) = explode(":",$starttime);
+	list($edhr,$edmin)  = explode(":",$endtime);
+	if($format == 'am/pm')
+	{
+		$hr = $sthr+0;
+		if($hr <= 11)
+		{
+			$timearr['starthour'] = $sthr;
+			$timearr['startfmt'] = 'am';
+		}
+		else
+		{
+			$sthr = $sthr - 12;
+			if($sthr <= 9 && strlen(trim($sthr)) < 2)
+                        {
+                                $hrvalue= '0'.$sthr;
+                        }else $hrvalue=$edhr;
+			$timearr['starthour'] = $hrvalue;
+			$timearr['startfmt'] = 'pm';
+		}
+		$ehr = $edhr+0;
+                if($hr <= 11)
+                {
+                        $timearr['endhour'] = $edhr;
+                        $timearr['endfmt'] = 'am';
+                }
+                else
+                {
+                        $edhr = $edhr - 12;
+                        if($edhr <= 9 && strlen(trim($edhr)) < 2)
+                        {
+                                $hrvalue= '0'.$edhr;
+                        }else $hrvalue=$edhr;
+                        $timearr['endhour'] = $hrvalue;
+                        $timearr['endfmt'] = 'pm';
+                }
+		$timearr['startmin']  = $stmin;
+		$timearr['endmin']    = $edmin;
+		return $timearr;
+	}
+	if($format == '24')
+	{
+		$timearr['starthour'] = $sthr;
+		$timearr['startmin']  = $stmin;
+		$timearr['startfmt']  = '';
+		$timearr['endhour']   = $edhr;
+                $timearr['endmin']    = $edmin;
+		$timearr['endfmt']    = '';
+		return $timearr;
+	}
+}
+
 //Code Added by Minnie -Ends
 ?>





More information about the vtigercrm-commits mailing list