addColumn('no', 'no'); $this->addColumn( 'date', 'registrationDate', ['title' => 'Registration Date', 'orderBy' => 'ea.registrationDate', 'attribs' => ['class' => 'date-registered']] ); $this->addColumn( 'viewLink', 'memberId', [ 'title' => 'Attendee Name', 'orderBy' => 'lastName', 'activeFlag' => 'memberId', 'textField' => 'attendeeName', 'urlPattern' => $this->_getUserViewPattern(), ] ); $this->addStatusColumn(); $this->addColumn('money', 'amount', ['title' => 'Amount', 'orderBy' => 'amount', 'emptyText' => '-']); $this->addColumn( 'text', 'paymentTypeTitle', ['title' => 'Payment Type', 'orderBy' => 'paymentTypeTitle', 'defaultText' => '-'] ); $this->addColumn('options', 'options'); return $this; } public function addStatusColumn() { $statusOptions = (new Qs_Db_Table('EventAttendeeStatus'))->get4Select(); $formSelect = new Qs_View_Helper_FormSelect(); $formSelect->setView(Qs_View::getInstance()); $this->addColumn( 'html', 'statusTitle', [ 'title' => 'Attendance Status', 'orderBy' => 'eas.sorter', 'initCallback' => function (&$params) use ($statusOptions, $formSelect) { $params['value'] = $formSelect->formSelect( "status[{$params['id']}]", $params['value'], ['class' => self::STATUS_CLASS_NAME, 'data-id' => $params['id']], $statusOptions ); }, 'params' => ['value' => 'status', 'id' => 'id'] ] ); return $this; } protected function _getUserViewPattern() { if (($url = UserView::getPage('url'))) { return $url . '?action=view&id=%d'; } return null; } /** * @param mixed $eventId * @return $this */ public function setEventId($eventId) { $this->_eventId = $eventId; return $this; } /** * @return mixed */ public function getEventId() { return $this->_eventId; } public function toArray() { $item = parent::toArray(); foreach (['script', 'initObject'] as $name) { if (!array_key_exists($name, $item)) { $item[$name] = []; } } $options = [ 'eventId' => $this->getEventId(), 'statusElementsSelector' => '.' . self::STATUS_CLASS_NAME ]; $item['script'][] = ['js/app/event/attendee/admin/List.js']; $item['initObject'][] = ['app.event.attendee.admin.List', [$options]]; return $item; } }