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

title

Body

[close]

/php/ -> app_new_r.php (source)

   1  <?php
   2  /**
   3   * Copyright 1999 - 2004 by Gero Kohnert
   4   *
   5   * Editing of "repeating" appointments
   6   *
   7   * @modulegroup appointment
   8   * @module app_new_r
   9   * @package appointment
  10   */
  11   include_once  'webelements.p3';
  12   include_once  'permission.p3';
  13   include_once  'appointment.pinc';
  14  
  15  
  16   /* Check if user is allowed to use it */
  17   check_user();
  18   loadmodules("appointment","new");
  19   loadlayout();
  20  
  21   /**
  22    * display a appointment for changing
  23    */
  24   class app_new_r extends layout {
  25     /**
  26      * display the info
  27      */
  28     Function info() {
  29       global $table,$tutos, $lang;
  30  
  31       $a_checked[0] = "";
  32       $a_checked[1] = "";
  33       $a_checked[2] = "";
  34       $a_checked[3] = "";
  35       $a_checked[$this->obj->mod_allow] = " checked=\"checked\"";
  36  
  37       $r_checked[1] = "";
  38       $r_checked[2] = "";
  39       $r_checked[3] = "";
  40       $r_checked[4] = "";
  41       $r_checked[$this->obj->repeat] = " checked=\"checked\"";
  42  
  43  
  44       if ( $this->obj->allowed == 0 ) {
  45          echo "<b>". $lang['ReadOnlyAppoint'] ."</b><br />\n";
  46       }
  47       echo "<form name=\"appnew\" action=\"app_ins.php\" method=\"post\">\n";
  48       $this->addHidden("gotourl","app_new_r.php");
  49       if ( $this->obj->id > 0 ) {
  50         $this->addHidden("id",$this->obj->id);
  51       }
  52  
  53       echo $this->DataTableStart();
  54  
  55       echo "<tr>\n";
  56       echo "<th colspan=\"6\">";
  57       if ( $this->obj->id > 0 ) {
  58         echo $lang['ModOldAppoint'] ."(repeat)";
  59         echo "</th>\n";
  60         echo "</tr><tr>\n";
  61         echo "<td colspan=\"5\"><b>". $lang['AppCreatedBy'] ."</b>&nbsp;". $this->obj->creator->getLink();
  62         echo "&nbsp;<b>". $lang['atDateTime'] ."</b>&nbsp;". $this->obj->creation->getDateTime()."</td>";
  63         echo "<td align=\"right\">" .acl_link($this->obj) ."</td>\n";
  64         echo "</tr>\n";
  65       } else {
  66         echo $lang['CreateAppoint'] ." (repeat)";
  67         echo "</th>\n";
  68       }
  69       echo "</tr>\n";
  70       $this->addHidden("creator",$this->obj->creator->id);
  71  
  72       # START
  73       echo "<tr>";
  74       echo $this->showfield($lang['AppFirstDate'],0,"start_d");
  75       echo " <td colspan=\"2\">";
  76       $this->obj->start->EnterDate("start");
  77       echo "</td>";
  78       echo "<td valign=\"top\">&nbsp;<b>";
  79       if ( !isset($_SERVER['HTTP_USER_AGENT']) || ereg("Lynx",$_SERVER['HTTP_USER_AGENT']) || ereg("w3m",$_SERVER['HTTP_USER_AGENT']) ) {
  80         echo $lang['StartTime'];
  81       } else {
  82         echo "<a href=\"JavaScript: var d = document.forms[0];
  83  mywindow = window.open('', 'timer', 'width=120,height=420,top=100,left=450');
  84  mywindow.location.href = '". $tutos['base'] ."/php/minitimer.php?f=start&amp;". SID ."'; mywindow.focus();\"
  85  onmouseover=\"self.status='minitimer' ;return true\">";
  86         echo $lang['StartTime'];
  87         echo "</a>";
  88       }
  89       echo "</b>&nbsp;<br />&nbsp;<font size=\"-1\">(HH:MM)</font></td>\n";
  90       echo " <td colspan=\"2\">";
  91       $this->obj->start->EnterTime("start");
  92       echo " </td>\n";
  93  
  94       # END
  95       echo "</tr><tr>\n";
  96       echo $this->showfield($lang['AppLastDate'],0,"end_d");
  97       echo "<td colspan=\"2\">";
  98       $this->obj->end->EnterDate("end");
  99       echo "<br />". $lang['AppNoLastDate'];
 100       echo "<input type=\"checkbox\" name=\"r_ignore\" value=\"1\"". ($this->obj->r_ignore == 1 ? " checked=\"checked\"":"") ." />";
 101       echo "</td>\n";
 102       echo "<td valign=\"top\">&nbsp;<b>";
 103       if ( !isset($_SERVER['HTTP_USER_AGENT']) || ereg("Lynx",$_SERVER['HTTP_USER_AGENT']) || ereg("w3m",$_SERVER['HTTP_USER_AGENT']) ) {
 104         echo $lang['EndTime'];
 105       } else {
 106         echo "<a href=\"JavaScript: var d = document.forms[0];
 107  mywindow = window.open('', 'timer', 'width=120,height=420,top=100,left=450');
 108  mywindow.location.href = '". $tutos['base'] ."/php/minitimer.php?f=end&amp;". SID ."'; mywindow.focus();\"
 109  onmouseover=\"self.status='minitimer' ;return true\">";
 110         echo $lang['EndTime'];
 111         echo "</a>";
 112       }
 113       echo "</b>&nbsp;<br />&nbsp;<font size=\"-1\">(HH:MM)</font></td>\n";
 114       echo "<td colspan=\"2\">";
 115       $this->obj->end->EnterTime("end");
 116       echo "</td>\n";
 117  
 118       echo "</tr><tr>\n";
 119  
 120       # REPEAT TYPE
 121       echo $this->showfield($lang['AppRepeatType'],0,"repeat");
 122       echo " <td colspan=\"2\">\n";
 123       echo "  <input type=\"radio\" id=\"repeat\" name=\"repeat\" value=\"". APP_REP_DAY ."\"". $r_checked[APP_REP_DAY] ." />&nbsp;". $lang['AppRepeatDay'] ."<br />";
 124       echo "  <input type=\"radio\" name=\"repeat\" value=\"". APP_REP_WEEK ."\"". $r_checked[APP_REP_WEEK] ." />&nbsp;". $lang['AppRepeatWeek'] ."<br />";
 125       echo "  <input type=\"radio\" name=\"repeat\" value=\"". APP_REP_MONTH ."\"". $r_checked[APP_REP_MONTH] ." />&nbsp;". $lang['AppRepeatMonth'] ."<br />";
 126       echo "  <input type=\"radio\" name=\"repeat\" value=\"". APP_REP_YEAR ."\"". $r_checked[APP_REP_YEAR] ." />&nbsp;". $lang['AppRepeatYear'] ."<br />";
 127       echo " </td>\n";
 128  
 129       # Ignore times
 130       echo " <td colspan=\"3\" valign=\"top\">\n";
 131       echo $lang['IgnoreTime'];
 132       echo "&nbsp;<input type=\"checkbox\" name=\"t_ignore\" value=\"1\" ". ($this->obj->t_ignore == 1 ? "checked=\"checked\"":"") ." /><br />\n";
 133       echo "<font size=\"-1\">". $lang['IgnoreTime2'] ."</font>";
 134       echo " </td>\n";
 135  
 136       echo "</tr><tr>\n";
 137  
 138       # LOCATION
 139       echo $this->showfield($lang['Location2'],0,"outside");
 140       echo " <td colspan=\"5\">\n";
 141       echo "  <select id=\"outside\" name=\"outside\">\n";
 142       @reset($lang['AppLoc']);
 143       while ( list($i,$f) = each($lang['AppLoc']) ) {
 144         echo "   <option value=\"". $i ."\" ". ($this->obj->outside == $i ? "selected=\"selected\"":"") .">". $lang['AppLoc'][$i] ."</option>\n";
 145       }
 146       echo "  </select>\n";
 147       echo " </td>\n";
 148  
 149       echo "</tr><tr>\n";
 150       echo $this->showfield($lang['Description'],0,"descr");
 151       echo $this->textarea("descr",5,$table['appointment1']['description'][size],$this->obj->descr);
 152  
 153       echo "</tr><tr>\n";
 154       # Customer/Visitor name
 155       echo $this->showfieldc($lang['VisitAt'] ."<br />". $lang['VisitFrom'],0,"v");
 156       echo " <td colspan=\"5\">";
 157       select_from_array_or_input($this->obj,"v",$this->obj->visitor,1);
 158       echo " </td>\n";
 159  
 160       if ( $this->user->feature_ok(useprojects,PERM_SEE) ) {
 161         echo "</tr><tr>\n";
 162         echo $this->showfieldc($lang['Product'],0,"p");
 163         echo " <td colspan=\"5\">\n";
 164         select_from_array_or_input($this->obj,"p",$this->obj->product,1);
 165         echo " </td>\n";
 166       }
 167  
 168       echo "</tr><tr>\n";
 169  
 170       echo $this->showfield($lang['Participants'],1,"people");
 171       echo " <td valign=\"top\">\n";
 172       echo "". $this->user->askPeople("people[]",$this->obj->people,1) ."\n";
 173       echo " </td>\n";
 174  
 175       echo " <td colspan=\"4\">&nbsp;<b>". $lang['AppChangeOrDel'] ."</b>&nbsp;<br />\n";
 176       echo "&nbsp;<input type=\"radio\" name=\"mod_allow\" value=\"2\"". $a_checked[2] ." />&nbsp;". $lang['only'] ." ". $this->obj->creator->getLink() ."<br />\n";
 177       echo "&nbsp;<input type=\"radio\" name=\"mod_allow\" value=\"1\"". $a_checked[1] ." />&nbsp;". $lang['Participants'] ."<br />\n";
 178       echo "&nbsp;<input type=\"radio\" name=\"mod_allow\" value=\"0\"". $a_checked[0] ." />&nbsp;". $lang['everybody'] ."<br />\n";
 179       echo "&nbsp;<input type=\"radio\" name=\"mod_allow\" value=\"3\"". $a_checked[3] ." />&nbsp;". $lang['AppPrivate'] ."<br />\n";
 180  
 181       echo " </td>\n";
 182  
 183       if ( $this->obj->mod_ok() ) {
 184         echo "</tr><tr>\n";
 185         if ( $this->obj->id > 0 ) {
 186           submit_reset(0,1,2,1,2,0);
 187         } else {
 188           submit_reset(0,-1,2,1,2,0);
 189         }
 190       }
 191       echo "</tr>\n";
 192       echo $this->DataTableEnd();
 193       hiddenFormElements();
 194       echo $this->getHidden();
 195       echo "</form>\n";
 196       echo $lang['FldsRequired'] ."\n";
 197       echo $this->setfocus("appnew.descr");
 198     }
 199     /**
 200      * navigate
 201      */
 202     Function navigate() {
 203     }
 204     /**
 205      * prepare
 206      */
 207     Function prepare() {
 208       global $msg,$tutos, $lang;
 209  
 210       $p = array();
 211       $this->obj = new appointment($this->dbconn);
 212  
 213       if ( isset($_GET['id']) ) {
 214         $this->name = $lang['AppointModify'];
 215         $this->obj = $this->obj->read($_GET['id'],$this->obj);
 216         if ($this->obj->id < 0) {
 217           $msg .= sprintf($lang['Err0040'],$lang[$this->obj->getType()]);
 218           $this->stop = true;
 219         }
 220         $this->obj->read_participants();
 221          /* only the owner may change */
 222         if ( $this->user->id == $this->obj->creator->id )  {
 223           $this->obj->allowed = 2;
 224         }
 225         if ( $this->obj->visitor != -1 ) {
 226           $this->obj->xfn['v'] = $this->obj->visitor->getFullName();
 227         }
 228         if ( $this->obj->product != -1 ) {
 229           $this->obj->xfn['p'] = $this->obj->product->getFullName();
 230         }
 231         foreach($this->obj->participant as $i => $f) {
 232           $p[$i] = 2;
 233         }
 234       } else {
 235         $this->name = $lang['AppointCreate'];
 236         /* New event */
 237         if (isset($_GET['t']) && is_numeric($_GET['t'])) {
 238           $this->obj->start->setDateTime($_GET['t']);
 239           $this->obj->end->setDateTime($_GET['t']);
 240         }
 241         $this->obj->repeat = 1;
 242         $p[$this->user->id] = 2;
 243       }
 244  
 245       # Set available Parameters
 246       if ( isset($_GET['descr']) ) {
 247         $this->obj->descr = StripSlashes($_GET['descr']);
 248       }
 249       if ( isset($_GET['trace']) ) {
 250         $this->obj->trace = $_GET['trace'];
 251       }
 252       if ( isset($_GET['email']) ) {
 253         $this->obj->email = $_GET['email'];
 254       }
 255       if ( isset($_GET['mod_allow']) ) {
 256         $this->obj->mod_allow = $_GET['mod_allow'];
 257       }
 258       if ( isset($_GET['start']) ) {
 259         $this->obj->start->setDateTime($_GET['start']);
 260       }
 261       if ( isset($_GET['end']) ) {
 262         $this->obj->end->setDateTime($_GET['end']);
 263       }
 264       if ( isset($_GET['remember']) ) {
 265         $this->obj->remember = $_GET['remember'];
 266       }
 267       if ( isset($_GET['t_ignore']) ) {
 268         $this->obj->t_ignore = $_GET['t_ignore'];
 269       }
 270  
 271       preset_from_array_or_input($this->obj,'visitor','v');
 272       preset_from_array_or_input($this->obj,'product','p');
 273  
 274       if ( isset($_GET['people']) ) {
 275         $p = array();
 276         foreach($_GET['people'] as $i => $f) {
 277           $p[$f] = 2;
 278         }
 279       }
 280       $this->obj->people = $p;
 281  
 282       if ( isset($_GET['outside']) ) {
 283         $this->obj->outside = $_GET['outside'];
 284       }
 285  
 286       $this->obj->allowed = $this->obj->mod_ok();
 287       if ( ($this->obj->id < 0) && !$this->user->feature_ok(usecalendar,PERM_NEW) ) {
 288         $msg .= sprintf($lang['Err0054'],$lang[$this->obj->getType()]);
 289         $this->stop = true;
 290       } else if (  ! $this->obj->mod_ok() ) {
 291         $msg .= sprintf($lang['Err0024'],$lang[$this->obj->getType()]);
 292         $this->stop = true;
 293       }
 294       # menu
 295       $m = appointment::getSelectLink($this->user);
 296       $m[category][] = "obj";
 297       $this->addmenu($m);
 298       $m = appointment::getAddLink($this->user,$this->obj);
 299       $this->addmenu($m);
 300       if ( $this->obj->id > 0 ) {
 301         if ( $this->obj->del_ok() ) {
 302           $m = array( url => $this->obj->getDelURL(),
 303                       text => $lang['Delete'],
 304                       info => $lang['AppDelInfo'],
 305                       confirm => true,
 306                       category => array("app","del","obj")
 307                     );
 308           $this->addMenu($m);
 309         }
 310         $m = array( url => $this->obj->getURL(),
 311                     text => $lang['AppSeeEntry'],
 312                     info => $lang['AppSeeEntryI'],
 313                     category => array("app","show","obj")
 314                   );
 315         $this->addMenu($m);
 316       }
 317       if ( $this->obj->see_ok() && ($this->obj->id > 0) ) {
 318         $m = array( url => "app_show.php?format=ical&id=". $this->obj->id,
 319                     text => $lang['AppGetIcal'],
 320                     info => $lang['AppGetIcal'],
 321                     category => array("app","show","obj")
 322                   );
 323         $this->addMenu($m);
 324       }
 325       add_module_addlinks($this,$this->obj);
 326     }
 327   }
 328  
 329   $l = new app_new_r($current_user);
 330   $l->display();
 331   $dbconn->Close();
 332  ?>
 333  <!--
 334      CVS Info:  $Id: app_new_r.php,v 1.51.2.2 2004/08/25 19:04:04 gokohnert Exp $
 335      $Author: gokohnert $
 336  -->


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