strftime() public static méthode

Formats a string by strftime().
See also: http://www.php.net/manual/en/function.strftime.php
public static strftime ( string $value, string $format = '' ) : string
$value string Unix timestamp or datetime string for `strtotime`
$format string Possible values are format strings like in `strftime` or "date" or "datetime", default is "date"
Résultat string
Exemple #1
0
 public function testStrftime()
 {
     $oldLocale = rex_i18n::getLocale();
     rex_i18n::setLocale('en_gb');
     $value = 1336811080;
     $format = '%d.%m.%Y %H:%M';
     $this->assertEquals('12.05.2012 10:24', rex_formatter::strftime($value, $format));
     $format = 'date';
     $this->assertEquals('2012-May-12', rex_formatter::strftime($value, $format));
     $format = 'datetime';
     $this->assertEquals('2012-May-12 10:24', rex_formatter::strftime($value, $format));
     rex_i18n::setLocale($oldLocale);
 }
function rex_metainfo_content_sidebar($extionPointParams)
{
    $params = $extionPointParams->getParams();
    $article = rex_article::get($params['article_id'], $params['clang']);
    $articleStatusTypes = rex_article_service::statusTypes();
    $panel = '';
    $panel .= '<dl class="dl-horizontal">';
    $panel .= '<dt>' . rex_i18n::msg('created_by') . '</dt>';
    $panel .= '<dd>' . $article->getValue('createuser') . '</dd>';
    $panel .= '<dt>' . rex_i18n::msg('created_on') . '</dt>';
    $panel .= '<dd>' . rex_formatter::strftime($article->getValue('createdate'), 'date') . '</dd>';
    $panel .= '<dt>' . rex_i18n::msg('updated_by') . '</dt>';
    $panel .= '<dd>' . $article->getValue('updateuser') . '</dd>';
    $panel .= '<dt>' . rex_i18n::msg('updated_on') . '</dt>';
    $panel .= '<dd>' . rex_formatter::strftime($article->getValue('updatedate'), 'date') . '</dd>';
    $panel .= '<dt>' . rex_i18n::msg('status') . '</dt>';
    $panel .= '<dd class="' . $articleStatusTypes[$article->getValue('status')][1] . '">' . $articleStatusTypes[$article->getValue('status')][0] . '</dd>';
    $panel .= '</dl>';
    $fragment = new rex_fragment();
    $fragment->setVar('title', rex_i18n::msg('metadata'), false);
    $fragment->setVar('body', $panel, false);
    $content = $fragment->parse('core/page/section.php');
    return $content;
}
Exemple #3
0
 }
 $qry = 'SELECT * FROM ' . $addTable . rex::getTablePrefix() . 'media f WHERE ' . $where . ' ORDER BY f.updatedate desc, f.id desc';
 // ----- EXTENSION POINT
 $qry = rex_extension::registerPoint(new rex_extension_point('MEDIA_LIST_QUERY', $qry, ['category_id' => $rex_file_category]));
 $files = rex_sql::factory();
 //   $files->setDebug();
 $files->setQuery($qry);
 $panel .= '<tbody>';
 for ($i = 0; $i < $files->getRows(); ++$i) {
     $file_id = $files->getValue('id');
     $file_name = $files->getValue('filename');
     $file_oname = $files->getValue('originalname');
     $file_title = $files->getValue('title');
     $file_type = $files->getValue('filetype');
     $file_size = $files->getValue('filesize');
     $file_stamp = rex_formatter::strftime($files->getDateTimeValue('updatedate'), 'datetime');
     $file_updateuser = $files->getValue('updateuser');
     $encoded_file_name = urlencode($file_name);
     // Eine titel Spalte schätzen
     $alt = '';
     foreach (['title'] as $col) {
         if ($files->hasValue($col) && $files->getValue($col) != '') {
             $alt = htmlspecialchars($files->getValue($col));
             break;
         }
     }
     // Eine beschreibende Spalte schätzen
     $desc = '';
     foreach (['med_description'] as $col) {
         if ($files->hasValue($col) && $files->getValue($col) != '') {
             $desc = '<p>' . htmlspecialchars($files->getValue($col)) . '</p>';
<?php

rex_extension::register('STRUCTURE_CONTENT_SIDEBAR', function (rex_extension_point $ep) {
    $params = $ep->getParams();
    $subject = $ep->getSubject();
    $article = rex_article::get($params['article_id'], $params['clang']);
    $articleStatusTypes = rex_article_service::statusTypes();
    $panel = '';
    $panel .= '<dl class="dl-horizontal text-left">';
    $panel .= '<dt>' . rex_i18n::msg('created_by') . '</dt>';
    $panel .= '<dd>' . $article->getValue('createuser') . '</dd>';
    $panel .= '<dt>' . rex_i18n::msg('created_on') . '</dt>';
    $panel .= '<dd>' . rex_formatter::strftime($article->getValue('createdate'), 'date') . '</dd>';
    $panel .= '<dt>' . rex_i18n::msg('updated_by') . '</dt>';
    $panel .= '<dd>' . $article->getValue('updateuser') . '</dd>';
    $panel .= '<dt>' . rex_i18n::msg('updated_on') . '</dt>';
    $panel .= '<dd>' . rex_formatter::strftime($article->getValue('updatedate'), 'date') . '</dd>';
    $panel .= '<dt>' . rex_i18n::msg('status') . '</dt>';
    $panel .= '<dd class="' . $articleStatusTypes[$article->getValue('status')][1] . '">' . $articleStatusTypes[$article->getValue('status')][0] . '</dd>';
    $panel .= '</dl>';
    $fragment = new rex_fragment();
    $fragment->setVar('title', '<i class="rex-icon rex-icon-info"></i> ' . rex_i18n::msg('metadata'), false);
    $fragment->setVar('body', $panel, false);
    $fragment->setVar('collapse', true);
    $fragment->setVar('collapsed', true);
    $content = $fragment->parse('core/page/section.php');
    return $content . $subject;
});
Exemple #5
0
 /**
  * Returns the timestamp.
  *
  * @param string $format See {@link rex_formatter::strftime}
  *
  * @return int|string Unix timestamp or formatted string if $format is given
  */
 public function getTimestamp($format = null)
 {
     if (is_null($format)) {
         return $this->timestamp;
     }
     return rex_formatter::strftime($this->timestamp, $format);
 }
Exemple #6
0
    <footer class="rex-global-footer">
        <nav class="rex-nav-footer">
            <ul class="list-inline">
                <li><a href="#rex-start-of-page"><i class="fa fa-arrow-up"></i></a></li>
                <li><a href="http://www.yakamara.de" target="_blank">yakamara.de</a></li>
                <li><a href="http://www.redaxo.org" target="_blank">redaxo.org</a></li>
                <li><a href="http://www.redaxo.org/de/forum/" target="_blank"><?php 
echo rex_i18n::msg('footer_joinforum');
?>
</a></li>
                <li><a href="<?php 
echo rex::getUser() ? rex_url::backendPage('credits') : 'http://www.redaxo.org/" target="_blank';
?>
"><?php 
echo rex_i18n::msg('footer_credits');
?>
</a></li>
                <li><?php 
echo rex_i18n::msg('footer_datetime', rex_formatter::strftime(time(), 'date'));
?>
</li>
                <li><!--DYN--><?php 
echo rex_i18n::msg('footer_scripttime', $this->time);
?>
<!--/DYN--></li>
            </ul>
        </nav>
    </footer>
Exemple #7
0
     } else {
         // --------------------- ARTIKEL NORMAL VIEW | NO EDIT NO ENTER
         $art_status = $artStatusTypes[$sql->getValue('status')][0];
         $art_status_class = $artStatusTypes[$sql->getValue('status')][1];
         $art_status_icon = $artStatusTypes[$sql->getValue('status')][2];
         $tmpl_td = '';
         if ($withTemplates) {
             $tmpl = isset($TEMPLATE_NAME[$sql->getValue('template_id')]) ? $TEMPLATE_NAME[$sql->getValue('template_id')] : '';
             $tmpl_td = '<td data-title="' . rex_i18n::msg('header_template') . '">' . $tmpl . '</td>';
         }
         $echo .= '<tr>
                         <td class="rex-table-icon"><i class="rex-icon' . $class . '"></i></td>
                         <td class="rex-table-id" data-title="' . rex_i18n::msg('header_id') . '">' . $sql->getValue('id') . '</td>
                         <td data-title="' . rex_i18n::msg('header_article_name') . '">' . htmlspecialchars($sql->getValue('name')) . '</td>
                         ' . $tmpl_td . '
                         <td data-title="' . rex_i18n::msg('header_date') . '">' . rex_formatter::strftime($sql->getDateTimeValue('createdate'), 'date') . '</td>
                         <td class="rex-table-priority" data-title="' . rex_i18n::msg('header_priority') . '">' . htmlspecialchars($sql->getValue('priority')) . '</td>
                         <td class="rex-table-action"><span class="text-muted"><i class="rex-icon rex-icon-edit"></i> ' . rex_i18n::msg('change') . '</span></td>
                         <td class="rex-table-action"><span class="text-muted"><i class="rex-icon rex-icon-delete"></i> ' . rex_i18n::msg('delete') . '</span></td>
                         <td class="rex-table-action"><span class="' . $art_status_class . ' text-muted"><i class="rex-icon ' . $art_status_icon . '"></i> ' . $art_status . '</span></td>
                     </tr>';
     }
     $sql->next();
 }
 // tbody nur anzeigen, wenn später auch inhalt drinnen stehen wird
 if ($sql->getRows() > 0 || $function == 'add_art') {
     $echo .= '
             </tbody>';
 }
 $echo .= '
         </table>';
Exemple #8
0
         // --------------------- ARTIKEL NORMAL VIEW | NO EDIT NO ENTER
         $art_status = $artStatusTypes[$sql->getValue('status')][0];
         $art_status_class = $artStatusTypes[$sql->getValue('status')][1];
         $art_status_icon = $artStatusTypes[$sql->getValue('status')][2];
         $tmpl_td = '';
         if ($withTemplates) {
             $tmpl = isset($TEMPLATE_NAME[$sql->getValue('template_id')]) ? $TEMPLATE_NAME[$sql->getValue('template_id')] : '';
             $tmpl_td = '<td>' . $tmpl . '</td>';
         }
         $echo .= '<tr>
                         <td><i class="rex-icon' . $class . '"></i></td>
                         <td>' . $sql->getValue('id') . '</td>
                         <td>' . htmlspecialchars($sql->getValue('name')) . '</td>
                         <td>' . htmlspecialchars($sql->getValue('priority')) . '</td>
                         ' . $tmpl_td . '
                         <td>' . rex_formatter::strftime($sql->getDateTimeValue('createdate'), 'date') . '</td>
                         <td><span class="text-muted"><i class="rex-icon rex-icon-edit"></i> ' . rex_i18n::msg('change') . '</span></td>
                         <td><span class="text-muted"><i class="rex-icon rex-icon-delete"></i> ' . rex_i18n::msg('delete') . '</span></td>
                         <td><span class="' . $art_status_class . ' text-muted"><i class="rex-icon ' . $art_status_icon . '"></i> ' . $art_status . '</span></td>
                     </tr>';
     }
     $sql->next();
 }
 // tbody nur anzeigen, wenn später auch inhalt drinnen stehen wird
 if ($sql->getRows() > 0 || $function == 'add_art') {
     $echo .= '
             </tbody>';
 } elseif ($sql->getRows() == 0) {
     $echo .= '
         <tbody>
             <tr>