datepicker in admin logs

This commit is contained in:
Etienne Roudeix
2013-10-30 12:00:48 +01:00
parent 19e373f7fe
commit 52fa6783f3
12 changed files with 2828 additions and 500 deletions

View File

@@ -41,12 +41,14 @@ class AdminLogsController extends BaseAdminController
public function loadLoggerAjaxAction()
{
$entries = array();
foreach( AdminLogQuery::getEntries(
$this->getRequest()->request->get('admins', array()),
null,
null,
array_merge($this->getRequest()->request->get('resources', array()), $this->getRequest()->request->get('modules', array()))
) as $entry) {
$this->getRequest()->request->get('admins', array()),
$this->getRequest()->request->get('fromDate', null),
$this->getRequest()->request->get('toDate', null),
array_merge($this->getRequest()->request->get('resources', array()), $this->getRequest()->request->get('modules', array())),
null
) as $entry) {
$entries[] = array(
"head" => sprintf(

View File

@@ -43,7 +43,17 @@ class Assetic extends AbstractSmartyPlugin
public function blockJavascripts($params, $content, \Smarty_Internal_Template $template, &$repeat)
{
return $this->assetManager->processSmartyPluginCall('js', $params, $content, $template, $repeat);
try {
return $this->assetManager->processSmartyPluginCall('js', $params, $content, $template, $repeat);
} catch(\Exception $e) {
$catchException = $this->getNormalizedParam($params, array('catchException'));
if($catchException == "true") {
$repeat = false;
return null;
} else {
throw $e;
}
}
}
public function blockImages($params, $content, \Smarty_Internal_Template $template, &$repeat)

View File

@@ -20,23 +20,25 @@ class AdminLogQuery extends BaseAdminLogQuery
{
/**
* @param null $login
* @param \DateTime $maxDateTime
* @param \DateTime $minDateTime
* @param null $minDate
* @param null $maxDate
* @param null $resources
* @param null $actions
*
* @return array|mixed|\Propel\Runtime\Collection\ObjectCollection
*/
public static function getEntries($login = null, \DateTime $maxDateTime = null, \DateTime $minDateTime = null, $resources = null, $actions = null)
public static function getEntries($login = null, $minDate = null, $maxDate = null, $resources = null, $actions = null)
{
$search = self::create();
if(null !== $minDateTime) {
$search->filterByCreatedAt($minDateTime->getTimestamp(), Criteria::GREATER_EQUAL);
if(null !== $minDate) {
$search->filterByCreatedAt($minDate, Criteria::GREATER_EQUAL);
}
if(null !== $maxDateTime) {
$search->filterByCreatedAt($maxDateTime->getTimestamp(), Criteria::LESS_EQUAL);
if(null !== $maxDate) {
$maxDateObject = new \DateTime($maxDate);
$maxDateObject->add(new \DateInterval('P1D'));
$search->filterByCreatedAt(date('Y-m-d', $maxDateObject->getTimestamp()), Criteria::LESS_THAN);
}
if(null !== $resources) {