public function show($segments)
 {
     extract($_POST);
     if (!isset($username)) {
         $username = $segments[1];
     }
     $entry = DB::query('select id,username,title,location,bio,avatar from users where username = \'' . $username . '\'', 1);
     $entry['activity'] = DB::query('select count(*) as activity from feed where user_id = \'' . $entry['id'] . '\'', 2, 'activity');
     if (!is_file(PATH_UPLOAD . 'profile/' . $entry['avatar'])) {
         $entry['avatar'] = 'default.png';
     }
     $feed = array();
     $feedraw = DB::query('select * from feed where user_id = ' . $entry['id'] . ' and privacy_id = 1 order by id desc limit 20', 0);
     foreach ($feedraw as $i => $row) {
         $feed[$i] = $row;
         $feed[$i]['status'] = Feed::parse_status($row['status']);
         $feed[$i]['files'] = Feed::get_files($row['id'], 'th');
         if (isset($row['created_ts'])) {
             $feed[$i]['timespan'] = timespan($row['created_ts']);
         }
     }
     $follow_btn = "";
     if ($entry['id'] != $_SESSION['user_id']) {
         $following = DB::query('select id from follows where user_id = ' . $_SESSION['user_id'] . ' and user2_id = ' . $entry['id'], 1);
         if ($following) {
             $follow_btn = '<button class="btn btn-success follow" data-id="' . $entry['id'] . '"><i class="ion-checkmark-round"></i> ' . _l('Following') . ' </button>';
         } else {
             $follow_btn = '<button class="btn btn-info follow" data-id="' . $entry['id'] . '"><i class="ion-ios-bolt"></i> ' . _l('Follow') . ' </button>';
         }
     }
     return array('view' => "account", 'follow_btn' => $follow_btn, 'entry' => $entry, 'feed' => $feed);
 }
Example #2
0
 function view_forum($forumID = 0)
 {
     $this->load->helper('date');
     $forumID = intval($forumID);
     $forum = $this->forum_model->getForum($forumID);
     // Check if topic exists
     if (!empty($forum)) {
         $forum['topic_list'] = array();
         // Get a list of posts which have no parents (topics) in this forum
         foreach ($this->post_model->getTopicsInForum($forumID) as $topic) {
             $topic['post_count'] = count($this->post_model->getPostsInTopic($topic['postID']));
             $topic['last_post'] = $this->post_model->getLastPost('topic', $topic['postID']);
             // Convert to unix and see how long ago it was posted
             $timespan = timespan(mysql_to_unix($topic['last_post']['post_date']));
             // If its set and doesnt contain the word days in the timespan
             if (isset($forum['last_post']['post_date']) && !strpos($timespan, 'Day')) {
                 $topic['last_post']['post_date'] = $timespan;
             } else {
                 $topic['last_post']['post_date'] = $topic['last_post']['post_date'];
             }
             $forum['topic_list'][] = $topic;
         }
         $this->data = array_merge($this->data, $forum);
         $this->layout->title('Forums > ' . $this->data['forum_name']);
         $this->layout->create('view_forum', $this->data);
     } else {
         show_error('The Forum doesn\'t exist!');
         $this->layout->create('message', $this->data);
     }
 }
Example #3
0
function duration_human($minutes, $output = 'days,hours,minutes', $short = false, $separator = ', ')
{
    $format = function ($value, $unit, $short) {
        $unitString = trans_choice("time.{$unit}", $value);
        return sprintf('<strong>%d</strong>%s', $value, $short ? $unitString[0] : " {$unitString}");
    };
    $strings = [];
    if ($short && $separator == ', ') {
        $separator = ' ';
    }
    $timespan = timespan(time() + $minutes * 60, time(), $output);
    foreach (array_filter($timespan) as $unit => $value) {
        $strings[] = $format($value, $unit, $short);
    }
    if (empty($strings)) {
        end($timespan);
        $unit = key($timespan);
        $strings[] = $format($timespan[$unit], $unit, $short);
    }
    $last = array_pop($strings);
    $count = count($strings);
    if ($count && $short) {
        return sprintf('%s%s%s', implode($separator, $strings), $separator, $last);
    } elseif ($count) {
        return sprintf('%s %s %s', implode($separator, $strings), trans('and'), $last);
    } else {
        return $last;
    }
}
Example #4
0
 function index()
 {
     if (!is_logged()) {
         redirect(base_url());
     }
     $this->data['title'] = lang('off_vote');
     $text = icon('64x64/chart_up.png') . '<p>';
     if (config('alt_vote', 'rf_settings')) {
         $text .= '<br><h2>' . anchor('evote', 'Emudev Top') . '</h2>';
         $text .= '<h2>' . anchor('mmotop', 'MMOTOP') . '</h2>';
     } else {
         if ($this->_get_last_vote() != 0) {
             $text .= lang('off_youvote') . timespan($this->_get_last_vote(true), time()) . ',' . br(1);
             $text .= '<p>' . icon('32x32/clock.png') . lang('off_vote_wait') . timespan(time() + $this->_get_last_vote(), time() + $this->limit) . '</p>';
         } elseif ($this->_last_ip() != 0) {
             $text .= icon("32x32/globe_warning.png") . lang('off_ip_vote');
             $text .= '<p>' . icon('32x32/clock.png') . lang('off_vote_wait') . timespan(time() + $this->_last_ip(), time() + $this->limit) . '</p>';
         } else {
             $text .= lang('off_vote_title') . '</p>' . $this->_show_vote_link() . anchor('vote/getbonus/' . gen_secure(), lang('off_vote_get')) . icon('32x32/note_accept.png');
             // .gen_secure()
         }
     }
     $this->data['content'] = $text . br(2) . icon('32x32/sms.png') . anchor('vote/sms', lang('off_vote_sms'));
     compile();
 }
