/**
  * Formata o valor
  * @param mixed $value
  * @param string $type
  * @param boolean $formatar
  * @return mixed
  */
 function formatValue($value, $type, $formatar)
 {
     switch (strtolower($type)) {
         case 'data':
         case 'dt':
         case 'date':
             $value = Date::data((string) $value);
             return $formatar ? Date::formatData($value) : $value;
             break;
         case 'timestamp':
         case 'datatime':
             $value = Date::timestamp((string) $value);
             return $formatar ? Date::formatDataTime($value) : $value;
             break;
         case 'real':
             return $formatar ? Number::real($value) : Number::float($value, 2);
         case 'hide':
             return $formatar ? null : $value;
             break;
         case 'array':
             return $formatar ? stringToArray($value) : arrayToString($value);
             break;
         default:
             return $value;
     }
 }
Exemplo n.º 2
0
function siteforum_filter_shortdate($date)
{
    if (!$date) {
        return '';
    }
    loader_import('saf.Date');
    return Date::timestamp($date, 'M j - g:i A');
}
Exemplo n.º 3
0
 function getStatus($user)
 {
     global $db, $loader;
     $loader->import('saf.Date');
     $res = $db->fetch('select session_id, expires from sitellite_user where username = ?', $user);
     if (!$res) {
         $this->error = $db->error;
         return false;
     }
     if (!empty($res->session_id) && Date::timestamp($res->expires, 'U') >= time()) {
         return 'available';
     }
     return 'away';
 }
Exemplo n.º 4
0
/**
 * @package CMS
 */
