Пример #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');
     }
 }
Пример #2
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');
 }
Пример #3
0
 /**
  * Delete Command for an entity.
  *
  * @param LibBaseTemplateObject $command The action object
  */
 protected function _commandDelete($command)
 {
     $entity = $this->getController()->getItem();
     $command->append(array('label' => JText::_('LIB-AN-ACTION-DELETE')))->href(JRoute::_($entity->getURL()))->setAttribute('data-action', 'delete')->setAttribute('data-redirect', JRoute::_('index.php?option=com_locations&view=locations'))->class('action-delete');
 }
Пример #4
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');
 }
Пример #5
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');
 }
Пример #6
0
 /**
  * Add Followers button toolbar.
  *
  * @param LibBaseTemplateObject $command The action object
  */
 protected function _commandAddFollowers($command)
 {
     $actor = $command->actor;
     $labels = array();
     $labels[] = strtoupper('com-' . $this->getIdentifier()->package . '-socialgraph-toolbar-followers-add');
     $labels[] = 'COM-ACTORS-SOCIALGRAPH-TOOLBAR-FOLLOWERS-ADD';
     $label = translate($labels);
     $url = $actor->getURL() . '&get=graph&type=leadables';
     $command->append(array('label' => $label))->href($url)->id('leadables-add');
 }
Пример #7
0
 /**
  * Delete Command for a story
  *
  * @param LibBaseTemplateObject $command The command object
  *
  * @return void
  */
 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');
 }
Пример #8
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));
 }
Пример #9
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');
 }
Пример #10
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');
 }