Easy PHP Calendar - We really take care of your dates!


Go Back   Easy PHP Calendar > General Discussion > Customizations (Themes / Templates)

Customizations (Themes / Templates) Help with customizing the themes and templates. Post your own custom themes for others to enjoy.

Closed Thread
 
Thread Tools Search this Thread Display Modes

Parsing Outlook file...
Old 09-27-2006, 11:16 PM   #1
teeohhem
Calendar User
 
teeohhem is offline
Join Date: Sep 2006
Posts: 2
Cool Parsing Outlook file...

I found an old script on the internet to parse a .csv file and integrate it into version 4 of this calendar script. How can I change it and how do I integrate it so it will work for version 6?

It is as follows:

Code:
I have developed a script for parsing a MS Outlook calendar dump.

In escal.php add the following code at line 53 after the setting for $readFile:


// READ EVENTS CALENDAR FROM OUTLOOK CSV FILE
// $readCSV=1 :: Read dates and events for marking the calendar from an Outlook '.CSV' file.
// That file sould be located in the same directory as this script.
// Setting $readCSV to any number but one (1), the script will NOT attempt to read the .CSV file.
$readCSV=0;


and then add this code at line 136 <before '// LOAD MARKING INFO FROM FILE'>:


////////////////////////////////////////////////////////////////////////////////////
// &nbsp;Import and parse Outlook Calendar data from CSV file
//
// &nbsp;Outlook Calendar fields available:
// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1 "Subject", 
// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2 "Start Date", 
// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 3 "Start Time", &nbsp;
// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 4 "End Date", 
// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5 "End Time", 
// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 6 "All day event",
// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 7 "Reminder on/off",
// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 8 "Reminder Date",
// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 9 "Reminder Time",
// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 10 "Meeting Organizer",
// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 11 "Required Attendees",
// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 12 "Optional Attendees",
// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 13 "Meeting Resources",
// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 14 "Billing Information",
// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 15 "Categories",
// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 16 "Description", 
// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 17 "Location", 
// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 18 "Mileage",
// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 19 "Priority",
// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 20 "Private",
// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 21 "Sensitivity",
// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 22 "Show time as"
//
// &nbsp;The file created is a comma delimited text file with the extension '.CSV'
// &nbsp;The user has the choice to use any or all of the fields and chnage the
// &nbsp;order as they appear in the file. Outlook also includes the field names
// &nbsp;present, in the order sent, as the first line in the text file. This script
// &nbsp;will first read that line and save the array key for each element that
// &nbsp;is to be used. The other items are ignored. Then the rest of the calendar 
// &nbsp;file is read, and parsed. 
////////////////////////////////////////////////////////////////////////////////////
if($readCSV==1){
 &nbsp;if(file_exists("outlook.CSV")){ // does the file exist?
 &nbsp; &nbsp;$fp=fopen("outlook.CSV","r"); // open it for reading
 &nbsp;$ndxRow=1; // the first row of data is always the field index
 &nbsp; unset($strd, $endd, $subj, $strt, $loct); // initialize key variables
 &nbsp;Do{
 &nbsp;	$cal_dat = fgetcsv($fp,10000,","); // start reading the file one row at a time
 &nbsp;if(!$cal_dat) break; // if the file is empty; abort!
 &nbsp;if($ndxRow){ // first time through
 &nbsp;	foreach($cal_dat as $key=>$fieldName){ // loop through all array elements
 &nbsp; &nbsp;switch($fieldName){ // find the desired field names
 &nbsp; &nbsp; &nbsp; &nbsp;case "Start Date": $strd=$key;
 &nbsp; &nbsp; &nbsp; &nbsp;case "End Date": &nbsp; $endd=$key;
 &nbsp; &nbsp; &nbsp; &nbsp;case "Subject": &nbsp; &nbsp;$subj=$key;
 &nbsp; &nbsp; &nbsp; &nbsp;case "Start Time": $srtt=$key;
 &nbsp; &nbsp; &nbsp; &nbsp;case "Location": &nbsp; $loct=$key;
 &nbsp; &nbsp;} // end switch
 &nbsp;	} // end foreach element
 &nbsp;	$ndxRow--; // decrement this variable, allow parsing the rest
 &nbsp;}
 &nbsp;else{ // all the rest of the data file
 &nbsp;	$es .= "$cal_dat[$strd]x"; // event start date
 &nbsp;	if($cal_dat[$endd]!=""){ &nbsp; // event end date
 &nbsp; &nbsp;$ee .= "$cal_dat[$endd]x";
 &nbsp;	}
 &nbsp;	else{ // if no end date, make it the same as start date
 &nbsp; &nbsp;$ee .= "$cal_dat[$strd]x";
 &nbsp;	} // end set start and end date
 &nbsp;	if(IsSet($subj) && ($cal_dat[$subj]!="")){ // what is the subject <aka. description>
 &nbsp; &nbsp;$cal_dat[$subj]=htmlspecialchars($cal_dat[$subj],  ENT_QUOTES);
 &nbsp; &nbsp;$eTitle .= "$cal_dat[$subj]";
 &nbsp; &nbsp;if(IsSet($loct) && ($cal_dat[$loct]!="")){ // append the event location 
 &nbsp; &nbsp; &nbsp;	$eTitle .= " &nbsp;at" . $cal_dat[$loct];
 &nbsp; &nbsp; &nbsp;} // end if location is set
 &nbsp; &nbsp;if(IsSet($srtt)){ // append the start time for the event 
 &nbsp; &nbsp; &nbsp;	$eTitle .= date(" -- g:i A",strtotime($cal_dat[$srtt]));
 &nbsp; &nbsp; &nbsp;} // end if start time is set
 &nbsp; &nbsp;$eTitle .= "||";
 &nbsp;	}
 &nbsp;	else{
 &nbsp; &nbsp;$eTitle .=" ||"; // There is no subject <description> for this event
 &nbsp;	}// end if a subject exists
 &nbsp;}// end if row on or rest of data
 &nbsp;}WHILE($cal_dat);
 &nbsp;fclose($fp);
 &nbsp;} // end if file exists
} // end if read CSV is set &nbsp; &nbsp; &nbsp;
Thanks,
Tom
 

