Skip to content

Commit

Permalink
styles and bugs squashed
Browse files Browse the repository at this point in the history
  • Loading branch information
cws13003 committed Dec 5, 2017
1 parent 2369e62 commit 53fec36
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 23 deletions.
2 changes: 1 addition & 1 deletion www/application/controllers/All_Tweets.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function __Construct(){
parent::__Construct ();
$this->load->database(); // load database
$this->load->model('All_Tweets_Model'); // load model
$this->output->enable_profiler(TRUE);
//$this->output->enable_profiler(TRUE);
}

public function index() {
Expand Down
3 changes: 1 addition & 2 deletions www/application/controllers/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ function __Construct(){
public function index(){
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
$this->form_validation->set_error_delimiters('', '');

$this->form_validation->set_rules('username', 'Username', 'required');
$this->form_validation->set_rules('password', 'Password', 'required');

if ($this->form_validation->run() == FALSE){
$this->load->view('templates/header');
$this->load->view('login');
$this->load->view('templates/footer');
}


Expand All @@ -37,7 +37,6 @@ public function index(){
else {
$this->load->view('templates/header');
$this->load->view('login', $data);
$this->load->view('templates/footer');
}

}
Expand Down
3 changes: 1 addition & 2 deletions www/application/controllers/Register.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function __Construct(){
parent::__Construct();
$this->load->database(); // load database
$this->load->model('User_Info_Model'); // load model
$this->output->enable_profiler(TRUE);
//$this->output->enable_profiler(TRUE);
}

public function index(){
Expand All @@ -25,7 +25,6 @@ public function index(){
if ($this->form_validation->run() == FALSE){
$this->load->view('templates/header');
$this->load->view('register');
$this->load->view('templates/footer');
}

// load the homepage once properly submitted
Expand Down
3 changes: 2 additions & 1 deletion www/application/controllers/User_Tweets.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ function __Construct(){
//$this->load->library('session');
$this->load->database(); // load database
$this->load->model('User_Tweets_Model'); // load model
$this->output->enable_profiler(TRUE);
//$this->output->enable_profiler(TRUE);
}

public function index() {
// get posts based on user ID
$this->data['posts'] = $this->User_Tweets_Model->getPosts(); // calling Post model method getPosts()
$this->load->view('templates/header', NULL);
$this->load->view('templates/nav', NULL);
Expand Down
4 changes: 1 addition & 3 deletions www/application/models/User_Tweets_Model.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<?php
class User_Tweets_Model extends CI_Model {
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 and Users.id = $user_id");
$this->db->where("Users.id = Tweets.user_id");
$this->db->order_by('date_time', 'DESC');
$query = $this->db->get();
return $query->result_array();
Expand Down
24 changes: 16 additions & 8 deletions www/application/views/home.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@
</div>
<div class="col-md-3 date">
<?php
$startDate = $row['date_time'];
$start = new DateTime($startDate);
echo $start->format('m/d/y h:s A');
?>
$startDate = $row['date_time'];
$start = new DateTime($startDate);
$timestring = $start->format('m/d/y h:s A');
$time_arr = str_split($timestring);
if($time_arr[count($time_arr) - 8] === '0')
unset($time_arr[count($time_arr) - 8]);
echo implode("",$time_arr);
?>
</div>
</div>
<div class="row tweet italic">
Expand All @@ -53,10 +57,14 @@
</div>
<div class="col-md-3 date">
<?php
$startDate = $post['date_time'];
$start = new DateTime($startDate);
echo $start->format('m/d/y h:s A');
?>
$startDate = $post['date_time'];
$start = new DateTime($startDate);
$timestring = $start->format('m/d/y h:s A');
$time_arr = str_split($timestring);
if($time_arr[count($time_arr) - 8] === '0')
unset($time_arr[count($time_arr) - 8]);
echo implode("",$time_arr);
?>
</div>
</div>
<div class="row tweet italic">
Expand Down
7 changes: 6 additions & 1 deletion www/application/views/login.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php
$this->load->library('form_validation');
echo validation_errors();
echo form_open('login'); ?>
echo form_open('login');
?>
<div class="login container">
<img class="icon" src="../img/twitter.png" alt="Twitter">
<div class="form-group">
Expand All @@ -19,3 +20,7 @@
</form>

</div>
<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>
</html>
5 changes: 5 additions & 0 deletions www/application/views/register.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,8 @@
<button type="submit" class="btn btn-primary">Sign Up</button>
</form>
</div>

<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>
</html>
1 change: 1 addition & 0 deletions www/application/views/templates/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<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">
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro" rel="stylesheet">
</head>
<body>
6 changes: 3 additions & 3 deletions www/application/views/templates/nav.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="all_tweets">
<a class="navbar-brand" href="/index.php/all_tweets">
<img class="home-icon" alt="Brand" src="../../img/twitter.png">
</a>
</div>
<ul class="nav navbar-nav">
<li><a href="all_tweets">Home</a></li>
<li><a href="user_tweets">Profile</a></li>
<li><a href="/index.php/all_tweets">Home</a></li>
<li><a href="/index.php/user_tweets">Profile</a></li>
</div>
</nav>
9 changes: 7 additions & 2 deletions www/application/views/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
<?php echo validation_errors(); ?>
<?php echo form_open('user_tweets/create'); ?>
<div class="form-group">
<input class="form-control" type="text" name="tweet" value="<?php echo set_value('tweet'); ?>" placeholder="What's on your mind?"/>
<!--<input class="form-control" type="text" name="tweet" value="<?php echo set_value('tweet'); ?>" placeholder="What's on your mind?"/>-->
<textarea class="form-control" rows="3" name="tweet" value="<?php echo set_value('tweet'); ?>" placeholder="What's on your mind?"></textarea>
<?php echo form_error('tweet'); ?>
</div>
<button class="btn btn-primary" type="submit">Tweet</button>
Expand All @@ -24,7 +25,11 @@
<?php
$startDate = $post['date_time'];
$start = new DateTime($startDate);
echo $start->format('m/d/y h:s A');
$timestring = $start->format('m/d/y h:s A');
$time_arr = str_split($timestring);
if($time_arr[count($time_arr) - 8] === '0')
unset($time_arr[count($time_arr) - 8]);
echo implode("",$time_arr);
?>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions www/css/styles.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
body {
background-color: #E3F3FD;
font-family: 'Source Sans Pro', sans-serif;
}

img.home-icon {
Expand Down

0 comments on commit 53fec36

Please sign in to comment.