Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Shemona Singh authored and Shemona Singh committed Dec 6, 2017
2 parents 7fe0ebf + 5ca3c77 commit a910e39
Show file tree
Hide file tree
Showing 7 changed files with 110 additions and 56 deletions.
97 changes: 65 additions & 32 deletions www/application/views/home.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
// shouldn't need the title and links below
?>

<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">
<!-- header used to be here -->

<div class="home container">
<h1>All Tweets</h1>
Expand All @@ -19,17 +17,76 @@
</div>
<button class="btn btn-primary" type="submit" value="Search">Search</button>
</form>
<!-- DISPLAY ERROR IF NO SEARCH RESULTS FOUND -->
<?php
if($results === []){ ?>
<div class="tweet-container">
<div class="row">
<div class="col-md-6">
<?php echo "<h3>No tweets found</h3>"; ?>

</div>
</div>
<div class="row tweet">
<div class="col-md-12">
<?php echo "There are no tweets that match your query, please try another search.";?>
</div>
</div>
</div>
<?php }?>

<!-- OUTPUT SEARCH RESULTS -->
<?php foreach($results as $row){ ?>
<div class="tweet-container">
<?php
if($row['username'] === "mona") echo "<img class=\"profile-icon\" alt=\"user\" src=\"../../img/mona.png\">";
else if($row['username'] === "chris") echo "<img class=\"profile-icon\" alt=\"user\" src=\"../../img/chris.png\">";
else echo "<img class=\"profile-icon\" alt=\"user\" src=\"../../img/anon.png\">";
?>
<div class="tweet-data">
<div class="row">
<div class="col-md-6">
<?php echo "<h3>" . $row['first_name'] . " " . $row['last_name'] . " " . "<span class=\"handle\">" . "@" . $row['username'] . "</span>" . "</h3>"; ?>

</div>
<div class="col-md-3 date">
<?php
$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">
<div class="col-md-6">
<?php echo "\"" . $row['tweet'] . "\"";?>
</div>
</div>
</div>
</div>
<?php } ?>

<!-- OUTPUT ALL TWEETS IF NOT ON SEARCH RESULT PAGE -->
<?php foreach($posts as $post){ ?>
<div class="tweet-container">
<!-- LOAD USER ICON -->
<?php
if($post['username'] === "mona") echo "<img class=\"profile-icon\" alt=\"user\" src=\"../../img/mona.png\">";
else if($post['username'] === "chris") echo "<img class=\"profile-icon\" alt=\"user\" src=\"../../img/chris.png\">";
else echo "<img class=\"profile-icon\" alt=\"user\" src=\"../../img/anon.png\">";
?>
<div class="tweet-data">
<div class="row">
<div class="col-md-6">
<?php echo "<h3>" . $row['first_name'] . " " . $row['last_name'] . " " . "<span class=\"handle\">" . "@" . $row['username'] . "</span>" . "</h3>"; ?>

<?php echo "<h3>" . $post['first_name'] . " " . $post['last_name'] . " " . "<span class=\"handle\">" . "@" . $post['username'] . "</span>" . "</h3>"; ?>
</div>
<div class="col-md-3 date">
<?php
$startDate = $row['date_time'];
$startDate = $post['date_time'];
$start = new DateTime($startDate);
$timestring = $start->format('m/d/y h:s A');
$time_arr = str_split($timestring);
Expand All @@ -40,36 +97,12 @@
</div>
</div>
<div class="row tweet italic">
<div class="col-md-12">
<?php echo "\"" . $row['tweet'] . "\"";?>
<div class="col-md-6">
<?php echo "\"" . $post['tweet'] . "\"";?>
</div>
</div>
</div>
<?php } ?>

<?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'] . " " . "<span class=\"handle\">" . "@" . $post['username'] . "</span>" . "</h3>"; ?>
</div>
<div class="col-md-3 date">
<?php
$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">
<div class="col-md-12">
<?php echo "\"" . $post['tweet'] . "\"";?>
</div>
</div>
</div>
<?php }?>
</div>
2 changes: 1 addition & 1 deletion www/application/views/templates/nav.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="/index.php/all_tweets">
<img class="home-icon" alt="Brand" src="../../img/twitter.png">
<img class="home-icon" alt="Twitter" src="../../img/twitter.png">
</a>
</div>
<ul class="nav navbar-nav">
Expand Down
55 changes: 32 additions & 23 deletions www/application/views/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,37 @@
</div>

<?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'] . " " . "<span class=\"handle\">" . "@" . $post['username'] . "</span>" . "</h3>"; ?>
</div>
<div class="col-md-3 date">
<?php
$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">
<div class="col-md-12">
<?php echo "\"" . $post['tweet'] . "\"";?>
</div>
</div>
</div>
<div class="tweet-container">
<!-- LOAD USER ICON -->
<?php
if($post['username'] === "mona") echo "<img class=\"profile-icon\" alt=\"user\" src=\"../../img/mona.png\">";
else if($post['username'] === "chris") echo "<img class=\"profile-icon\" alt=\"user\" src=\"../../img/chris.png\">";
else echo "<img class=\"profile-icon\" alt=\"user\" src=\"../../img/anon.png\">";
?>
<div class="tweet-data">
<div class="row">
<div class="col-md-6">
<?php echo "<h3>" . $post['first_name'] . " " . $post['last_name'] . " " . "<span class=\"handle\">" . "@" . $post['username'] . "</span>" . "</h3>"; ?>
</div>
<div class="col-md-3 date">
<?php
$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">
<div class="col-md-6">
<?php echo "\"" . $post['tweet'] . "\"";?>
</div>
</div>
</div>

</div>
<?php }?>
</div>
12 changes: 12 additions & 0 deletions www/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ img.home-icon {
margin-left: 4em;
}

img.profile-icon {
width: 75px;
margin-left: 1em;
float: left;
}

.login {
max-width:45%;
margin:0 auto;
Expand Down Expand Up @@ -54,6 +60,10 @@ img.icon.reg {
margin-top:0!important
}

.row {
margin-left: 0px;
}

.handle {
color: grey;
}
Expand All @@ -66,6 +76,8 @@ img.icon.reg {
.tweet{
font-size: 16px;
font-style: italic;
margin-left: 4em;
margin-top: -100px;
}

.footer {
Expand Down
Binary file added www/img/anon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added www/img/chris.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added www/img/mona.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a910e39

Please sign in to comment.