Old 09-28-2006, 09:55 AM   #2
Brian
EPC Developer
 
Brian's Avatar
 
Brian is offline
Join Date: Jun 2001
Location: Florida, USA
Posts: 10,907
Default

The database structure and column types and very different from the current version. I don't believe this script can be modified to do this.
__________________
-- Brian

Questions?

Instructions | FAQs | Errors FAQ | Forums | Support
| Web Site Hosting
 

Get version 4?
Old 09-28-2006, 07:15 PM   #3
teeohhem
Calendar User
 
teeohhem is offline
Join Date: Sep 2006
Posts: 2
Default Get version 4?

Is there any way to obtain version 4 of your script so that I can implement this function? I think it is extremely useful and will definitely help me in the future.

Thanks!

Tom
 

Old 09-28-2006, 09:30 PM   #4
Brian
EPC Developer
 
Brian's Avatar
 
Brian is offline
Join Date: Jun 2001
Location: Florida, USA
Posts: 10,907
Default

Unfortunately, that version hasn't been available for years...
__________________
-- Brian

Questions?

Instructions | FAQs | Errors FAQ | Forums | Support
| Web Site Hosting
 
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Corrupt File badhaircut Installation / Upgrade Questions 6 07-29-2006 08:22 AM
No XML file in EasyPHP Calendar! can't install in Mambo aliweb Mambo/Joomla Integration 1 05-02-2006 11:41 AM
Event Creation - Flat File mcfatema@iowatelecom.net General Support 4 11-01-2004 10:49 PM
flat file newbie question mmcneal76 General Support 5 08-03-2004 01:17 PM
Version 4.0 Beta Discussion tomB General Support 22 11-12-2003 01:26 PM



All times are GMT -4. The time now is 04:25 AM.


vBulletin skins developed by: eXtremepixels
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright 2009 NashTech, Inc.

| Home | Register | Today's Posts | Search | New Posts |