[Tutos-commits] CVS: tutos/php app_new.php,1.33,1.34 appointment.pinc,1.100,1.101
Projects / CRM / PLM / Calendar / Tasks / SCRUM / Test / Inventory
Brought to you by:
gokohnert
From: Gero K. <gok...@us...> - 2002-09-01 09:27:47
|
Update of /cvsroot/tutos/tutos/php In directory usw-pr-cvs1:/tmp/cvs-serv30697/php Modified Files: app_new.php appointment.pinc Log Message: php/app_ins.php Index: app_new.php =================================================================== RCS file: /cvsroot/tutos/tutos/php/app_new.php,v retrieving revision 1.33 retrieving revision 1.34 diff -u -r1.33 -r1.34 --- app_new.php 27 Aug 2002 16:57:00 -0000 1.33 +++ app_new.php 1 Sep 2002 09:27:44 -0000 1.34 @@ -101,124 +101,121 @@ echo $lang['EndTime']; echo "</a>\n"; } - echo "</B> <BR> <FONT SIZE=-1>(HH:MM)</FONT></TD>\n"; - echo "<TD COLSPAN=2>"; - $this->obj->end->EnterTime("end"); - echo "</TD>\n"; - - echo "</TR><TR>\n"; - - # LOCATION - echo $this->showfieldc($lang['Location2'],0,"outside"); - echo " <TD COLSPAN=2>\n"; - echo " <SELECT name=outside>\n"; - @reset($lang['AppLoc']); - while ( list($i,$f) = each($lang['AppLoc']) ) { - echo " <OPTION VALUE=\"". $i ."\" ". ($this->obj->outside == $i ? "SELECTED":"") .">". $lang['AppLoc'][$i] ."</OPTION>\n"; - } - echo " </SELECT>\n"; - echo " </TD>\n"; - - # Ignore times - echo " <TD COLSPAN=3 VALIGN=top>\n"; - echo $lang['IgnoreTime']; - echo " <INPUT type=\"checkbox\" name=\"t_ignore\" value=1 ". ($this->obj->t_ignore == 1 ? "CHECKED":"") ."><BR>\n"; - echo "<FONT SIZE=-1>". $lang['IgnoreTime2'] ."</FONT>"; - echo " </TD>\n"; - - - echo "</TR><TR>\n"; - echo $this->showfield($lang['Description'],0,"descr"); - echo " <TD COLSPAN=5><TEXTAREA wrap=virtual rows=3 cols=40 name=\"descr\">". $this->obj->descr ."</TEXTAREA>\n"; - echo " </TD>\n"; - - - echo "</TR><TR>\n"; - # Customer/Visitor name - echo $this->showfieldc($lang['VisitAt'] ."<BR>". $lang['VisitFrom'],0,"vfn"); - echo " <TD COLSPAN=1>"; - select_from_array_or_input($this->obj,"v",$this->obj->visitor,1); - echo " </TD>\n"; - echo " <TD COLSPAN=4 ROWSPAN=2> </TD>\n"; + echo "</B> <BR> <FONT SIZE=-1>(HH:MM)</FONT></TD>\n"; + echo "<TD COLSPAN=2>"; + $this->obj->end->EnterTime("end"); + echo "</TD>\n"; - if ( $this->user->feature_ok(useprojects,PERM_SEE) ) { - echo "</TR><TR>\n"; - echo $this->showfieldc($lang['Product'],0,"pfn"); - echo " <TD COLSPAN=1>\n"; - select_from_array_or_input($this->obj,"p",$this->obj->product,1); - echo " </TD>\n"; - } else { echo "</TR><TR>\n"; - echo " <TD COLSPAN=2> </TD>\n"; - } - - echo "</TR><TR>\n"; - echo " <TD CLASS=\"desc\" ROWSPAN=2 VALIGN=top><LABEL FOR=\"people[]\">". $lang['Participants'] ."</LABEL> <FONT COLOR=red>(*)</FONT></TD>"; - echo " <TD ROWSPAN=2 VALIGN=top>\n"; - - echo "". $this->user->askPeople("people[]",$this->obj->people,1) ."\n"; - - echo " </TD>\n"; - - echo " <TD COLSPAN=1>\n"; - echo $lang['tracestate']; - echo " <INPUT type=\"checkbox\" name=\"trace\" value=1 ". ($this->obj->trace == 1 ? "CHECKED":"") .">\n"; - echo "<BR><FONT SIZE=-1>". $lang['tracestate_desc'] ."</FONT>"; - echo " </TD>\n"; - - echo " <TD COLSPAN=3> <B>". $lang['AppChangeOrDel'] ."</B> <BR>\n"; - echo " <INPUT type=\"radio\" name=\"mod_allow\" value=2 ". $a_checked[2] ."> ". $lang['only'] ." ". $this->obj->creator->getLink() ."<BR>\n"; - echo " <INPUT type=\"radio\" name=\"mod_allow\" value=1 ". $a_checked[1] ."> ". $lang['Participants'] ."<BR>\n"; - echo " <INPUT type=\"radio\" name=\"mod_allow\" value=0 ". $a_checked[0] ."> ". $lang['everybody'] ."<BR>\n"; - echo " <INPUT type=\"radio\" name=\"mod_allow\" value=3 ". $a_checked[3] ."> ". $lang['AppPrivate'] ."<BR>\n"; + # LOCATION + echo $this->showfieldc($lang['Location2'],0,"outside"); + echo " <td colspan=\"2\">\n"; + echo " <select name=\"outside\">\n"; + foreach ($lang['AppLoc'] as $i => $f) { + echo " <option value=\"". $i ."\" ". ($this->obj->outside == $i ? "SELECTED":"") .">". $lang['AppLoc'][$i] ."</option>\n"; + } + echo " </select>\n"; + echo " </td>\n"; + + # Ignore times + echo " <td colspan=\"3\" valign=\"top\">\n"; + echo "<input type=\"checkbox\" name=\"t_ignore\" value=1 ". ($this->obj->t_ignore == 1 ? "CHECKED":"") .">\n"; + echo $lang['IgnoreTime'] ."<br>\n"; + echo "<FONT SIZE=-1>". $lang['IgnoreTime2'] ."</FONT>"; + echo " </TD>\n"; - echo " </TD>\n"; - echo "</TR><TR>\n"; + echo "</tr><tr>\n"; + echo $this->showfield($lang['Description'],0,"descr"); + echo " <td colspan=\"5\"><textarea wrap=\"virtual\" rows=\"3\" cols=\"40\" name=\"descr\">". $this->obj->descr ."</textarea>\n"; + echo " </TD>\n"; - echo " <TD COLSPAN=1>\n"; - if ( $this->obj->id > 0 ) { - echo $lang['InfoEmail']; - } else { - echo $lang['InviteEmail']; - } - echo " <INPUT type=\"checkbox\" name=\"email\" value=1 ". ($this->obj->email == 1 ? "CHECKED":"") .">\n"; - echo " </TD>\n"; - @reset($lang['AppRemind']); - while ( list ($i,$f) = @each ($lang['AppRemind']) ) { - $x[$i] = ""; - } - $x[$this->obj->remember] = "SELECTED"; + echo "</tr><tr>\n"; + # Customer/Visitor name + echo $this->showfieldc($lang['VisitAt'] ."<BR>". $lang['VisitFrom'],0,"vfn"); + echo " <td colspan=\"5\">"; + select_from_array_or_input($this->obj,"v",$this->obj->visitor,1); + echo " </td>\n"; + + if ( $this->user->feature_ok(useprojects,PERM_SEE) ) { + echo "</TR><TR>\n"; + echo $this->showfieldc($lang['Product'],0,"pfn"); + echo " <td colspan=\"5\">\n"; + select_from_array_or_input($this->obj,"p",$this->obj->product,1); + echo " </TD>\n"; + } + + # list of possible participants + echo "</tr><tr>\n"; + echo " <td class=\"desc\" rowspan=\"3\" valign=top><label for=\"people[]\">". $lang['Participants'] ."</label> <FONT COLOR=red>(*)</FONT></TD>"; + echo " <td rowspan=\"3\" valign=\"top\">\n"; + + echo "". $this->user->askPeople("people[]",$this->obj->people,1) ."\n"; + + echo " </td>\n"; + + # Voting + echo " <td colspan=\"1\">\n"; + echo "<input type=\"checkbox\" name=\"trace\" value=\"1\" ". ($this->obj->trace == 1 ? "CHECKED":"") .">\n"; + echo $lang['tracestate']; + echo "<BR><FONT SIZE=-1>". $lang['tracestate_desc'] ."</FONT>"; + echo " </td>\n"; + + # Permissions + echo " <td rowspan=\"2\" colspan=\"3\"> <B>". $lang['AppChangeOrDel'] ."</B> <BR>\n"; + echo " <input type=\"radio\" name=\"mod_allow\" value=2 ". $a_checked[2] ."> ". $lang['only'] ." ". $this->obj->creator->getLink() ."<BR>\n"; + echo " <input type=\"radio\" name=\"mod_allow\" value=1 ". $a_checked[1] ."> ". $lang['Participants'] ."<BR>\n"; + echo " <input type=\"radio\" name=\"mod_allow\" value=0 ". $a_checked[0] ."> ". $lang['everybody'] ."<BR>\n"; + echo " <input type=\"radio\" name=\"mod_allow\" value=3 ". $a_checked[3] ."> ". $lang['AppPrivate'] ."<BR>\n"; + echo " </td>\n"; + + echo "</tr><tr>\n"; + + # check available + echo "<td colspan=\"1\">\n"; + echo "<input type=\"checkbox\" name=\"check\" value=\"1\" ". ($this->obj->check == 1 ? "CHECKED":"") .">\n"; + echo "check<br>(do not create on conflicts)</td>"; + echo "</tr><tr>\n"; + + # email invite/inform + echo " <td colspan=\"1\">\n"; + echo "<input type=\"checkbox\" name=\"email\" value=\"1\" ". ($this->obj->email == 1 ? "CHECKED":"") .">\n"; + if ( $this->obj->id > 0 ) { + echo $lang['InfoEmail']; + } else { + echo $lang['InviteEmail']; + } + echo " </td>\n"; - echo " <TD COLSPAN=3>". $lang['AppEmailRemind'] ."<BR>\n"; - echo " <SELECT name=\"remember\">\n"; - @reset($lang['AppRemind']); - while ( list ($i,$f) = @each ($lang['AppRemind']) ) { - echo " <OPTION VALUE=". $i ." ". $x[$i] .">". $f ."</OPTION>\n"; - } - echo " </SELECT>"; - echo " </TD>\n"; - echo " </TR>\n"; + # reminder email + echo " <td colspan=\"3\"><b>". $lang['AppEmailRemind'] ."</b><br>\n"; + echo " <select name=\"remember\">\n"; + foreach ($lang['AppRemind'] as $i => $f) { + echo " <option value=\"". $i ."\"". ($i == $this->obj->remember ? " SELECTED":"") .">". $f ."</option>\n"; + } + echo " </select>"; + echo " </td>\n"; + echo " </tr>\n"; - module_addforms($this->user,$this->obj,6); + module_addforms($this->user,$this->obj,6); - if ( $this->obj->allowed != 0 ) { - echo "<TR>\n"; + if ( $this->obj->allowed != 0 ) { + echo "<tr>\n"; - if ( $this->obj->id > 0 ) { - submit_reset(0,1,2,1,2,0); - } else { - submit_reset(0,-1,2,1,2,0); - } - echo "</TR>\n"; + if ( $this->obj->id > 0 ) { + submit_reset(0,1,2,1,2,0); + } else { + submit_reset(0,-1,2,1,2,0); + } + echo "</tr>\n"; } echo $this->DataTableEnd(); hiddenFormElements(); echo $this->getHidden(); - echo "</FORM>\n"; + echo "</form>\n"; echo $lang['FldsRequired'] ."\n"; } /** @@ -311,6 +308,9 @@ } if ( isset($HTTP_GET_VARS['t_ignore']) ) { $this->obj->t_ignore = $HTTP_GET_VARS['t_ignore']; + } + if ( isset($HTTP_GET_VARS['check']) ) { + $this->obj->check = $HTTP_GET_VARS['check']; } preset_from_array_or_input($this->obj,'visitor','v'); Index: appointment.pinc =================================================================== RCS file: /cvsroot/tutos/tutos/php/appointment.pinc,v retrieving revision 1.100 retrieving revision 1.101 diff -u -r1.100 -r1.101 --- appointment.pinc 24 Aug 2002 07:53:52 -0000 1.100 +++ appointment.pinc 1 Sep 2002 09:27:44 -0000 1.101 @@ -78,9 +78,9 @@ unset($f); } # Check Project - if ( array_key_exists($obj->product->id,$uids)) { + if ( array_key_exists($obj->product->id,$uids)) { return true; - } + } # Check Resources if ( class_exists ("resource") ) { resource::obj_read($obj); @@ -91,7 +91,7 @@ } unset($f); } - } + } return false; } if ( $obj->gettype() == "note" ) { @@ -175,7 +175,7 @@ foreach($tt->ids as $i1 => $f1 ) { $uids[$i1] = 1; } - unset($tt); + unset($tt); } } else { $tt = getObject($user->dbconn,$team); @@ -196,7 +196,7 @@ } else { $msg .= sprintf($lang['Err0022'],$lang['Calendar']."(". $lang['Team']." ".$tt->getFullName().")"); cal_setDefault($user,$uids); - } + } } else if ( $tt->getType() == "user" ) { if ( $tt->see_ok() ) { $uids[$team] = 1; @@ -205,18 +205,18 @@ foreach($tt->teamids as $i => $f ) { $uids[$i] = 1; } - } else { + } else { $msg .= sprintf($lang['Err0022'],$lang['Calendar']."(". $lang['User']." ".$tt->getFullName().")"); cal_setDefault($user,$uids); - } + } } else { if ( $tt->see_ok() ) { $teamname = $lang[$tt->getType()] ." ". $tt->getFullname(); $uids[$team] = 1; - } else { + } else { $msg .= sprintf($lang['Err0022'],$lang['Calendar']."(". $lang[$tt->getType()]." ".$tt->getFullName().")"); cal_setDefault($user,$uids); - } + } } } return $uids; @@ -446,7 +446,7 @@ $this->participant_state[$xx] = $result->get($a, "state"); $a++; - unset($p); + unset($p); } $result->free(); $this->participants_is_read = 1; @@ -573,7 +573,7 @@ $q = "DELETE FROM ". $this->tablename2 ." WHERE app_id = ". $this->id; $this->dbconn->Exec($q); - $msg .= parent::delete(); + $msg .= parent::delete(); return $msg; } /** @@ -970,14 +970,35 @@ $ical .= "END:VCALENDAR\n"; return $ical; } - /* --------------------------------------------------------------------------- + /** + * check the availablility of all participants + */ + function check_participants(&$msg) { + # read the calendar for all participants + # with the given dates + $r = false; + $this->callist = array(); + $this->readCal($this,$this->start,$this->end); + foreach ($this->callist as $i => $f) { + foreach ($this->participant as $i2 => $f2) { + $uids = array(); + $uids[$i2] = $this->participant[$i2]; + if ( cal_check_against_list($f,$uids) ) { + $msg .= "conflict : ". $f2->getFullName() ." : ". $f->getLink() ."<br>\n"; + $r = true; + } + } + } + return $r; + } + /** * Return a Location of Appointment */ function getLocation() { global $lang; - return "<SPAN class=apploc". $this->outside .">". $lang['AppLoc'][$this->outside] ."</SPAN>"; + return "<span class=\"apploc". $this->outside ."\">". $lang['AppLoc'][$this->outside] ."</span>"; } - /* --------------------------------------------------------------------------- + /** * put aout the formatted appointment */ function formatted () { @@ -1023,10 +1044,10 @@ $duration = sprintf($duration," "); } - echo " <TR>\n"; - echo " <TD NOWRAP CLASS=". $class ." COLSPAN=2><B> ". $this->getLink($duration) ."</B></TD>\n"; - echo " <TD NOWRAP CLASS=". $class ." ALIGN=right><B>". $this->getLocation() ."</B></TD>\n"; - echo " </TR>\n"; + echo " <tr>\n"; + echo " <td nowrap class=\"". $class ."\" colspan=\"2\"><b> ". $this->getLink($duration) ."</b></td>\n"; + echo " <td nowrap class=\"". $class ."\" align=\"right\"><b>". $this->getLocation() ."</b></td>\n"; + echo " </tr>\n"; @reset($this->participant); while ( list ($i,$fp) = @each ($this->participant) ) { @@ -1037,29 +1058,29 @@ $cols = 3; } if ( $fp->gettype() == "address" ) { - echo " <TD NOWRAP CLASS=". $class ." WIDTH=\"100%\" COLSPAN=". $cols .">"; + echo " <td nowrap class=\"". $class ."\" width=\"100%\" colspan=\"". $cols ."\">"; /* for adresses show link with first + last name */ echo $fp->getLink( $fp->getShortName()); } else if ( $fp->gettype() == "team" ) { - echo " <TD CLASS=". $class ." WIDTH=\"100%\" COLSPAN=". $cols .">"; + echo " <td class=\"". $class ."\" width=\"100%\" colspan=\"". $cols ."\">"; /* for teams show link name */ echo $fp->getLink(); } else { - echo " <TD CLASS=". $class ." WIDTH=\"100%\" COLSPAN=". $cols .">"; + echo " <td class=\"". $class ."\" width=\"100%\" colspan=\"". $cols ."\">"; echo gettype($fp); } - echo "</TD>\n"; + echo "</td>\n"; if ( ($this->trace == 1) && ($fp->gettype() == "address") ) { $s = sprintf("text%d",$this->participant_state[$i]); - echo " <TD CLASS=". $class ." ALIGN=right><SPAN CLASS=". $s .">"; + echo " <td class=\"". $class ."\" align=\"right\"><span class=\"". $s ."\">"; if ( $fp->id == $current_user->id ) { echo makelink("app_vote.php?id=". $this->id ."&adr_id=". $fp->id,$lang['AppState'][$this->participant_state[$i]],$lang['AppVoteInfo']); } else { echo $lang['AppState'][$this->participant_state[$i]]; } - echo "</SPAN></TD>\n"; + echo "</span></td>\n"; } - echo " </TR>\n"; + echo " </tr>\n"; } if ( $tutos[applocdesc][$this->outside] == 1 ) { @@ -1114,7 +1135,7 @@ } } } - /** --------------------------------------------------------------------------- + /** * checks if the appointment happens that day * Date d true if appointment happens that day */ @@ -1124,10 +1145,8 @@ if ( $x < $this->start->getYYYYMMDD() ) return false; - -# $this->descr .= "\n".$this->s_out . $this->e_out; -# $this->descr .= "\n".$d->getDateTime(); - + $this->s_out = 0; + $this->e_out = 0; switch ( $this->repeat ) { case 0: if ( $x > $this->end->getYYYYMMDD() ) return false; @@ -1144,32 +1163,34 @@ break; case 1: if ($this->r_arg != Date("w",$d->getTimeStamp())) return false; - if ( $this->r_ignore == 0 ) { + if ( $this->r_ignore == 0 ) { # Check end if ( $x > $this->end->getYYYYMMDD() ) return false; } break; case 2: if ($this->r_arg != Date("j",$d->getTimeStamp())) return false; - if ( $this->r_ignore == 0 ) { + if ( $this->r_ignore == 0 ) { # Check end if ( $x > $this->end->getYYYYMMDD() ) return false; } break; case 3: if ($this->r_arg != Date("j/n",$d->getTimeStamp())) return false; - if ( $this->r_ignore == 0 ) { + if ( $this->r_ignore == 0 ) { # Check end if ( $x > $this->end->getYYYYMMDD() ) return false; } break; case 4: - if ( $this->r_ignore == 0 ) { + if ( $this->r_ignore == 0 ) { # Check end if ( $x > $this->end->getYYYYMMDD() ) return false; } break; - } + default: + break; + } return true; } /** --------------------------------------------------------------------------- @@ -1279,13 +1300,13 @@ echo $user->layout->showfield($lang['Appointments']); echo " <TD VALIGN=top COLSPAN=".($cols-1).">\n"; $ext = 0; - if ($obj->getType() == "product") { + if ($obj->getType() == "product") { $ext = 2; - } + } if ( $format == "paper" ) { showApps($obj,0,$ext,-1); } else { - showApps($obj,0,$ext); + showApps($obj,0,$ext); } echo " </TD>\n"; echo "</TR>\n"; @@ -1404,27 +1425,27 @@ $r->free(); - $wd = ""; - $md = ""; - $ymd = ""; - $pre = ""; - $x = $from; - while ( $x->getTimeStamp() < $to->getTimeStamp() ) { + $x = $from; + $wd .= $pre ."'". Date("w",$x->getTimeStamp()) ."'"; + $md .= $pre ."'". Date("j",$x->getTimeStamp()) ."'"; + $ymd .= $pre ."'". Date("j/n",$x->getTimeStamp()) ."'"; + $x->addDays(1); + $pre = ","; + while ( $x->getTimeStamp() < $to->getTimeStamp() ) { $wd .= $pre ."'". Date("w",$x->getTimeStamp()) ."'"; $md .= $pre ."'". Date("j",$x->getTimeStamp()) ."'"; $ymd .= $pre ."'". Date("j/n",$x->getTimeStamp()) ."'"; - $pre = ","; - $x->addDays(1); - } + $x->addDays(1); + } # # Second query ( repeating appointments w/o end ) # $q = "SELECT c.* FROM calendar c WHERE "; $q .= " r_ignore = 1 AND ("; $q .= " ( repeat = 1 AND r_arg in (". $wd .") )"; - $q .= "OR ( repeat = 2 AND r_arg in (". $md .") )"; - $q .= "OR ( repeat = 3 AND r_arg in (". $ymd .") )"; - $q .= "OR ( repeat = 4 )"; + $q .= " OR ( repeat = 2 AND r_arg in (". $md .") )"; + $q .= " OR ( repeat = 3 AND r_arg in (". $ymd .") )"; + $q .= " OR ( repeat = 4 )"; $q .= " ) AND ( a_start <= ". $x2 ." )"; $q .= ""; $q .= " ORDER by a_start"; @@ -1451,9 +1472,9 @@ $q = "SELECT c.* FROM calendar c WHERE "; $q .= " r_ignore = 0 AND ("; $q .= " ( repeat = 1 AND r_arg in (". $wd .") )"; - $q .= "OR ( repeat = 2 AND r_arg in (". $md .") )"; - $q .= "OR ( repeat = 3 AND r_arg in (". $ymd .") )"; - $q .= "OR ( repeat = 4 )"; + $q .= " OR ( repeat = 2 AND r_arg in (". $md .") )"; + $q .= " OR ( repeat = 3 AND r_arg in (". $ymd .") )"; + $q .= " OR ( repeat = 4 )"; $q .= ") AND ( (a_start < ". $x2 ." AND a_start >= ". $x1 .")"; $q .= " OR (a_end < ". $x2 ." AND a_end >= ". $x1 .")"; $q .= " OR (a_start < ". $x1 ." AND a_end >= ". $x2 .")"; |