addColumn('date', 'eventStartDate', ['orderBy' => 'eventStartDate', 'title' => 'Event Date']); $this->addEventNameColumn(); $this->addColumn( 'date', 'paymentDate', ['orderBy' => 'paymentDate', 'title' => 'Payment Date', 'emptyText' => '-'] ); $this->addColumn( 'text', 'paymentTypeTitle', ['orderBy' => 'paymentTypeTitle', 'title' => 'Payment Type', 'defaultText' => '-'] ); $this->addColumn('text', 'createdByTitle', ['orderBy' => 'createdByTitle', 'title' => 'Created By']); $this->addOptionsColumn(); return $this; } public function addEventNameColumn() { $this->addColumn( 'link_advanced', 'eventName', [ 'orderBy' => 'eventName', 'title' => 'Event Name', 'text' => '%s', 'params' => ['text' => 'eventName', 'enabled' => 'eventEnabled'], 'url' => $this->getEventUrl(), 'urlParams' => ['eventAlias'], 'initCallback' => function (&$options) { $params = &$options['params']; $column = &$options['column']; if ('y' !== $params['enabled']) { $column['defaultText'] = $params['text']; $params['text'] = null; } }, ] ); } public function addOptionsColumn() { $this->addColumn( 'options', 'options', [ 'actions' => [ 'viewOrder' => ['formattedLink' => OrderView::getPage('url') . '/view/%d'], ], 'params' => ['orderId', 'createdBy'], 'initCallback' => function (&$options) { $params = &$options['params']; $column = &$options['column']; if (empty($params['orderId']) || $params['createdBy'] != AttendeeEntity::CREATED_BY_ME) { unset($column['actions']['viewOrder']); } }, ] ); return $this; } protected function getEventUrl() { $page = Qs_SiteMap::findFirst(null, ['type' => 'Event\\'], ['type' => EventConfigForm::TYPE_DETAILS]); if (false === $page) { return null; } return $page['url'] . '/%s'; } }