コード例 #1
0
ファイル: common.api.php プロジェクト: stephen-smith/openemr
function postcalendar_userapi_eventDetail($args, $admin = false)
{
    if (!(bool) PC_ACCESS_READ) {
        return _POSTCALENDARNOAUTH;
    }
    // get the theme globals :: is there a better way to do this?
    pnThemeLoad(pnUserGetTheme());
    global $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $bgcolor5;
    global $textcolor1, $textcolor2;
    $popup = pnVarCleanFromInput('popup');
    extract($args);
    unset($args);
    if (!isset($cacheid)) {
        $cacheid = null;
    }
    if (!isset($eid)) {
        return false;
    }
    if (!isset($nopop)) {
        $nopop = false;
    }
    $uid = pnUserGetVar('uid');
    //=================================================================
    //  Find out what Template we're using
    //=================================================================
    $template_name = _SETTING_TEMPLATE;
    if (!isset($template_name)) {
        $template_name = 'default';
    }
    //=================================================================
    //  Setup Smarty Template Engine
    //=================================================================
    $tpl = new pcSmarty();
    if ($admin) {
        $template = $template_name . '/admin/details.html';
        $args['cacheid'] = '';
        $print = 0;
        $Date =& postcalendar_getDate();
        $tpl->caching = false;
    } else {
        $template = $template_name . '/user/details.html';
    }
    if (!$tpl->is_cached($template, $cacheid)) {
        // let's get the DB information
        list($dbconn) = pnDBGetConn();
        $pntable = pnDBGetTables();
        // get the event's information
        $event =& postcalendar_userapi_pcGetEventDetails($eid);
        // if the above is false, it's a private event for another user
        // we should not diplay this - so we just exit gracefully
        if ($event === false) {
            return false;
        }
        //=================================================================
        //  get event's topic information
        //=================================================================
        $topics_table = $pntable['topics'];
        $topics_column = $pntable['topics_column'];
        $topicsql = "SELECT {$topics_column['topictext']},{$topics_column['topicimage']}\n                     FROM {$topics_table}\n                     WHERE {$topics_column['topicid']} = {$event['topic']}\n                     LIMIT 1";
        $topic_result = $dbconn->Execute($topicsql);
        list($event['topictext'], $event['topicimg']) = $topic_result->fields;
        $location = unserialize($event['location']);
        $event['location'] = $location['event_location'];
        $event['street1'] = $location['event_street1'];
        $event['street2'] = $location['event_street2'];
        $event['city'] = $location['event_city'];
        $event['state'] = $location['event_state'];
        $event['postal'] = $location['event_postal'];
        $event['date'] = str_replace('-', '', $Date);
        //=================================================================
        //  populate the template
        //=================================================================
        if (!empty($event['location']) || !empty($event['street1']) || !empty($event['street2']) || !empty($event['city']) || !empty($event['state']) || !empty($event['postal'])) {
            $tpl->assign('LOCATION_INFO', true);
        } else {
            $tpl->assign('LOCATION_INFO', false);
        }
        if (!empty($event['contname']) || !empty($event['contemail']) || !empty($event['conttel']) || !empty($event['website'])) {
            $tpl->assign('CONTACT_INFO', true);
        } else {
            $tpl->assign('CONTACT_INFO', false);
        }
        $display_type = substr($event['hometext'], 0, 6);
        if ($display_type == ':text:') {
            $prepFunction = 'pcVarPrepForDisplay';
            $event['hometext'] = substr($event['hometext'], 6);
        } elseif ($display_type == ':html:') {
            $prepFunction = 'pcVarPrepHTMLDisplay';
            $event['hometext'] = substr($event['hometext'], 6);
        } else {
            $prepFunction = 'pcVarPrepHTMLDisplay';
        }
        unset($display_type);
        // prep the vars for output
        $event['title'] =& $prepFunction($event['title']);
        $event['hometext'] =& $prepFunction($event['hometext']);
        $event['desc'] =& $event['hometext'];
        $event['conttel'] =& $prepFunction($event['conttel']);
        $event['contname'] =& $prepFunction($event['contname']);
        $event['contemail'] =& $prepFunction($event['contemail']);
        $event['website'] =& $prepFunction(postcalendar_makeValidURL($event['website']));
        $event['fee'] =& $prepFunction($event['fee']);
        $event['location'] =& $prepFunction($event['location']);
        $event['street1'] =& $prepFunction($event['street1']);
        $event['street2'] =& $prepFunction($event['street2']);
        $event['city'] =& $prepFunction($event['city']);
        $event['state'] =& $prepFunction($event['state']);
        $event['postal'] =& $prepFunction($event['postal']);
        $tpl->assign_by_ref('A_EVENT', $event);
        //=================================================================
        //  populate the template $ADMIN_OPTIONS
        //=================================================================
        $target = '';
        if (_SETTING_OPEN_NEW_WINDOW) {
            $target = 'target="csCalendar"';
        }
        $admin_edit_url = $admin_delete_url = '';
        if (pnSecAuthAction(0, 'PostCalendar::', '::', ACCESS_ADMIN)) {
            $admin_edit_url = pnModURL(__POSTCALENDAR__, 'admin', 'submit', array('pc_event_id' => $eid));
            $admin_delete_url = pnModURL(__POSTCALENDAR__, 'admin', 'adminevents', array('action' => _ACTION_DELETE, 'pc_event_id' => $eid));
        }
        $user_edit_url = $user_delete_url = '';
        if (pnUserLoggedIn()) {
            $logged_in_uname = $_SESSION['authUser'];
        } else {
            $logged_in_uname = '';
        }
        $can_edit = false;
        if (pnSecAuthAction(0, 'PostCalendar::', '::', ACCESS_ADD) && validateGroupStatus($logged_in_uname, getUsername($event['uname']))) {
            $user_edit_url = pnModURL(__POSTCALENDAR__, 'user', 'submit', array('pc_event_id' => $eid));
            $user_delete_url = pnModURL(__POSTCALENDAR__, 'user', 'delete', array('pc_event_id' => $eid));
            $can_edit = true;
        }
        $tpl->assign('STYLE', $GLOBALS['style']);
        $tpl->assign_by_ref('ADMIN_TARGET', $target);
        $tpl->assign_by_ref('ADMIN_EDIT', $admin_edit_url);
        $tpl->assign_by_ref('ADMIN_DELETE', $admin_delete_url);
        $tpl->assign_by_ref('USER_TARGET', $target);
        $tpl->assign_by_ref('USER_EDIT', $user_edit_url);
        $tpl->assign_by_ref('USER_DELETE', $user_delete_url);
        $tpl->assign_by_ref('USER_CAN_EDIT', $can_edit);
    }
    //=================================================================
    //  Parse the template
    //=================================================================
    if ($popup != 1 && $print != 1) {
        $output = "\n\n<!-- START POSTCALENDAR OUTPUT [-: HTTP://POSTCALENDAR.TV :-] -->\n\n";
        $output .= $tpl->fetch($template, $cacheid);
        $output .= "\n\n<!-- END POSTCALENDAR OUTPUT [-: HTTP://POSTCALENDAR.TV :-] -->\n\n";
    } else {
        $theme = pnUserGetTheme();
        echo "<html><head>";
        echo "<LINK REL=\"StyleSheet\" HREF=\"themes/{$theme}/style/styleNN.css\" TYPE=\"text/css\">\n\n\n";
        echo "<style type=\"text/css\">\n";
        echo "@import url(\"themes/{$theme}/style/style.css\"); ";
        echo "</style>\n";
        echo "</head><body>\n";
        $tpl->display($template, $cacheid);
        echo postcalendar_footer();
        echo "\n</body></html>";
        session_write_close();
        exit;
    }
    return $output;
}
コード例 #2
0
ファイル: pnuser.php プロジェクト: stephen-smith/openemr
function postcalendar_user_submit($args)
{
    // We need at least ADD permission to submit an event
    if (!(bool) PC_ACCESS_ADD) {
        return _POSTCALENDARNOAUTH;
    }
    $output = new pnHTML();
    $output->SetInputMode(_PNH_VERBATIMINPUT);
    // get the theme globals :: is there a better way to do this?
    pnThemeLoad(pnUserGetTheme());
    global $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $bgcolor5, $textcolor1, $textcolor2;
    // $category = pnVarCleanFromInput('event_category');
    $category = pnVarCleanFromInput('category');
    if (!empty($category)) {
        $category = unserialize(base64_decode($category));
        //print_r($category);
    } else {
        //print_r($_POST);
        $cat = $_POST['category'];
        $category = unserialize(base64_decode($cat));
        //print_r($category);
    }
    //print_r($category);
    // echo("<!-- Here is the argument array: -->\n");
    // foreach ($args as $tmpkey => $tmpval) { // debugging
    //  echo("<!-- $tmpkey => '$tmpval' -->\n");
    // }
    extract($args);
    $Date =& postcalendar_getDate();
    $year = substr($Date, 0, 4);
    $month = substr($Date, 4, 2);
    $day = substr($Date, 6, 2);
    // basic event information
    $event_desc = pnVarCleanFromInput('event_desc');
    $event_category = pnVarCleanFromInput('event_category');
    $event_subject = pnVarCleanFromInput('event_subject');
    $event_sharing = pnVarCleanFromInput('event_sharing');
    $event_topic = pnVarCleanFromInput('event_topic');
    //id of the user the event is for
    $event_userid = pnVarCleanFromInput('event_userid');
    if (!is_numeric($event_userid)) {
        $event_userid = 0;
    }
    $event_pid = pnVarCleanFromInput('event_pid');
    if (!is_numeric($event_pid)) {
        $event_pid = "";
    }
    // event start information
    $event_startmonth = pnVarCleanFromInput('event_startmonth');
    $event_startday = pnVarCleanFromInput('event_startday');
    $event_startyear = pnVarCleanFromInput('event_startyear');
    $event_starttimeh = pnVarCleanFromInput('event_starttimeh');
    $event_starttimem = pnVarCleanFromInput('event_starttimem');
    $event_startampm = pnVarCleanFromInput('event_startampm');
    // location data
    $event_location = pnVarCleanFromInput('event_location');
    $event_street1 = pnVarCleanFromInput('event_street1');
    $event_street2 = pnVarCleanFromInput('event_street2');
    $event_city = pnVarCleanFromInput('event_city');
    $event_state = pnVarCleanFromInput('event_state');
    $event_postal = pnVarCleanFromInput('event_postal');
    $event_location_info = serialize(compact('event_location', 'event_street1', 'event_street2', 'event_city', 'event_state', 'event_postal'));
    // contact data
    $event_contname = pnVarCleanFromInput('event_contname');
    $event_conttel = pnVarCleanFromInput('event_conttel');
    $event_contemail = pnVarCleanFromInput('event_contemail');
    $event_website = pnVarCleanFromInput('event_website');
    $event_fee = pnVarCleanFromInput('event_fee');
    $event_patient_name = pnVarCleanFromInput('patient_name');
    // event repeating data
    if (is_array($category)) {
        //$event_subject        =
        $event_desc = $category['desc'];
        $event_category = $category['id'];
        $event_duration = $category['event_duration'];
        //seconds of the event
        $event_dur_hours = $event_duration / (60 * 60);
        //seconds divided by 60 seconds * 60 minutes
        $event_dur_minutes = $event_duration % (60 * 60) / 60;
        $event_repeat = $category['event_repeat'];
        $event_repeat_freq = $category['event_repeat_freq'];
        $event_repeat_freq_type = $category['event_repeat_freq_type'];
        $event_repeat_on_num = $category['event_repeat_on_num'];
        $event_repeat_on_day = $category['event_repeat_on_day'];
        $event_repeat_on_freq = $category['event_repeat_on_freq'];
        $event_recurrspec = serialize(compact('event_repeat_freq', 'event_repeat_freq_type', 'event_repeat_on_num', 'event_repeat_on_day', 'event_repeat_on_freq'));
        // event end information
        $multiple = $category['end_date_freq'] . " ";
        switch ($category['end_date_type']) {
            case REPEAT_EVERY_DAY:
            case REPEAT_EVERY_WORK_DAY:
                //end date is in days
                $multiple .= "days";
                break;
            case REPEAT_EVERY_WEEK:
                //end date is in weeks
                $multiple .= "weeks";
                break;
            case REPEAT_EVERY_MONTH:
                //end date is in months
                $multiple .= "months";
                break;
            case REPEAT_EVERY_YEAR:
                //end date is in years
                $multiple .= "years";
                break;
        }
        $edate = strtotime(pnVarCleanFromInput('Date'));
        $event_startmonth = date("m", $edate);
        $event_startday = date("d", $edate);
        $event_startyear = date("Y", $edate);
        $event_enddate = strtotime(pnVarCleanFromInput('Date') . " + " . $multiple);
        $event_endmonth = date("m", $event_enddate);
        $event_endday = date("d", $event_enddate);
        $event_endyear = date("Y", $event_enddate);
        $event_endtype = $category['end_date_flag'];
        // I'm pretty sure this was a bug since 'event_all_day' appears nowhere
        // else in the code, but it's hard to tell WTF is going on.
        //    $event_allday         = $category['event_all_day'];
        $event_allday = $category['all_day'];
    } else {
        $event_dur_hours = pnVarCleanFromInput('event_dur_hours');
        $event_dur_minutes = pnVarCleanFromInput('event_dur_minutes');
        $event_duration = 60 * 60 * $event_dur_hours + 60 * $event_dur_minutes;
        $event_repeat = pnVarCleanFromInput('event_repeat');
        $event_repeat_freq = pnVarCleanFromInput('event_repeat_freq');
        $event_repeat_freq_type = pnVarCleanFromInput('event_repeat_freq_type');
        $event_repeat_on_num = pnVarCleanFromInput('event_repeat_on_num');
        $event_repeat_on_day = pnVarCleanFromInput('event_repeat_on_day');
        $event_repeat_on_freq = pnVarCleanFromInput('event_repeat_on_freq');
        $event_recurrspec = serialize(compact('event_repeat_freq', 'event_repeat_freq_type', 'event_repeat_on_num', 'event_repeat_on_day', 'event_repeat_on_freq'));
        // event end information
        $event_endmonth = pnVarCleanFromInput('event_endmonth');
        $event_endday = pnVarCleanFromInput('event_endday');
        $event_endyear = pnVarCleanFromInput('event_endyear');
        $event_endtype = pnVarCleanFromInput('event_endtype');
        $event_allday = pnVarCleanFromInput('event_allday');
    }
    // Added by Rod:
    if ($event_allday) {
        $event_starttimeh = 0;
        $event_starttimem = 0;
        $event_startampm = 1;
        $event_dur_hours = 24;
        $event_dur_minutes = 0;
        $event_duration = 60 * 60 * $event_dur_hours;
    }
    $form_action = pnVarCleanFromInput('form_action');
    $pc_html_or_text = pnVarCleanFromInput('pc_html_or_text');
    $pc_event_id = pnVarCleanFromInput('pc_event_id');
    $data_loaded = pnVarCleanFromInput('data_loaded');
    $is_update = pnVarCleanFromInput('is_update');
    $authid = pnVarCleanFromInput('authid');
    //pennfirm uname matchup future fix
    //if(pnUserLoggedIn()) { $uname = pnUserGetVar('uname'); }
    //else { $uname = pnConfigGetVar('anonymous'); }
    $uname = $_SESSION['authUser'];
    if (!isset($event_repeat)) {
        $event_repeat = 0;
    }
    if (!isset($pc_event_id) || empty($pc_event_id) || $data_loaded) {
        // lets wrap all the data into array for passing to submit and preview functions
        $eventdata = compact('event_subject', 'event_desc', 'event_sharing', 'event_category', 'event_topic', 'event_startmonth', 'event_startday', 'event_startyear', 'event_starttimeh', 'event_starttimem', 'event_startampm', 'event_endmonth', 'event_endday', 'event_endyear', 'event_endtype', 'event_dur_hours', 'event_dur_minutes', 'event_duration', 'event_allday', 'event_location', 'event_street1', 'event_street2', 'event_city', 'event_state', 'event_postal', 'event_location_info', 'event_contname', 'event_conttel', 'event_contemail', 'event_website', 'event_fee', 'event_repeat', 'event_repeat_freq', 'event_repeat_freq_type', 'event_repeat_on_num', 'event_repeat_on_day', 'event_repeat_on_freq', 'event_recurrspec', 'uname', "event_userid", "event_pid", 'Date', 'year', 'month', 'day', 'pc_html_or_text', 'event_patient_name', 'event_pid');
        $eventdata['is_update'] = $is_update;
        $eventdata['pc_event_id'] = $pc_event_id;
        $eventdata['data_loaded'] = true;
        $eventdata['category'] = base64_encode(serialize($category));
    } else {
        $event =& postcalendar_userapi_pcGetEventDetails($pc_event_id);
        //echo "uname is:$uname  other name is: ".$event['uname'] . "<br />";
        if ($uname != $event['uname']) {
            if (!validateGroupStatus($uname, getUsername($event['uname']))) {
                return _PC_CAN_NOT_EDIT;
            }
        }
        $eventdata['event_subject'] = $event['title'];
        $eventdata['event_desc'] = $event['hometext'];
        $eventdata['event_sharing'] = $event['sharing'];
        $eventdata['event_category'] = $event['catid'];
        $eventdata['event_topic'] = $event['topic'];
        $eventdata['event_startmonth'] = substr($event['eventDate'], 5, 2);
        $eventdata['event_startday'] = substr($event['eventDate'], 8, 2);
        $eventdata['event_startyear'] = substr($event['eventDate'], 0, 4);
        $eventdata['event_starttimeh'] = substr($event['startTime'], 0, 2);
        $eventdata['event_starttimem'] = substr($event['startTime'], 3, 2);
        $eventdata['event_startampm'] = $eventdata['event_starttimeh'] < 12 ? 1 : 2;
        //1 is am , 2 is pm
        $eventdata['event_endmonth'] = substr($event['endDate'], 5, 2);
        $eventdata['event_endday'] = substr($event['endDate'], 8, 2);
        $eventdata['event_endyear'] = substr($event['endDate'], 0, 4);
        $eventdata['event_endtype'] = $event['endDate'] == '0000-00-00' ? '0' : '1';
        $eventdata['event_dur_hours'] = $event['duration_hours'];
        $eventdata['event_dur_minutes'] = $event['duration_minutes'];
        $eventdata['event_duration'] = $event['duration'];
        $eventdata['event_allday'] = $event['alldayevent'];
        $loc_data = unserialize($event['location']);
        $eventdata['event_location'] = $loc_data['event_location'];
        $eventdata['event_street1'] = $loc_data['event_street1'];
        $eventdata['event_street2'] = $loc_data['event_street2'];
        $eventdata['event_city'] = $loc_data['event_city'];
        $eventdata['event_state'] = $loc_data['event_state'];
        $eventdata['event_postal'] = $loc_data['event_postal'];
        $eventdata['event_location_info'] = $loc_data;
        $eventdata['event_contname'] = $event['contname'];
        $eventdata['event_conttel'] = $event['conttel'];
        $eventdata['event_contemail'] = $event['contemail'];
        $eventdata['event_website'] = $event['website'];
        $eventdata['event_fee'] = $event['fee'];
        $eventdata['event_repeat'] = $event['recurrtype'];
        $rspecs = unserialize($event['recurrspec']);
        $eventdata['event_repeat_freq'] = $rspecs['event_repeat_freq'];
        $eventdata['event_repeat_freq_type'] = $rspecs['event_repeat_freq_type'];
        $eventdata['event_repeat_on_num'] = $rspecs['event_repeat_on_num'];
        $eventdata['event_repeat_on_day'] = $rspecs['event_repeat_on_day'];
        $eventdata['event_repeat_on_freq'] = $rspecs['event_repeat_on_freq'];
        $eventdata['event_recurrspec'] = $rspecs;
        $eventdata['uname'] = $uname;
        $eventdata['event_userid'] = $event['event_userid'];
        $eventdata['event_pid'] = $event['pid'];
        $eventdata['event_aid'] = $event['aid'];
        $eventdata['Date'] = $Date;
        $eventdata['year'] = $year;
        $eventdata['month'] = $month;
        $eventdata['day'] = $day;
        $eventdata['is_update'] = true;
        $eventdata['pc_event_id'] = $pc_event_id;
        $event_data['patient_name'] = $event_patient_name;
        $eventdata['data_loaded'] = true;
        $eventdata['pc_html_or_text'] = $pc_html_or_text;
        $eventdata['category'] = base64_encode(serialize($category));
    }
    // lets get the module's information
    $modinfo = pnModGetInfo(pnModGetIDFromName(__POSTCALENDAR__));
    $categories = pnModAPIFunc(__POSTCALENDAR__, 'user', 'getCategories');
    $output->tabindex = 1;
    //================================================================
    //    ERROR CHECKING
    //================================================================
    // removed event_desc as a required_var
    $required_vars = array('event_subject');
    $required_name = array(_PC_EVENT_TITLE, _PC_EVENT_DESC);
    $error_msg = '';
    $output->SetOutputMode(_PNH_RETURNOUTPUT);
    $reqCount = count($required_vars);
    //print_r($eventdata);
    for ($r = 0; $r < $reqCount; $r++) {
        if (empty(${$required_vars}[$r]) || !preg_match('/\\S/i', ${$required_vars}[$r])) {
            $error_msg .= $output->Text('<b>' . $required_name[$r] . '</b> ' . _PC_SUBMIT_ERROR4);
            $error_msg .= $output->Linebreak();
        }
    }
    unset($reqCount);
    // check repeating frequencies
    if ($event_repeat == REPEAT) {
        //can't have a repeating event that doesnt have an end date
        if ($event_endtype == 0) {
            $error_msg .= $output->Text("Repeating events must have an end date set.");
            $error_msg .= $output->Linebreak();
        }
        if (!isset($event_repeat_freq) || $event_repeat_freq < 1 || empty($event_repeat_freq)) {
            $error_msg .= $output->Text(_PC_SUBMIT_ERROR5);
            $error_msg .= $output->Linebreak();
        } elseif (!is_numeric($event_repeat_freq)) {
            $error_msg .= $output->Text(_PC_SUBMIT_ERROR6);
            $error_msg .= $output->Linebreak();
        }
    } elseif ($event_repeat == REPEAT_ON) {
        //can't have a repeating event that doesnt have an end date
        if ($event_endtype == 0) {
            $error_msg .= $output->Text("Repeating events must have an end date set.");
            $error_msg .= $output->Linebreak();
        }
        if (!isset($event_repeat_on_freq) || $event_repeat_on_freq < 1 || empty($event_repeat_on_freq)) {
            $error_msg .= $output->Text(_PC_SUBMIT_ERROR5);
            $error_msg .= $output->Linebreak();
        } elseif (!is_numeric($event_repeat_on_freq)) {
            $error_msg .= $output->Text(_PC_SUBMIT_ERROR6);
            $error_msg .= $output->Linebreak();
        }
    }
    // check date validity
    if (_SETTING_TIME_24HOUR) {
        $startTime = $event_starttimeh . ':' . $event_starttimem;
        $endTime = $event_endtimeh . ':' . $event_endtimem;
    } else {
        if ($event_startampm == _AM_VAL) {
            $event_starttimeh = $event_starttimeh == 12 ? '00' : $event_starttimeh;
        } else {
            $event_starttimeh = $event_starttimeh != 12 ? $event_starttimeh += 12 : $event_starttimeh;
        }
        $startTime = $event_starttimeh . ':' . $event_starttimem;
    }
    $sdate = strtotime($event_startyear . '-' . $event_startmonth . '-' . $event_startday);
    $edate = strtotime($event_endyear . '-' . $event_endmonth . '-' . $event_endday);
    $tdate = strtotime(date('Y-m-d'));
    if ($edate < $sdate && $event_endtype == 1) {
        $error_msg .= $output->Text(_PC_SUBMIT_ERROR1);
        $error_msg .= $output->Linebreak();
    }
    if (!checkdate($event_startmonth, $event_startday, $event_startyear)) {
        $error_msg .= $output->Text(_PC_SUBMIT_ERROR2 . " '{$event_startyear}-{$event_startmonth}-{$event_startday}'");
        $error_msg .= $output->Linebreak();
    }
    if (!checkdate($event_endmonth, $event_endday, $event_endyear)) {
        $error_msg .= $output->Text(_PC_SUBMIT_ERROR3 . " '{$event_endyear}-{$event_endmonth}-{$event_endday}'");
        $error_msg .= $output->Linebreak();
    }
    //check limit on category
    if (($ret = checkCategoryLimits($eventdata)) != null) {
        $error_msg .= $output->Text("This category has a limit of {$ret['limit']} between {$ret['start']} and {$ret['end']} which you have exceeded.");
        $error_msg .= $output->Linebreak();
        //$output->Text(pnModAPIFunc('PostCalendar','user','buildSubmitForm',$eventdata));
        //return $output->GetOutput();
    }
    //echo "fa: " . $form_action . " double_book: " . pnVarCleanFromInput("double_book") . " update: " . $eventdata['is_update'] . " em: " . $error_msg;
    //event collision check
    if ($form_action == "commit" && pnVarCleanFromInput("double_book") != 1 && !$eventdata['is_update'] && empty($error_msg)) {
        //check on new shceduling events(in or out of office) to make sure that
        //you don't have more than one set per day
        //event category 1 is in office, event category 2 is out of office
        if ($eventdata['event_category'] == 2 || $eventdata['event_category'] == 3) {
            $searchargs = array();
            $searchargs['start'] = $eventdata['event_startmonth'] . "/" . $eventdata['event_startday'] . "/" . $eventdata['event_startyear'];
            $searchargs['end'] = $eventdata['event_endmonth'] . "/" . $eventdata['event_endday'] . "/" . $eventdata['event_endyear'];
            $searchargs['provider_id'] = $eventdata['event_userid'];
            //faFLag uses pcgeteventsfa, which can search on provider
            $searchargs['faFlag'] = true;
            $searchargs['s_keywords'] = " (a.pc_catid = 2 OR a.pc_catid = 3) ";
            //print_r($searchargs);
            $eventsByDate =& postcalendar_userapi_pcGetEvents($searchargs);
            $ekey = md5($event_data['subject'] . date("U") . rand(0, 1000));
            $oldstatus = $eventdata['event_status'];
            $oldtitle = $eventdata['event_subject'];
            $old_patient_name = $eventdata['patient_name'];
            $old_dur_hours = $eventdata['event_dur_hours'];
            $old_dur_min = $eventdata['event_dur_minutes'];
            $old_duration = $eventdata['event_duration'];
            $eventdata['event_subject'] = mysql_real_escape_string($ekey);
            $eventdata['event_status'] = _EVENT_TEMPORARY;
            if (!pnModAPIFunc(__POSTCALENDAR__, 'user', 'submitEvent', $eventdata)) {
                $error_msg .= $output->Text('<center><div style="padding:5px; border:1px solid red; background-color: pink;">');
                $error_msg .= $output->Text("<b>The system was unable to check you event for conflicts with other events because there was a problem with your database.</b><br />");
                $error_msg .= $output->Text('</div></center>');
                $error_msg .= $output->Linebreak();
                $error_msg .= $output->Text($dbconn->ErrorMsg());
            }
            $searchargs['s_keywords'] = " (a.pc_catid = 2 OR a.pc_catid = 3) AND a.pc_title = '" . $eventdata['event_subject'] . "' ";
            $searchargs['event_status'] = _EVENT_TEMPORARY;
            $submitEventByDate =& postcalendar_userapi_pcGetEvents($searchargs);
            if (!delete_event($ekey)) {
                $error_msg .= $output->Text('<center><div style="padding:5px; border:1px solid red; background-color: pink;">');
                $error_msg .= $output->Text("<b>The system was unable to delete a temporary record it created, this may have left the database in an inconsistent state.</b><br />");
                $error_msg .= $output->Text('</div></center>');
                $error_msg .= $output->Linebreak();
                $error_msg .= $output->Text($dbconn->ErrorMsg());
            }
            $eventdata['event_status'] = $oldstatus;
            $eventdata['event_subject'] = $oldtitle;
            $eventdata['patient_name '] = $old_patient_name;
            $eventdata['event_dur_hours'] = $old_dur_hour;
            $eventdata['event_dur_minutes'] = $old_dur_min;
            foreach ($submitEventByDate as $date => $newevent) {
                if (count($eventsByDate[$date]) > 0 && count($newevent) > 0) {
                    foreach ($eventsByDate[$date] as $con_event) {
                        if ($con_event['catid'] == $newevent[0]['catid']) {
                            $error_msg .= $output->Text('There is a conflict on ' . $date . ' with event ' . $con_event['title']);
                            $error_msg .= $output->Linebreak();
                        }
                    }
                }
            }
            /*echo "<br /><br />";
              print_r($eventsByDate);
              echo "<br /><br />";
              print_r($submitEventByDate);*/
        }
        $colls = checkEventCollision($eventdata);
        if (count($colls) > 0) {
            foreach ($colls as $coll) {
                $error_msg .= $output->Text("Event Collides with: " . $coll['title'] . " at " . date("g:i a", strtotime($coll['startTime'])) . "<br />");
                $error_msg .= $output->Linebreak();
            }
            $error_msg .= $output->Text("Submit again to \"Double Book\" <br />To change values click back in your browser.");
            $error_msg .= $output->Linebreak();
            // the following line will display "DOUBLE BOOKED" if when adding an event there is a collistion with anothe appointment
            //$eventdata['event_subject'] = "DOUBLE BOOKED " . $eventdata['event_subject'];
            $eventdata['double_book'] = 1;
        }
    }
    $output->SetOutputMode(_PNH_KEEPOUTPUT);
    if ($form_action == 'preview') {
        //================================================================
        //  Preview the event
        //================================================================
        // check authid
        if (!pnSecConfirmAuthKey()) {
            return _NO_DIRECT_ACCESS;
        }
        if (!empty($error_msg)) {
            $preview = false;
            $output->Text('<table border="0" width="100%" cellpadding="1" cellspacing="0"><tr><td bgcolor="red">');
            $output->Text('<table border="0" width="100%" cellpadding="1" cellspacing="0"><tr><td bgcolor="pink">');
            $output->Text('<center><b>' . _PC_SUBMIT_ERROR . '</b></center>');
            $output->Linebreak();
            $output->Text($error_msg);
            $output->Text('</td></td></table>');
            $output->Text('</td></td></table>');
            $output->Linebreak(2);
        } else {
            $output->Text(pnModAPIFunc(__POSTCALENDAR__, 'user', 'eventPreview', $eventdata));
            $output->Linebreak();
        }
    } elseif ($form_action == 'commit') {
        //================================================================
        //  Enter the event into the DB
        //================================================================
        if (!empty($error_msg)) {
            if (!pnSecConfirmAuthKey(true)) {
                return _NO_DIRECT_ACCESS;
            }
        } else {
            if (!pnSecConfirmAuthKey()) {
                return _NO_DIRECT_ACCESS;
            }
        }
        if (!empty($error_msg)) {
            $preview = false;
            $output->Text('<table border="0" width="100%" cellpadding="1" cellspacing="0"><tr><td bgcolor="red">');
            $output->Text('<table border="0" width="100%" cellpadding="1" cellspacing="0"><tr><td bgcolor="pink">');
            $output->Text('<center><b>' . _PC_SUBMIT_ERROR . '</b></center>');
            $output->Linebreak();
            $output->Text($error_msg);
            $output->Text('</td></td></table>');
            $output->Text('</td></td></table>');
            $output->Linebreak(2);
        } else {
            if (!pnModAPIFunc(__POSTCALENDAR__, 'user', 'submitEvent', $eventdata)) {
                $output->Text('<center><div style="padding:5px; border:1px solid red; background-color: pink;">');
                $output->Text("<b>" . _PC_EVENT_SUBMISSION_FAILED . "</b>");
                $output->Text('</div></center>');
                $output->Linebreak();
                $output->Text($dbconn->ErrorMsg());
            } else {
                // clear the Smarty cache
                $tpl = new pcSmarty();
                $tpl->clear_all_cache();
                $output->Text('<center><div style="padding:5px; border:1px solid green; background-color: lightgreen;">');
                if ($is_update) {
                    $output->Text("<b>" . _PC_EVENT_EDIT_SUCCESS . "</b>");
                } else {
                    $output->Text("<b>" . _PC_EVENT_SUBMISSION_SUCCESS . "</b>");
                }
                $output->Text('</div></center>');
                $output->Linebreak();
                // clear the form vars
                $event_subject = $event_desc = $event_sharing = $event_category = $event_topic = $event_startmonth = $event_startday = $event_startyear = $event_starttimeh = $event_starttimem = $event_startampm = $event_endmonth = $event_endday = $event_endyear = $event_endtype = $event_dur_hours = $event_dur_minutes = $event_duration = $event_allday = $event_location = $event_street1 = $event_street2 = $event_city = $event_state = $event_postal = $event_location_info = $event_contname = $event_conttel = $event_contemail = $event_website = $event_fee = $event_repeat = $event_repeat_freq = $event_repeat_freq_type = $event_repeat_on_num = $event_repeat_on_day = $event_repeat_on_freq = $event_recurrspec = $uname = $Date = $year = $month = $day = $pc_html_or_text = $event_patient_name = $evnet_pid = null;
                $is_update = false;
                $pc_event_id = 0;
                //$_SESSION['category'] = "";
                // lets wrap all the data into array for passing to submit and preview functions
                $eventdata = compact('event_subject', 'event_desc', 'event_sharing', 'event_category', 'event_topic', 'event_startmonth', 'event_startday', 'event_startyear', 'event_starttimeh', 'event_starttimem', 'event_startampm', 'event_endmonth', 'event_endday', 'event_endyear', 'event_endtype', 'event_dur_hours', 'event_dur_minutes', 'event_duration', 'event_allday', 'event_location', 'event_street1', 'event_street2', 'event_city', 'event_state', 'event_postal', 'event_location_info', 'event_contname', 'event_conttel', 'event_contemail', 'event_website', 'event_fee', 'event_repeat', 'event_repeat_freq', 'event_repeat_freq_type', 'event_repeat_on_num', 'event_repeat_on_day', 'event_repeat_on_freq', 'event_recurrspec', 'uname', 'Date', 'year', 'month', 'day', 'pc_html_or_text', 'is_update', 'pc_event_id', 'event_patient_name');
                //if no using the no_nav format then show form again after submit
                if (pnVarCleanFromInput("no_nav") == 1) {
                    return $output->GetOutput();
                }
            }
        }
    }
    $output->Text(pnModAPIFunc('PostCalendar', 'user', 'buildSubmitForm', $eventdata));
    return $output->GetOutput();
}
コード例 #3
0
ファイル: pnadmin.php プロジェクト: robertdown/openemr
function postcalendar_admin_submit($args)
{
    if (!PC_ACCESS_ADMIN) {
        return _POSTCALENDAR_NOAUTH;
    }
    pnModAPILoad(__POSTCALENDAR__, 'user');
    $output = postcalendar_adminmenu();
    // get the theme globals :: is there a better way to do this?
    pnThemeLoad(pnUserGetTheme());
    global $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $bgcolor5, $textcolor1, $textcolor2;
    extract($args);
    $Date = postcalendar_getDate();
    $year = substr($Date, 0, 4);
    $month = substr($Date, 4, 2);
    $day = substr($Date, 6, 2);
    // basic event information
    $event_subject = pnVarCleanFromInput('event_subject');
    $event_desc = pnVarCleanFromInput('event_desc');
    $event_sharing = pnVarCleanFromInput('event_sharing');
    $event_category = pnVarCleanFromInput('event_category');
    $event_topic = pnVarCleanFromInput('event_topic');
    // event start information
    $event_startmonth = pnVarCleanFromInput('event_startmonth');
    $event_startday = pnVarCleanFromInput('event_startday');
    $event_startyear = pnVarCleanFromInput('event_startyear');
    $event_starttimeh = pnVarCleanFromInput('event_starttimeh');
    $event_starttimem = pnVarCleanFromInput('event_starttimem');
    $event_startampm = pnVarCleanFromInput('event_startampm');
    // event end information
    $event_endmonth = pnVarCleanFromInput('event_endmonth');
    $event_endday = pnVarCleanFromInput('event_endday');
    $event_endyear = pnVarCleanFromInput('event_endyear');
    $event_endtype = pnVarCleanFromInput('event_endtype');
    $event_dur_hours = pnVarCleanFromInput('event_dur_hours');
    $event_dur_minutes = pnVarCleanFromInput('event_dur_minutes');
    $event_duration = 60 * 60 * $event_dur_hours + 60 * $event_dur_minutes;
    $event_allday = pnVarCleanFromInput('event_allday');
    // location data
    $event_location = pnVarCleanFromInput('event_location');
    $event_street1 = pnVarCleanFromInput('event_street1');
    $event_street2 = pnVarCleanFromInput('event_street2');
    $event_city = pnVarCleanFromInput('event_city');
    $event_state = pnVarCleanFromInput('event_state');
    $event_postal = pnVarCleanFromInput('event_postal');
    $event_location_info = serialize(compact('event_location', 'event_street1', 'event_street2', 'event_city', 'event_state', 'event_postal'));
    // contact data
    $event_contname = pnVarCleanFromInput('event_contname');
    $event_conttel = pnVarCleanFromInput('event_conttel');
    $event_contemail = pnVarCleanFromInput('event_contemail');
    $event_website = pnVarCleanFromInput('event_website');
    $event_fee = pnVarCleanFromInput('event_fee');
    // event repeating data
    $event_repeat = pnVarCleanFromInput('event_repeat');
    $event_repeat_freq = pnVarCleanFromInput('event_repeat_freq');
    $event_repeat_freq_type = pnVarCleanFromInput('event_repeat_freq_type');
    $event_repeat_on_num = pnVarCleanFromInput('event_repeat_on_num');
    $event_repeat_on_day = pnVarCleanFromInput('event_repeat_on_day');
    $event_repeat_on_freq = pnVarCleanFromInput('event_repeat_on_freq');
    $event_recurrspec = serialize(compact('event_repeat_freq', 'event_repeat_freq_type', 'event_repeat_on_num', 'event_repeat_on_day', 'event_repeat_on_freq'));
    $pc_html_or_text = pnVarCleanFromInput('pc_html_or_text');
    $form_action = pnVarCleanFromInput('form_action');
    $pc_event_id = pnVarCleanFromInput('pc_event_id');
    $data_loaded = pnVarCleanFromInput('data_loaded');
    $is_update = pnVarCleanFromInput('is_update');
    $authid = pnVarCleanFromInput('authid');
    if (pnUserLoggedIn()) {
        $uname = pnUserGetVar('uname');
    } else {
        $uname = pnConfigGetVar('anonymous');
    }
    if (!isset($event_repeat)) {
        $event_repeat = 0;
    }
    // lets wrap all the data into array for passing to submit and preview functions
    if (!isset($pc_event_id) || empty($pc_event_id) || $data_loaded) {
        $eventdata = compact('event_subject', 'event_desc', 'event_sharing', 'event_category', 'event_topic', 'event_startmonth', 'event_startday', 'event_startyear', 'event_starttimeh', 'event_starttimem', 'event_startampm', 'event_endmonth', 'event_endday', 'event_endyear', 'event_endtype', 'event_dur_hours', 'event_dur_minutes', 'event_duration', 'event_allday', 'event_location', 'event_street1', 'event_street2', 'event_city', 'event_state', 'event_postal', 'event_location_info', 'event_contname', 'event_conttel', 'event_contemail', 'event_website', 'event_fee', 'event_repeat', 'event_repeat_freq', 'event_repeat_freq_type', 'event_repeat_on_num', 'event_repeat_on_day', 'event_repeat_on_freq', 'event_recurrspec', 'uname', 'Date', 'year', 'month', 'day', 'pc_html_or_text');
        $eventdata['is_update'] = $is_update;
        $eventdata['pc_event_id'] = $pc_event_id;
        $eventdata['data_loaded'] = true;
    } else {
        $event = postcalendar_userapi_pcGetEventDetails($pc_event_id);
        $eventdata['event_subject'] = $event['title'];
        $eventdata['event_desc'] = $event['hometext'];
        $eventdata['event_sharing'] = $event['sharing'];
        $eventdata['event_category'] = $event['catid'];
        $eventdata['event_topic'] = $event['topic'];
        $eventdata['event_startmonth'] = substr($event['eventDate'], 5, 2);
        $eventdata['event_startday'] = substr($event['eventDate'], 8, 2);
        $eventdata['event_startyear'] = substr($event['eventDate'], 0, 4);
        $eventdata['event_starttimeh'] = substr($event['startTime'], 0, 2);
        $eventdata['event_starttimem'] = substr($event['startTime'], 3, 2);
        $eventdata['event_startampm'] = $eventdata['event_starttimeh'] < 12 ? _PC_AM : _PC_PM;
        $eventdata['event_endmonth'] = substr($event['endDate'], 5, 2);
        $eventdata['event_endday'] = substr($event['endDate'], 8, 2);
        $eventdata['event_endyear'] = substr($event['endDate'], 0, 4);
        $eventdata['event_endtype'] = $event['endDate'] == '0000-00-00' ? '0' : '1';
        $eventdata['event_dur_hours'] = $event['duration_hours'];
        $eventdata['event_dur_minutes'] = $event['duration_minutes'];
        $eventdata['event_duration'] = $event['duration'];
        $eventdata['event_allday'] = $event['alldayevent'];
        $loc_data = unserialize($event['location']);
        $eventdata['event_location'] = $loc_data['event_location'];
        $eventdata['event_street1'] = $loc_data['event_street1'];
        $eventdata['event_street2'] = $loc_data['event_street2'];
        $eventdata['event_city'] = $loc_data['event_city'];
        $eventdata['event_state'] = $loc_data['event_state'];
        $eventdata['event_postal'] = $loc_data['event_postal'];
        $eventdata['event_location_info'] = $loc_data;
        $eventdata['event_contname'] = $event['contname'];
        $eventdata['event_conttel'] = $event['conttel'];
        $eventdata['event_contemail'] = $event['contemail'];
        $eventdata['event_website'] = $event['website'];
        $eventdata['event_fee'] = $event['fee'];
        $eventdata['event_repeat'] = $event['recurrtype'];
        $eventdata['event_pid'] = $event['pid'];
        $eventdata['event_aid'] = $event['aid'];
        $rspecs = unserialize($event['recurrspec']);
        $eventdata['event_repeat_freq'] = $rspecs['event_repeat_freq'];
        $eventdata['event_repeat_freq_type'] = $rspecs['event_repeat_freq_type'];
        $eventdata['event_repeat_on_num'] = $rspecs['event_repeat_on_num'];
        $eventdata['event_repeat_on_day'] = $rspecs['event_repeat_on_day'];
        $eventdata['event_repeat_on_freq'] = $rspecs['event_repeat_on_freq'];
        $eventdata['event_recurrspec'] = $rspecs;
        $eventdata['uname'] = $uname;
        $eventdata['Date'] = $Date;
        $eventdata['year'] = $year;
        $eventdata['month'] = $month;
        $eventdata['day'] = $day;
        $eventdata['is_update'] = true;
        $eventdata['pc_event_id'] = $pc_event_id;
        $eventdata['data_loaded'] = true;
        $eventdata['pc_html_or_text'] = $pc_html_or_text;
    }
    // lets get the module's information
    $modinfo = pnModGetInfo(pnModGetIDFromName(__POSTCALENDAR__));
    $categories = pnModAPIFunc(__POSTCALENDAR__, 'user', 'getCategories');
    //================================================================
    //	ERROR CHECKING
    //================================================================
    $required_vars = array('event_subject', 'event_desc');
    $required_name = array(_PC_EVENT_TITLE, _PC_EVENT_DESC);
    $error_msg = '';
    $reqCount = count($required_vars);
    for ($r = 0; $r < $reqCount; $r++) {
        if (empty(${$required_vars}[$r]) || !preg_match('/\\S/i', ${$required_vars}[$r])) {
            $error_msg .= '<b>' . $required_name[$r] . '</b> ' . _PC_SUBMIT_ERROR4 . '<br />';
        }
    }
    unset($reqCount);
    // check repeating frequencies
    if ($event_repeat == REPEAT) {
        if (!isset($event_repeat_freq) || $event_repeat_freq < 1 || empty($event_repeat_freq)) {
            $error_msg .= _PC_SUBMIT_ERROR5 . '<br />';
        } elseif (!is_numeric($event_repeat_freq)) {
            $error_msg .= _PC_SUBMIT_ERROR6 . '<br />';
        }
    } elseif ($event_repeat == REPEAT_ON) {
        if (!isset($event_repeat_on_freq) || $event_repeat_on_freq < 1 || empty($event_repeat_on_freq)) {
            $error_msg .= _PC_SUBMIT_ERROR5 . '<br />';
        } elseif (!is_numeric($event_repeat_on_freq)) {
            $error_msg .= _PC_SUBMIT_ERROR6 . '<br />';
        }
    }
    // check date validity
    if (_SETTING_TIME_24HOUR) {
        $startTime = $event_starttimeh . ':' . $event_starttimem;
        $endTime = $event_endtimeh . ':' . $event_endtimem;
    } else {
        if ($event_startampm == _AM_VAL) {
            $event_starttimeh = $event_starttimeh == 12 ? '00' : $event_starttimeh;
        } else {
            $event_starttimeh = $event_starttimeh != 12 ? $event_starttimeh += 12 : $event_starttimeh;
        }
        $startTime = $event_starttimeh . ':' . $event_starttimem;
    }
    $sdate = strtotime($event_startyear . '-' . $event_startmonth . '-' . $event_startday);
    $edate = strtotime($event_endyear . '-' . $event_endmonth . '-' . $event_endday);
    $tdate = strtotime(date('Y-m-d'));
    if ($edate < $sdate && $event_endtype == 1) {
        $error_msg .= _PC_SUBMIT_ERROR1 . '<br />';
    }
    if (!checkdate($event_startmonth, $event_startday, $event_startyear)) {
        $error_msg .= _PC_SUBMIT_ERROR2 . '<br />';
    }
    if (!checkdate($event_endmonth, $event_endday, $event_endyear)) {
        $error_msg .= _PC_SUBMIT_ERROR3 . '<br />';
    }
    //================================================================
    //	Preview the event
    //================================================================
    if ($form_action == 'preview') {
        if (!empty($error_msg)) {
            $preview = false;
            $output .= '<table border="0" width="100%" cellpadding="1" cellspacing="0"><tr><td bgcolor="red">';
            $output .= '<table border="0" width="100%" cellpadding="1" cellspacing="0"><tr><td bgcolor="pink">';
            $output .= '<center><b>' . _PC_SUBMIT_ERROR . '</b></center>';
            $output .= '<br />';
            $output .= $error_msg;
            $output .= '</td></td></table>';
            $output .= '</td></td></table>';
            $output .= '<br /><br />';
        } else {
            $output .= pnModAPIFunc(__POSTCALENDAR__, 'user', 'eventPreview', $eventdata);
            $output .= '<br />';
        }
    }
    //================================================================
    //	Enter the event into the DB
    //================================================================
    if ($form_action == 'commit') {
        //if (!pnSecConfirmAuthKey()) { return(_NO_DIRECT_ACCESS); }
        if (!empty($error_msg)) {
            $preview = false;
            $output .= '<table border="0" width="100%" cellpadding="1" cellspacing="0"><tr><td bgcolor="red">';
            $output .= '<table border="0" width="100%" cellpadding="1" cellspacing="0"><tr><td bgcolor="pink">';
            $output .= '<center><b>' . _PC_SUBMIT_ERROR . '</b></center>';
            $output .= '<br />';
            $output .= $error_msg;
            $output .= '</td></td></table>';
            $output .= '</td></td></table>';
            $output .= '<br /><br />';
        } else {
            if (!pnModAPIFunc(__POSTCALENDAR__, 'admin', 'submitEvent', $eventdata)) {
                $output .= '<center><div style="padding:5px; border:1px solid red; background-color: pink;">';
                $output .= "<b>" . _PC_EVENT_SUBMISSION_FAILED . "</b>";
                $output .= '</div></center><br />';
                $output .= '<br />';
            } else {
                // clear the Smarty cache
                $tpl = new pcSmarty();
                $tpl->clear_all_cache();
                $output .= '<center><div style="padding:5px; border:1px solid green; background-color: lightgreen;">';
                if ($is_update) {
                    $output .= "<b>" . _PC_EVENT_EDIT_SUCCESS . "</b>";
                } else {
                    $output .= "<b>" . _PC_EVENT_SUBMISSION_SUCCESS . "</b>";
                }
                $output .= '</div></center><br />';
                $output .= '<br />';
                // clear the form vars
                $event_subject = $event_desc = $event_sharing = $event_category = $event_topic = $event_startmonth = $event_startday = $event_startyear = $event_starttimeh = $event_starttimem = $event_startampm = $event_endmonth = $event_endday = $event_endyear = $event_endtype = $event_dur_hours = $event_dur_minutes = $event_duration = $event_allday = $event_location = $event_street1 = $event_street2 = $event_city = $event_state = $event_postal = $event_location_info = $event_contname = $event_conttel = $event_contemail = $event_website = $event_fee = $event_repeat = $event_repeat_freq = $event_repeat_freq_type = $event_repeat_on_num = $event_repeat_on_day = $event_repeat_on_freq = $event_recurrspec = $uname = $Date = $year = $month = $day = $pc_html_or_text = null;
                $is_update = false;
                $pc_event_id = 0;
                // lets wrap all the data into array for passing to submit and preview functions
                $eventdata = compact('event_subject', 'event_desc', 'event_sharing', 'event_category', 'event_topic', 'event_startmonth', 'event_startday', 'event_startyear', 'event_starttimeh', 'event_starttimem', 'event_startampm', 'event_endmonth', 'event_endday', 'event_endyear', 'event_endtype', 'event_dur_hours', 'event_dur_minutes', 'event_duration', 'event_allday', 'event_location', 'event_street1', 'event_street2', 'event_city', 'event_state', 'event_postal', 'event_location_info', 'event_contname', 'event_conttel', 'event_contemail', 'event_website', 'event_fee', 'event_repeat', 'event_repeat_freq', 'event_repeat_freq_type', 'event_repeat_on_num', 'event_repeat_on_day', 'event_repeat_on_freq', 'event_recurrspec', 'uname', 'Date', 'year', 'month', 'day', 'pc_html_or_text', 'is_update', 'pc_event_id');
            }
        }
    }
    $output .= pnModAPIFunc('PostCalendar', 'admin', 'buildSubmitForm', $eventdata);
    return $output;
}