addColumn('no', 'no'); $this->addColumn('date', 'added', ['title' => 'Date Added', 'orderBy' => 'User.added']); $this->addColumn('name', 'name', ['title' => 'Name', 'orderBy' => 'lastName']); $this->addColumn('text', 'jobTitle', ['title' => 'Job Title', 'orderBy' => 'jobTitle']); $this->addColumn('text', 'companyName', ['title' => 'Company', 'orderBy' => 'companyName', 'defaultText' => '-']); $this->addColumn('text', 'companyType', ['title' => 'Company Type', 'orderBy' => 'companyType', 'defaultText' => '-']); $this->addColumn('status', 'status', ['orderBy' => 'status', 'values' => $this->_getStatuses()]); $this->_addOptionsColumn(); return $this; } protected function _addOptionsColumn() { $options = array(); $itemName = $this->getConfig('itemName'); $options['actions']['view'] = [ 'title' => 'View ' . $itemName, 'linkTitle' => 'View this ' . $itemName, 'separator' => '
' ]; $options['actions']['edit'] = [ 'title' => 'Edit ' . $itemName, 'linkTitle' => 'Edit this ' . $itemName, 'separator' => '
' ]; $viewActionTitle = $this->isActionAllowed('edit') ? 'View/Edit' : 'View'; if (($url = Qs_SiteMap::find(null, ['type' => 'ECommerce_Order_Admin_'], null, 'url'))) { $options['actions']['viewPurchases'] = [ 'title' => $viewActionTitle . ' Purchases', 'linkTitle' => $viewActionTitle . ' 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' => $viewActionTitle . ' Event History', 'linkTitle' => $viewActionTitle . ' Event History of this ' . $itemName, 'formattedLink' => $url . '?userId=%d', 'separator' => '
', ]; } if (($url = Qs_SiteMap::find(null, ['type' => 'Classified\\Admin\\'], null, 'url'))) { $options['actions']['viewListings'] = [ 'title' => $viewActionTitle . ' Listings', 'linkTitle' => $viewActionTitle . ' Listings of this ' . $itemName, 'formattedLink' => $url . '?submitterUserId=%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' => '
' ]; 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 ); } if (!$this->getDoc()->getAcl()->isAllowed('individuals', Acl::PRIVILEGE_WRITE)) { $options['actions'] = \Qs_Array::excludeKey($options['actions'], [ 'edit', 'delete', 'viewListings', 'selectEvent' ]); } $this->addColumn('options', 'options', $options); return $this; } protected function _getStatuses() { return (new Qs_Db_Table('UserStatus'))->get4Select(); } }