function InteractiveShell($sExpression, $sQueryId, $sFormat, $sFileName, $sMode) { if ($sMode == 'dialog') { $oP = new ajax_page(''); $oP->add('<div id="interactive_export_dlg">'); $sExportBtnLabel = json_encode(Dict::S('UI:Button:Export')); $sJSTitle = json_encode(htmlentities(utils::ReadParam('dialog_title', '', false, 'raw_data'), ENT_QUOTES, 'UTF-8')); $oP->add_ready_script(<<<EOF \t\t\$('#interactive_export_dlg').dialog({ \t\t\tautoOpen: true, \t\t\tmodal: true, \t\t\twidth: '80%', \t\t\ttitle: {$sJSTitle}, \t\t\tclose: function() { \$('#export-form').attr('data-state', 'cancelled'); \$(this).remove(); }, \t\t\tbuttons: [ \t\t\t\t{text: {$sExportBtnLabel}, id: 'export-dlg-submit', click: function() {} } \t\t\t] \t\t}); \t\t\t \t\tsetTimeout(function() { \$('#interactive_export_dlg').dialog('option', { position: { my: "center", at: "center", of: window }}); \$('#export-btn').hide(); ExportInitButton('#export-dlg-submit'); }, 100); EOF ); } else { $oP = new iTopWebPage('iTop Export'); } if ($sExpression === null) { // No expression supplied, let's check if phrasebook entry is given if ($sQueryId !== null) { $oSearch = DBObjectSearch::FromOQL('SELECT QueryOQL WHERE id = :query_id', array('query_id' => $sQueryId)); $oQueries = new DBObjectSet($oSearch); if ($oQueries->Count() > 0) { $oQuery = $oQueries->Fetch(); $sExpression = $oQuery->Get('oql'); $sFields = trim($oQuery->Get('fields')); } else { ReportErrorAndExit("Invalid query phrasebook identifier: '{$sQueryId}'"); } } else { if (utils::IsModeCLI()) { Usage(); ReportErrorAndExit("No expression or query phrasebook identifier supplied."); } else { // form to enter an OQL query or pick a query phrasebook identifier DisplayForm($oP, utils::GetAbsoluteUrlAppRoot() . 'webservices/export-v2.php', $sExpression, $sQueryId, $sFormat); $oP->output(); exit; } } } if ($sFormat !== null) { $oExporter = BulkExport::FindExporter($sFormat); if ($oExporter === null) { $aSupportedFormats = BulkExport::FindSupportedFormats(); ReportErrorAndExit("Invalid output format: '{$sFormat}'. The supported formats are: " . implode(', ', array_keys($aSupportedFormats))); } else { DisplayForm($oP, utils::GetAbsoluteUrlAppRoot() . 'webservices/export-v2.php', $sExpression, $sQueryId, $sFormat); } } else { DisplayForm($oP, utils::GetAbsoluteUrlAppRoot() . 'webservices/export-v2.php', $sExpression, $sQueryId, $sFormat); } if ($sMode == 'dialog') { $oP->add('</div>'); } $oP->output(); }
$DesiredRecord = $_POST['SelectRecord']; GetLoadDesiredRecord(); DisplayForm(); break; case 'Delete': $DesiredRecord = $_POST['SelectRecord']; GetLoadDesiredRecord(); DeleteForm(); break; case 'Next': Db_Next(); DisplayForm(); break; case 'Previous': Db_Prev(); DisplayForm(); break; case 'Submit Changes': GetPostVariables(); Db_Update(); ListMenu(); break; case 'Submit Delete': GetPostVariables(); Db_Delete(); ListMenu(); break; case 'Submit Add': GetPostVariables(); if (ValidUniqueCode()) { Db_Add();
$formtitle = GetVariable("formtitle"); $formdesc = GetVariable("formdesc"); //$formfieldid = GetVariable("formfieldid"); $datatype = GetVariable("datatype"); $field = GetVariable("field"); $order = GetVariable("order"); $values = GetVariable("values"); $linebreaks = GetVariable("linebreaks"); $scored = GetVariable("scored"); /* determine action */ switch ($action) { case 'editform': DisplayFormForm("edit", $id); break; case 'viewform': DisplayForm($id); break; case 'addform': DisplayFormForm("add", ""); break; case 'updatefields': UpdateFields($id, $datatype, $field, $order, $values, $linebreaks, $scored); DisplayFormForm("edit", $id); break; case 'update': UpdateForm($id, $formtitle, $formdesc, $username); DisplayFormList(); break; case 'add': AddForm($formtitle, $formdesc, $username); DisplayFormList(); break; case 'delete': DeleteForm($id);
<?php /** * @author * @copyright 2010 */ include "connection.php"; if (isset($_GET['appid'])) { $folder = "image/"; $trans = array("/" => "_"); $filename = strtr($appid, $trans); $filename2 = $filename . "_" . "1" . ".jpg"; $filename3 = $filename . "_" . "2" . ".jpg"; if (file_exists("image/" . $filename2)) { DisplayForm($filename2, $filename3, $appid); } else { header("Location: Add_image.php"); exit; } } else { echo "<script type=\"text/javascript\">alert(\"ERROR:: Registration No. is not entered properly. Pls Check\")</script>"; }
$formtitle = GetVariable("formtitle"); $formdesc = GetVariable("formdesc"); //$formfieldid = GetVariable("formfieldid"); $datatype = GetVariable("datatype"); $field = GetVariable("field"); $order = GetVariable("order"); $values = GetVariable("values"); $linebreaks = GetVariable("linebreaks"); $scored = GetVariable("scored"); /* determine action */ switch ($action) { case 'editform': DisplayFormForm("edit", $id); break; case 'viewform': DisplayForm($id); break; case 'addform': DisplayFormForm("add", ""); break; case 'updatefields': UpdateFields($id, $datatype, $field, $order, $values, $linebreaks, $scored); DisplayFormForm("edit", $id); break; case 'update': UpdateForm($id, $formtitle, $formdesc, $username); DisplayFormList(); break; case 'add': AddForm($formtitle, $formdesc, $username); DisplayFormList();
function Add($method, $id, $groupid, $username, $calendarid, $projectid, $details, $title, $startdatetime, $enddatetime, $isalldayevent, $istimerequest, $currentcal, $repeats, $repeattype, $repeatsun, $repeatmon, $repeattue, $repeatwed, $repeatthu, $repeatfri, $repeatsat, $repeatenddate, $editall) { /* check if any form elements are bad, if so redisplay the addform */ if ($title == "") { DisplayForm("", "'Title' is blank", "", $username, $calendarid, $projectid, $details, $title, $startdatetime, $enddatetime, $isalldayevent, $istimerequest, $currentcal, $repeats, $repeattype, $repeatsun, $repeatmon, $repeattue, $repeatwed, $repeatthu, $repeatfri, $repeatsat, $repeatenddate); return; } if (!strtotime($startdatetime)) { DisplayForm("", "'Start date/time' is invalid", "", $username, $calendarid, $projectid, $details, $title, $startdatetime, $enddatetime, $isalldayevent, $istimerequest, $currentcal, $repeats, $repeattype, $repeatsun, $repeatmon, $repeattue, $repeatwed, $repeatthu, $repeatfri, $repeatsat, $repeatenddate); return; } if (!strtotime($enddatetime)) { DisplayForm("", "'End date/time' is invalid", "", $username, $calendarid, $projectid, $details, $title, $startdatetime, $enddatetime, $isalldayevent, $istimerequest, $currentcal, $repeats, $repeattype, $repeatsun, $repeatmon, $repeattue, $repeatwed, $repeatthu, $repeatfri, $repeatsat, $repeatenddate); return; } $details = mysql_real_escape_string($details); $title = mysql_real_escape_string($title); /* check if this appointment repeats */ if (!$repeats) { $numappts = 1; $startdatetimes[0] = date('Y-m-d H:i:s', strtotime($startdatetime)); $enddatetimes[0] = date('Y-m-d H:i:s', strtotime($enddatetime)); } else { if ($method == "add") { /* get all dates on which the repeating appt falls */ /* determine # of days between starting and ending date */ $totaltimediff = strtotime($repeatenddate) - strtotime($startdatetime) + 86400; /* for daily and monthly, add the current date first. all dates are added inside the weekly case below */ if ($repeattype == "daily" || $repeattype == "monthly") { $newappt = date('Y-m-d H:i:s', strtotime($startdatetime)); $appts[] = $newappt; } /* add interval until date difference between starting and new appt is greater than ending date */ $numappts = 1; $lastappt = $startdatetime; //print "Lastappt: $lastappt<br>"; //$appts[] = $startdatetime; $done = false; while (!$done) { switch ($repeattype) { case "daily": $newappt = date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s', strtotime($lastappt)) . " +1 days")); $appts[] = $newappt; break; case "weekly": //print "----- Lastappt: $lastappt<br>"; if ($repeatsun) { $appt = date('Y-m-d H:i:s', strtotime("Sunday", strtotime($lastappt))); //print "Sun appt: $appt<br>"; $appts[] = $appt; } if ($repeatmon) { $appt = date('Y-m-d H:i:s', strtotime("Monday", strtotime($lastappt))); //print "Mon appt: $appt<br>"; $appts[] = $appt; } if ($repeattue) { $appt = date('Y-m-d H:i:s', strtotime("Tuesday", strtotime($lastappt))); //print "Tue appt: $appt<br>"; $appts[] = $appt; } if ($repeatwed) { $appt = date('Y-m-d H:i:s', strtotime("Wednesday", strtotime($lastappt))); //print "Wed appt: $appt<br>"; $appts[] = $appt; } if ($repeatthu) { $appt = date('Y-m-d H:i:s', strtotime("Thursday", strtotime($lastappt))); //print "Thu appt: $appt<br>"; $appts[] = $appt; } if ($repeatfri) { $appt = date('Y-m-d H:i:s', strtotime("Friday", strtotime($lastappt))); //print "Fri appt: $appt<br>"; $appts[] = $appt; } if ($repeatsat) { $appt = date('Y-m-d H:i:s', strtotime("Saturday", strtotime($lastappt))); //print "Sat appt: $appt<br>"; $appts[] = $appt; } $newappt = date('Y-m-d H:i:s', strtotime($lastappt . " +1 weeks")); break; case "monthly": $newappt = date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s', strtotime($lastappt)) . " +1 month")); $appts[] = $newappt; break; } $newtimediff = strtotime($newappt) - strtotime($startdatetime); if ($newtimediff > $totaltimediff) { $done = true; break; } $numappts++; if ($numappts > 100) { $done = true; } $lastappt = $newappt; } /* sort the appointment list and remove any appointments that fall outside the startdate/enddate range */ sort($appts); /* make sure the remaining appointments retain the time */ $k = 0; for ($i = 0; $i < count($appts); $i++) { //print date('Y-m-d', strtotime($appts[$i])); //print date('H:i:s', strtotime($startdatetime)); $appts[$i] = date('Y-m-d', strtotime($appts[$i])) . " " . date('H:i:s', strtotime($startdatetime)); $newtimediff = strtotime($appts[$i]) - strtotime($startdatetime); //print "NewTimeDiff: $newtimediff, Totaltimediff $totaltimediff<br>"; //echo "<pre>"; //print_r(get_defined_vars()); //echo "</pre>"; if ($newtimediff < $totaltimediff) { $startdatetimes[$k] = date('Y-m-d H:i:s', strtotime($appts[$i])); // . date('H:i:s', strtotime($startdatetime)); //$appts[$i] = date('Y-m-d', strtotime($appts[$i])) . " " . date('H:i:s', strtotime($startdatetime)); $enddatetimes[$k] = date('Y-m-d ', strtotime($appts[$i])) . date('H:i:s', strtotime($enddatetime)); $k++; } } } } //echo "<pre>"; //print_r($appts); //print_r($startdatetimes); //print_r($enddatetimes); //echo "</pre>"; //$groupid = ""; /* add all the appointments, one by one */ for ($i = 0; $i < count($startdatetimes); $i++) { /* if this is an all day appointment, ignore any times that were entered */ if ($isalldayevent) { $startdatetime = date('Y-m-d 00:00:00', strtotime($startdatetimes[$i])); $enddatetime = date('Y-m-d 00:00:00', strtotime($enddatetimes[$i])); } elseif ($istimerequest) { $startdatetime = date('Y-m-d H:i:s', strtotime($startdatetimes[$i])); $enddatetime = date('Y-m-d H:i:s', strtotime($enddatetimes[$i])); } else { $startdatetime = date('Y-m-d H:i:s', strtotime($startdatetimes[$i])); $enddatetime = date('Y-m-d H:i:s', strtotime($enddatetimes[$i])); // /* ignore allocations (for now) */ // /* check if there are any allocations for this calendar/project */ // $sqlstring = "select * from allocations where alloc_calendarid = $calendarid and alloc_projectid = $projectid"; // $result = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><i>$sqlstring</i><br>"); // if (mysql_num_rows($result) > 0) { // $row = mysql_fetch_array($result, MYSQL_ASSOC); // $alloc_days = $row['alloc_timeperiod']; // $alloc_hours = $row['alloc_amount']; // $allocdays = $alloc_days/2; // /* check the number of hours allocated vs the number of appointments on either side of this appointment */ // if ($method == "add") { // $sqlstring = "SELECT unix_timestamp(appt_startdate)/3600 'appt_startdate', unix_timestamp(appt_enddate)/3600 'appt_enddate' FROM `calendar_appointments` WHERE appt_startdate between (date_add('$startdatetime', interval -$allocdays day)) and (date_add('$startdatetime', interval $allocdays day)) and appt_calendarid = $calendarid and appt_projectid = $projectid and appt_isalldayevent = 0 and appt_istimerequest = 0 and appt_deletedate > now() and appt_canceldate > now()"; // } // else { // $sqlstring = "SELECT unix_timestamp(appt_startdate)/3600 'appt_startdate', unix_timestamp(appt_enddate)/3600 'appt_enddate' FROM `calendar_appointments` WHERE appt_startdate between (date_add('$startdatetime', interval -$allocdays day)) and (date_add('$startdatetime', interval $allocdays day)) and appt_calendarid = $calendarid and appt_projectid = $projectid and appt_isalldayevent = 0 and appt_istimerequest = 0 and appt_deletedate > now() and appt_canceldate > now() and appt_id != $id"; // } // $result = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><i>$sqlstring</i><br>"); // $total = 0; // while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { // $start = $row['appt_startdate']; // $end = $row['appt_enddate']; // $apptlength = $end - $start; // $total += $apptlength; // } // if ($total > $alloc_hours) { // ?> <!-- <div align="center" style="border:orange 1px solid; background: lightyellow"> // This appointment exceeds the allocation of <?php echo $alloc_hours; ?> hours per <?php echo $alloc_days; ?> for this project. Before adding this appointment, the project is using <?php echo $total; ?> hours within a <?php echo $alloc_days; ?> day span of time centered at <?php echo $startdatetime; ?> </div> --> <?php // } // } /* check to see if this appointment overlaps an existing appt on the same calendar */ if ($method == "add") { $sqlstring = "select * from calendar_appointments where ( (appt_startdate > '{$startdatetime}' and appt_startdate < '{$enddatetime}') or (appt_enddate > '{$startdatetime}' and appt_enddate < '{$enddatetime}') or (appt_startdate = '{$startdatetime}' and appt_enddate = '{$enddatetime}') or (appt_startdate < '{$startdatetime}' and appt_enddate > '{$startdatetime}') or (appt_startdate < '{$enddatetime}' and appt_enddate > '{$enddatetime}') ) and appt_calendarid = {$calendarid} and appt_deletedate > now() and appt_canceldate > now() and appt_istimerequest <> 1"; } else { $sqlstring = "select * from calendar_appointments where ( (appt_startdate > '{$startdatetime}' and appt_startdate < '{$enddatetime}') or (appt_enddate > '{$startdatetime}' and appt_enddate < '{$enddatetime}') or (appt_startdate = '{$startdatetime}' and appt_enddate = '{$enddatetime}') or (appt_startdate < '{$startdatetime}' and appt_enddate > '{$startdatetime}') or (appt_startdate < '{$enddatetime}' and appt_enddate > '{$enddatetime}') ) and appt_calendarid = {$calendarid} and appt_deletedate > now() and appt_canceldate > now() and appt_id != {$id} and appt_istimerequest <> 1"; } //echo "<br>$sqlstring<br>"; $result = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><i>{$sqlstring}</i><br>"); if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $tstart = $row['appt_startdate']; $tend = $row['appt_enddate']; $ttitle = $row['appt_title']; } DisplayForm("", "This appointment overlaps with an existing appointment(s): [{$ttitle}: {$tstart} - {$tend}]", "", $username, $calendarid, $projectid, $details, $title, $startdatetime, $enddatetime, $isalldayevent, $istimerequest, $currentcal, $repeats, $repeattype, $repeatsun, $repeatmon, $repeattue, $repeatwed, $repeatthu, $repeatfri, $repeatsat, $repeatenddate, ""); return; } } /* if we get to this point, its safe to add to the database */ if ($method == "add") { $sqlstring = "insert into calendar_appointments (appt_groupid, appt_username, appt_calendarid, appt_projectid, appt_title, appt_details, appt_startdate, appt_enddate, appt_isalldayevent, appt_istimerequest) values ('{$groupid}', '{$username}', {$calendarid}, {$projectid}, '{$title}', '{$details}', '{$startdatetime}', '{$enddatetime}', {$isalldayevent}, {$istimerequest})"; //echo "$sqlstring<br>"; $result = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><i>{$sqlstring}</i><br>"); /* CALULATE&POPULATE GROUP ID */ if ($groupid == "") { $groupid = mysql_insert_id(); $sqlstring = "update calendar_appointments set appt_groupid = {$groupid} where appt_id = {$groupid}"; //echo "$sqlstring<br>"; $result = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><i>{$sqlstring}</i><br>"); } } else { $sqlstring = "select * from calendar_appointments where appt_groupid = {$groupid}"; $result = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><i>{$sqlstring}</i><br>"); if (mysql_num_rows($result) > 1) { $repeats = true; } if ($editall) { $sqlstring = "update calendar_appointments set appt_username = '******', appt_calendarid = {$calendarid}, appt_projectid = {$projectid}, appt_title = '{$title}', appt_details = '{$details}', appt_isalldayevent = {$isalldayevent}, appt_istimerequest = {$istimerequest} where appt_groupid = {$groupid}"; } else { if ($repeats) { $sqlstring = "update calendar_appointments set appt_username = '******', appt_calendarid = {$calendarid}, appt_projectid = {$projectid}, appt_title = '{$title}', appt_details = '{$details}', appt_isalldayevent = {$isalldayevent}, appt_istimerequest = {$istimerequest} where appt_id = {$id}"; } else { $sqlstring = "update calendar_appointments set appt_username = '******', appt_calendarid = {$calendarid}, appt_projectid = {$projectid}, appt_title = '{$title}', appt_details = '{$details}', appt_startdate = '{$startdatetime}', appt_enddate = '{$enddatetime}', appt_isalldayevent = {$isalldayevent}, appt_istimerequest = {$istimerequest} where appt_id = {$id}"; } } //echo "$sqlstring<br>"; //exit(0); $result = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><i>{$sqlstring}</i><br>"); } } ?> <div align="center"> <?php if ($method == "add") { echo "Appointment added"; } else { echo "Appointment updated"; } ?> <br> <table><tr><td><img src="images/back16.png"></td><td><a href="calendar.php" class="link">Back</a> to calendar</td></tr></table><br> </div> <?php }
case 'create': $msg = CreateAccount($email, $firstname, $midname, $lastname, $institution, $instance, $country, $password); if ($msg != "") { DisplayForm($msg, $email, $firstname, $midname, $lastname, $institution, $instance, $country); } else { DisplaySuccessMessage($email, $firstname, $midname, $lastname, $institution, $instance, $country, $password); } break; case 'r': ResetPasswordForm(""); break; case 'rp': ResetPassword($e); break; default: DisplayForm(""); } /* -------------------------------------------- */ /* ------- DisplaySuccessMessage -------------- */ /* -------------------------------------------- */ function DisplaySuccessMessage($email, $name, $institution, $country, $password) { ?> <div align="center"> <br><br> <b>Thank you for signing up</b><br><br> An email has been sent to <<?php echo $email; ?> > with a link to activate your account. </div>