$list->addParam('clang', $clang); $list->addParam('subpage', $subpage); $imgHeader = ' <a class="rex-i-element rex-i-generic-add" href="' . $list->getUrl(array('func' => 'add')) . '"> <span class="rex-i-element-text">add</span> </a>'; $list->setColumnLabel('id', $imgHeader); $list->setColumnLabel('title', $I18N->msg('asd_news_title')); $list->setColumnLabel('publishedAt', $I18N->msg('asd_news_publishedAt')); $list->removeColumn('status'); $list->addTableColumnGroup(array(40, '*', 120, 50, 50, 50, 50)); $list->setColumnParams('title', array('func' => 'edit', 'id' => '###id###')); $list->setColumnFormat('publishedAt', 'custom', function ($params) use($list, $now, $clang, $I18N, $REX) { $publishedAt = new DateTime($list->getValue('publishedAt')); $value = $publishedAt->format('d.m.Y H:i'); if ($list->getValue('publishedAt') == '0000-00-00 00:00:00') { return ''; } return '<span>' . $value . '</span>'; }); $list->addColumn('publishCol', $I18N->msg('asd_news_publish'), -1, array('<th colspan="4">' . $I18N->msg('actions') . '</th>', '<td>###VALUE###</td>')); $list->setColumnFormat('publishCol', 'custom', function ($params) use($list, $clang, $now, $I18N) { $publishedAt = new DateTime($list->getValue('publishedAt')); if ($list->getValue('publishedAt') == '0000-00-00 00:00:00') { return ' <span class="rex-offline datepicker" data-id="###id###">' . $I18N->msg('asd_news_unpublished') . '</span> <span style="height:1px; width:1px; display:block" id="news_###id###" data-clang="' . $clang . '" value="' . $now->format('d/m/Y H:i') . '"></span>'; } $url = $list->getParsedUrl(array('func' => 'unpublish', 'id' => '###id###')); return '<a href="' . $url . '" class="rex-online" onclick="return confirm(\'' . $I18N->msg('asd_news_really_unpublish') . '\');">' . $I18N->msg('asd_news_published') . '</a>'; }); $list->addColumn('editCol', $I18N->msg('edit'), -1, array('', '<td>###VALUE###</td>'));