function parseInputs($user) { if (isset($_POST['func'])) { $func = $_POST['func']; // getters =============================== if ($func === "getGoals") { echo json_encode(getGoals($user)); } if ($func === "getIndustries") { echo json_encode(getIndustries($user)); } if ($func === "getLocations") { echo json_encode(getLocations($user)); } if ($func === "getPostings") { getPostings($user); } if ($func === "getContacts") { echo json_encode(getContacts($user)); } if ($func === "getSchedules") { echo json_encode(getSchedules($user)); } if ($func === "getCompanies") { echo getCompanies($user); } if ($func === "getBlogId") { echo json_encode(getBlogId($user, $_POST['title'], $_POST['text'])); } if ($func === "getBlog") { echo json_encode(getBlog($user)); } if ($func === "getNotesOnPosting") { $postingId = $_POST['postingId']; echo json_encode(getNotesOnPosting($user, $postingId)); } // inserters =============================== if ($func === "insertGoal") { if (isset($_POST["goal"]) && $_POST["goal"] !== '') { echo json_encode(insertGoal($user, $_POST["goal"])); } } if ($func === "insertIndustry") { if (isset($_POST["industry"]) && $_POST["industry"] !== '') { echo json_encode(insertIndustry($user, $_POST["industry"])); } } if ($func === "insertCompany") { $url = urldecode($_POST["url"]); $companyName = $_POST["company"]; insertCompany($user, $companyName); } if ($func === "insertLocation") { if (isset($_POST["location"]) && $_POST["location"] !== '') { echo json_encode(insertLocation($user, $_POST["location"])); } } if ($func === "insertPosting") { echo json_encode(insertPosting($user)); } if ($func === "insertContact") { // more complex. will be responsible for getting $_POST echo json_encode(insertContact($user)); } if ($func === "insertSchedule") { // more complex. will be responsible for getting $_POST // echo json_encode(insertSchedule($user)); echo insertSchedule($user); } if ($func === "addSchedule") { // more complex. will be responsible for getting $_POST // echo json_encode(insertSchedule($user)); // echo "adding ZSchecdule"; $name = $_POST["name"]; $description = $_POST["description"]; $contact = $_POST["contact"]; $start = $_POST["start"]; $end = $_POST["end"]; // addSchedule($name,$description,$contact,$start,$end) if (addSchedule($name, $description, $contact, $start, $end)) { $scheduleId = getScheduleId($name, $description, $contact, $start, $end); if ($scheduleId > 0) { // echo $scheduleId; // insert schedule id and user id to user_schedule $query = "insert into user_schedule "; $query .= "(user,schedule) "; $query .= "values ( {$user}, "; $query .= "{$scheduleId} ) "; //return $query; echo booleanEcho($query); } else { echo "error getting schedule id."; } } else { echo "error inserting schedule."; } } if ($func === "insertBlog") { echo json_encode(insertBlog($user)); } if ($func === "insertNotesPostingUser") { // insertBlog, then insertNotesPostingUser $noteId = insertBlog($user); // $noteId = $_POST["noteId"]; $postingId = $_POST["postingId"]; echo json_encode(insertNotesPostingUser($noteId, $postingId, $user)); } // removers =============================== if ($func === "removeGoal") { // url is the id for user_goals if (isset($_POST["url"]) && $_POST["url"] !== '') { echo json_encode(removeGoal($user, $_POST["url"])); } } if ($func === "removeIndustry") { // url is the id for user_industries if (isset($_POST["url"]) && $_POST["url"] !== '') { echo json_encode(removeIndustry($user, $_POST["url"])); } } if ($func === "removeLocation") { // url is the id for locations if (isset($_POST["url"]) && $_POST["url"] !== '') { echo json_encode(removeLocation($user, $_POST["url"])); } } if ($func === "removeContact") { // url is the id for user_contacts if (isset($_POST["url"]) && $_POST["url"] !== '') { echo json_encode(removeUserContact($user, $_POST["url"])); } } if ($func === "removePosting") { if (isset($_POST["url"]) && $_POST["url"] !== '') { removePosting($user, $_POST["url"]); } } if ($func === "removeCompany") { $companyId = $_POST["url"]; // companyID is stored here removeCompany($user, $companyId); } if ($func === "removeSchedule") { $scheduleId = $_POST["url"]; // scheduleID is stored here echo json_encode(removeSchedule($user, $scheduleId)); } if ($func === "removeBlog") { $userNoteId = $_POST["url"]; // need to get noteId from userNoteId $noteId = getNoteIdFromUserNoteId($userNoteId); if (removeNoteUser($user, $userNoteId) === true) { if (removeNote($noteId) === true) { echo json_encode(true); } else { echo json_encode("Error removing from notes."); } } else { echo json_encode("Error removing from NoteUser."); } } // updaters =============================== if ($func === "updateGoal") { echo json_encode(updateGoal($user)); } if ($func === "updateIndustry") { echo json_encode(updateIndustry($user)); } if ($func === "updatePosting") { updatePosting($user); // returns on its own } if ($func === "updateContact") { echo json_encode(updateContact($user)); } } }
case 'edit_event': editNote(); break; case 'event': showNote(JRequest::getVar('calendar', 0, '', 'int')); break; case 'event_save_show': showNote(save_before_show()); break; case 'module_event': module_event(); break; // This will work when you set task to 'remove // This will work when you set task to 'remove case 'remove_event': removeNote(); break; case 'publish_event': changeNote(1); break; case 'unpublish_event': changeNote(0); break; ////////////////CALENDAR//////////////////////////////////// ////////////////CALENDAR//////////////////////////////////// case 'add_calendar': case 'edit_calendar': edit_calendar(); break; case 'save_calendar': case 'apply_calendar':
echo "failed - validation"; } } // request summary model // need type of request, notesRequest_Type = page, notesRequest_Type = elementno // need elements requested, notesRequest_Elements[noelements] = {1,2,3,4,5,6,7} or just 1 // need last 20 elements, notesRequest_LastGroupNo = 20 (no notes per page), noteRequest_LastNo = 1 (no of page to request), allows dymanic loading on scrolling if (isset($_POST["notesRequest_Type"])) { if ($_POST["notesRequest_Type"] == "page") { if (ctype_digit($_POST["notesRequest_LastGroupNo"]) && ctype_digit($_POST["noteRequest_Page"])) { getNotesPage($conn, $_POST["notesRequest_LastGroupNo"], $_POST["noteRequest_Page"]); } } else { if ($_POST["notesRequest_Type"] == "remove") { if (ctype_digit($_POST["noteNo"])) { removeNote($conn, $_POST["noteNo"]); } } else { if ($_POST["notesRequest_Type"] == "elementno") { if (ctype_digit($_POST["notesRequest_Elements"])) { getNotesElementNo($conn, $_POST["notesRequest_Elements"]); } } else { if ($_POST["notesRequest_Type"] == "checkupdate") { checkUpdates($conn, $_POST["notesRequest_CheckNotes"]); } else { if ($_POST["notesRequest_Type"] == "add") { insertNote($conn); } else { if ($_POST["notesRequest_Type"] == "update") { updateNote($conn);