Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private function editEventForm($function = 'addnew', $eventID = null, $courseID = null){
- $path = $this -> moduleBaseUrl . "&sdms_section=eventoverview";
- $smarty = $this -> getSmartyVar();
- $currencySymbols = $this -> getCurrencySymbols();
- $currencySymbolsJS = json_encode($currencySymbols);
- $symbolString = "<script type='text/javascript'> var currencySymbols = " . $currencySymbolsJS . "</script>";
- $smarty -> assign("T_JS_SYMBOLS_OBJ", $symbolString);
- if($function == 'edit'){
- $path = $path . "&func=edit&ref=$eventID";
- $editflag = 1;
- $tag = _SDMS_EDITEVENT;
- $subtag = _SDMS_UPDATEEVENT;
- $getEvent = eF_getTableData('sdms_actevent','activitykey, eventreference, maximumnumber, eventstatus, organiser, owner, branch, trainer, eventtitle, scope, programmeaims, programmeobj, programmeprog, ts_start, ts_end, ts_close, coursefee, currency, extratrainers',"id='$eventID'");
- $arrEvent = $getEvent[0];
- $getSession = eF_getTableData('sdms_actsessi','venuekey, roomkey',"eventkey='$eventID'");
- $arrSession = $getSession[0];
- $courseID = $arrEvent['activitykey'];
- $eventRef = $arrEvent['eventreference'];
- $eventTitle = $arrEvent['eventtitle'];
- $maxDel = $arrEvent['maximumnumber'];
- $status = $arrEvent['eventstatus'];
- $start_ts = $arrEvent['ts_start'];
- $end_ts = $arrEvent['ts_end'];
- $close_ts = $arrEvent['ts_close'];
- $objectives = $arrEvent['programmeobj'];
- $scope = $arrEvent['scope'];
- $aims = $arrEvent['programmeaims'];
- $programme = $arrEvent['programmeprog'];
- $venue = $arrSession['venuekey'];
- $venueRoom = $arrSession['roomkey'];
- $orgValue = $arrEvent['organiser'];
- $courseFee = $arrEvent['coursefee'];
- $trainerValue = $arrEvent['trainer'];
- $currency = $arrEvent['currency'];
- $currencySymbol = $currencySymbols[$currency];
- $owner = $arrEvent['owner'];
- $branch = $arrEvent['branch'];
- $extratrainers = explode(",",$arrEvent["extratrainers"]);
- $formatFee = number_format(($courseFee / 100), 2, ".", ",");
- $explodeFee = explode(".", $formatFee);
- $feeValue1 = $explodeFee[0];
- $feeValue2 = $explodeFee[1];
- $startDate = date("d/m/Y", $start_ts);
- $startTimeH = date("H", $start_ts);
- $startTimeM = date("i", $start_ts);
- $endDate = date("d/m/Y", $end_ts);
- $endTimeH = date("H", $end_ts);
- $endTimeM = date("i", $end_ts);
- $closeDate = ($close_ts == 0) ? "" : date("d/m/Y", $close_ts);
- $activity = $this -> getCourseDetails($courseID);
- }elseif($function == 'addnew' && $courseID != null){
- $path = $path . "&func=addnew&ref=$courseID";
- $editflag = null;
- $tag = _SDMS_NEWEVENT;
- $subtag = _SDMS_SUBMITEVENT;
- $activity = $this -> getCourseDetails($courseID);
- $getActEventCount = eF_getTableData('sdms_actevent','id',"activitykey='$courseID'");
- $eventNum = count($getActEventCount);
- $eventRef = $eventNum + 1;
- $eventTitle = $activity['title'];
- $maxDel = $activity['delegates'];
- $scope = $activity['scope'];
- $orgValue = $activity['organiser'];
- $trainerValue = null;
- $status = 'schd';
- $venue = null;
- $venueRoom = null;
- $courseFee = $activity['fee'];
- $defStartTS = $activity['defStartTS'];
- $defEndTS = $activity['defEndTS'];
- $currency = $activity['defcurrency'];
- $currencySymbol = $currencySymbols[$currency];
- $scope = $activity['scope'];
- $owner = 0;
- $branch = 0;
- $formatFee = number_format(($courseFee / 100), 2, ".", ",");
- $explodeFee = explode(".", $formatFee);
- $feeValue1 = $explodeFee[0];
- $feeValue2 = $explodeFee[1];
- $startDate = $endDate = $closeDate = date("d/m/Y");
- $startTimeH = date("H", $defStartTS);
- $startTimeM = date("i", $defStartTS);
- $endTimeH = date("H", $defEndTS);
- $endTimeM = date("i", $defEndTS);
- }else{
- $t_conf = "Call to undefined function - $function - in editEventForm() .";
- $outcome = "failure";
- $this -> setMessageVar($t_conf, $outcome);
- }
- $statusDropDown = $this -> buildCodesDropDown("STATUS", $status);
- $venues = $this -> buildVenueDropDown($venue);
- $venueRooms = $this -> buildVenueRoomsDropDown($venue, $venueRoom);
- $organiser = $this -> buildOrganisersDropDown($orgValue);
- $trainer = $this -> buildTrainersDropDown($trainerValue);
- $currencies = $this -> buildCurrenciesDropDown();
- $ownersDropDown = $this -> getSupervisorsDropDown();
- $branchDropDown = $this -> getBranchDropDown();
- //new multi-trainer stuff
- $form2 = new HTML_QuickForm("addMultipleTrainers", "POST", $path, "", null, true);
- $trainerQuery = eF_getTableData("users", "*", "istrainer = '1'");
- $trainerArray = array();
- $trainerNameArray = array();
- $z=0;
- foreach($trainerQuery as $trainerData){
- $trainerArray[$z]["Name"] = $trainerData["name"];
- $trainerArray[$z]["Surname"] = $trainerData["surname"];
- $trainerArray[$z]["Login"] = $trainerData["login"];
- $trainerGroup = eF_getTableData("users_to_groups", "*", "users_LOGIN = '".$trainerArray[$z]["Login"]."'");
- $groupData = eF_getTableData("groups", "*", "id = '".$trainerGroup[0]["groups_ID"]."'");
- $trainerArray[$z]["Group"] = $groupData[0]["name"];
- if($trainerArray[$z]["Group"] == ""){
- $trainerArray[$z]["Group"] = "No Branch";
- }
- $z++;
- }
- $z=0;
- foreach($trainerArray as $multiTrainer){
- $form2 -> addElement('checkbox', 'trainers[]', $multiTrainer["Login"], "", "");
- $form2 -> addElement('radio', 'maintrainer[]', $multiTrainer["Group"], "", $multiTrainer["Login"]);
- $trainerNameArray[$z] = $multiTrainer["Name"]." ".$multiTrainer["Surname"]." (".$multiTrainer["Login"].")";
- $z++;
- }
- $form2 -> addElement('submit', 'submit', _SDMS_FORMTRAINERSBUTTON, 'class="flatButton"');
- /*
- $form2 -> addElement('select', 'MainTrainer', _SDMS_FORMMAINTRAINER.': ', $trainer, 'style="width:250px; margin:5px 0 5px 0;"');
- $multiselect = $form2 -> addElement('select', 'trainers', _SDMS_FORMTRAINERS.': ', $trainer, 'style="dith:250px; margin:5px 0 5px 0;"');
- $multiselect -> setMultiple(true);
- */
- if($form2 -> isSubmitted() && $form2 -> validate()){
- $values2 = $form2 -> exportValues();
- //isSubmitted doesn't like our foreach addElements, so we grab the post.
- foreach($_POST as $key=>$value){
- $values2[$key] = $value;
- }
- $trainer = $values2["maintrainer"][0];
- for($z=0; $z<=sizeof($values2["trainers"]); $z++){
- if($trainer == $values2["trainers"][$z]){
- unset($values2["trainers"][$z]);
- }
- }
- $extratrainers = implode(",", $values2["trainers"]);
- $trainerClashCheckNew = $this -> trainerClashCheck($trainer, $start_ts, $end_ts, $eventID);
- $multiTrainerClashCheckNew = array();
- foreach($values2["trainers"] as $xTrainer){
- $multiTrainerClashCheckNew[] = $this -> multiTrainerClashCheck($xTrainer, $start_ts, $end_ts, $eventID);
- }
- $eventDataNew = array( 'trainer' => $trainer,
- 'extratrainers' => $extratrainers,
- 'eventstatus' => strtoupper($status)
- );
- if($trainerClashCheckNew[0] > 0){
- $eventDataNew['eventstatus'] = "PROP";
- }
- foreach($multiTrainerClashCheckNew as $multiCheck){
- if($multiCheck[0]>0){
- $eventDataNew["eventstatus"] = "PROP";
- }
- }
- $queryNew = eF_updateTableData('sdms_actevent', $eventDataNew, "id='".$eventID."'");
- $t_conf = "Trainers Added to: ".$eventTitle;
- $outcome = "success";
- if($trainerClashCheckNew[0] > 0){
- $t_conf = _SDMS_TRAINERCLASH;
- $outcome = "failure";
- }
- foreach($multiTrainerClashCheckNew as $multiCheck){
- if($multiCheck[0]>0){
- $t_conf = "One or more trainers have prior commitments on this date and time, event status set to Proposed.";
- $outcome = "failure";
- }
- }
- $path = $this -> moduleBaseUrl . "&sdms_section=eventoverview&func=edit&ref=$eventID";
- eF_redirect($path.'&message='.$t_conf.'&message_type='.$outcome);
- }
- $renderer2 = prepareFormRenderer($form2);
- $form2 = $renderer2 -> toArray();
- //forcing checkbox value change as html_quickform only allows 1 or 0
- for($x=0; $x<=sizeof($form2); $x++){
- if($form2["trainers"][$x]["type"] == "checkbox"){
- $form2["trainers"][$x]["value"] = $form2["trainers"][$x]["label"];
- $form2["trainers"][$x]["label"] = $trainerNameArray[$x];
- $flagMainVar = "flagMain('".$form2["trainers"][$x]["value"]."')";
- $form2["trainers"][$x]["html"] = str_replace('value="1"', 'value="'.$form2["trainers"][$x]["value"].'" onchange="'.$flagMainVar.'"', $form2["trainers"][$x]["html"]);
- $form2["maintrainer"][$x]["html"] = str_replace('value="'.$form2["maintrainer"][$x]["value"].'"', 'value="'.$form2["maintrainer"][$x]["value"].'" onchange="flagTrainer()"', $form2["maintrainer"][$x]["html"]);
- if($trainerValue != "0"){
- if($form2["trainers"][$x]["value"] == $trainerValue){
- $form2["maintrainer"][$x]["html"] = str_replace('name="maintrainer[]"', 'name="maintrainer[]" checked="checked"', $form2["maintrainer"][$x]["html"]);
- $form2["trainers"][$x]["html"] = str_replace('name="trainers[]"', 'name="trainers[]" checked="checked"', $form2["trainers"][$x]["html"]);
- }
- if(in_array($form2["trainers"][$x]["value"], $extratrainers)){
- $form2["trainers"][$x]["html"] = str_replace('name="trainers[]"', 'name="trainers[]" checked="checked"', $form2["trainers"][$x]["html"]);
- }
- }
- else{
- if($form2["trainers"][$x]["value"] == $values2["maintrainer"][0]){
- $form2["maintrainer"][$x]["html"] = str_replace('name="maintrainer[]"', 'name="maintrainer[]" checked="checked"', $form2["maintrainer"][$x]["html"]);
- $form2["trainers"][$x]["html"] = str_replace('name="trainers[]"', 'name="trainers[]" checked="checked"', $form2["trainers"][$x]["html"]);
- }
- if(in_array($form2["trainers"][$x]["value"], $values2["trainers"])){
- $form2["trainers"][$x]["html"] = str_replace('name="trainers[]"', 'name="trainers[]" checked="checked"', $form2["trainers"][$x]["html"]);
- }
- }
- }
- }
- $smarty -> assign("T_MULTITRAINER", $form2);
- $activityTitle = $activity['title'];
- $activityLink = "<a class='editLink' href='" . $this -> moduleBaseUrl . "&sdms_section=courses&func=edit&ref=$courseID&def_tab=ecc_evsch'>$activityTitle</a>";
- $datePickerJS = "<script type=\"text/javascript\">
- window.onload = function(){
- new JsDatePick({
- useMode:2,
- target:\"datepicker\",
- dateFormat:\"%d/%m/%Y\"
- });
- new JsDatePick({
- useMode:2,
- target:\"endDateNew\",
- dateFormat:\"%d/%m/%Y\"
- });
- new JsDatePick({
- useMode:2,
- target:\"closeDateNew\",
- dateFormat:\"%d/%m/%Y\"
- });
- };
- function showHide(divID){
- if(document.getElementById(divID).style.display == 'block'){
- document.getElementById(divID).style.display = 'none';
- }
- else{
- document.getElementById(divID).style.display = 'block';
- }
- }
- </script>";
- $smarty -> assign("T_DATEPICKER_JS", $datePickerJS);
- //new defines
- $smarty -> assign("T_LABELMULTIPLETRAINER", _SDMS_LABELMULTITRAINER);
- $smarty -> assign("T_LABELMULTIPLETRAINERS", _SDMS_LABELMULTIPLETRAINERS);
- $smarty -> assign("T_LABELTRAINER", _SDMS_LABELTRAINER);
- $smarty -> assign("T_LABELTRAINERNAME", _SDMS_LABELTRAINERNAME);
- $jsVenueRoomArray = $this -> buildVenueRoomsJSArray();
- $smarty -> assign('T_VENUEROOM_JS_ARRAY', $jsVenueRoomArray);
- $smarty -> assign('T_ACTIVITY_LINK', $activityLink);
- $smarty -> assign('T_COURSETAB_LABEL', $tag);
- $smarty -> assign('T_EDITCOUSE_FLAG', $editflag);
- $smarty -> assign("T_CURRENCY_SYMBOL", $currencySymbol);
- $form = new HTML_QuickForm("editEventDetails", "POST", $path, "", null,true);
- $form -> addElement('text', 'startDateNew', _SDMS_START .': ', 'size="12" maxlength="10" id="datepicker" onchange="updateEndCloseDate(this);" value="'.$startDate.'"');
- $form -> addElement('text', 'endDate_New', _SDMS_END .': ', "size=\"12\" maxlength=\"10\" id=\"endDateNew\" value=\"$endDate\"");
- $form -> addElement('text', 'closeDate_New', _SDMS_CLOSE .': ', 'size="12" maxlength="10" id="closeDateNew" value="'.$closeDate.'"');
- $form -> addElement('text', 'eventReference', _SDMS_REFERENCE .': ', array('size' => 10, 'maxlength' => 10, 'value' => $eventRef, 'onblur' => "this.value=this.value.toUpperCase()"));
- $form -> addElement('text', 'eventTitle', _SDMS_TITLE .': ', array('size' => 100, 'maxlength' => 100, 'value' => $eventTitle));
- $form -> addElement('select', 'status', _SDMS_STATUSLABEL .": ", $statusDropDown, 'style = "width:250px;margin:5px 0 5px 0;"');
- $form -> addElement('select', 'organiser', _SDMS_ORGANISER .": ", $organiser, 'style = "width:250px;margin:5px 0 5px 0;"');
- $form -> addElement('text', 'startTime_h', null, array('size' => 2, 'maxlength' => 2, 'value' => "$startTimeH"));
- $form -> addElement('text', 'startTime_m', null, array('size' => 2, 'maxlength' => 2, 'value' => "$startTimeM"));
- $form -> addElement('text', 'endTime_h', null, array('size' => 2, 'maxlength' => 2, 'value' => "$endTimeH"));
- $form -> addElement('text', 'endTime_m', null, array('size' => 2, 'maxlength' => 2, 'value' => "$endTimeM"));
- $form -> addElement('text', 'maxDel', _SDMS_MAXDELEGATES .": ", array('size' => 2, 'maxlength' => 2, 'value' => $maxDel));
- //$form -> addElement('select', 'provider', "Provider", $provider);
- $trainerSelect = $form -> addElement('select', 'trainer', _SDMS_TRAINER .": ", $trainer, 'style = "width:250px;margin:5px 0 5px 0;"');
- if(isset($values2["maintrainer"][0]) && $values2["maintrainer"][0] != "0"){
- $trainerSelectValue = $values2["maintrainer"][0];
- $trainerSelect -> setSelected($trainerSelectValue);
- }
- if(isset($extratrainers)){
- foreach($extratrainers as $extraTrainer){
- if($extraTrainer != ""){
- $form -> addElement('text', 'extratrainer[]', 'extratrainer', 'value="'.$extraTrainer.'"');
- $extraCount++;
- }
- }
- }
- if(isset($values2["trainers"])){
- foreach($values2["trainers"] as $extraTrainer){
- if($extraTrainer != $values2["maintrainer"][0]){
- if($trainerSelectValue == "" && $trainerValue == "0"){
- //Original code here no longer needed.
- }
- elseif($extratrainers[0] != ""){
- if(!in_array($extraTrainer, $extratrainers)){
- $form -> addElement('text', 'extratrainer[]', 'extratrainer', 'value="'.$extraTrainer.'"');
- $extraCount++;
- }
- }
- else{
- $form -> addElement('text', 'extratrainer[]', 'extratrainer', 'value="'.$extraTrainer.'"');
- $extraCount++;
- }
- }
- }
- }
- if($extraCount == ""){
- $extraCount = 0;
- }
- $smarty -> assign("T_EXTRATRAINERCOUNT", $extraCount);
- $form -> addElement('text', 'courseFee1', _SDMS_COURSEFEE .": ", array('size' => 3, 'maxlength' => 3, 'value' => $feeValue1));
- $form -> addElement('text', 'courseFee2', '', array('size' => 2, 'maxlength' => 2, 'value' => $feeValue2));
- $form -> addElement('select', 'currency', _SDMS_CURRENCY .": ", $currencies, 'style = "width:250px;margin:5px 0 5px 0;" onChange = "updateCurrencySymbol(this);"');
- $form -> addElement('select', 'venue', _SDMS_VENUE .": ", $venues, 'onChange = "venueRoomChange(this);" style = "width:250px;margin:5px 0 5px 0;"');
- $form -> addElement('select', 'venueRoom', _SDMS_ROOM . ": ", $venueRooms, 'id = "venueRoom" style = "width:250px;margin:5px 0 5px 0;"');
- $form -> addElement('select', 'owner', _SDMS_OWNER .": ", $ownersDropDown, 'id = "eventOwner" style = "width:250px;margin:5px 0 5px 0;"');
- $form -> addElement('select', 'branch', _SDMS_AVAILABILITY . ": ", $branchDropDown, 'id = "availibility" style = "width:250px;margin:5px 0 5px 0;"');
- $form -> addElement('textarea', 'scope', _SDMS_SCOPE .": ", array('rows' => 10, 'cols' => 90)) -> setValue($scope);
- $form -> addElement('textarea', 'objectives', _SDMS_OBJECTIVES .": ", array('rows' => 10, 'cols' => 90)) -> setValue($objectives);
- $form -> addElement('textarea', 'progAims', _SDMS_AIMS .": ", array('rows' => 10, 'cols' => 90)) -> setValue($aims);
- $form -> addElement('textarea', 'programme', _SDMS_PROGRAMME .": ", array('rows' => 10, 'cols' => 90)) -> setValue($programme);
- $form -> addElement('submit', 'submit_event', $subtag, 'class = "flatButton"');
- $defaultValues['owner'] = array($owner);
- $defaultValues['branch'] = array($branch);
- $defaultValues['currency'] = array($currency);
- $form -> setDefaults($defaultValues);
- if($form -> isSubmitted() && $form -> validate()){
- $values = $form -> exportValues();
- $feeValue1 = $values['courseFee1'];
- $feeValue2 = $values['courseFee2'];
- $courseFee = "$feeValue1"."$feeValue2";
- $roomValue = ($values['venueRoom'] != null) ? $values['venueRoom'] : $_POST['venueRoom'];
- $roomValue = ($roomValue == null) ? 0 : $roomValue;
- $trainer = $values['trainer'];
- if(isset($_POST["extratrainer"])){
- $extratrainers = implode(",", $_POST["extratrainer"]);
- }
- else{
- $extratrainers = "";
- }
- list($startDay, $startMonth, $startYear) = explode("/", $values['startDateNew']);
- list($endDay, $endMonth, $endYear) = explode("/", $values['endDate_New']);
- list($closeDay, $closeMonth, $closeYear) = explode("/", $values['closeDate_New']);
- $start_ts = mktime($values['startTime_h'], $values['startTime_m'], 0, $startMonth, $startDay, $startYear);
- $end_ts = mktime($values['endTime_h'], $values['endTime_m'], 0, $endMonth, $endDay, $endYear);
- $close_hour = ($closeDay == $startDay && $closeMonth == $startMonth && $closeYear == $startYear) ? $values['startTime_h'] : 23;
- $close_min = ($closeDay == $startDay && $closeMonth == $startMonth && $closeYear == $startYear) ? ($values['startTime_m'] - 1) : 59;
- $close_ts = mktime($close_hour, $close_min, 59, $closeMonth, $closeDay, $closeYear);
- $edit_ts = date("U");
- $eventData = array( 'activitykey' => $courseID,
- 'eventreference' => $values['eventReference'],
- 'maximumnumber' => $values['maxDel'],
- 'eventstatus' => strtoupper($values['status']),
- 'organiser' => $values['organiser'],
- 'owner' => $values['owner'],
- 'branch' => $values['branch'],
- 'trainer' => $trainer,
- 'scope' => $values['scope'],
- 'eventtitle' => $values['eventTitle'],
- 'programmeaims' => $values['progAims'],
- 'programmeobj' => $values['objectives'],
- 'programmeprog' => $values['programme'],
- 'ts_start' => $start_ts,
- 'ts_end' => $end_ts,
- 'ts_close' => $close_ts,
- 'coursefee' => $courseFee,
- 'currency' => $values['currency'],
- 'ts_changed' => $edit_ts,
- 'extratrainers' => $extratrainers
- );
- $sessionData = array( 'venuekey' => $values['venue'],
- 'roomkey' => $roomValue
- );
- $checkReference = $this -> checkEventReference($eventData['eventreference'], $courseID, $eventID);
- $venueRoomClashCheck = $this -> venueRoomClashCheck($roomValue, $start_ts, $end_ts, $eventID);
- $trainerClashCheck = $this -> trainerClashCheck($trainer, $start_ts, $end_ts, $eventID);
- $multiTrainerClashCheck = array();
- if(isset($_POST["extratrainer"])){
- foreach($_POST["extratrainer"] as $xTrainer){
- $multiTrainerClashCheck[] = $this -> multiTrainerClashCheck($xTrainer, $start_ts, $end_ts, $eventID);
- }
- }
- if($trainerClashCheck[0] > 0){
- $eventData['eventstatus'] = "PROP";
- }
- foreach($multiTrainerClashCheck as $multiCheck){
- if($multiCheck[0]>0){
- $eventData["eventstatus"] = "PROP";
- }
- }
- if(strlen($eventData['eventreference']) < 1){
- $t_conf = _SDMS_REFERENCEMISSING;
- $outcome = "failure";
- }elseif(strlen($eventData['eventtitle']) <= 1){
- $t_conf = _SDMS_TITLEMISSING;
- $outcome = "failure";
- }elseif($eventData['eventstatus'] == '0'){
- $t_conf = _SDMS_NOSTATUSSELECTED;
- }elseif($checkReference === true){
- $t_conf = _SDMS_DUPLICATEREFERENCE;
- $outcome = "failure";
- }elseif($end_ts < $start_ts){
- $t_conf = _SDMS_ENDBEFORESTART;
- $outcome = "failure";
- }elseif($start_ts < $close_ts){
- $t_conf = _SDMS_CLOSEAFTERSTART;
- $outcome = "failure";
- }else{
- if($function == 'edit'){
- $temp = eF_getTableData('sdms_actevent','eventstatus',"id='".$eventID."'");
- $temp = $temp[0]['eventstatus'];
- $eventSession = eF_getTableData('sdms_actsessi','id',"eventkey='" . $eventID . "'");
- $query = eF_updateTableData('sdms_actevent', $eventData, "id='".$eventID."'");
- if(count($eventSession) > 0){
- eF_updateTableData('sdms_actsessi', $sessionData, "eventkey='".$eventID."'");
- }else{
- $sessionData['activitykey'] = $courseID;
- $sessionData['eventkey'] = $eventID;
- $query = eF_insertTableData('sdms_actsessi', $sessionData);
- }
- $t_conf = _SDMS_EVENTUPDATED . ": $eventTitle";
- $outcome = "success";
- if($temp != $eventData['eventstatus']){
- $eventCode = ($eventData['eventstatus'] == "CANC" || $eventData['eventstatus'] == "CLOS" || $eventData['eventstatus'] == "DELE" || $eventData['eventstatus'] == "REDN") ? 'ESCC' : 'ESIU';
- $this -> emailEventHandler($eventCode, null, $eventID);
- }
- unset($temp);
- }elseif($function == 'addnew'){
- $eventID = eF_insertTableData('sdms_actevent', $eventData);
- $sessionData['activitykey'] = $courseID;
- $sessionData['eventkey'] = $eventID;
- $query = eF_insertTableData('sdms_actsessi', $sessionData);
- ($trainerClashCheck[0] <= 0) ? $this -> addCalendarEvent($eventID, $eventData['trainer']) : '';
- $this -> addCalendarEvent($eventID, $eventData['organiser']);
- $t_conf = _SDMS_EVENTCREATED . ": $eventTitle";
- $outcome = "success";
- }
- if($sessionData['venuekey'] != 0 && $sessionData['roomkey'] != 0){
- $updateRoomResources = $this -> assignRoomResourceToEvent($sessionData['roomkey'], $eventID);
- }
- if($venueRoomClashCheck[0] > 0){
- $t_conf = _SDMS_VENUEROOMCLASH;
- $outcome = "failure";
- }
- if($trainerClashCheck[0] > 0){
- $t_conf = _SDMS_TRAINERCLASH;
- $outcome = "failure";
- }
- foreach($multiTrainerClashCheck as $multiCheck){
- if($multiCheck[0]>0){
- $t_conf = "One or more trainers have prior commitments on this date and time, event status set to Proposed.";
- $outcome = "failure";
- }
- }
- $path = $this -> moduleBaseUrl . "&sdms_section=eventoverview&func=edit&ref=$eventID";
- eF_redirect($path.'&message='.$t_conf.'&message_type='.$outcome);
- }
- $this -> setMessageVar($t_conf, $outcome);
- }
- $renderer = prepareFormRenderer($form);
- $form = $renderer -> toArray();
- for($x=0; $x<=sizeof($form); $x++){
- if($form["extratrainer"][$x]["type"] == "text"){
- $form["extratrainer"][$x]["html"] = str_replace('name="extratrainer[]"', 'name="extratrainer[]" readonly="readonly" style="background-color:#DCDCDC;" ', $form["extratrainer"][$x]["html"]);
- }
- }
- return $form;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement