Esempio n. 1
0
 /**
  * Edit Command for an entity
  *
  * @param LibBaseTemplateObject $command The action object
  *
  * @return void
  */
 protected function _commandEdit($command)
 {
     $entity = $this->getController()->getItem();
     $view = $this->getController()->getView()->getName();
     $layout = pick($command->layout, 'edit');
     $command->append(array('label' => JText::_('LIB-AN-ACTION-EDIT')))->href($entity->getURL() . '&layout=' . $layout);
     if (KInflector::isPlural($view)) {
         $command->setAttribute('data-action', 'edit');
     }
 }
Esempio n. 2
0
 /**
  * Delete Command for a story.
  *
  * @param LibBaseTemplateObject $command The command object
  */
 protected function _commandDelete($command)
 {
     $entity = $this->getController()->getItem();
     $link = 'option=com_stories&view=story';
     foreach ($entity->getIds() as $id) {
         $link .= '&id[]=' . $id;
     }
     $command->append(array('label' => JText::_('LIB-AN-ACTION-DELETE')))->href(JRoute::_($link))->setAttribute('data-action', 'delete')->class('action-delete');
 }
Esempio n. 3
0
 /**
  * New button toolbar.
  *
  * @param LibBaseTemplateObject $command The action object
  */
 protected function _commandNew($command)
 {
     $actor = $this->getController()->actor;
     $name = $this->getController()->getIdentifier()->name;
     $labels = array();
     $labels[] = strtoupper('com-' . $this->getIdentifier()->package . '-toolbar-' . $name . '-new');
     $labels[] = 'New';
     $label = translate($labels);
     $url = 'option=com_' . $this->getIdentifier()->package . '&view=' . $name . '&oid=' . $actor->id . '&layout=add';
     $command->append(array('label' => $label))->href(JRoute::_($url));
 }
Esempio n. 4
0
 /**
  * Calls on of the method above.
  *
  * {@inheritdoc}
  */
 public function __call($method, $arguments)
 {
     if (count($arguments) && in_array(strtolower($method), array('method', 'data', 'href', 'label'))) {
         $this->{'set' . ucfirst($method)}($arguments[0]);
     } else {
         parent::__call($method, $arguments);
     }
     return $this;
 }
Esempio n. 5
0
<?php

defined('KOOWA') or die('Restricted access');
?>

<div class="row">
	<div class="span8">
	<?php 
echo @template('form');
?>
	</div>
	
	<?php 
if ($actor->authorize('administration')) {
    ?>
	<div class="span4">
	<?php 
    echo @helper('ui.gadget', LibBaseTemplateObject::getInstance('revisions', array('title' => @text('COM-ARTICLES-ARTICLE-REVISIONS'), 'url' => 'view=revisions&layout=gadget&pid=' . $article->id . '&oid=' . $actor->id)));
    ?>
	</div>
	<?php 
}
?>
</div>
Esempio n. 6
0
 /**
  * Delete a location from a locatable entity
  *
  * @param LibBaseTemplateObject $command The action object
  */
 protected function _commandDeleteLocation($command)
 {
     $location = $this->getController()->getItem();
     $locatable = $command->locatable;
     $command->setAttribute('data-action', 'deleteLocation')->setAttribute('data-location', $location->id)->href($locatable->getURL());
     $command->label = translate('LIB-AN-ACTION-DELETE');
 }
Esempio n. 7
0
 /**
  * Enable/Disable action
  *
  * @param LibBaseTemplateObject $command The action object
  *
  * @return void
  */
 protected function _commandEnable($command)
 {
     $entity = $this->getController()->getItem();
     $label = JText::_('LIB-AN-ACTION-' . strtoupper($entity->enabled ? 'disable' : 'enable'));
     $command->append(array('label' => $label))->href($entity->getURL() . '&action=' . ($entity->enabled ? 'disable' : 'enable'))->setAttribute('data-trigger', 'Submit');
 }
Esempio n. 8
0
 /**
  * New button toolbar
  *
  * @param LibBaseTemplateObject $command The action object
  *
  * @return void
  */
 protected function _commandNew($command)
 {
     $command->append(array('label' => JText::_('COM-TODOS-TOOLBAR-TODO-NEW')))->href('#')->setAttribute('data-trigger', 'ReadForm');
 }
Esempio n. 9
0
 /**
  * Restore command
  *
  * @param LibBaseTemplateObject $command Command object
  *
  * @return void
  */
 protected function _commandRestore($command)
 {
     $entity = $this->getController()->getItem();
     $command->append(array('label' => JText::_('COM-PAGES-PAGE-REVISION-RESTORE')));
     $command->href('option=com_pages&view=revision&action=restore&id=' . $entity->id)->setAttribute('data-trigger', 'Submit');
 }
Esempio n. 10
0
 /**
  * Method to build a command.
  *
  * @param LibBaseTemplateObject $command The action object
  */
 protected function _buildCommand($command)
 {
     $url = $command->receiver->getURL();
     $command->setAttribute('data-action', $command->action);
     $command->setAttribute('data-actor', $command->actor->id);
     if (!$this->_use_post && $this->getController()->getRequest()->getFormat() != 'json') {
         $url .= '&layout=list';
     }
     $command->href($url);
 }
Esempio n. 11
0
 /**
  * Set a value by key
  *
  * @param   string  The key name.
  * @param   mixed   The value for the key
  * 
  * @return  void
  * @throws KConfigException if the $name is empty
  */
 public function offsetSet($name, $object)
 {
     if (!$object instanceof LibBaseTemplateObjectInterface) {
         if (empty($name)) {
             throw new KConfigException('Template object name must be unique and non empty');
         }
         $object = LibBaseTemplateObject::getInstance($name, $object);
     }
     $this->_objects[$object->getName()] = $object;
     return $object;
 }
Esempio n. 12
0
 /**
  * New button toolbar.
  *
  * @param LibBaseTemplateObject $command The action object
  */
 protected function _commandNew($command)
 {
     $name = $this->getController()->getIdentifier()->name;
     $command->append(array('label' => JText::_('COM-UBSCRIPTIONS-TOOLBAR-' . $name . '-NEW')))->href('#')->setAttribute('data-trigger', 'ReadForm');
 }
Esempio n. 13
0
 /**
  * Customize the sticky command.
  *
  * @param LibBaseTemplateObject $command Command Object
  */
 protected function _commandPin($command)
 {
     $entity = $this->getController()->getItem();
     $label = $entity->pinned ? JTEXT::_('LIB-AN-ACTION-UNPIN') : JTEXT::_('LIB-AN-ACTION-PIN');
     $command->append(array('label' => $label))->href($entity->getURL() . '&action=' . ($entity->pinned ? 'unpin' : 'pin'))->setAttribute('data-trigger', 'PostLink');
 }