require_once '../../php/classes/db/DB.class.php'; require_once '../../php/classes/controller/GroupTools.class.php'; require_once '../../php/classes/controller/UserTools.class.php'; /* require_once '../classes/obj/Group.class.php'; require_once '../classes/obj/User.class.php'; require_once '../classes/db/DB.class.php'; require_once '../classes/controller/GroupTools.class.php'; require_once '../classes/controller/UserTools.class.php'; */ $db = new DB(); $db->connect(); $userTools = new UserTools(); $groupTools = new GroupTools(); if (isset($_POST['getGroup'])) { echo json_encode($groupTools->get($_SESSION['groupID'])); } else { if (isset($_POST['getMember'])) { echo "getting member " . $_POST['getMember']; echo json_encode($userTools->get($_POST['getMember'])); } } /* session_start(); if(isset($_SESSION['logged_in'])){ $user = unserialize($_SESSION['user']); $_SESSION['user'] = serialize($userTools->get($user->id)); } //leaving above unimplemented on account of lack of any sort of login or authentication system or stuff */
<?php //require_once 'php/classes/db/DB.class.php'; require_once '../../classes/db/DB.class.php'; require_once '../../classes/obj/Group.class.php'; require_once '../../classes/controller/GroupTools.class.php'; //require_once 'php/classes/controller/GroupTools.class.php'; $db = new DB(); $db->connect(); $groupTools = new GroupTools(); //$group = new Group(); if ($_POST['groupID']) { //looking up existing group $group = $groupTools->get($_POST['groupID']); $group->description = $_POST['description']; $group->meeting_time = $_POST['meeting_time']; $group->meeting_location = $_POST['meeting_location']; $group->save(false); $group = $groupTools->get($_POST['groupID']); //$groupraw = $groupTools->get_raw($_POST['groupID']); //echo json_encode($groupraw); echo json_encode($group); return; } else { //making new group $group->name = $_POST['name']; $group->size_max = $_POST['size_max']; $group->members = $_POST['members']; $group->topic = $_POST['topics']; $group->meeting_time = $_POST['meeting_time']; $group->meeting_location = $_POST['meeting_location'];