![]() |
|---|
| [ Index ] |
Source Code Reference for V1.00 |
[Summary view] [Print] [Text view]
1 <?php /* $Id: index.php 102 2008-03-18 19:52:59Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/calendar/index.php $ */ 2 if (!defined('W2P_BASE_DIR')) { 3 die('You should not access this file directly.'); 4 } 5 6 // check permissions for this record 7 $perms = &$AppUI->acl(); 8 $canRead = $perms->checkModule($m, 'view'); 9 10 if (!$canRead) { 11 $AppUI->redirect('m=public&a=access_denied'); 12 } 13 14 $AppUI->savePlace(); 15 16 w2PsetMicroTime(); 17 18 require_once ($AppUI->getModuleClass('companies')); 19 require_once ($AppUI->getModuleClass('tasks')); 20 21 // retrieve any state parameters 22 if (isset($_REQUEST['company_id'])) { 23 $AppUI->setState('CalIdxCompany', intval(w2PgetParam($_REQUEST, 'company_id', 0))); 24 } 25 $company_id = $AppUI->getState('CalIdxCompany', 0); 26 27 // Using simplified set/get semantics. Doesn't need as much code in the module. 28 $event_filter = $AppUI->checkPrefState('CalIdxFilter', w2PgetParam($_REQUEST, 'event_filter', ''), 'EVENTFILTER', 'my'); 29 30 // get the passed timestamp (today if none) 31 $ctoday = new CDate(); 32 $today = $ctoday->format(FMT_TIMESTAMP_DATE); 33 $date = w2PgetParam($_GET, 'date', $today); 34 35 // get the list of visible companies 36 $company = new CCompany(); 37 $companies = $company->getAllowedRecords($AppUI->user_id, 'company_id,company_name', 'company_name'); 38 $companies = arrayMerge(array('0' => $AppUI->_('All')), $companies); 39 40 #echo '<pre>';print_r($events);echo '</pre>'; 41 // setup the title block 42 $titleBlock = new CTitleBlock('Monthly Calendar', 'myevo-appointments.png', $m, $m . '.' . $a); 43 $titleBlock->addCell($AppUI->_('Company') . ':'); 44 $titleBlock->addCrumb('?m=calendar&a=year_view&date=' . $date, 'year view'); 45 $titleBlock->addCell(arraySelect($companies, 'company_id', 'onChange="document.pickCompany.submit()" class="text"', $company_id), '', '<form action="' . $_SERVER['REQUEST_URI'] . '" method="post" name="pickCompany">', '</form>'); 46 $titleBlock->addCell($AppUI->_('Event Filter') . ':'); 47 $titleBlock->addCell(arraySelect($event_filter_list, 'event_filter', 'onChange="document.pickFilter.submit()" class="text"', $event_filter, true), '', "<Form action='{$_SERVER['REQUEST_URI']}' method='post' name='pickFilter'>", '</form>'); 48 $titleBlock->show(); 49 ?> 50 51 <script language="javascript"> 52 function clickDay( uts, fdate ) { 53 window.location = './index.php?m=calendar&a=day_view&date='+uts+'&tab=0'; 54 } 55 function clickWeek( uts, fdate ) { 56 window.location = './index.php?m=calendar&a=week_view&date='+uts; 57 } 58 </script> 59 60 <table cellspacing="0" cellpadding="0" border="0" width="100%"><tr><td> 61 <?php 62 // establish the focus 'date' 63 $date = new CDate($date); 64 65 // prepare time period for 'events' 66 $first_time = new CDate($date); 67 $first_time->setDay(1); 68 $first_time->setTime(0, 0, 0); 69 $first_time->subtractSeconds(1); 70 $last_time = new CDate($date); 71 $last_time->setDay($date->getDaysInMonth()); 72 $last_time->setTime(23, 59, 59); 73 74 $links = array(); 75 76 // assemble the links for the tasks 77 require_once (W2P_BASE_DIR . '/modules/calendar/links_tasks.php'); 78 getTaskLinks($first_time, $last_time, $links, 20, $company_id); 79 80 // assemble the links for the events 81 require_once (W2P_BASE_DIR . '/modules/calendar/links_events.php'); 82 getEventLinks($first_time, $last_time, $links, 20); 83 84 // create the main calendar 85 $cal = new CMonthCalendar($date); 86 $cal->setStyles('motitle', 'mocal'); 87 $cal->setLinkFunctions('clickDay', 'clickWeek'); 88 $cal->setEvents($links); 89 90 echo $cal->show(); 91 //echo '<pre>';print_r($cal);echo '</pre>'; 92 93 // create the mini previous and next month calendars under 94 $minical = new CMonthCalendar($cal->prev_month); 95 $minical->setStyles('minititle', 'minical'); 96 $minical->showArrows = false; 97 $minical->showWeek = false; 98 $minical->clickMonth = true; 99 $minical->setLinkFunctions('clickDay'); 100 101 $first_time = new CDate($cal->prev_month); 102 $first_time->setDay(1); 103 $first_time->setTime(0, 0, 0); 104 $last_time = new CDate($cal->prev_month); 105 $last_time->setDay($cal->prev_month->getDaysInMonth()); 106 $last_time->setTime(23, 59, 59); 107 $links = array(); 108 getTaskLinks($first_time, $last_time, $links, 20, $company_id); 109 getEventLinks($first_time, $last_time, $links, 20); 110 $minical->setEvents($links); 111 112 echo '<table class="std" cellspacing="0" cellpadding="0" border="0" width="100%"><tr>'; 113 echo '<td valign="top" align="center" width="220">' . $minical->show() . '</td>'; 114 echo '<td valign="top" align="center" width="75%"> </td>'; 115 116 $minical->setDate($cal->next_month); 117 $first_time = new CDate($cal->next_month); 118 $first_time->setDay(1); 119 $first_time->setTime(0, 0, 0); 120 $last_time = new CDate($cal->next_month); 121 $last_time->setDay($cal->next_month->getDaysInMonth()); 122 $last_time->setTime(23, 59, 59); 123 $links = array(); 124 getTaskLinks($first_time, $last_time, $links, 20, $company_id, true); 125 getEventLinks($first_time, $last_time, $links, 20, true); 126 $minical->setEvents($links); 127 128 echo '<td valign="top" align="center" width="220">' . $minical->show() . '</td>'; 129 echo '</tr></table>'; 130 ?> 131 </td></tr></table>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Jan 7 03:00:01 2009 | Cross-referenced by PHPXref 0.7 |