From 931cd63dd593a4b9404aea388fc0caf01cdbd419 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 8 Jul 2011 20:19:49 -0400 Subject: [PATCH] Added a dummy method to register a user. --- application/controllers/rest.php | 68 +++++++++++++++++++++----------- 1 file changed, 44 insertions(+), 24 deletions(-) diff --git a/application/controllers/rest.php b/application/controllers/rest.php index 1244722..2fc1307 100644 --- a/application/controllers/rest.php +++ b/application/controllers/rest.php @@ -3,30 +3,6 @@ /** Controller for REST. */ class rest extends CI_Controller { - - /** A test method that simply echos back the input that is given. */ - public function test($data) - { - $this->output->set_header("Content-type: application/xml; charset=UTF-8"); - print("" . $data . ""); - } - - /** Get a document and all associated content. */ - public function document($id) - { - $this->load->helper('my_document_helper'); - $data = get_document_components($id); - $this->load->view('doc_view_xml', $data); - } - - /** Get a list of everything that is available in the database. */ - public function index() - { - $this->load->model("Document_model"); - $this->load->model("Author_model"); - $this->load->view('documents_xml'); - } - /** Dummy list of lots of data. */ public function big() { @@ -96,4 +72,48 @@ public function big() ); } + + /** Get a document and all associated content. */ + public function document($id) + { + $this->load->helper('my_document_helper'); + $data = get_document_components($id); + $this->load->view('doc_view_xml', $data); + } + + /** Get a list of everything that is available in the database. */ + public function index() + { + $this->load->model("Document_model"); + $this->load->model("Author_model"); + $this->load->view('documents_xml'); + } + + /** Dummy method to register a user. The format should be: + * rest/register/username/USERNAME/password/PASSWORD/professor/PROFESSOR + */ + public function register() + { + $uri_keys = array('username', 'password', 'professor'); + $uri_vals = $this->uri->uri_to_assoc(3, $uri_keys); + if ( $uri_vals['username'] == 'true' ) { + print("1\n"); + } + else { + print("-1\n"); + } + + +/* echo $uri_vals['username']; + echo $uri_vals['password']; + echo $uri_vals['professor']; */ + } + + /** A test method that simply echos back the input that is given. */ + public function test($data) + { + $this->output->set_header("Content-type: application/xml; charset=UTF-8"); + print("" . $data . ""); + } + }