home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 April / CMCD0404.ISO / Software / Freeware / Programare / dotproject / modules / calendar / view.php < prev    next >
Encoding:
PHP Script  |  2003-12-14  |  4.0 KB  |  126 lines

  1. <?php /* CALENDAR $Id: view.php,v 1.13 2003/12/13 20:14:55 gregorerhardt Exp $ */
  2. $event_id = intval( dPgetParam( $_GET, "event_id", 0 ) );
  3.  
  4. // check permissions for this record
  5. $canEdit = !getDenyEdit( $m, $event_id );
  6.  
  7. // check if this record has dependancies to prevent deletion
  8. $msg = '';
  9. $obj = new CEvent();
  10. $canDelete = $obj->canDelete( $msg, $event_id );
  11.  
  12. // load the record data
  13. if (!$obj->load( $event_id )) {
  14.     $AppUI->setMsg( 'Event' );
  15.     $AppUI->setMsg( "invalidID", UI_MSG_ERROR, true );
  16.     $AppUI->redirect();
  17. } else {
  18.     $AppUI->savePlace();
  19. }
  20.  
  21. // load the event types
  22. $types = dPgetSysVal( 'EventType' );
  23.  
  24. // load the event recurs types
  25. $recurs =  array (
  26.     'Never',
  27.     'Hourly',
  28.     'Daily',
  29.     'Weekly',
  30.     'Bi-Weekly',
  31.     'Every Month',
  32.     'Quarterly',
  33.     'Every 6 months',
  34.     'Every Year'
  35. );
  36.  
  37.  
  38. if ($obj->event_owner != $AppUI->user_id) {
  39.     $canEdit = false;
  40. }
  41. $df = $AppUI->getPref('SHDATEFORMAT');
  42. $tf = $AppUI->getPref('TIMEFORMAT');
  43.  
  44. $start_date = $obj->event_start_date ? new CDate( $obj->event_start_date ) : null;
  45. $end_date = $obj->event_end_date ? new CDate( $obj->event_end_date ) : null;
  46. $event_project = db_LoadResult('SELECT project_name FROM projects where project_id=' . $obj->event_project);
  47.  
  48. // setup the title block
  49. $titleBlock = new CTitleBlock( 'View Event', 'myevo-appointments.png', $m, "$m.$a" );
  50. if ($canEdit) {
  51.     $titleBlock->addCell();
  52.     $titleBlock->addCell(
  53.         '<input type="submit" class="button" value="'.$AppUI->_('new event').'">', '',
  54.         '<form action="?m=calendar&a=addedit" method="post">', '</form>'
  55.     );
  56. }
  57. $titleBlock->addCrumb( "?m=calendar&date=".$start_date->format( FMT_TIMESTAMP_DATE ), "month view" );
  58. if ($canEdit) {
  59.     $titleBlock->addCrumb( "?m=calendar&a=day_view&date=".$start_date->format( FMT_TIMESTAMP_DATE ), "day view" );
  60.     $titleBlock->addCrumb( "?m=calendar&a=addedit&event_id=$event_id", "edit this event" );
  61.     if ($canEdit) {
  62.         $titleBlock->addCrumbDelete( 'delete event', $canDelete, $msg );
  63.     }
  64. }
  65. $titleBlock->show();
  66. ?>
  67. <script language="javascript">
  68. function delIt() {
  69.     if (confirm( "<?php echo $AppUI->_('eventDelete');?>" )) {
  70.         document.frmDelete.submit();
  71.     }
  72. }
  73. </script>
  74.  
  75. <table border="0" cellpadding="4" cellspacing="0" width="100%" class="std">
  76.  
  77. <form name="frmDelete" action="./index.php?m=calendar" method="post">
  78.     <input type="hidden" name="dosql" value="do_event_aed" />
  79.     <input type="hidden" name="del" value="1" />
  80.     <input type="hidden" name="event_id" value="<?php echo $event_id;?>" />
  81. </form>
  82.  
  83. <tr>
  84.     <td valign="top" width="50%">
  85.         <strong><?php echo $AppUI->_('Details');?></strong>
  86.         <table cellspacing="1" cellpadding="2" width="100%">
  87.         <tr>
  88.             <td align="right" nowrap="nowrap"><?php echo $AppUI->_('Event Title');?>:</td>
  89.             <td class="hilite" width="100%"><?php echo $obj->event_title;?></td>
  90.         </tr>
  91.         <tr>
  92.             <td align="right" nowrap="nowrap"><?php echo $AppUI->_('Type');?>:</td>
  93.             <td class="hilite" width="100%"><?php echo $AppUI->_($types[$obj->event_type]);?></td>
  94.         </tr>    
  95.         <tr>
  96.             <td align="right" nowrap="nowrap"><?php echo $AppUI->_('Project');?>:</td>
  97.             <td class="hilite" width="100%"><a href='?m=projects&a=view&project_id=<? echo $obj->event_project ?>'><?php echo $event_project;?></a></td>
  98.         </tr>
  99.         <tr>
  100.             <td align="right" nowrap="nowrap"><?php echo $AppUI->_('Starts');?>:</td>
  101.             <td class="hilite"><?php echo $start_date ? $start_date->format( "$df $tf" ) : '-';?></td>
  102.         </tr>
  103.         <tr>
  104.             <td align="right" nowrap="nowrap"><?php echo $AppUI->_('Ends');?>:</td>
  105.             <td class="hilite"><?php echo $end_date ? $end_date->format( "$df $tf" ) : '-';?></td>
  106.         </tr>
  107.         <tr>
  108.             <td align="right" nowrap="nowrap"><?php echo $AppUI->_('Recurs');?>:</td>
  109.             <td class="hilite"><?php echo $AppUI->_($recurs[$obj->event_recurs])." (".$obj->event_times_recuring." ".$AppUI->_('times').")" ;?></td>
  110.         </tr>
  111.         </table>
  112.     </td>
  113.     <td width="50%" valign="top">
  114.         <strong><?php echo $AppUI->_('Description');?></strong>
  115.         <table cellspacing="0" cellpadding="2" border="0" width="100%">
  116.         <tr>
  117.             <td class="hilite">
  118.                 <?php echo str_replace( chr(10), "<br />", $obj->event_description);?> 
  119.             </td>
  120.         </tr>
  121.         </table>
  122.  
  123.     </td>
  124. </tr>
  125. </table>
  126.