Example #5
0
File: time.php Project: haoji/gwl
 function GetDateTimeInFormat($datestamp, $format)
 {
     switch ($format) {
         // Swatch Internet Time
         case null:
         case 1:
             return date_format(date_create($datestamp), 'jS F, Y') . ' @' . date("B", human_to_unix($datestamp)) . ' .beats';
             // Unix time
         // Unix time
         case 2:
             return human_to_unix($datestamp);
             // Time since
         // Time since
         case 3:
             return timespan(human_to_unix($datestamp), time()) . ' ago';
             // Database
         // Database
         case 4:
             return $datestamp;
             // English
         // English
         case 5:
             return date_format(date_create($datestamp), 'jS F, Y, g:i a');
             // American
         // American
         case 6:
             return date_format(date_create($datestamp), 'F jS, Y, g:i a');
     }
 }
Example #6
0
 public function post_comments($post_id = 0)
 {
     // load date_helper from CI's app singleton
     get_instance()->load->helper('date');
     $comments = $this->db->where('post_id', (int) $post_id)->order_by('created DESC')->get('comments')->result_array();
     return array_map(function ($a) {
         $a['time_ago'] = timespan(mysql_to_unix($a['created']), time(), 2);
         return $a;
     }, $comments);
 }
Example #7
0
function smart_timestamp($timestamp, $date_format = "j M")
{
    $time = explode(',', timespan($timestamp));
    $seconds_day = 86400;
    if (now() - $timestamp > $seconds_day) {
        return date($date_format, $timestamp);
    } else {
        return $time[0] . " ago";
    }
}
Example #8
0
 public function index($name)
 {
     $fsdata = dirname(__FILE__) . '/../../data/' . $name;
     $filelist = Utils::fileList($fsdata, 5);
     $files = array();
     foreach ($filelist as $file) {
         $ts2 = strtok($file, ".");
         $mins = (time() - filename2date($ts2, 'U')) / 60;
         $unixtime = filename2date($ts2, $mins > 1440 ? 'Y M j D H:i' : 'D H:i');
         $files[] = array('filename' => $file, 'ts' => date2es($unixtime) . ' (hace ' . timespan($mins) . ')');
     }
     return array('name' => $name, 'files' => $files);
 }
Example #9
0
 function token_time($access_token, $time)
 {
     $access_token_info = $this->general->custom_file_get_contents('https://graph.facebook.com/oauth/access_token_info?client_id=' . $this->app_id . '&access_token=' . $access_token);
     $access_token_info = json_decode($access_token_info);
     if (isset($access_token_info->access_token) && isset($access_token_info->expires_in)) {
         return timespan($time - $access_token_info->expires_in, $time);
     } else {
         if (isset($access_token_info->access_token) && !isset($access_token_info->expires_in)) {
             return LNG_TOKEN_NOT_EXPIRE;
         } else {
             return LNG_TOKEN_NOT_EXPIRE_TIME;
         }
     }
 }
Example #10
0
    public function show($segments)
    {
        $entry = array();
        $data = DB::query('select webcams.title, webcams.caption, webcams.code, webcams.location, users.username, users.title as user_title
			from webcams 
			join users on users.id = webcams.user_id 
			where webcams.code = \'' . $segments[1] . '\'', 1);
        if ($data) {
            $files = File::dir_content(PATH_WEBCAM . $data['username'], '', 'lastsnap.jpg');
            $dotssize = 16;
            $dotssize = count($files);
            $select = array();
            if (count($files)) {
                sort($files);
                foreach ($files as $i => $file) {
                    $tmp = stat(PATH_WEBCAM . $data['username'] . '/' . $file);
                    if (isset($segments[2]) && isset($segments[3])) {
                        if ($tmp[9] >= $segments[2] && $tmp[9] <= $segments[3]) {
                            //$select[] = array($tmp[9],date('Y m d H:i:s',$tmp[9]),timespan($tmp[9]));
                        } else {
                            unset($files[$i]);
                        }
                    } else {
                        if ($i == count($files) - 1) {
                            $segments[3] = $tmp[9];
                        }
                    }
                    $select[] = array($tmp[9], date('Y m d H:i:s', $tmp[9]), timespan($tmp[9]));
                }
                if ($segments[4] == null) {
                    $segments[4] = 1000;
                }
                if ($segments[5] == null) {
                    $segments[5] = 500;
                }
                $stat = stat(PATH_WEBCAM . $data['username'] . '/' . $files[count($files) - 1]);
                $entry = $data;
                $entry['count'] = count($files);
                $entry['timespan'] = timespan($stat[9]);
                //$entry['files'] = array_slice($files,count($files)-$dotssize,count($files));
                $entry['files'] = $files;
            }
        }
        return array('view' => 'webcams/show', 'select' => $select, 'segments' => $segments, 'entry' => $entry);
    }
