Skip to content
Permalink
eb691ad8ea
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
71 lines (66 sloc) 2.91 KB
<?php defined('BASEPATH') OR exit('No direct script access allowed');
error_reporting(0);
?>
<div class="home container">
<h1>My Profile</h1>
<?php $this->load->library('form_validation'); ?>
<div class="row">
<div class="col-md-4 user-content">
<div class="row">
<?php
if($this->session->userdata('username') === "mona") echo "<img class=\"profile-icon\" alt=\"user\" src=" . base_url("img/mona.png") . ">";
else if($this->session->userdata('username') === "chris") echo "<img class=\"profile-icon\" alt=\"user\" src=" . base_url("img/chris.png") .">";
else echo "<img class=\"profile-icon\" alt=\"user\" src=" . base_url("img/anon.png") .">";
?>
</div>
<div class="row">
<?php
echo "<h3>" . $this->session->userdata('first_name') . " " . $this->session->userdata('last_name') . " " . "<span class=\"handle\">" . "@" . $this->session->userdata('username') . "</span>" . "</h3>";
echo "<h4 class=\"location\">" . "<span class=\"glyphicon glyphicon-map-marker\"></span>" . " " . $this->session->userdata('location') . "</h4>";
?>
</div>
</div>
<div class="col-md-8 tweet-submit">
<?php echo form_open('User_Tweets/create'); ?>
<div class="form-group">
<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>
</form>
</div>
</div>
<?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=" . base_url("img/mona.png") . ">";
else if($post['username'] === "chris") echo "<img class=\"profile-icon\" alt=\"user\" src=" . base_url("img/chris.png") .">";
else echo "<img class=\"profile-icon\" alt=\"user\" src=" . base_url("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>