added timestamp parameter to format_date sparty plugin
This commit is contained in:
@@ -157,23 +157,6 @@ class AttributeController extends AbstractCrudController
|
||||
'postscriptum' => $object->getPostscriptum()
|
||||
);
|
||||
|
||||
// Setup attributes values
|
||||
/*
|
||||
* FIXME : doesn't work. "We get a This form should not contain extra fields." error
|
||||
$attr_av_list = AttributeAvQuery::create()
|
||||
->joinWithI18n($this->getCurrentEditionLocale())
|
||||
->filterByAttributeId($object->getId())
|
||||
->find();
|
||||
|
||||
$attr_array = array();
|
||||
|
||||
foreach ($attr_av_list as $attr_av) {
|
||||
$attr_array[$attr_av->getId()] = $attr_av->getTitle();
|
||||
}
|
||||
|
||||
$data['attribute_values'] = $attr_array;
|
||||
*/
|
||||
|
||||
// Setup the object form
|
||||
return new AttributeModificationForm($this->getRequest(), "form", $data);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ use Thelia\Core\Template\Element\LoopResultRow;
|
||||
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
use Thelia\Tools\DateTimeFormat;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -90,15 +91,15 @@ class Feed extends BaseLoop
|
||||
$author = $item->get_author();
|
||||
$description = $item->get_description();
|
||||
|
||||
$date = $item->get_date('d/m/Y');
|
||||
|
||||
$loopResultRow = new LoopResultRow($loopResult, null, $this->versionable, $this->timestampable, $this->countable);
|
||||
|
||||
$loopResultRow->set("URL", $item->get_permalink());
|
||||
$loopResultRow->set("TITLE", $item->get_title());
|
||||
$loopResultRow->set("AUTHOR", $item->get_author());
|
||||
$loopResultRow->set("DESCRIPTION", $item->get_description());
|
||||
$loopResultRow->set("DATE", $item->get_date('d/m/Y')); // FIXME - date format should be an intl parameter
|
||||
$loopResultRow
|
||||
->set("URL" , $item->get_permalink())
|
||||
->set("TITLE" , $item->get_title())
|
||||
->set("AUTHOR" , $item->get_author())
|
||||
->set("DESCRIPTION" , $item->get_description())
|
||||
->set("DATE" , $item->get_date('U')) // FIXME - date format should be an intl parameter
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
|
||||
@@ -73,7 +73,14 @@ class Format extends AbstractSmartyPlugin
|
||||
$date = $this->getParam($params, "date", false);
|
||||
|
||||
if ($date === false) {
|
||||
throw new SmartyPluginException("date is a mandatory parameter in format_date function");
|
||||
$timestamp = $this->getParam($params, "timestamp", false);
|
||||
|
||||
if ($timestamp === false)
|
||||
throw new SmartyPluginException("Either date or timestamp is a mandatory parameter in format_date function");
|
||||
else {
|
||||
$date = new \DateTime();
|
||||
$date->setTimestamp($timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$date instanceof \DateTime) {
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">
|
||||
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapse-{$LOOP_COUNT}">
|
||||
{$TITLE|strip_tags nofilter} - {$DATE}
|
||||
{$TITLE|strip_tags nofilter} - {format_date timestamp=$DATE}
|
||||
</a>
|
||||
</h3>
|
||||
</div>
|
||||
@@ -20,7 +20,7 @@
|
||||
<a href="{$URL}" target="_blank" class="btn btn-defaut btn-primary"><span class="glyphicon glyphicon-book"></span> {intl l='Lire la suite'}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/loop}
|
||||
</div>
|
||||
Reference in New Issue
Block a user