/** * Prepare the list data configuration. * * @return SQLListDataConfig */ protected function prepareListDataConfig() { $user = BackendUser::getInstance(); $config = new SQLListDataConfig(); $config->setTable('tl_calendar'); $config->setKeyColumn('id'); $config->addColumns($this->getColumns()); // Todo is search column must be configured $config->addSearchColumns('title'); $config->setOrderByExpr('title'); $config->setLabelCallback($this->prepareLabelCallback($config)); $config->setIconCallback($this->prepareIconCallback()); if (!$user->isAdmin && count($user->calendars) > 0) { $config->setConditionExpr('id IN (' . implode(', ', $user->calendars) . ')'); } return $config; }
/** * Get list data config. * * @param $pid * * @return SQLListDataConfig */ protected function getListDataConfig($pid = null) { $config = new SQLListDataConfig(); $config->setTable('tl_article'); $config->setKeyColumn('id'); $config->setOrderByExpr('sorting'); $config->setColumns($this->getColumns()); // Todo is search column must be configured $config->addSearchColumns('title'); $config->setLabelCallback($this->getLabelCallback($config)); $config->setIconCallback($this->getIconCallback()); $config->setContentCallback($this->getContentCallback()); if ($pid) { $config->setConditionExpr('pid=' . $pid); } return $config; }