addColumn('no', 'no'); $this->addColumn('date', 'added', array('title' => 'Date Added', 'orderBy' => 'User.added')); $this->addColumn('text', 'fullName', array('title' => 'Full Name', 'orderBy' => 'lastName')); $mode = $this->getConfig('mode'); if (Module::MODE_SIMPLE == $mode) { $this->addColumn('email', 'email', array('orderBy' => 'email')); $this->addColumn('text', 'workPhone', array('title' => 'Phone', 'orderBy' => 'workPhone')); } else if (Module::MODE_ASSOCIATION == $mode) { $this->addColumn( 'text', 'companyName', array( 'title' => 'Institution/Employer', 'orderBy' => 'companyName', 'defaultText' => '-' ) ); } else { throw new Qs_Exception('Unknown module mode.'); } $this->addColumn('status', 'status', array('orderBy' => 'status', 'values' => $this->_getStatuses())); $this->_addOptionsColumn(); return $this; } protected function _addOptionsColumn() { $options = array(); $itemName = $this->getConfig('itemName'); if (Module::MODE_ASSOCIATION == $this->getConfig('mode')) { $options['actions']['edit'] = [ 'title' => 'Edit ' . $itemName, 'linkTitle' => 'Edit this ' . $itemName, 'separator' => '
' ]; if (($url = Qs_SiteMap::find(null, ['type' => 'ECommerce_Order_Admin_'], null, 'url'))) { $options['actions']['viewPurchases'] = [ 'title' => 'View/Edit Purchases', 'linkTitle' => 'View/Edit Purchases of this ' . $itemName, 'formattedLink' => $url . '?userId=%d', 'separator' => '
', ]; } if (($url = Qs_SiteMap::find(null, ['type' => 'Event\\History\\Admin\\'], null, 'url'))) { $options['actions']['eventHistory'] = [ 'title' => 'View/Edit Event History', 'linkTitle' => 'View/Edit Event History of this ' . $itemName, 'formattedLink' => $url . '?userId=%d', 'separator' => '
', ]; } if (($url = Qs_SiteMap::find(null, ['type' => 'Event\\Attendee\\Admin\\'], null, 'url'))) { $options['actions']['selectEvent'] = [ 'title' => 'Add to Event', 'linkTitle' => 'Add this ' . $itemName . ' to Event', 'formattedLink' => $url . '?action=selectEvent&userId=%d', 'separator' => '
', ]; } $options['actions']['delete'] = [ 'title' => 'Delete ' . $itemName, 'linkTitle' => 'Delete this ' . $itemName, 'separator' => '
' ]; } else { $options['actions'] = array( 'edit' => array(), 'delete' => array(), ); } if (Qs_Config::getByClass('Qs_ViewController_Log')->enabled && ($logBaseUrl = Qs_SiteMap::findFirst(null, array('type' => 'ViewControllerLog_Admin_'), null, 'url')) ) { $options['actions']['viewLog'] = array( 'formattedLink' => $logBaseUrl . '/user?roleId=%d', 'linkTitle' => "View Log of this " . $itemName ); } $this->addColumn('options', 'options', $options); return $this; } protected function _getStatuses() { return (new Qs_Db_Table('UserStatus'))->get4Select(); } }