Example #11
0
 function index()
 {
     $this->data['title'] = lang('off_acc') . gen_name_profile();
     $this->data['content'] = '<p>' . lang('off_welcome') . gen_name_profile() . lang('off_welcome2') . '</p>';
     if (check_master_answer() == false) {
         $this->data['content'] .= icon('32x32/security.png') . anchor('main/profile', b(lang('off_attepprofile')));
     }
     $this->data['content'] .= br(2) . '<p>' . effect_toggle(b(lang('off_main_lastbuy')), 'log', 'slide') . '</p>
     <hr>' . hiddendiv("log", GetLogBuy()) . $this->_reflink();
     //$this->data['content'].=anchor('rdonate',icon('24x24/euro_currency_sign.png').lang('off_return_donate')).br(1);
     if (is_gm()) {
         $this->data['content'] .= lang('off_gm_panel') . anchor('manager', lang('off_gm_btn2'));
     }
     if (prenium_active() == true) {
         $this->data['content'] .= icon('32x32/package_download.png', lang('off_premhave')) . lang('off_premium_expire') . timespan(time(), premium_expire());
     }
     compile();
 }
Example #12
0
 public function index()
 {
     // Define the page title.
     $data['title'] = lang('tle_recent_discussions');
     // Define the template.
     $data['template'] = 'pages/home/home';
     // Get the discussions from the database.
     $discussions = $this->discussions->order_by(array('sticky' => 'DESC', 'posted' => 'DESC'))->get_all();
     // Set the table template.
     $data['tmpl'] = array('table_open' => '<table class="table table-hover">');
     $this->table->set_template(element('tmpl', $data));
     // Set the table headings.
     $this->table->set_heading('', 'Discussion', 'Users', 'Replies', 'Views', 'Activity');
     // Loop through the discussions.
     if (!empty($discussions)) {
         foreach ($discussions as $row) {
             // Get the user who created the discussion.
             $poster = $this->users->get_by('username', $row->poster);
             $last_poster = $this->users->get_by('username', $row->last_poster);
             // Build the posters avatar.
             $data['avatar'] = array('src' => $this->gravatar->get_gravatar($poster->email, $this->config->item('gravatar_rating'), $this->config->item('gravatar_size'), $this->config->item('gravatar_default_image')), 'title' => '' . $poster->username . ' - Discussion Creator');
             // Get the category associated with the discussion.
             $cat = $this->categories->get_by('id', $row->category_id);
             if (!empty($this->_unread)) {
                 if (in_array($row->id, $this->_unread)) {
                     $unread = true;
                 } else {
                     $unread = false;
                 }
             } else {
                 $unread = false;
             }
             $data['discussions'][] = array('subject' => $unread == TRUE ? anchor(site_url('discussions/view/' . $row->id), '<i class="fa fa-lightbulb-o"></i>&nbsp;<strong>' . $row->subject . '</strong>') : anchor(site_url('discussions/view/' . $row->id), $row->subject), 'replies' => $row->replies, 'views' => $row->views, 'last_comment' => timespan($row->last_comment, time()), 'last_poster' => anchor(site_url('users/profile/' . $row->last_poster_id), $row->last_poster), 'category' => anchor(site_url('categories/' . $cat->slug . ''), $cat->name), 'avatar' => anchor(site_url('users/profile/' . $poster->id), img(element('avatar', $data))), 'avatar_last_poster' => anchor(site_url('users/profile/' . $last_poster->id), img(element('avatar_last_poster', $data))), 'sticky' => $row->sticky == 1 ? '<span class="label label-success"><i class="fa fa-thumb-tack"></i></span>&nbsp;' : '', 'closed' => $row->closed == 1 ? '<span class="label label-danger"><i class="fa fa-lock"></i></span>&nbsp;' : '', 'unread' => in_array($row->id, $this->_unread) ? 'unread' : '');
         }
     } else {
         // Fill with blank data to prevent errors.
         $data['discussions'] = '';
     }
     // Build the page breadcrumbs.
     $this->crumbs->add(lang('crumb_recent_discussions'));
     // Define the page data.
     $data['page'] = array('btn_new_discussion' => anchor(site_url('discussions/new_discussion'), lang('btn_new_discussion'), array('class' => 'btn btn-default btn-xs')), 'lnk_mark_all' => anchor(site_url('discussions/mark_all'), lang('lnk_mark_all')), 'discussions' => element('discussions', $data), 'has_discussions' => !empty($discussions) ? 1 : 0, 'breadcrumbs' => $this->crumbs->output(), 'pagination' => $this->pagination->create_links());
     $this->render(element('page', $data), element('title', $data), element('template', $data));
 }
