-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.uconn.edu/shs12010/twitter-clone
- Loading branch information
Showing
3 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
class Tweet extends CI_Controller { | ||
function __Construct(){ | ||
parent::__Construct(); | ||
$this->load->database(); // load database | ||
$this->load->model('User_Tweets_Model'); // load model | ||
$this->output->enable_profiler(TRUE); | ||
} | ||
|
||
public function index(){ | ||
$this->load->helper('form'); | ||
$this->load->library('form_validation'); | ||
|
||
$data['title'] = 'Create a tweet'; | ||
|
||
$this->form_validation->set_rules('tweet', 'Tweet', 'required'); | ||
|
||
if ($this->form_validation->run() === FALSE) | ||
{ | ||
$this->load->view('tweet', $data); | ||
} | ||
else | ||
{ | ||
$this->User_Tweets_Model->addTweet(); | ||
$this->load->view('formsuccess'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
class User_Info_Model extends CI_Model { | ||
// login | ||
function getUserID(){ | ||
|
||
} | ||
// new user | ||
function addUser(){ | ||
$this->load->helper('url'); | ||
|
||
$data = array( | ||
'first_name' => $this->input->post('firstname'), | ||
'last_name' => $this->input->post('lastname'), | ||
'email' => $this->input->post('email'), | ||
'username' => $this->input->post('username'), | ||
'password' => $this->input->post('password'), | ||
'location' => $this->input->post('location') | ||
); | ||
|
||
return $this->db->insert('Users', $data); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php $this->load->library('form_validation'); ?> | ||
<?php echo validation_errors(); ?> | ||
<?php echo form_open('tweet'); ?> | ||
|
||
<h2><?php echo $title; ?></h2> | ||
|
||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-md-2 col-md-offset-5"> | ||
<h5>Tweet</h5> | ||
<input type="text" name="tweet" value="<?php echo set_value('tweet'); ?>" size="50" /> | ||
<?php echo form_error('tweet'); ?> | ||
<!--<input type="hidden" name="user_id" value="<?php echo 'id' // USER ID HERE for tweet creation ?>"/>--> | ||
<div><input class="btn" type="submit" value="Submit"/></div> | ||
</div> | ||
</div> | ||
</div> | ||
</form> |