} if (strlen($_GET['day']) < 2) { $_GET['day'] = "0" . $_GET['day']; } $event_date = $_GET['year'] . "-" . $_GET['month'] . "-" . $_GET['day']; //Check if it's a valid date if (!checkdate($_GET['month'], $_GET['day'], $_GET['year'])) { exit("<b>{$lang['global_01']}{$lang['colon']}</b><br>{$lang['calendar_popup_19']}"); } print "<div style='color:green;font-family:verdana;padding:5px;margin-bottom:10px;font-weight:bold;font-size:16px;border-bottom:1px solid #aaa;'>\n\t\t\t\t{$lang['calendar_popup_20']}</div>\n\t\t\t\n\t\t\t<form method='post' action='{$_SERVER['PHP_SELF']}?pid={$project_id}&width=600' name='form'>\n\t\t\t<table style='font-family:Arial;font-size:14px;' cellpadding='0' cellspacing='10'>"; // Show option to attach calendar event to a record (i.e. unscheduled cal event) if ($_GET['record'] != "") { $_GET['record'] = strip_tags(label_decode($_GET['record'])); print "\n\t\t\t<tr>\n\t\t\t\t<td valign='top'>{$table_pk_label}: </td>\n\t\t\t\t<td valign='top'>\n\t\t\t\t\t<b>" . RCView::escape(removeDDEending($_GET['record'])) . "</b>\n\t\t\t\t\t<input type='hidden' name='idnumber' value='" . RCView::escape($_GET['record']) . "'>\n\t\t\t\t</td>\n\t\t\t</tr>"; } print "<tr>\n\t\t\t\t<td valign='top'>{$lang['global_18']}{$lang['colon']}</td>\n\t\t\t\t<td valign='top'>\n\t\t\t\t\t<b>" . DateTimeRC::format_ts_from_ymd($event_date) . " (" . DateTimeRC::getDay($event_date) . ")</b>\n\t\t\t\t\t<input type='hidden' id='event_date' name='event_date' value='{$event_date}'>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td valign='top'>\n\t\t\t\t\t{$lang['global_13']}{$lang['colon']}\n\t\t\t\t\t<div style='font-size:10px;color:#888;'>{$lang['global_06']}</div>\n\t\t\t\t</td>\n\t\t\t\t<td valign='top'>\n\t\t\t\t\t<input type='text' class='x-form-text x-form-field time' id='event_time' name='event_time' maxlength='5' style='width:50px;' onblur=\"redcap_validate(this,'','','soft_typed','time')\"> \n\t\t\t\t\t<span style='font-size:10px;color:#777;font-family:tahoma;'>HH:MM ({$lang['calendar_popup_22']})</span>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td valign='top'>{$lang['calendar_popup_11']}{$lang['colon']}</td>\n\t\t\t\t<td valign='top'><textarea id='notes' name='notes' class='x-form-textarea x-form-field' style='font-size:12px;width:400px;height:100px;'>{$row['notes']}</textarea></td>\n\t\t\t</tr>"; // Show option to attach calendar event to a record (i.e. unscheduled cal event) if ($_GET['record'] == "") { print "<tr>\n\t\t\t\t\t<td valign='top'>{$table_pk_label}: </td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t<table cellpadding=0 cellspacing=0><tr>\n\t\t\t\t\t\t<td valign='top'>\n\t\t\t\t\t\t\t<select name='idnumber' id='idnumber' class='x-form-text x-form-field' style='height:22px;padding-right:0;font-size:11px;'>\n\t\t\t\t\t\t\t<option value=''> - {$lang['calendar_popup_23']} - </option>"; // Retrieve record list (exclude non-DAG records if user is in a DAG) foreach (array_keys(Records::getData('array', array(), $table_pk, array(), $user_rights['group_id'])) as $this_record) { print "\t\t\t<option value='{$this_record}'>" . removeDDEending($this_record) . "</option>"; } print "\t\t\t</select>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td valign='top' style='font-size:11px;color:#666;padding-left:10px;'>\n\t\t\t\t\t\t\t{$lang['calendar_popup_24']} {$table_pk_label}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr></table>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>"; } print "<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td valign='top'>\n\t\t\t\t\t<br><br>\n\t\t\t\t\t<input type='submit' value='{$lang['calendar_popup_25']}' onclick=\"\n\t\t\t\t\t\tif (document.getElementById('notes').value.length < 1) {\n\t\t\t\t\t\t\talert('{$lang['calendar_popup_26']}');\n\t\t\t\t\t\t\treturn false;\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\">\n\t\t\t\t\t<br><br>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t</form>"; /** * DISPLAY CONFIRMATION THAT NEW CALENDAR EVENT WAS CREATED */ } elseif (!isset($_GET['cal_id']) && !empty($_POST)) { //If an existing record was selected, make sure record doesn't already exist in a DAG. If so, add its group_id to calendar event.
break; //Edit notes //Edit notes case "edit_notes": $sql = "update redcap_events_calendar set notes = '" . prep($_POST['notes']) . "' where cal_id = {$_POST['cal_id']}"; if (db_query($sql)) { //LOGGING log_event($sql, "redcap_events_calendar", "MANAGE", $_POST['cal_id'], calLogChange($_POST['cal_id']), "Edit calendar event"); } exit; break; } } //DATE Field if ($_GET['view'] == "date") { print "<div id='change_date' style='display:block;'>\n\t\t\t\t<b>" . DateTimeRC::format_ts_from_ymd($event_date) . " (" . DateTimeRC::getDay($event_date) . ")</b> "; // Dont' allow user to change date here if tied to an Event (need to change on Scheduling page where it might affect other scheduled dates) if ($row['event_id'] == "") { print "<a href='javascript:;' style='text-decoration:underline;font-size:11px;' onclick=\"\$('#change_date').css({'display':'none'});\$('#save_date').css({'display':'block'});\">{$lang['calendar_popup_ajax_03']}</a>"; } print "{$msg}\n\t\t\t</div>\n\t\t\t<div id='save_date' style='display:none;position:relative;'>\n\t\t\t\t<input type='text' id='newdate' name='newdate' onblur=\"redcap_validate(this,'','','hard','date_'+user_date_format_validation,1,1,user_date_format_delimiter);\" value='" . DateTimeRC::format_ts_from_ymd($event_date) . "' class='x-form-text x-form-field' style='width:70px;' maxlength='10'><span class='df'>(" . DateTimeRC::get_user_format_label() . ")</span>\n\t\t\t\t \n\t\t\t\t<input type='button' id='savebtndatecalpopup' style='font-size:11px;' value='" . cleanHtml($lang['calendar_popup_ajax_04']) . "' onclick='saveDateCalPopup({$_GET['cal_id']})'> \n\t\t\t\t<input type='button' style='font-size:11px;' value='" . cleanHtml($lang['global_53']) . "' onclick=\"\$('#change_date').css({'display':'block'});\$('#save_date').css({'display':'none'});\">\n\t\t\t</div>"; //TIME Field } elseif ($_GET['view'] == "time") { $time_field = "<input type='text' class='x-form-text x-form-field time' id='event_time' name='event_time' value='" . remBr(cleanHtml($_GET['event_time'])) . "' maxlength='5' style='width:50px;' onblur=\"redcap_validate(this,'','','soft_typed','time')\"> \n\t\t\t\t\t<span style='font-size:10px;color:#777;font-family:tahoma;'>HH:MM</span> \n\t\t\t\t\t<input type='button' id='savebtntimecalpopup' style='font-size:11px;' value='{$lang['calendar_popup_ajax_06']}' onclick='saveTimeCalPopup({$_GET['cal_id']})'>"; //Visit Time if ($_GET['event_time'] == "") { $visible = $time_field; $hidden = ""; } else { $visible = "<b>" . DateTimeRC::format_ts_from_ymd($_GET['event_time']) . "</b> \n\t\t\t\t\t<a href='javascript:;' style='text-decoration:underline;font-size:11px;' onclick=\"\$('#change_time').css({'display':'none'});\$('#save_time').css({'display':'block'});\">{$lang['calendar_popup_ajax_07']}</a>"; $hidden = $time_field . " \n\t\t\t\t\t<input type='button' style='font-size:11px;' value='{$lang['global_53']}' onclick=\"\$('#change_time').css({'display':'block'});\$('#save_time').css({'display':'none'});\">";