![]() |
|---|
| [ Index ] |
Source Code Reference for V1.00 |
[Summary view] [Print] [Text view]
1 <?php /* $Id: week_view.php 137 2008-04-04 16:12:02Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/calendar/week_view.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 global $locale_char_set; 16 17 require_once ($AppUI->getModuleClass('tasks')); 18 19 // retrieve any state parameters 20 if (isset($_REQUEST['company_id'])) { 21 $AppUI->setState('CalIdxCompany', intval(w2PgetParam($_REQUEST, 'company_id', 0))); 22 } 23 $company_id = $AppUI->getState('CalIdxCompany') !== null ? $AppUI->getState('CalIdxCompany') : $AppUI->user_company; 24 25 $event_filter = $AppUI->checkPrefState('CalIdxFilter', w2PgetParam($_REQUEST, 'event_filter', ''), 'EVENTFILTER', 'my'); 26 27 // get the passed timestamp (today if none) 28 $date = w2PgetParam($_GET, 'date', null); 29 30 // establish the focus 'date' 31 $this_week = new CDate($date); 32 $dd = $this_week->getDay(); 33 $mm = $this_week->getMonth(); 34 $yy = $this_week->getYear(); 35 36 // prepare time period for 'events' 37 $first_time = new CDate(Date_calc::beginOfWeek($dd, $mm, $yy, FMT_TIMESTAMP_DATE, LOCALE_FIRST_DAY)); 38 $first_time->setTime(0, 0, 0); 39 $first_time->subtractSeconds(1); 40 $last_time = new CDate(Date_calc::endOfWeek($dd, $mm, $yy, FMT_TIMESTAMP_DATE, LOCALE_FIRST_DAY)); 41 $last_time->setTime(23, 59, 59); 42 43 $prev_week = new CDate(Date_calc::beginOfPrevWeek($dd, $mm, $yy, FMT_TIMESTAMP_DATE, LOCALE_FIRST_DAY)); 44 $next_week = new CDate(Date_calc::beginOfNextWeek($dd, $mm, $yy, FMT_TIMESTAMP_DATE, LOCALE_FIRST_DAY)); 45 46 $links = array(); 47 48 // assemble the links for the tasks 49 require_once (W2P_BASE_DIR . '/modules/calendar/links_tasks.php'); 50 getTaskLinks($first_time, $last_time, $links, 50, $company_id); 51 52 // assemble the links for the events 53 require_once (W2P_BASE_DIR . '/modules/calendar/links_events.php'); 54 getEventLinks($first_time, $last_time, $links, 50); 55 56 // get the list of visible companies 57 $company = new CCompany(); 58 $companies = $company->getAllowedRecords($AppUI->user_id, 'company_id,company_name', 'company_name'); 59 $companies = arrayMerge(array('0' => $AppUI->_('All')), $companies); 60 61 // setup the title block 62 $titleBlock = new CTitleBlock('Week View', 'myevo-appointments.png', $m, "$m.$a"); 63 $titleBlock->addCrumb('?m=calendar&date=' . $this_week->format(FMT_TIMESTAMP_DATE), 'month view'); 64 $titleBlock->addCell($AppUI->_('Company') . ':'); 65 $titleBlock->addCell(arraySelect($companies, 'company_id', 'onchange="document.pickCompany.submit()" class="text"', $company_id), '', '<form action="' . $_SERVER['REQUEST_URI'] . '" method="post" name="pickCompany">', '</form>'); 66 $titleBlock->addCell($AppUI->_('Event Filter') . ':'); 67 $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>'); 68 $titleBlock->show(); 69 ?> 70 <table border="0" cellspacing="0" cellpadding="2" width="100%" class="motitle"> 71 <tr> 72 <td> 73 <a href="<?php echo '?m=calendar&a=week_view&date=' . $prev_week->format(FMT_TIMESTAMP_DATE); ?>"><img src="<?php echo w2PfindImage('prev.gif'); ?>" width="16" height="16" alt="pre" border="0"></A> 74 </td> 75 <th width="100%"> 76 <span style="font-size:12pt"><?php echo $AppUI->_('Week') . ' ' . $first_time->format('%U - %Y') . ' - ' . $AppUI->_($first_time->format('%B')); ?></span> 77 </th> 78 <td> 79 <a href="<?php echo '?m=calendar&a=week_view&date=' . $next_week->format(FMT_TIMESTAMP_DATE); ?>"><img src="<?php echo w2PfindImage('next.gif'); ?>" width="16" height="16" alt="next" border="0"></A> 80 </td> 81 </tr> 82 </table> 83 84 <table border="0" cellspacing="1" cellpadding="2" width="100%" style="margin-width:4px;background-color:white"> 85 <?php 86 $column = 0; 87 $show_day = $this_week; 88 89 $today = new CDate(); 90 $today = $today->format(FMT_TIMESTAMP_DATE); 91 92 $s = ''; 93 $s .= '<tr>'; 94 for ($i = 0; $i < 7; $i++) { 95 $dayStamp = $show_day->format(FMT_TIMESTAMP_DATE); 96 97 $day = $show_day->getDay(); 98 $href = '?m=calendar&a=day_view&date='.$dayStamp.'&tab=0'; 99 100 $dow = intval($show_day->format('%w')); 101 if ($dow == 0 || $dow == 6) { 102 $s .= '<td class="weekendDay" style="width:14.29%;">'; 103 } else { 104 $s .= '<td class="weekDay" style="width:14.29%;">'; 105 } 106 107 $s .= ' <table style="width:100%;border-spacing:0;">'; 108 $s .= ' <tr><td align="left"><a href="' . $href . '">'; 109 110 $s .= $dayStamp == $today ? '<span style="color:red">' : ''; 111 $day_string = "<strong>" . htmlentities($show_day->format('%d'), ENT_COMPAT, $locale_char_set) . '</strong>'; 112 $day_name = $AppUI->_(htmlentities($show_day->format('%A'), ENT_COMPAT, $locale_char_set)); 113 $s .= $day_string . ' ' . $day_name; 114 $s .= $dayStamp == $today ? '</span>' : ''; 115 $s .= '</a></td></tr>'; 116 117 $s .= '<tr><td>'; 118 119 if (isset($links[$dayStamp])) { 120 foreach ($links[$dayStamp] as $e) { 121 $href = isset($e['href']) ? $e['href'] : null; 122 $alt = isset($e['alt']) ? $e['alt'] : null; 123 124 $s .= '<br />'; 125 $s .= $href ? '<a href="'.$href.'" class="event" title="'.$alt.'">' : ''; 126 $s .= $e['text']; 127 $s .= $href ? '</a>' : ''; 128 } 129 } 130 131 $s .= '</td></tr></table>'; 132 133 $s .= '</td>'; 134 135 // select next day 136 $show_day->addSeconds(24 * 3600); 137 } 138 $s .= '</tr>'; 139 echo $s; 140 ?> 141 <tr> 142 <td colspan="7" align="right" bgcolor="#efefe7"> 143 <a href="./index.php?m=calendar&a=day_view"><?php echo $AppUI->_('today'); ?></a> 144 </td> 145 </tr> 146 </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 |