public static function getGlobalButtons() { $user = sfContext::getInstance()->getUser(); if ($user->hasCredential('blog_author') || $user->hasCredential('blog_admin')) { aTools::addGlobalButtons(array(new aGlobalButton('blog', 'Blog', '@a_blog_admin', 'a-blog-btn'), new aGlobalButton('events', 'Events', '@a_event_admin', 'a-events day-' . date('j')))); } }
/** * You too can do this in a plugin dependent on a, see the provided stylesheet * for how to correctly specify an icon to go with your button. See the * apostrophePluginConfiguration class for the registration of the event listener. */ public static function getGlobalButtons() { // Only if we have suitable credentials if (aMediaTools::userHasUploadPrivilege()) { aTools::addGlobalButtons(array(new aGlobalButton('media', 'Media', 'aMedia/index', 'a-media', '/admin/media', 'aMedia'))); } }
public static function getGlobalButtons() { $user = sfContext::getInstance()->getUser(); if ($user->hasCredential('admin')) { aTools::addGlobalButtons(array(new aGlobalButton('polls', 'Polls', '@a_poll_poll_admin', 'a-poll'))); } }
public static function getGlobalButtons() { $mediaEnginePage = aPageTable::retrieveBySlug('/admin/media'); // Only if we have suitable credentials $user = sfContext::getInstance()->getUser(); if ($user->hasCredential('media_admin') || $user->hasCredential('media_upload')) { aTools::addGlobalButtons(array(new aGlobalButton('media', 'Media', 'aMedia/index', 'a-media', $mediaEnginePage))); } }
public static function getGlobalButtonsInternal(sfEvent $event) { // If we needed a context object we could get it from $event->getSubject(), // but this is a simple static thing // Add the users button only if the user has the admin credential. // This is typically only given to admins and superadmins. // TODO: there is also the cms_admin credential, should I differentiate here? $user = sfContext::getInstance()->getUser(); if ($user->hasCredential('admin')) { $extraAdminButtons = sfConfig::get('app_a_extra_admin_buttons', array('users' => array('label' => 'Users', 'action' => 'aUserAdmin/index', 'class' => 'a-users'), 'reorganize' => array('label' => 'Reorganize', 'action' => 'a/reorganize', 'class' => 'a-reorganize'))); // Eventually this one too. Reorganize will probably get moved into it // ('Settings', 'a/globalSettings', 'a-settings') if (is_array($extraAdminButtons)) { foreach ($extraAdminButtons as $name => $data) { aTools::addGlobalButtons(array(new aGlobalButton($name, $data['label'], $data['action'], isset($data['class']) ? $data['class'] : ''))); } } } }
/** * DOCUMENT ME * @param sfEvent $event */ public static function getGlobalButtonsInternal(sfEvent $event) { // If we needed a context object we could get it from $event->getSubject(), // but this is a simple static thing // Add the users button only if the user has the admin credential. // This is typically only given to admins and superadmins. $user = sfContext::getInstance()->getUser(); if ($user->hasCredential('admin')) { $extraAdminButtons = sfConfig::get('app_a_extra_admin_buttons', array('users' => array('label' => 'Users', 'action' => 'aUserAdmin/index', 'class' => 'a-users'), 'categories' => array('label' => 'Categories', 'action' => 'aCategoryAdmin/index', 'class' => 'a-categories'), 'tags' => array('label' => 'Tags', 'action' => 'aTagAdmin/index', 'class' => 'a-tags'), 'reorganize' => array('label' => 'Reorganize', 'action' => 'a/reorganize', 'class' => 'a-reorganize'))); if (is_array($extraAdminButtons)) { foreach ($extraAdminButtons as $name => $data) { aTools::addGlobalButtons(array(new aGlobalButton($name, $data['label'], $data['action'], isset($data['class']) ? $data['class'] : ''))); } } } }