function filter_cms_messages_date($date)
{
    global $simple_template_register;
    $obj =& $simple_template_register['parent'];
    if ($obj->status == 'unread') {
        $start = '<strong>';
        $end = '</strong>';
    } else {
        $start = '';
        $end = '';
    }
    loader_import('saf.Date');
    return $start . Date::timestamp($date, array('today' => '\\T\\o\\d\\a\\y - g:i A', 'yesterday' => '\\Y\\e\\s\\t\\e\\r\\d\\a\\y - g:i A', 'tomorrow' => '\\T\\o\\m\\o\\r\\r\\o\\w - g:i A', 'this week' => 'l, F j, Y - g:i A', 'other' => 'F j, Y - g:i A')) . $end;
}
Exemplo n.º 5
0
    exit;
}
$current = $rex->getRevision($parameters['_key'], $parameters['_current'], true);
if (!$current) {
    header('Location: ' . $_SERVER['HTTP_REFERER']);
    exit;
}
$info = array('r_autoid' => $revision->sv_autoid, 'r_author' => $revision->sv_author, 'r_action' => $revision->sv_action, 'r_revision' => Date::timestamp($revision->sv_revision, 'F j, Y - g:ia'), 'r_changelog' => $revision->sv_changelog, 'r_current' => $revision->sv_current, 'r_deleted' => $revision->sv_deleted);
unset($revision->sv_autoid);
unset($revision->sv_author);
unset($revision->sv_action);
unset($revision->sv_revision);
unset($revision->sv_changelog);
unset($revision->sv_current);
unset($revision->sv_deleted);
$cinfo = array('c_autoid' => $current->sv_autoid, 'c_author' => $current->sv_author, 'c_action' => $current->sv_action, 'c_revision' => Date::timestamp($current->sv_revision, 'F j, Y - g:ia'), 'c_changelog' => $current->sv_changelog, 'c_current' => $current->sv_current, 'c_deleted' => $current->sv_deleted);
unset($current->sv_autoid);
unset($current->sv_author);
unset($current->sv_action);
unset($current->sv_revision);
unset($current->sv_changelog);
unset($current->sv_current);
unset($current->sv_deleted);
foreach (get_object_vars($revision) as $k => $v) {
    $revision->{$k} = array('revision' => $v, 'current' => $current->{$k});
}
$GLOBALS['cms_history_view_colnames'] = array();
global $cms_history_view_colnames;
foreach ($rex->info as $k => $v) {
    if (strpos($k, 'hint:') === 0) {
        if (isset($v['alt'])) {
Exemplo n.º 6
0
function msg_date_format($date)
{
    loader_import('saf.Date');
    return Date::timestamp($date, array('today' => '\\T\\o\\d\\a\\y - g:i A', 'yesterday' => '\\Y\\e\\s\\t\\e\\r\\d\\a\\y - g:i A', 'tomorrow' => '\\T\\o\\m\\o\\r\\r\\o\\w - g:i A', 'this week' => 'l, F j, Y - g:i A', 'other' => 'F j, Y - g:i A'));
}
Exemplo n.º 7
0
function pretty_date($date)
{
    loader_import('saf.Date');
    return Date::timestamp($date, 'M j, Y - g:ia');
}
Exemplo n.º 8
0
function sitefaq_filter_date_time($date)
{
    return Date::timestamp($date, appconf('format_date_time'));
}
Exemplo n.º 9
0
function sitepoll_filter_date_time($date)
{
    loader_import('saf.Date');
    return Date::timestamp($date, 'F jS, Y - g:i A');
}
Exemplo n.º 10
0
 /**
  * 
  * @param string $Table
  * @param array $values
  * @return array
  */
 public static function format_values($Table, array $values = null)
 {
     if (is_null($values)) {
         return $values;
     } else {
         foreach ($values as $key => $value) {
             if (is_null($value)) {
                 $values[$key] = '';
             }
         }
     }
     $infoTable = self::getTableInfo($Table);
     $result = [];
     foreach ($infoTable as $info) {
         $field = $info['Field'];
         # Verificando campo
         if (isset($values[$field])) {
             # Valor passado
             $value = $values[$field];
             # Tipo de dado
             $type = strtolower(current(explode('(', $info['Type'])));
             # Formatando tipos de valores
             if (trim($value) !== '') {
                 switch ($type) {
                     case 'date':
                         $value = Date::data($value);
                         break;
                     case 'tinyint':
                     case 'smallint':
                     case 'mediumint':
                     case 'bigint':
                     case 'int':
                         $value = Number::int($value);
                         break;
                     case 'decimal':
                     case 'float':
                     case 'double':
                     case 'real':
                         $value = Number::float($value);
                         break;
                     case 'datetime':
                     case 'timestamp':
                         $value = Date::timestamp($value);
                         break;
                     case 'time':
                         $value = Date::time($value);
                         break;
                 }
             } else {
                 if ($info['Null'] == 'NO') {
                     $value = '';
                 } else {
                     if ($info['Null'] == 'YES') {
                         $value = null;
                     }
                 }
             }
             # Setando valor na array
             $result[$field] = $value;
         }
     }
     return $result;
 }
Exemplo n.º 11
0
 $item =& $list[$k];
 $e =& $cal->addEvent('VEVENT');
 $e->addProperty('UID', site_domain() . '/siteevent/' . $item->id);
 $e->addProperty('SEQUENCE', $k + 1);
 $p =& $e->addProperty('URL', 'http://' . site_domain() . site_prefix() . '/index/siteevent-details-action/id.' . $item->id . '/title.' . siteevent_filter_link_title($item->title));
 $p->addParameter('VALUE', 'URI');
 $e->addProperty('STATUS', 'CONFIRMED');
 if ($item->time && $item->time > '00:00:00') {
     $e->addProperty('DTSTART', Date::timestamp($item->date . ' ' . $item->time, 'Ymd\\THis'));
 } else {
     $p =& $e->addProperty('DTSTART', Date::format($item->date, 'Ymd'));
     $p->addParameter('VALUE', 'DATE');
 }
 if ($item->until_date && $item->until_date > '0000-00-00') {
     if ($item->until_time && $item->until_time > '00:00:00') {
         $e->addProperty('DTEND', Date::timestamp($item->until_date . ' ' . $item->until_time, 'Ymd\\THis'));
     } else {
         $p =& $e->addProperty('DTEND', Date::format($item->until_date, 'Ymd'));
         $p->addParameter('VALUE', 'DATE');
     }
 }
 $e->addProperty('CATEGORIES', strtoupper($item->category));
 $e->addProperty('SUMMARY', $item->title);
 $details = strip_tags($item->details);
 $details = preg_replace('|[\\r\\n]|s', '\\n', $details);
 $e->addProperty('DESCRIPTION', $details);
 if (!empty($item->contact_email)) {
     $p =& $e->addProperty('ORGANIZER', array('MAILTO', $item->contact_email));
     if (!empty($item->contact)) {
         $p->addParameter('CN', $item->contact);
     }
Exemplo n.º 12
0
 public static function fecha_corta($datetime = NULL)
 {
     $meses = array(1 => 'Ene', 2 => 'Feb', 3 => 'Mar', 4 => 'Abr', 5 => 'May', 6 => 'Jun', 7 => 'Jul', 8 => 'Ago', 9 => 'Sep', 10 => 'Oct', 11 => 'Nov', 12 => 'Dic');
     if ($datetime == NULL) {
         Date::$datetime = date('d-m-Y H:i:s');
     }
     Date::$datetime = $datetime;
     Date::$timestamp = strtotime(Date::$datetime);
     $mes = (int) date('m', Date::$timestamp);
     $mes = $meses[$mes];
     //retornamos
     // return date('d',Date::$timestamp).'/'.$mes.'/'.date('Y',Date::$timestamp);
     return date('d/m/Y', Date::$timestamp);
 }
Exemplo n.º 13
0
function news_date_comments($time)
{
    return Date::timestamp($time, appconf('date_time'));
}
Exemplo n.º 14
0
function sitesearch_filter_time($mtime)
{
    return Date::timestamp($mtime, appconf('time_format'));
}