Example #13
0
 /**
  * Load a constant
  *
  * Magic method to get a constant or global variable
  * 
  * Usage:
  *   {{ twitter:feed username="******" limit="5" }}
  * 
  * @return array The tweet objects in an array.
  */
 function feed()
 {
     $username = $this->attribute('username');
     $limit = $this->attribute('limit', 5);
     if (!($tweets = $this->pyrocache->get('twitter-' . $username))) {
         $tweets = json_decode(@file_get_contents($this->feed_url . '&screen_name=' . $username . '&count=' . $limit));
         $this->pyrocache->write($tweets, 'twitter-' . $username, $this->settings->twitter_cache);
     }
     $patterns = array('((https?|ftp|gopher|telnet|file|notes|ms-help):((//)|(\\\\))+[\\w\\d:#@%/;$()~_?\\+-=\\\\.&]*)' => '<a href="$0" target="_blank">$0</a>', '|([a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,6})|i' => '<a href="mailto:$1">$1</a>', '| @([a-z0-9-_]+)|i' => '<a href="http://twitter.com/$1" target="_blank">$0</a>', '|#([a-z0-9-_]+)|i' => '<a href="http://twitter.com/search?q=%23$1" target="_blank">$0</a>');
     if (!$tweets) {
         return array();
     }
     foreach ($tweets as &$tweet) {
         $tweet->id = sprintf('%.0f', $tweet->id);
         $tweet->text = str_replace($username . ': ', '', $tweet->text);
         $tweet->text = preg_replace(array_keys($patterns), $patterns, $tweet->text);
         $tweet->timespan = strtolower(current(explode(',', timespan(strtotime($tweet->created_at))))) . ' ago';
     }
     return $tweets;
 }
function nicetime($timestamp)
{
    if ($timestamp == '' or !is_numeric($timestamp)) {
        return '';
    }
    $hari = date('l', $timestamp);
    $tgl = date('d', $timestamp);
    $bln = date('F', $timestamp);
    $thn = date('Y', $timestamp);
    $pukul = date('H:i', $timestamp);
    // timespan dari CI's date helper
    $timespan = strtolower(timespan($timestamp));
    $timespan = str_replace(',', '', $timespan);
    $exp = explode(' ', $timespan);
    $k = $exp[1];
    $v = $exp[0];
    if ($v > 0) {
        if (stristr($k, 'year') or date('Y') > $thn) {
            return $tgl . ' ' . $bln . ' ' . $thn;
        } elseif (stristr($k, 'week') or stristr($k, 'month')) {
            return $tgl . ' ' . $bln . ' at ' . $pukul;
        } elseif (stristr($k, 'day') or stristr($k, 'hour') or stristr($k, 'minute') or stristr($k, 'second')) {
            if ($v >= 2 and stristr($k, 'day')) {
                return $hari . ' at ' . $pukul;
            } elseif (date('j') - date('j', $timestamp) == 1) {
                return 'Yesterday at ' . $pukul;
            } elseif (date('D') == date('D', $timestamp) and ($v >= 10 and stristr($k, 'hour'))) {
                return 'Today at ' . $pukul;
            } elseif (stristr($k, 'hour') and $v < 10 or stristr($k, 'minute') or stristr($k, 'second')) {
                if (stristr($k, 'second') and $v <= 15) {
                    return 'just now';
                }
                return $v . ' ' . $k . ' ago';
            } else {
                return $hari . ' at ' . $pukul;
            }
        }
    } else {
        return 'just now';
    }
}
Example #15
0
/**
 * Get an array containing logged actions.
 * 
 * If $action is left empty but $item_id is not, or if the $action is an integer,
 * it retrieves all the actions pertaining to $item_id.
 * 
 * If $action is NOT empty but $item_id is, it retrieves all the $action actions in the DB.
 * 
 * If both $action and $item_id have a value, it returns all $action actions pertaining to $item_id.
 * 
 * Returns an array. Triggers an error if the action does not exist in My_lang.
 * 
 * Usage:
 * 
 * 
 * @staticvar array $userIdCache
 * @param string|integer $action
 * @param integer $item_id
 * @return array 
 */
