/** * 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'); } }
/** * 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'); }
/** * 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)); }
/** * 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; }
<?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>
/** * 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'); }
/** * 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'); }
/** * 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'); }
/** * 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'); }
/** * 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); }
/** * 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; }
/** * 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'); }
/** * 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'); }