/** * @param ActionElement $element * @param array $elementInformation * @return bool */ protected function shouldRenderToolBarElement($element, $elementInformation) { assert('$element instanceof ActionElement'); assert('is_array($elementInformation)'); if (!parent::shouldRenderToolBarElement($element, $elementInformation)) { return false; } $actionType = $element->getActionType(); if ($actionType == null) { return true; } $actionSecurity = ActionSecurityFactory::createActionSecurityFromActionType($actionType, $this->makeModel(), Yii::app()->user->userModel); return $actionSecurity->canUserPerformAction(); }
/** * Override to check for for MassEdit link. This link should only be rendered if there are selectable rows. * @return boolean */ protected function shouldRenderToolBarElement($element, $elementInformation) { assert('$element instanceof ActionElement'); assert('is_array($elementInformation)'); if (!parent::shouldRenderToolBarElement($element, $elementInformation)) { return false; } if ($this->activeActionElementType == ListViewTypesToggleLinkActionElement::TYPE_KANBAN_BOARD && ($elementInformation['type'] == 'MassEditMenu' || $elementInformation['type'] == 'MassDeleteMenu' || $elementInformation['type'] == 'ExportMenu')) { return false; } if ($elementInformation['type'] == 'MassEditMenu' && !$this->listViewRowsAreSelectable) { return false; } return true; }