";
if (($fid) && ($editid) && ($status=='save')) {
$error="";
if ($textarea=="") { $error="
Description is blank.schedule not updated.
"; }
if ($newenddate<$newstartdate) { $error="
End date is before starting date. ($newenddate)schedule not updated.
"; }
if (strlen($newstartdate)<>10) { $error="
Starting date appeared to be invalid. ($newstartdate)schedule not updated.
"; }
if (strlen($newenddate)<>10) { $error="
End date appeared to be invalid. ($newenddate)schedule not updated.
"; }
if (!$error) {
$update="update lerage_schedule set description='$textarea',Start_date='$newstartdate',End_date='$newenddate' where pid='$id' and pjob='$pjob' and Ident='$editid'";
$updaterec = mysql_query("$update") or $msg="
Unable to update schedule, contact admin. ";
//if ($admin) print "$update
";
} else { $msg=$error; $status=""; }
}
if (($fid) && ($delid!="")) {
$update="delete from lerage_schedule where pid='$id' and pjob='$pjob' and Ident='$delid'";
$updaterec = mysql_query("$update") or $msg="
Unable to remove schedule, contact admin. ";
//print "$update
";
}
if (($fid) && ($editid) && ($status!='save')) {
if ($msg) { echo "$msg"; }
echo "
EDIT SCHEDULE
";
$sqry="select description,Start_date,End_date,Ident from lerage_schedule where pid='$id' and pjob='$pjob' and Ident='$editid'";
$srec=SelectQry($sqry);
$desc=$srec[0]['description'];
$desc=str_replace("","",$desc);
$desc=str_replace("
","",$desc);
print "";
//if ($msg) { print "$msg"; }
print "";
print "";
print "";
print "";
if ($y=='') { $y=$current_year; }
if ($m=='') { $m=$current_month; }
print "";
print "";
exit;
} else {
if ($msg) { echo "$msg"; }
echo "TRAVEL PLANS";
if (($y) && ($m)) {
if (($m<10) && (!preg_match("/^0/",$m))) { $m="0" . $m; }
$extra=" and (Start_date like '$y-$m%') ";
} else { $extra=" and (Start_date like '$current_year-$current_month-%') "; }
$sqry="select description,Start_date,End_date,Ident from lerage_schedule where pid='$id' and pjob='$pjob' and description!='' $extra order by Start_date desc limit 10";
//if ($admin) print "$sqry";
$srec=SelectQry($sqry);
for($s=0;$s","",$desc);
$desc=str_replace("","",$desc);
$editid=$srec[$s]['Ident'];
$startdate=$srec[$s]['Start_date'];
$enddate=$srec[$s]['End_date'];
//if ($admin) { print "$editid: $pdate
"; }
if (count($srec)>2) {
if (strlen($desc)>50) {
$desc=substr($desc,0,50);
$desc.="...";
}
}
if (($fid==$id) && ($job==$pjob)) {
print "- $pdate : " . ucfirst($desc) . "
";
} else {
print "- $pdate : " . ucfirst($desc) . "
";
}
}
}
echo "
";
echo "";
echo "";
// Load Calendar for 'testuser' with AJAX day status selection
require "calendar.php";
print calendar("", "", "testuser", 0, 1);
echo "
";
echo "";
echo "";
?>