Skip to content

Commit

Permalink
registration
Browse files Browse the repository at this point in the history
  • Loading branch information
cws13003 committed Dec 4, 2017
2 parents c35b8bb + 41b5a2f commit 7187e5c
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 35 deletions.
18 changes: 18 additions & 0 deletions www/application/controllers/User_Tweets.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<<<<<<< HEAD
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

Expand All @@ -19,3 +20,20 @@ public function index() {
}

}
=======
<?php defined('BASEPATH') OR exit('No direct script access allowed');
class User_Tweets extends CI_Controller {
function __Construct(){
parent::__Construct ();

$this->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);
}
}
>>>>>>> 41b5a2f810bd6d9f899d79ce9dd4069ec9f97dda
18 changes: 18 additions & 0 deletions www/application/models/User_Tweets_Model.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
class User_Tweets_Model extends CI_Model {
<<<<<<< HEAD
function getPosts(){
//$_SESSION['user_id'] = $id;
$this->db->select("first_name, last_name, username, tweet, date_time");
Expand Down Expand Up @@ -32,5 +33,22 @@ function addTweet(){
return $this->db->insert('tweets', $data);
*/
}
=======

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, 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();
}

>>>>>>> 41b5a2f810bd6d9f899d79ce9dd4069ec9f97dda

}
51 changes: 22 additions & 29 deletions www/application/views/home.php
Original file line number Diff line number Diff line change
@@ -1,32 +1,25 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>All Tweets</title>
<style type="text/css">
?>

</style>
</head>
<body>

<h1>Tweets Feed</h1>
<div class="container">
<div class="row">
<?php foreach($posts as $post){?>
<div class="col-md-4">
<?php echo $post['first_name'];?>
<?php echo $post['last_name'];?>
<?php echo $post['username'];?>
</div>
<div class="col-md-8">
<?php echo $post['tweet'];?>
<?php echo $post['date_time'];?>
</div>
<?php }?>
</div>
</div>

</body>
</html>
<div class="home container">
<h1>All Tweets</h1>
<?php foreach($posts as $post){?>
<div class="tweet-container">
<div class="row">
<div class="col-md-6">
<?php echo "<h3>" . $post['first_name'] . " " . $post['last_name'] . "</h3>"; ?>
<?php echo "<h4>" . "@" . $post['username'] . "</h4>";?>
</div>
<div class="col-md-3 date">
<?php echo $post['date_time'];?>
</div>
</div>
<div class="row tweet italic">
<div class="col-md-12">
<?php echo "\"" . $post['tweet'] . "\"";?>
</div>
</div>
</div>
<?php }?>
</div>
2 changes: 1 addition & 1 deletion www/application/views/templates/footer.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<em>&copy; 2017</em>
<em>&copy; 2017 Stumper and Singh Studios</em>
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</body>
Expand Down
12 changes: 7 additions & 5 deletions www/application/views/templates/header.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<html>
<!DOCTYPE html>

<html lang="en">
<head>
<title>Twitter</title>
<title>Twitter Clone</title>
<link type="text/css" rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="/css/styles.css">
<meta charset="utf-8">
</head>
<body>
<h2>Hello</h2>
<body>
1 change: 1 addition & 0 deletions www/application/views/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<div class="row">
<?php foreach($posts as $post){?>
<div class="col-md-4">
<?php echo $post['first_name'];?>
<?php echo $post['last_name'];?>
<?php echo $post['username'];?>
</div>
Expand Down
24 changes: 24 additions & 0 deletions www/css/styles.css
Original file line number Diff line number Diff line change
@@ -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;
}

0 comments on commit 7187e5c

Please sign in to comment.