Exemplo n.º 1
0
     }
     break;
 case 'toog_user':
     if ($_POST['status'] == 1) {
         $status = 0;
     } else {
         $status = 1;
     }
     if ($user->toogle($_POST['object_id'], $status)) {
         $isAvailable = true;
     }
     break;
 case 'new_appointment':
     $appointments->startdate = $_POST['startdate'] . '+' . $_POST['zone'];
     $appointments->title = $_POST['title'];
     $lastid = $appointments->add();
     if ($lastid) {
         echo json_encode(array('status' => 'success', 'eventid' => $lastid));
         exit;
     }
     break;
 case 'changetitle':
     $appointments->id = $_POST['eventid'];
     $appointments->title = $_POST['title'];
     $appointments->user_id = $_POST['user_id'];
     $user->id = $_POST['user_id'];
     date_default_timezone_set('Africa/Nairobi');
     $appointments->startdate = date('c', strtotime($_POST['startdate']));
     if ($appointments->edit()) {
         $data = $user->readOne();
         while ($row = $data->fetch(PDO::FETCH_ASSOC)) {