[ PHPXref.com ] [ Generated: Sun Jul 20 20:47:44 2008 ] [ TUTOS 1.2 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/php/ -> app_show.php (source)

   1  <?php
   2  /**
   3   * Copyright 1999 - 2004 by Gero Kohnert
   4   *
   5   *  CVS Info:  $Id: app_show.php,v 1.44.2.1 2004/07/26 19:54:57 gokohnert Exp $
   6   *  $Author: gokohnert $
   7   *
   8   * A four week calendar 
   9   *
  10   * @modulegroup appointment
  11   * @module app_show
  12   * @package appointment
  13   */
  14   include_once  'webelements.p3';
  15   include_once  'permission.p3';
  16   include_once  'appointment.pinc';
  17   include_once  'product.pinc';
  18  
  19  
  20   /* --------------------------------------------------------------------------- */
  21   /* Check if user is allowed to use it */
  22   check_user();
  23   loadmodules('appointment','show');
  24   loadlayout();
  25  
  26   /**
  27    * display a appointment
  28    */
  29   class app_show extends layout {
  30     /**
  31      * the data display part
  32      */
  33     Function info() {
  34       global $tutos,$lang;
  35  
  36       if ( $this->format == "ical") {
  37         Header("Expires: 0");
  38         Header("Pragma: no-cache");
  39         # set content to text/calendar
  40         if (strstr($_SERVER["HTTP_USER_AGENT"],"MSIE 5") || strstr($_SERVER["HTTP_USER_AGENT"],"MSIE 6") ) {
  41           Header("Cache-Control:");
  42           Header("Connection: close");
  43           Header("Content-Transfer-Encoding: binary");
  44         }
  45         Header("Content-type: text/calendar");
  46         Header("Content-Disposition: attachment; filename=\"appointment.ics\"");
  47         Header("Content-Description: Upload from TUTOS" );
  48         echo $this->obj->getIcal();
  49         return;
  50       } else if ( $this->format == "xml") {
  51         echo $this->obj->exportXMLHeader();
  52         echo $this->obj->exportXML();
  53         return;
  54       }
  55  
  56       echo $this->DataTableStart();
  57       echo "<tr>\n";
  58       echo "<th colspan=\"3\">". $lang['Calendar'] ."</th>\n";
  59       echo $this->user->layout->showGuiIcons("<th align=\"right\">","</th>",$this->obj,$this->obj,array("mod","del"),false);
  60       echo "</tr>\n";
  61  
  62       echo "<tr>\n";
  63       echo " <td colspan=\"2\">". $lang['AppCreatedBy'] ."\n";
  64       echo " ". $this->obj->creator->getLink() ."</td>\n";
  65       echo " <td colspan=\"2\">". $lang['atDateTime'] ."\n";
  66       echo " ". $this->obj->creation->getLinkDateTime() ."</td>\n";
  67       echo "</tr>\n";
  68  
  69       echo "<tr>\n";
  70       if ( $this->obj->repeat == 0 ) {
  71         echo $this->showfield($lang['StartDate']);
  72       } else {
  73         echo $this->showfield($lang['AppFirstDate']);
  74       }
  75  
  76       $dinfo = GetDaysInfo( $this->obj->start->getTimeStamp() );
  77  
  78       if ( ($this->obj->t_ignore != 0) || ($this->obj->repeat != 0) ) {
  79         echo $this->showdata($this->obj->start->getDate(),2);
  80       } else {
  81         echo $this->showdata($this->obj->start->getDateTime(),2);
  82       }
  83  
  84       echo "<td><span class=\"dinfo\">";
  85       if ( isset ($dinfo[Desc]) ) {
  86         echo $dinfo[Desc];
  87       }
  88       echo "</span>&nbsp;</td>\n";
  89       echo "</tr>\n";
  90  
  91       echo "<tr>\n";
  92       if ( $this->obj->repeat == 0 ) {
  93         echo $this->showfield($lang['EndDate']);
  94       } else {
  95         echo $this->showfield($lang['AppLastDate']);
  96       }
  97       $dinfo = GetDaysInfo( $this->obj->end->getTimeStamp() );
  98  
  99       if ( ($this->obj->t_ignore != 0) || ($this->obj->repeat != 0) ) {
 100         if ( ($this->obj->repeat != 0) && ($this->obj->r_ignore == 1) ) {
 101           echo  $this->showdata($lang['AppNoLastDate'],2);
 102         } else {
 103           echo  $this->showdata($this->obj->end->getDate(),2);
 104         }
 105       } else {
 106         echo  $this->showdata($this->obj->end->getDateTime(),2);
 107       }
 108       echo "<td><span class=\"dinfo\">";
 109       if ( isset ($dinfo[Desc]) ) {
 110         echo $dinfo[Desc];
 111       }
 112       echo "</span>&nbsp;</td>\n";
 113       echo "</tr>\n";
 114  
 115       if ( $this->obj->repeat != 0 ) {
 116         if ( $this->obj->t_ignore != 1 ) {
 117           echo "<tr>\n";
 118           echo $this->showfield($lang['StartTime']);
 119           echo $this->showdata($this->obj->start->getTime());
 120           echo $this->showfield($lang['EndTime']);
 121           echo $this->showdata($this->obj->end->getTime());
 122           echo "</tr>\n";
 123         }
 124         echo "<tr>\n";
 125         echo $this->showfield($lang['AppRepeatType']);
 126         echo " <td colspan=\"3\">\n";
 127         if ( $this->obj->repeat == APP_REP_WEEK ) {
 128           $wd = strftime("Day%w",$this->obj->start->getTimeStamp());
 129           echo sprintf($lang['AppRepeatInfo1'],$lang[$wd]);
 130         }
 131         if ( $this->obj->repeat == APP_REP_MONTH ) {
 132           echo strftime($lang['AppRepeatInfo2'],$this->obj->start->getTimeStamp());
 133         }
 134         if ( $this->obj->repeat == APP_REP_YEAR ) {
 135           echo strftime($lang['AppRepeatInfo3'],$this->obj->start->getTimeStamp());
 136         }
 137         if ( $this->obj->repeat == APP_REP_DAY ) {
 138           echo $lang['AppRepeatInfo4'];
 139         }
 140         echo " </td>\n";
 141         echo "</tr>\n";
 142       }
 143       echo "<tr>\n";
 144       echo $this->showfield($lang['Location2']);
 145       echo $this->showdata($this->obj->getLocation(),3);
 146       echo "</tr>\n";
 147  
 148       if ( $this->obj->remember > 0 ) {
 149         echo "<tr>\n";
 150         echo $this->showfield("reminder at");
 151         echo $this->showdata($lang['AppRemind'][$this->obj->remember],3);
 152         echo "</tr>\n";
 153       }
 154  
 155       if ( $this->obj->descr != "" ) {
 156         echo "<tr>\n";
 157         echo $this->showfield($lang['Description']);
 158         $descr = eregi_replace("\n","<br>",$this->obj->descr);
 159         echo $this->showdata(urlReplace($descr),3);
 160         echo "</tr>\n";
 161       }
 162  
 163       $pre = "";
 164       if ( count($this->obj->participant) > 0 ) {
 165         foreach ($this->obj->participant as $i => $f) {
 166           echo "<tr>\n";
 167           if ( $pre == "" ) {
 168             echo $this->showfield($lang['Participants']);
 169           } else {
 170             echo "<td>&nbsp;</td>";
 171           }
 172           if ( $this->obj->trace == 1 ) {
 173             echo " <td colspan=\"2\">". $f->getLink() ."</td>";
 174             echo "<td>". $lang['AppState'][$this->obj->participant_state[$i]] ."</td>";
 175           } else {
 176             echo " <td colspan=\"3\">". $f->getLink() ."</td>";
 177           }
 178           echo "</tr>\n";
 179           $pre = 1;
 180         }
 181       }
 182       if ( $this->obj->visitor != -1 ) {
 183         echo "<tr>\n";
 184         if ( $this->obj->outside ) {
 185           echo $this->showfield($lang['VisitAt']);
 186         } else {
 187           echo $this->showfield($lang['VisitFrom']);
 188         }
 189         echo $this->showdata($this->obj->visitor->getLink(),3);
 190         echo "</tr>\n";
 191       }
 192       if ( $this->user->feature_ok(useprojects,PERM_SEE) ) {
 193         if ( $this->obj->product != -1 ) {
 194           echo "<tr>\n";
 195           echo $this->showfield($lang['ProductP']);
 196           echo $this->showdata($this->obj->product->getLink(),3);
 197           echo "</tr>\n";
 198         }
 199       }
 200       # References to modules
 201       show_module_infolists($this->user,$this->obj,4,$this->format);
 202       echo $this->obj->getHistoryLink(4);
 203       echo $this->DataTableEnd();
 204     }
 205     /**
 206      * naviagation
 207      */
 208     Function navigate() {
 209     }
 210     /**
 211      * prepare
 212      */
 213     Function prepare() {
 214       global $msg,$tutos, $lang;
 215  
 216       $this->name = $lang['AppointDetail'];
 217       $this->obj = new appointment($this->dbconn);
 218       if ( isset($_GET['id']) ) {
 219         $this->obj = $this->obj->read($_GET['id'],$this->obj);
 220       } else {
 221         $this->stop = true;
 222       }
 223       if ( ! $this->obj->see_ok() ) {
 224         $msg .= sprintf($lang['Err0022'],$lang[$this->obj->getType()]);
 225         $this->stop = true;
 226       } else if ( $this->obj->id < 0 ) {
 227         $msg .= sprintf($lang['Err0040'],$lang[$this->obj->getType()]);
 228         $this->stop = true;
 229       }
 230       $this->obj->read_participants();
 231       # menu
 232       $m = appointment::getSelectLink($this->user);
 233       $m[category][] = "obj";
 234       $this->addmenu($m);
 235       $m = appointment::getAddLink($this->user,$this->obj);
 236       $this->addMenu($m);
 237       if ( ($this->obj->id > 0) && $this->obj->mod_ok() ) {
 238         $m = array( text => $lang['Modify'],
 239                     info => $lang['ModOldAppoint'],
 240                     category => array("app","mod","obj")
 241                   );
 242         if ( $this->obj->repeat == 0 ) {
 243           $m[url] = "app_new.php?id=". $this->obj->id;
 244         } else {
 245           $m[url] = "app_new_r.php?id=". $this->obj->id;
 246         }
 247         $this->addMenu($m);
 248       }
 249       if ( $this->obj->see_ok() && ($this->obj->id > 0) ) {
 250         $m = array( url => "app_show.php?format=ical&id=".$this->obj->id,
 251                     text => $lang['AppGetIcal'],
 252                     info => "get this appointment as Ical file",
 253                     category => array("app","view")
 254                   );
 255         $this->addMenu($m);
 256       }
 257       add_module_addlinks($this,$this->obj);
 258  
 259       # add this page to the browsehistory of the users session
 260       $this->addtohistory();
 261     }
 262   }
 263  
 264   $l = new app_show($current_user);
 265   $l->display();
 266   $dbconn->Close();
 267  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]