function get_logged_actions($action = '', $item_id = 0)
{
    # In order to increase performance, whenever the function gets the username
    # of a given user_id, it'll cache it, so that it won't need to go query the DB
    # again for the duration of the request.
    static $userIdCache = array();
    if (!empty($action) and !is_int($action) and !lang($action)) {
        trigger_error('Action message does not exist for ' . $action . '. Create it in /language/My_lang.php.');
    }
    $CI =& get_instance();
    $CI->load->model('users/user_m');
    $where = array();
    if (!empty($item_id)) {
        $where['item_id'] = $item_id;
    }
    if (is_int($action)) {
        $where['item_id'] = $action;
    } elseif (!empty($action)) {
        $where['action'] = $action;
    }
    $buffer = $CI->db->get_where('action_logs', $where)->result_array();
    foreach ($buffer as $key => $row) {
        $variables = array('timeago' => strtolower(timespan($row['timestamp']) . ' ago'));
        if ($row['user_id'] != 0) {
            if (!isset($userIdCache[$row['user_id']])) {
                $userBuffer = $CI->user_m->select('username')->get($row['user_id']);
                $userBuffer = $userBuffer->username;
            } else {
                $userBuffer = $userIdCache[$row['user_id']];
            }
            $variables['username'] = $userBuffer;
        }
        if ($row['item_id'] != 0) {
            $variables['item_id'] = $row['item_id'];
        }
        foreach ($variables as $variable => $value) {
            $buffer[$key]['message'] = str_ireplace('{' . $variable . '}', $value, $buffer[$key]['message']);
        }
    }
    return $buffer;
}
Example #16
0
function time_ago($timeago, $short = false)
{
    $instance =& get_instance();
    $now = time();
    $timepices = array();
    if (!is_numeric($timeago)) {
        $timeago = human_to_unix($timeago);
    }
    $timespan = timespan($timeago, $now);
    $timespan = explode(",", trim($timespan));
    foreach ($timespan as $key => $value) {
        $timespanvalue = explode(" ", trim($value));
        $arrayvalue = $timespanvalue[0] . " " . $instance->lang->line('application_' . $timespanvalue[1]);
        $timepices[$key] = $arrayvalue;
    }
    $return = $timepices[0];
    if (isset($timepices[1]) && $short == false) {
        $return .= ' ' . $instance->lang->line('application_and') . ' ' . $timepices[1];
    }
    $return .= ' ' . $instance->lang->line('application_ago');
    return $return;
}
Example #17
0
File: time.php Project: GStepOne/CI
 function test()
 {
     ini_set('date.timezone', 'PRC');
     //people republic of china
     $this->load->helper("date");
     //  echo timezone_menu("UP8");
     // $datestring = "Year: %Y Month: %m Day: %d - %h:%i %a";
     $time = time();
     // echo standard_date("DATE_ATOM", $time);
     $timestamp = local_to_gmt($time);
     //转化为时间戳 gmt greenwich mean time 格林尼治时间
     //$timezone="PRC";//people republic of china
     //  echo gmt_to_local($timestamp,$timezone,true);
     $mysql = '20061124092345';
     $unix = mysql_to_unix($mysql);
     $past_time = '19900926092633';
     $a = strtotime($past_time);
     echo local_to_gmt($past_time);
     // $time=time();
     echo timespan($past_time, $time);
     ///$past_time 一定是个时间戳
 }
Example #18
0
	function index()
	{
		$this->check_session();
		$this->load->model('Workout', 'workout');
		$user->id = $this->tank_auth->get_user_id();
		$result['workouts'] = $this->workout->get_connection_workouts($user);


		for($i=0; $i<count($result['workouts']); $i++)
		{
			$post_time = $result['workouts'][$i]->workout_date;
			
			$post_date = human_to_unix($post_time);
			$post_date = timespan($post_date);
			
			$post_time_array = explode(", ", $post_date);
			$post_time_count = count($post_time_array);
			switch ($post_time_count) 
			{
			    case 0:
			        break;
			    case 1:
			        $post_date = strtolower($post_time_array[0])." ago";
			        break;
			    case 2:
			    	$post_date = strtolower($post_time_array[1])." ago";
			        break;
			    case 3:
			    	$post_date = strtolower($post_time_array[2])." ago";
			        break;
			    default:
					$post_date = date("j \of M y", strtotime($post_time));
			}
			$result['workouts'][$i]->workout_date = $post_date;
		}

		$this->load->view('connections', $result);
	}
Example #19
0
 public function calculate_hours($time_in, $time_out, $timein_date, $timeout_date)
 {
     // Extract timed in && out
     $time_in = self::time_extract($time_in);
     $time_out = self::time_extract($time_out);
     // Extract date timed in && out
     $timedin_date = self::date_extract($timein_date);
     $timedout_date = self::date_extract($timeout_date);
     // Convert to military time
     $timedin_hour = self::to_military($time_in['hour'], $time_in['ampm']);
     $timedout_hour = self::to_military($time_out['hour'], $time_out['ampm']);
     // Calculate span of time ( Excluding minutes yet )
     $start = mktime($timedin_hour, 0, 0, $timedin_date['month'], $timedin_date['day'], $timedin_date['year']);
     $end = mktime($timedout_hour, 0, 0, $timedout_date['month'], $timedout_date['day'], $timedout_date['year']);
     // Calculate minutes
     $total_minutes = intval($time_in['minute']) + intval($time_out['minute']);
     // Now get the hours rendered
     $timespan = timespan($start, $end, 5);
     $timespan = explode(',', $timespan);
     $found = false;
     foreach ($timespan as $time) {
         $time = trim($time);
         if (strpos($time, 'Hour') !== false) {
             $found = true;
             $hours = explode(' ', $time);
         }
     }
     if ($found) {
         $hours_rendered = (int) $hours[0];
     } else {
         $hours_rendered = 0;
     }
     if ($total_minutes > 59) {
         $hours_rendered = $hours_rendered + 1;
     }
     return $hours_rendered;
 }
