//check if the user has a fb account authenticated if (!$recent[$i]['fb_uid']) { //else, use standard fb icon $recent[$i]['fb_uid'] = 1; } } usort($recentDrinks, 'compare_time'); $test = array(); for ($i = 0; $i < 100; $i++) { if ($recentDrinks[$i] !== null) { $test[] = $recentDrinks[$i]; } } $recentDrinks = $test; for ($i = 0; $i < sizeof($recentDrinks); $i++) { $recentDrinks[$i]['timestamp'] = SpoonDate::getTimeAgo(strtotime($recentDrinks[$i]['timestamp'])); //check if the user has a fb account authenticated if (!$recentDrinks[$i]['fb_uid']) { //else, use standard fb icon $recentDrinks[$i]['fb_uid'] = 1; } } if ($recent !== null) { //$tpl->assign('oRecent', true); $tpl->assign('iRecent', $recent); $tpl->assign('iRecentt', $recentDrinks); } //else //$tpl->assign('oNoRecent', true); /*end code max*/ } else {
/** * Get time ago as a string for use in a datagrid * * @param int $timestamp The UNIX-timestamp to convert in a time-ago-string. * @return string */ public static function getTimeAgo($timestamp) { $timestamp = (int) $timestamp; // get user setting for long dates $format = Authentication::getUser()->getSetting('datetime_format'); // get the time ago as a string $timeAgo = \SpoonDate::getTimeAgo($timestamp, Language::getInterfaceLanguage(), $format); return '<abbr title="' . \SpoonDate::getDate($format, $timestamp, Language::getInterfaceLanguage()) . '">' . $timeAgo . '</abbr>'; }
/** * Get time ago as a string for use in a datagrid * * @param int $timestamp The UNIX-timestamp to convert in a time-ago-string. * * @return string */ public static function getTimeAgo($timestamp) { $timestamp = (int) $timestamp; // get user setting for long dates $format = Authentication::getUser()->getSetting('datetime_format'); // get the time ago as a string $timeAgo = \SpoonDate::getTimeAgo($timestamp, BackendLanguage::getInterfaceLanguage(), $format); return '<time data-toggle="tooltip" datetime="' . \SpoonDate::getDate('Y-m-d H:i:s', $timestamp) . '" title="' . \SpoonDate::getDate($format, $timestamp, BackendLanguage::getInterfaceLanguage()) . '">' . $timeAgo . '</time>'; }
/** * Formats a timestamp as a string that indicates the time ago * syntax: {$var|timeago} * * @param string[optional] $var A UNIX-timestamp that will be formated as a time-ago-string. * @return string */ public static function timeAgo($var = null) { $var = (int) $var; // invalid timestamp if ($var == 0) { return ''; } // return return '<abbr title="' . SpoonDate::getDate(FrontendModel::getModuleSetting('core', 'date_format_long') . ', ' . FrontendModel::getModuleSetting('core', 'time_format'), $var, FRONTEND_LANGUAGE) . '">' . SpoonDate::getTimeAgo($var, FRONTEND_LANGUAGE) . '</abbr>'; }
/** * Formats a timestamp as a string that indicates the time ago * syntax: {{ $string|timeago }}. * * @param string $string A UNIX-timestamp that will be formatted as a time-ago-string. * * @return string */ public static function timeAgo($string = null) { $string = (int) $string; // invalid timestamp if ($string == 0) { return ''; } // return return '<abbr title="' . \SpoonDate::getDate(FrontendModel::get('fork.settings')->get('Core', 'date_format_long') . ', ' . FrontendModel::get('fork.settings')->get('Core', 'time_format'), $string, Locale::frontendLanguage()) . '">' . \SpoonDate::getTimeAgo($string, Locale::frontendLanguage()) . '</abbr>'; }
/** * Formats a timestamp as a string that indicates the time ago * syntax: {$var|timeago} * * @param string $var A UNIX-timestamp that will be formatted as a time-ago-string. * @return string */ public static function timeAgo($var = null) { $var = (int) $var; // invalid timestamp if ($var == 0) { return ''; } // return return '<abbr title="' . \SpoonDate::getDate(Model::get('fork.settings')->get('Core', 'date_format_long') . ', ' . Model::get('fork.settings')->get('Core', 'time_format'), $var, FRONTEND_LANGUAGE) . '">' . \SpoonDate::getTimeAgo($var, FRONTEND_LANGUAGE) . '</abbr>'; }