[ Index ]

Source Code Reference for V1.00

title

Body

[close]

/modules/calendar/ -> year_view.php (source)

   1  <?php /* $Id: year_view.php 38 2008-02-11 11:38:51Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/calendar/year_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  
  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', $AppUI->user_company);
  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  $date = w2PgetParam($_GET, 'date', '');
  32  
  33  // get the list of visible companies

  34  $company = new CCompany();
  35  $companies = $company->getAllowedRecords($AppUI->user_id, 'company_id,company_name', 'company_name');
  36  $companies = arrayMerge(array('0' => $AppUI->_('All')), $companies);
  37  
  38  #echo '<pre>';print_r($events);echo '</pre>';

  39  // setup the title block

  40  $titleBlock = new CTitleBlock('Yearly Calendar', 'myevo-appointments.png', $m, "$m.$a");
  41  $titleBlock->addCell($AppUI->_('Company') . ':');
  42  $titleBlock->addCell(arraySelect($companies, 'company_id', 'onChange="document.pickCompany.submit()" class="text"', $company_id), '', '<form action="' . $_SERVER['REQUEST_URI'] . '" method="post" name="pickCompany">', '</form>');
  43  $titleBlock->addCell($AppUI->_('Event Filter') . ':');
  44  $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>');
  45  $titleBlock->show();
  46  ?>
  47  
  48  <script language="javascript">
  49  function clickDay( uts, fdate ) {
  50      window.location = './index.php?m=calendar&a=day_view&date='+uts;
  51  }
  52  function clickWeek( uts, fdate ) {
  53      window.location = './index.php?m=calendar&a=week_view&date='+uts;
  54  }
  55  </script>
  56  
  57  <?php
  58  // establish the focus 'date'

  59  if (!$date) {
  60      $date = new CDate();
  61  } else {
  62      $date = new CDate($date);
  63  }
  64  $date->setDay(1);
  65  $date->setMonth(1);
  66  $prev_year = $date->format(FMT_TIMESTAMP_DATE);
  67  $prev_year = (int)($prev_year - 10000);
  68  $next_year = $date->format(FMT_TIMESTAMP_DATE);
  69  $next_year = (int)($next_year + 10000);
  70  
  71  ?>
  72  <table class="std" width="100%" cellspacing="0" cellpadding="0">
  73  <tr>
  74      <td>
  75          <table width="100%" cellspacing="0" cellpadding="4">
  76          <tr>
  77              <td colspan="20" valign="top">
  78                  <table border="0" cellspacing="1" cellpadding="2" width="100%" class="motitle">
  79                      <tr>
  80                          <td>
  81                              <a href="<?php echo '?m=calendar&a=year_view&date=' . $prev_year; ?>"><img src="<?php echo w2PfindImage('prev.gif'); ?>" width="16" height="16" alt="pre" title="pre" border="0"></a>
  82                          </td>
  83                          <th width="100%" align="center">
  84                              <?php echo htmlentities($date->format('%Y')); ?>
  85                          </th>
  86                          <td>
  87                              <a href="<?php echo '?m=calendar&a=year_view&date=' . $next_year; ?>"><img src="<?php echo w2PfindImage('next.gif'); ?>" width="16" height="16" alt="next" title="next" border="0"></a>
  88                          </td>
  89                      </tr>
  90                  </table>
  91              </td>
  92          </tr>
  93  <?php
  94  $minical = new CMonthCalendar($date);
  95  $minical->setStyles('minititle', 'minical');
  96  $minical->showArrows = false;
  97  $minical->showWeek = true;
  98  $minical->clickMonth = true;
  99  $minical->setLinkFunctions('clickDay', 'clickWeek');
 100  // prepare time period for 1st minical'events'

 101  require_once (w2PgetConfig('root_dir') . "/modules/calendar/links_tasks.php");
 102  require_once (w2PgetConfig('root_dir') . "/modules/calendar/links_events.php");
 103  $first_time = new CDate($date);
 104  $first_time->setDay(1);
 105  $first_time->setTime(0, 0, 0);
 106  $last_time = new CDate($date);
 107  $last_time->setDay($date->getDaysInMonth());
 108  $last_time->setTime(23, 59, 59);
 109  
 110  $links = array();
 111  
 112  // assemble the links for the tasks

 113  // assemble the links for the events

 114  //Pedro A.

 115  getTaskLinks($first_time, $last_time, $links, 20, $company_id, true);
 116  getEventLinks($first_time, $last_time, $links, 20, true);
 117  $minical->setEvents($links);
 118  
 119  echo '<table cellspacing="0" cellpadding="0" border="0" width="100%"><tr>';
 120  echo '<td valign="top" align="center" width="20%">&nbsp;</td>';
 121  echo '<td valign="top" align="center" width="200">' . $minical->show() . '</td>';
 122  
 123  $date->addMonths(1);
 124  $first_time = new CDate($date);
 125  $first_time->setDay(1);
 126  $first_time->setTime(0, 0, 0);
 127  $last_time = new CDate($date);
 128  $last_time->setDay($date->getDaysInMonth());
 129  $last_time->setTime(23, 59, 59);
 130  $links = array();
 131  // assemble the links for the tasks

 132  // assemble the links for the events

 133  //Pedro A.

 134  getTaskLinks($first_time, $last_time, $links, 20, $company_id, true);
 135  getEventLinks($first_time, $last_time, $links, 20, true);
 136  $minical->setEvents($links);
 137  $minical->setDate($date);
 138  echo '<td valign="top" align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>';
 139  echo '<td valign="top" align="center" width="200">' . $minical->show() . '</td>';
 140  
 141  $date->addMonths(1);
 142  $first_time = new CDate($date);
 143  $first_time->setDay(1);
 144  $first_time->setTime(0, 0, 0);
 145  $last_time = new CDate($date);
 146  $last_time->setDay($date->getDaysInMonth());
 147  $last_time->setTime(23, 59, 59);
 148  $links = array();
 149  // assemble the links for the tasks

 150  // assemble the links for the events

 151  //Pedro A.

 152  getTaskLinks($first_time, $last_time, $links, 20, $company_id, true);
 153  getEventLinks($first_time, $last_time, $links, 20, true);
 154  $minical->setEvents($links);
 155  $minical->setDate($date);
 156  echo '<td valign="top" align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>';
 157  echo '<td valign="top" align="center" width="200">' . $minical->show() . '</td>';
 158  
 159  $date->addMonths(1);
 160  $first_time = new CDate($date);
 161  $first_time->setDay(1);
 162  $first_time->setTime(0, 0, 0);
 163  $last_time = new CDate($date);
 164  $last_time->setDay($date->getDaysInMonth());
 165  $last_time->setTime(23, 59, 59);
 166  $links = array();
 167  // assemble the links for the tasks

 168  // assemble the links for the events

 169  //Pedro A.

 170  getTaskLinks($first_time, $last_time, $links, 20, $company_id, true);
 171  getEventLinks($first_time, $last_time, $links, 20, true);
 172  $minical->setEvents($links);
 173  $minical->setDate($date);
 174  echo '<td valign="top" align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>';
 175  echo '<td valign="top" align="center" width="200">' . $minical->show() . '</td>';
 176  echo '<td valign="top" align="center" width="20%">&nbsp;</td>';
 177  echo '</tr></table>';
 178  
 179  $date->addMonths(1);
 180  $first_time = new CDate($date);
 181  $first_time->setDay(1);
 182  $first_time->setTime(0, 0, 0);
 183  $last_time = new CDate($date);
 184  $last_time->setDay($date->getDaysInMonth());
 185  $last_time->setTime(23, 59, 59);
 186  $links = array();
 187  // assemble the links for the tasks

 188  // assemble the links for the events

 189  //Pedro A.

 190  getTaskLinks($first_time, $last_time, $links, 20, $company_id, true);
 191  getEventLinks($first_time, $last_time, $links, 20, true);
 192  $minical->setEvents($links);
 193  $minical->setDate($date);
 194  echo '<table cellspacing="0" cellpadding="0" border="0" width="100%"><tr>';
 195  echo '<td valign="top" align="center" width="20%">&nbsp;</td>';
 196  echo '<td valign="top" align="center" width="200">' . $minical->show() . '</td>';
 197  
 198  $date->addMonths(1);
 199  $first_time = new CDate($date);
 200  $first_time->setDay(1);
 201  $first_time->setTime(0, 0, 0);
 202  $last_time = new CDate($date);
 203  $last_time->setDay($date->getDaysInMonth());
 204  $last_time->setTime(23, 59, 59);
 205  $links = array();
 206  // assemble the links for the tasks

 207  // assemble the links for the events

 208  //Pedro A.

 209  getTaskLinks($first_time, $last_time, $links, 20, $company_id, true);
 210  getEventLinks($first_time, $last_time, $links, 20, true);
 211  $minical->setEvents($links);
 212  $minical->setDate($date);
 213  echo '<td valign="top" align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>';
 214  echo '<td valign="top" align="center" width="200">' . $minical->show() . '</td>';
 215  
 216  $date->addMonths(1);
 217  $first_time = new CDate($date);
 218  $first_time->setDay(1);
 219  $first_time->setTime(0, 0, 0);
 220  $last_time = new CDate($date);
 221  $last_time->setDay($date->getDaysInMonth());
 222  $last_time->setTime(23, 59, 59);
 223  $links = array();
 224  // assemble the links for the tasks

 225  // assemble the links for the events

 226  //Pedro A.

 227  getTaskLinks($first_time, $last_time, $links, 20, $company_id, true);
 228  getEventLinks($first_time, $last_time, $links, 20, true);
 229  $minical->setEvents($links);
 230  $minical->setDate($date);
 231  
 232  echo '<td valign="top" align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>';
 233  echo '<td valign="top" align="center" width="200">' . $minical->show() . '</td>';
 234  
 235  $date->addMonths(1);
 236  $first_time = new CDate($date);
 237  $first_time->setDay(1);
 238  $first_time->setTime(0, 0, 0);
 239  $last_time = new CDate($date);
 240  $last_time->setDay($date->getDaysInMonth());
 241  $last_time->setTime(23, 59, 59);
 242  $links = array();
 243  // assemble the links for the tasks

 244  // assemble the links for the events

 245  //Pedro A.

 246  getTaskLinks($first_time, $last_time, $links, 20, $company_id, true);
 247  getEventLinks($first_time, $last_time, $links, 20, true);
 248  $minical->setEvents($links);
 249  $minical->setDate($date);
 250  echo '<td valign="top" align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>';
 251  echo '<td valign="top" align="center" width="200">' . $minical->show() . '</td>';
 252  echo '<td valign="top" align="center" width="20%">&nbsp;</td>';
 253  echo '</tr></table>';
 254  
 255  $date->addMonths(1);
 256  $first_time = new CDate($date);
 257  $first_time->setDay(1);
 258  $first_time->setTime(0, 0, 0);
 259  $last_time = new CDate($date);
 260  $last_time->setDay($date->getDaysInMonth());
 261  $last_time->setTime(23, 59, 59);
 262  $links = array();
 263  // assemble the links for the tasks

 264  // assemble the links for the events

 265  //Pedro A.

 266  getTaskLinks($first_time, $last_time, $links, 20, $company_id, true);
 267  getEventLinks($first_time, $last_time, $links, 20, true);
 268  $minical->setEvents($links);
 269  $minical->setDate($date);
 270  echo '<table cellspacing="0" cellpadding="0" border="0" width="100%"><tr>';
 271  echo '<td valign="top" align="center" width="20%">&nbsp;</td>';
 272  echo '<td valign="top" align="center" width="200">' . $minical->show() . '</td>';
 273  
 274  $date->addMonths(1);
 275  $first_time = new CDate($date);
 276  $first_time->setDay(1);
 277  $first_time->setTime(0, 0, 0);
 278  $last_time = new CDate($date);
 279  $last_time->setDay($date->getDaysInMonth());
 280  $last_time->setTime(23, 59, 59);
 281  $links = array();
 282  // assemble the links for the tasks

 283  // assemble the links for the events

 284  //Pedro A.

 285  getTaskLinks($first_time, $last_time, $links, 20, $company_id, true);
 286  getEventLinks($first_time, $last_time, $links, 20, true);
 287  $minical->setEvents($links);
 288  $minical->setDate($date);
 289  
 290  echo '<td valign="top" align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>';
 291  echo '<td valign="top" align="center" width="200">' . $minical->show() . '</td>';
 292  
 293  $date->addMonths(1);
 294  $first_time = new CDate($date);
 295  $first_time->setDay(1);
 296  $first_time->setTime(0, 0, 0);
 297  $last_time = new CDate($date);
 298  $last_time->setDay($date->getDaysInMonth());
 299  $last_time->setTime(23, 59, 59);
 300  $links = array();
 301  // assemble the links for the tasks

 302  // assemble the links for the events

 303  //Pedro A.

 304  getTaskLinks($first_time, $last_time, $links, 20, $company_id, true);
 305  getEventLinks($first_time, $last_time, $links, 20, true);
 306  $minical->setEvents($links);
 307  $minical->setDate($date);
 308  echo '<td valign="top" align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>';
 309  echo '<td valign="top" align="center" width="200">' . $minical->show() . '</td>';
 310  
 311  $date->addMonths(1);
 312  $first_time = new CDate($date);
 313  $first_time->setDay(1);
 314  $first_time->setTime(0, 0, 0);
 315  $last_time = new CDate($date);
 316  $last_time->setDay($date->getDaysInMonth());
 317  $last_time->setTime(23, 59, 59);
 318  $links = array();
 319  // assemble the links for the tasks

 320  // assemble the links for the events

 321  //Pedro A.

 322  getTaskLinks($first_time, $last_time, $links, 20, $company_id, true);
 323  getEventLinks($first_time, $last_time, $links, 20, true);
 324  $minical->setEvents($links);
 325  $minical->setDate($date);
 326  echo '<td valign="top" align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>';
 327  echo '<td valign="top" align="center" width="200">' . $minical->show() . '</td>';
 328  echo '<td valign="top" align="center" width="20%">&nbsp;</td>';
 329  echo '</tr></table>';
 330  ?>
 331      </td>
 332  </tr>
 333  <tr>
 334      <td>
 335          <table width="100%" class="minical">
 336          <tr>
 337                 <td nowrap="nowrap"><?php echo $AppUI->_('Key'); ?>:</td>
 338               <td>&nbsp;</td>
 339               <td style="border-style:solid;border-width:1px" class="day">&nbsp;&nbsp;</td>
 340               <td nowrap="nowrap"><?php echo $AppUI->_('Day'); ?></td>
 341               <td>&nbsp;</td>
 342               <td style="border-style:solid;border-width:1px" class="event">&nbsp;&nbsp;</td>
 343               <td nowrap="nowrap"><?php echo $AppUI->_('Event'); ?></td>
 344               <td>&nbsp;</td>
 345               <td style="border-style:solid;border-width:1px" class="task">&nbsp;&nbsp;</td>
 346               <td nowrap="nowrap"><?php echo $AppUI->_('Task'); ?></td>
 347               <td>&nbsp;</td>
 348               <td style="border-style:solid;border-width:1px" class="eventtask">&nbsp;&nbsp;</td>
 349               <td nowrap="nowrap"><?php echo $AppUI->_('Event'); ?>+<?php echo $AppUI->_('Task'); ?></td>
 350               <td>&nbsp;</td>
 351               <td style="border-style:solid;border-width:1px" class="weekend">&nbsp;&nbsp;</td>
 352               <td nowrap="nowrap"><?php echo $AppUI->_('Weekend'); ?></td>
 353               <td>&nbsp;</td>
 354               <td class="today">&nbsp;&nbsp;</td>
 355               <td nowrap="nowrap"><?php echo $AppUI->_('Today'); ?></td>
 356               <td>&nbsp;</td>
 357               <td width="40%">&nbsp;</td>
 358          </tr>
 359          </table>
 360      </td>
 361  </tr>
 362  </table>