Exemplo n.º 1
0
                                        "email" : "' . $tutor->get_email() . '",
                                        "phone" : "' . $tutor->get_phone() . '",
                                        "address" : "' . $tutor->get_address() . '"

                               },';
            $id_transporter = $c->get_transporter();
            $transporter = new Transporter($id_transporter);
            $json .= '
                               "transporter" : {
                                        "id" : "' . $transporter->get_id() . '",
                                        "photo" : "' . $transporter->get_photo() . '",
                                        "firstname" : "' . $transporter->get_first_name() . '",
                                        "lastname" : "' . $transporter->get_last_name() . '",
                                        "email" : "' . $transporter->get_email() . '",
                                        "phone" : "' . $transporter->get_phone() . '",
                                        "address" : "' . $transporter->get_address() . '"

                               },
                               "medicines" :[';
            $medicines = $c->get_medicines();
            $second = true;
            foreach ($medicines as $m) {
                if ($second) {
                    $second = false;
                } else {
                    $json .= ',';
                }
                $json .= '{
                                        "id" : ' . $m->get_id() . ',
                                        "name" : "' . $m->get_name() . '",
                                        "description" : "' . $m->get_description() . '",
Exemplo n.º 2
0
                $json .= '{	"id" : "' . $c->get_id() . '",
                                            "photo" : "' . $c->get_photo() . '",
                                            "firstname" : "' . $c->get_first_name() . '",
                                            "lastname" : "' . $c->get_last_name() . '",
                                            "dateofbirth" : "' . $c->get_date_of_birth() . '",
                                            "skills" : "' . $c->get_skills() . '",
                                            "status" : "' . $c->get_status() . '",';
                $t = new Transporter($c->get_transporter());
                $json .= '
                                            "transporter" : {
                                                            "id" : "' . $t->get_id() . '",
                                                            "firstname" : "' . $t->get_first_name() . '",
                                                            "lastname" : "' . $t->get_last_name() . '",
                                                            "phone" : "' . $t->get_phone() . '",
                                                            "email" : "' . $t->get_email() . '", 
                                                            "address" : "' . $t->get_address() . '"
                                            }
                                            }';
            }
            $json .= ']
						  }';
            $json .= '] }';
            echo $json;
        } catch (RecordNotFoundException $ex) {
            echo '{"status" : 3, "errorMessage" : "' . $ex->get_message() . '"}';
        }
        //start json
    } else {
        echo '{"status" : 2, "errorMessage" : "Invalid Token"}';
    }
} else {