Example #20
0
 function list_items($id, $person, $source, $place_id, $place_name, $message = null, $img, $cords, $time)
 {
     $map_item['id'] = $id;
     $map_item['person'] = $person;
     $map_item['source'] = $source;
     $map_item['place_id'] = $place_id;
     $map_item['place_name'] = $place_name;
     $map_item['message'] = $message;
     $map_item['img'] = $img;
     $map_item['cords'] = $cords;
     $map_item['time'] = timespan($time) . " ago";
     $map_item['time_raw'] = $time;
     $this->map_items[] = $map_item;
 }
Example #21
0
    <div class="username"><?php 
        echo anchor('/user/' . url_title($row->author_name, 'dash', FALSE), $row->author_name);
        ?>
</div>
    <div class="time"><?php 
        echo timespan(strtotime($row->created), time());
        ?>
</div>
  </div>
  <div class="three">
    <div class="username"><?php 
        echo anchor('/user/' . url_title($row->responder_name, 'dash', FALSE), $row->responder_name);
        ?>
</div>
    <div class="time"><?php 
        echo timespan(strtotime($row->response_created), time());
        ?>
</div>
  </div>
  <div class="four">
    <span><?php 
        echo $row->response_count;
        ?>
</span>
  </div>
                                                                                        <?php 
        if ($logged_in) {
            ?>
  <div class="five">
    <a class="favourite<?php 
            echo $favorite;
Example #22
0
	function getWorkoutData()
	{
	
	
			$this->load->model('Workout', 'workout');
		$this->load->model('User', 'user');

		
		$user->id = $this->session->userdata('id');

		$result['user'] = $this->user->get_user($user);
		//print_r($result['user']);
	
	
		$this->load->model('Workout', 'workout');
		$user->id = $this->session->userdata('id');
		$result['workouts'] = $this->workout->get_user_workouts($user);

		for($i=0; $i<count($result['workouts']); $i++)
		{
			$post_time = $result['workouts'][$i]->workout_date;
			
			$post_date = human_to_unix($post_time);
			$post_date = timespan($post_date);
			
			$post_time_array = explode(", ", $post_date);
			$post_time_count = count($post_time_array);
			switch ($post_time_count) 
			{
			    case 0:
			        break;
			    case 1:
			        $post_date = strtolower($post_time_array[0])." ago";
			        break;
			    case 2:
			    	$post_date = strtolower($post_time_array[0])." ago";
			        break;
			    default:
					$post_date = date("j \of M y", $post_time);
			}
			$result['workouts'][$i]->workout_date = $post_date;
		}
		return $result;
	}
</td>									
										<td><?php 
        echo $policy['category'];
        ?>
</td>
										<td><?php 
        echo $policy['customer_type'] == 1 || $policy['customer_type'] == 4 ? $policy['f_name'] . ' ' . $policy['l_name'] : $policy['company_name'];
        ?>
</td>
										<td><?php 
        echo $policy['created_date'];
        ?>
</td>
                                        <td>
                                        	<?php 
        echo timespan(strtotime($policy['created_time_date']), time());
        ?>
                                        </td>
                                        <td><?php 
        echo $policy['created_user_name'];
        ?>
</td>
                                        <td><?php 
        echo $policy['branch_name'];
        ?>
</td>
                                        <td><?php 
        echo $policy_status;
        ?>
</td>
										<?php 
Example #24
0
 /**
  * Replace all variables.
  *
  * @param String	The tagdata to be parsed
  * @param Object	The channel parser object
  * @param Mixed		The results from the preparse method
  *
  * @return String	The processed tagdata
  */
 public function replace($tagdata, EE_Channel_data_parser $obj, $search_link)
 {
     $tag = $obj->tag();
     $tag_options = $obj->tag_options();
     $data = $obj->row();
     $prefix = $obj->prefix();
     // I decided to split the huge if statement into educated guesses
     // so we spend less time doing silly comparisons
     if (strpos($tag, '_path') !== FALSE or strpos($tag, 'permalink') !== FALSE) {
         return $this->_paths($data, $tagdata, $tag, $tag_options, $prefix);
     }
     if (strpos($tag, 'url') !== FALSE) {
         return $this->_urls($data, $tagdata, $tag, $tag_options, $prefix);
     }
     // @todo remove
     $key = $tag;
     $val = $tag_options;
     //  parse {title}
     if ($key == $prefix . 'title') {
         $data['title'] = str_replace(array('{', '}'), array('&#123;', '&#125;'), $data['title']);
         $tagdata = str_replace(LD . $key . RD, ee()->typography->format_characters($data['title']), $tagdata);
     } elseif ($key == $prefix . "author") {
         $tagdata = str_replace(LD . $val . RD, $data['screen_name'] != '' ? $data['screen_name'] : $data['username'], $tagdata);
     } elseif ($key == $prefix . "channel") {
         $tagdata = str_replace(LD . $val . RD, $data['channel_title'], $tagdata);
     } elseif ($key == $prefix . "channel_short_name") {
         $tagdata = str_replace(LD . $val . RD, $data['channel_name'], $tagdata);
     } elseif ($key == $prefix . "relative_date") {
         $tagdata = str_replace(LD . $val . RD, timespan($data['entry_date']), $tagdata);
     } elseif ($key == $prefix . "signature") {
         if (ee()->session->userdata('display_signatures') == 'n' or $data['signature'] == '') {
             $tagdata = str_replace(LD . $key . RD, '', $tagdata);
         } else {
             $tagdata = str_replace(LD . $key . RD, ee()->typography->parse_type($data['signature'], array('text_format' => 'xhtml', 'html_format' => 'safe', 'auto_links' => 'y', 'allow_img_url' => ee()->config->item('sig_allow_img_hotlink'))), $tagdata);
         }
     } else {
         return $this->_basic($data, $tagdata, $tag, $tag_options, $prefix);
     }
     return $tagdata;
 }
?>
)</b> &nbsp;</a></li>
              <li><a href="mailto:martin@lazarov.bg">Contact</a></li>
            </ul>
          </div><!--/.nav-collapse -->
        </div>
      </div>
    </div>


	<div class="container">

		<?php 
