From 149688ad08d57cafe34ebf50ced8a3383f224009 Mon Sep 17 00:00:00 2001
From: Chris
Date: Sun, 3 Dec 2017 20:36:01 -0500
Subject: [PATCH 1/2] control
---
www/application/controllers/User_Tweets.php | 54 +++++---------------
www/application/models/User_Tweets_Model.php | 43 +++++-----------
2 files changed, 27 insertions(+), 70 deletions(-)
diff --git a/www/application/controllers/User_Tweets.php b/www/application/controllers/User_Tweets.php
index 870d5f8..ea30205 100644
--- a/www/application/controllers/User_Tweets.php
+++ b/www/application/controllers/User_Tweets.php
@@ -1,41 +1,15 @@
-load->library('session');
-=======
->>>>>>> f4837a582f4adec40ee0abbdbcab7529d12c3238
- $this->load->database(); // load database
- $this->load->model('User_Tweets_Model'); // load model
- $this->output->enable_profiler(TRUE);
+load->database();
+ $this->load->model('User_Tweets_Model');
+ $this->output->enable_profiler(TRUE);
+ }
+
+ public function index(){
+ $this->data['posts'] = $this->Users_Tweets_Model2->getPosts();
+ $this->load->view('user', $this->data);
+ }
}
-
- public function index() {
-<<<<<<< HEAD
- // load form to tweet
- $this->load->helper(array('form', 'url'));
- $this->load->library('form_validation');
-
- $this->form_validation->set_rules('tweet', 'Tweet', 'required');
-
- if ($this->form_validation->run() == FALSE)
- $this->load->view('user_tweets');
- echo "false";
- else {
- $this->Users_Tweets_Model->addTweet();
- $this->load->view('formsuccess');
- }
-
-
- $this->data['posts'] = $this->Users_Tweets_Model->getPosts(); // calling Post model method getPosts()
-=======
- $this->data['posts'] = $this->User_Tweets_Model->getPosts(); // calling Post model method getPosts()
->>>>>>> f4837a582f4adec40ee0abbdbcab7529d12c3238
- $this->load->view('user', $this->data); // load the view file , we are passing $data array to view file
- }
-
-}
diff --git a/www/application/models/User_Tweets_Model.php b/www/application/models/User_Tweets_Model.php
index f7211f3..c84a6c6 100644
--- a/www/application/models/User_Tweets_Model.php
+++ b/www/application/models/User_Tweets_Model.php
@@ -1,32 +1,15 @@
load->database();
- }
- function getPosts(){
-<<<<<<< HEAD:www/application/models/Users_Tweets_Model.php
-
- //$_SESSION['user_id'] = $id;
-=======
->>>>>>> f4837a582f4adec40ee0abbdbcab7529d12c3238:www/application/models/User_Tweets_Model.php
-
-
- $this->db->select("first_name, last_name, username, tweet, date_time");
- $this->db->from('Users, Tweets');
- $this->db->where('Users.id = Tweets.user_id');
- $this->db->order_by('date_time', 'DESC');
- $query = $this->db->get();
- return $query->result_array();
- }
-
- function addTweet(){
- $this->load->helper('url');
- $data = array(
- 'tweet' => $this->input->post('tweet')
- );
- }
-
+class User_Tweets_Model extends CI_Model {
+ public function __construct(){
+ $this->load->database();
+ }
+
+ function getPosts(){
+ $this->db->select("first_name, last_name, username, tweet, date_time");
+ $this->db->from('Users, Tweets');
+ $this->db->where('Users.id = Tweets.user_id');
+ $this->db->order_by('date_time', 'DESC');
+ $query = $this->db->get();
+ return $query->result_array();
+ }
}
-?>
From eac8bea4095d362923785a34325c76ed11e78620 Mon Sep 17 00:00:00 2001
From: Shemona Singh
Date: Mon, 4 Dec 2017 12:23:58 -0500
Subject: [PATCH 2/2] edited all tweets page and got information from database
per user
---
www/application/models/User_Tweets_Model.php | 10 ++--
www/application/views/home.php | 51 +++++++++-----------
www/application/views/templates/footer.php | 2 +-
www/application/views/templates/header.php | 12 +++--
www/application/views/user.php | 1 +
www/css/styles.css | 24 +++++++++
6 files changed, 62 insertions(+), 38 deletions(-)
create mode 100644 www/css/styles.css
diff --git a/www/application/models/User_Tweets_Model.php b/www/application/models/User_Tweets_Model.php
index 002bf21..9e01b77 100644
--- a/www/application/models/User_Tweets_Model.php
+++ b/www/application/models/User_Tweets_Model.php
@@ -3,14 +3,18 @@ class User_Tweets_Model extends CI_Model {
function getPosts(){
+ //$this->load->library('session');
+ //session_start();
+ $user_id = 1; //$this->session->userdata('session_id');
- $this->db->select("first_name, last_name, username, tweet, date_time");
- $this->db->from('Users, Tweets');
- $this->db->where('Users.id = Tweets.user_id');
+ $this->db->select("first_name, last_name, username, tweet, date_time, location");
+ $this->db->from("Users, Tweets");
+ $this->db->where("Users.id = Tweets.user_id and Users.id = $user_id");
$this->db->order_by('date_time', 'DESC');
$query = $this->db->get();
return $query->result_array();
}
+
}
?>
diff --git a/www/application/views/home.php b/www/application/views/home.php
index bf2eaeb..7153591 100644
--- a/www/application/views/home.php
+++ b/www/application/views/home.php
@@ -1,32 +1,25 @@
-
-
-
- All Tweets
-
-
-
-
- Tweets Feed
-
-
-
-
+
+
All Tweets
+
+
+
+
diff --git a/www/application/views/templates/footer.php b/www/application/views/templates/footer.php
index f531270..f9a1892 100644
--- a/www/application/views/templates/footer.php
+++ b/www/application/views/templates/footer.php
@@ -1,4 +1,4 @@
- © 2017
+ © 2017 Stumper and Singh Studios
-
- Hello
+
diff --git a/www/application/views/user.php b/www/application/views/user.php
index 9365408..69b996b 100644
--- a/www/application/views/user.php
+++ b/www/application/views/user.php
@@ -16,6 +16,7 @@
+
diff --git a/www/css/styles.css b/www/css/styles.css
new file mode 100644
index 0000000..bb75e82
--- /dev/null
+++ b/www/css/styles.css
@@ -0,0 +1,24 @@
+.home{
+ max-width:60%;
+ margin:0 auto
+}
+
+ .tweet-container{
+ border:1px solid #eeeeee;
+ padding:15px;
+ margin-bottom:15px;
+ max-width:100%;
+ }
+
+ .tweet-container h3{
+ margin-top:0!important
+ }
+
+ .date{
+ color:grey
+ }
+
+ .tweet{
+ font-size: 16px;
+ font-style: italic;
+ }
diff --git a/www/application/views/templates/header.php b/www/application/views/templates/header.php
index 5584cc0..de05d9c 100644
--- a/www/application/views/templates/header.php
+++ b/www/application/views/templates/header.php
@@ -1,8 +1,10 @@
-
+
+
+