Exemple #1
0
	/**
     * Initializes the default configuration for the object
     *
     * Called from {@link __construct()} as a first step of object instantiation.
     *
     * @param 	object 	An optional KConfig object with configuration options.
     * @return void
     */
    protected function _initialize(KConfig $config)
    {
    	$config->append(array(
    		'menubar' => 'menubar',
    	    'render'  => array('toolbar', 'menubar', 'title')
        ));
 
        parent::_initialize($config);
    }
 protected function _beforeGet(KCommandContext $context)
 {
     parent::_beforeGet($context);
     if ($context->caller->getIdentifier()->name === 'submit') {
         // Load the language strings for toolbar button labels
         JFactory::getLanguage()->load('joomla', JPATH_ADMINISTRATOR);
         $this->getView()->setToolbar($this->getToolbar());
         $this->getToolbar()->addCommand('save', array('label' => 'Upload', 'icon' => 'icon-32-upload'))->addCommand('cancel', array('attribs' => array('data-novalidate' => 'novalidate')));
     }
 }
    protected function _beforeGet(KCommandContext $context)
    {
        parent::_beforeGet($context);

        if ($context->caller->getIdentifier()->name === 'submit'
            || ($context->caller->getIdentifier()->name === 'document' && $context->caller->getRequest()->layout === 'form'))
        {
            // Load the language strings for toolbar button labels
            JFactory::getLanguage()->load('joomla', JPATH_ADMINISTRATOR);

            $this->getView()->setToolbar($this->getToolbar());
        }

        // Only display add document button if the user has access to add documents
        if ($context->caller->getIdentifier()->name === 'list') {
            $params = JFactory::getApplication()->getMenu()->getActive()->params;
            if ($params->get('show_add_document_button')) {
                $params->set('show_add_document_button', $this->canAdd());
            }
        }
    }