if ($muted) {
    echo '<div class="row"><div class="span4 offset4 label label-important" style="padding:10px;margin-bottom:20px;text-align:center;">';
    echo 'Sound muted for ' . timespan(time(), $muted) . ' <span class="pull-right"><a href="?mute=-1" style="color:white;"><i class="icon-music icon-white"></i> Unmute</a></span></div></div>';
}
?>
		<div class="row">
				<?php 
$alert = false;
foreach ($list as $name => $procs) {
    $parsed_url = parse_url($cfg[$name]['url']);
    if (isset($cfg[$name]['username']) && isset($cfg[$name]['password'])) {
        $base_url = 'http://' . $cfg[$name]['username'] . ':' . $cfg[$name]['password'] . '@';
    } else {
        $base_url = 'http://';
    }
    $ui_url = $base_url . $parsed_url['host'] . ':' . $cfg[$name]['port'] . '/';
    ?>
				<div class="span<?php 
        ?>
</span></td>
		<td><?php 
        echo anchor('invoices/view/' . $row->id, $this->settings_model->get_setting('currency_symbol') . number_format($row->subtotal, 2, $this->config->item('currency_decimal'), ''));
        ?>
</td>
		<td>
		<?php 
        if ($row->amount_paid >= $row->subtotal + 0.01) {
            // paid invoices
            echo anchor('invoices/view/' . $row->id, $this->lang->line('invoice_closed'), array('title' => 'invoice status'));
        } elseif (mysql_to_unix($row->dateIssued) >= strtotime('-' . $this->settings_model->get_setting('days_payment_due') . ' days')) {
            // owing less then the overdue days amount
            echo anchor('invoices/view/' . $row->id, $this->lang->line('invoice_open'), array('title' => 'invoice status'));
        } else {
            // owing more then the overdue days amount
            // convert days due into a timestamp, and add the days payement is due in seconds
            $due_date = mysql_to_unix($row->dateIssued) + $this->settings_model->get_setting('days_payment_due') * 60 * 60 * 24;
            $line = "<span class='error'>" . timespan($due_date, now()) . ' ' . $this->lang->line('invoice_overdue') . '</span>';
            echo anchor('invoices/view/' . $row->id, $line, array('title' => 'invoice status'));
        }
        ?>
		</td>
	</tr>
	<?php 
    }
}
?>
	</tbody>
</table>
Example #27
0
 /**
  * Profile
  *
  * Allows the user to view their profile.
  *
  * @param       integer     $user_id
  * @author      Chris Baines
  * @since       0.2.0
  */
 public function profile($user_id = NULL)
 {
     // Check if the user has permission.
     if (!$this->permission->has_permission('view_profile')) {
         // Create a message.
         $this->messageci->set(lang('error_permission_required'), 'error');
         // Redirect.
         redirect($this->agent->referrer(), 'refresh');
     }
     // Check if a user is logged in, otherwise load the achievements library.
     if ($this->ion_auth->logged_in() === FALSE) {
         $config['user_id'] = $user_id;
         $this->load->library('achievements', $config);
     }
     // Get the users achievements.
     $achievements = $this->achievements->get_user_achievements();
     if (!empty($achievements)) {
         foreach ($achievements as $row) {
             $data['achievements'][] = array('name' => $row->name, 'description' => $row->description, 'points' => $row->points);
         }
     }
     // Get the users thumbs.
     $thumbs = $this->thumbs->get_many_by('recipient_user_id', $user_id);
     // Set the table template.
     $data['tmpl'] = array('table_open' => '<table class="table table-hover">');
     $this->table->set_template(element('tmpl', $data));
     // Set the table headings.
     $this->table->set_heading('', lang('tbl_in_discussion'), lang('tbl_given_by'), lang('tbl_date'), lang('tbl_for_comment'));
     if (!empty($thumbs)) {
         foreach ($thumbs as $thumb) {
             // Get the discussion.
             $discussion = $this->discussions->get_by('id', $thumb->discussion_id);
             // Get the givers user details.
             $user = $this->ion_auth->user($thumb->giver_user_id)->row();
             // Build the givers avatar.
             $data['avatar'] = array('src' => $this->gravatar->get_gravatar($user->email, $this->config->item('gravatar_rating'), 20, $this->config->item('gravatar_default_image')));
             $this->table->add_row(img(element('avatar', $data)), anchor(site_url('discussions/view/' . $thumb->discussion_id), $discussion->subject), anchor(site_url('users/profile/' . $thumb->giver_user_id), ucwords($thumb->giver_username)), unix_to_human($thumb->given), anchor(site_url('discussions/view/' . $thumb->discussion_id . '/#' . $thumb->comment_id), 'View'));
         }
     }
     // Get the user from the database.
     if (!$user_id) {
         $user = $this->ion_auth->user()->row();
     } else {
         $user = $this->ion_auth->user($user_id)->row();
     }
     // Define the page title.
     $data['title'] = sprintf(lang('tle_profile'), $user->username);
     // Define the page template.
     $data['template'] = 'pages/users/profile';
     // Build the page breadcrumbs.
     $this->crumbs->add(lang('crumb_users'), 'users');
     $this->crumbs->add(sprintf(lang('crumb_profile'), $user->username));
     // Build the discussion starters avatar.
     $data['avatar'] = array('src' => $this->gravatar->get_gravatar($user->email, $this->config->item('gravatar_rating'), 100, $this->config->item('gravatar_default_image')), 'class' => 'media-object img-circle center-block');
     $data['page'] = array('username' => $user->username, 'joined' => timespan($user->created_on, time()), 'last_visit' => timespan($user->last_login, time()), 'first_name' => $user->first_name, 'last_name' => $user->last_name, 'points' => $user->points, 'avatar' => img(element('avatar', $data)), 'total_discussions' => $this->discussions->count_by('poster', $user->username), 'total_comments' => $this->comments->count_by('poster_id', $user->id), 'online' => $this->users->user_online($user->id) == TRUE ? '<i class="fa fa-circle online" title="' . lang('txt_online') . '"></i>' : '<i class="fa fa-circle offline" title="' . lang('txt_offline') . '"></i>', 'achievements' => element('achievements', $data), 'tbl_thumbs' => $this->table->generate(), 'has_achievements' => !empty($achievements) ? 1 : 0, 'btn_send_pm' => anchor(site_url('messages/send/' . $user->id . ''), lang('btn_pm'), array('class' => 'btn btn-default btn-sm', 'data-toggle' => 'tooltip', 'data-placement' => 'top', 'title' => lang('tip_send_user_pm'))), 'btn_login' => form_submit('submit', lang('btn_login'), 'class="btn btn-primary"'), 'btn_forgot_password' => anchor(site_url('users/forgot_password'), lang('btn_forgot_password'), array('class' => 'btn btn-danger')), 'breadcrumbs' => $this->crumbs->output());
     $this->render(element('page', $data), element('title', $data), element('template', $data));
 }
                            </td>
                            <td>
                                <?php 
        echo $company->company_title;
        ?>
                            </td>
                            <td>
                                <?php 
        echo date('F Y', $company->start_date);
        ?>
 -
                                <?php 
        echo $company->end_date ? date('F Y', $company->end_date) : 'Present';
        ?>
                                (<?php 
        echo timespan($company->start_date, $company->end_date);
        ?>
)
                                <ul class="actions">
                                    <li><a href="<?php 
        echo site_url('panel/companies/edit/' . $company->id);
        ?>
">Edit</a></li>
                                    <li class="last"><a href="#" class="clickRemoveRow" data-url="<?php 
        echo site_url('panel/companies/delete/' . $company->id);
        ?>
">Delete</a></li>
                                </ul>
                            </td>
                        </tr>
                    <?php 
Example #29
0
        echo $eo;
        ?>
">
					<td class="first"><a href="<?php 
        echo site_url("view/" . $reply['pid']);
        ?>
"><?php 
        echo $reply['title'];
        ?>
</a></td>
					<td><?php 
        echo $reply['name'];
        ?>
</td>
					<td><?php 
        $p = explode(",", timespan($reply['created'], time()));
        echo $p[0];
        ?>
 ago.</td>
				</tr>
		
			<?php 
    }
    ?>
			</tbody>
			</table>
<?php 
    echo $pages;
    ?>
		<div class="spacer high"></div><div class="spacer high"></div>
		<?php 
Example #30
0
        echo "你创建的";
    }
    ?>
主题 <a href="<?php 
    echo base_url('topic/' . $notice['topicid']);
    ?>
"><?php 
    echo $notice['topictitle'];
    ?>
</a> 中回复了你</small></h4>
                                    <blockquote>
                                        <?php 
    echo $notice['comment'];
    ?>
                                        <small><?php 
    echo timespan($notice['addtime']);
    ?>
</small>
                                    </blockquote>
                                </div>
                            </li>
                            <hr class="smallhr">
                            <?php 
}
?>
                        </ul>
                        <ul class="pager"><?php 
echo $pagination;
?>
</ul>
                    </div>