Ejemplo n.º 1
0
 /**
  * Display the input
  *
  * @return string The HTML result of the input displaying
  */
 public function display()
 {
     $this->class .= " btn-danger input-delete ";
     $this->icon = "times";
     $this->type = "submit";
     return parent::display();
 }
Ejemplo n.º 2
0
 /**
  * Display the widget
  *
  * @return string The generated HTML
  */
 public function display()
 {
     $plugin = $this->plugin;
     $installer = $plugin->getInstallerInstance();
     $buttons = array(ButtonInput::create(array('icon' => 'share icon-flip-horizontal', 'class' => 'btn-default btn-block', 'href' => App::router()->getUri('manage-plugins'), 'label' => Lang::get('main.back-button'))));
     if (isset($updates[$plugin->getName()])) {
         $buttons[] = ButtonInput::create(array('icon' => 'refresh', 'class' => 'btn-info update-plugin btn-block', 'label' => Lang::get($this->_plugin . '.update-plugin-button'), 'href' => App::router()->getUri('update-plugin', array('plugin' => $plugin->getName()))));
     }
     if (!$plugin->isInstalled()) {
         // the plugin is not installed
         // Install button
         $buttons[] = ButtonInput::create(array('label' => Lang::get($this->_plugin . '.install-plugin-button'), 'icon' => 'upload', 'class' => 'install-plugin btn-block', 'href' => App::router()->getUri('install-plugin', array('plugin' => $plugin->getName()))));
         // Delete button
         $buttons[] = ButtonInput::create(array('label' => Lang::get($this->_plugin . '.delete-plugin-button'), 'icon' => 'trash', 'class' => 'btn-danger delete-plugin btn-block', 'href' => App::router()->getUri('delete-plugin', array('plugin' => $plugin->getName()))));
     } elseif (!$plugin->isActive()) {
         // The plugin is installed but not activated
         // Activate button
         $buttons[] = ButtonInput::create(array('label' => Lang::get($this->_plugin . '.activate-plugin-button'), 'class' => 'btn-success activate-plugin btn-block', 'icon' => 'check', 'href' => App::router()->getUri('activate-plugin', array('plugin' => $plugin->getName()))));
         // Settings button
         if (method_exists($installer, 'settings')) {
             $buttons[] = ButtonInput::create(array('icon' => 'cogs', 'label' => Lang::get($this->_plugin . '.plugin-settings-button'), 'href' => App::router()->getUri('plugin-settings', array('plugin' => $plugin->getName())), 'target' => 'dialog', 'class' => 'btn-info btn-block'));
         }
         // Uninstall button
         $buttons[] = ButtonInput::create(array('label' => Lang::get($this->_plugin . '.uninstall-plugin-button'), 'class' => 'btn-danger uninstall-plugin btn-block', 'icon' => 'chain-broken', 'href' => App::router()->getUri('uninstall-plugin', array('plugin' => $plugin->getName()))));
     } else {
         // The plugin is installed and active
         // Settings button
         if (method_exists($installer, 'settings')) {
             $buttons[] = ButtonInput::create(array('icon' => 'cogs', 'label' => Lang::get($this->_plugin . '.plugin-settings-button'), 'href' => App::router()->getUri('plugin-settings', array('plugin' => $plugin->getName())), 'target' => 'dialog', 'class' => 'btn-info btn-block'));
         }
         $buttons[] = ButtonInput::create(array('label' => Lang::get($this->_plugin . '.deactivate-plugin-button'), 'class' => 'btn-warning deactivate-plugin btn-block', 'icon' => 'ban', 'href' => App::router()->getUri('deactivate-plugin', array('plugin' => $plugin->getName()))));
     }
     return View::make($this->getPlugin()->getView('plugin-details-actions.tpl'), array('buttons' => $buttons));
 }
Ejemplo n.º 3
0
 /**
  * Display the list of available plugins on the file system
  */
 public function availablePlugins()
 {
     $plugins = Plugin::getAll(false, true);
     $api = new HawkApi();
     try {
         $updates = $api->getPluginsAvailableUpdates(array_map(function ($plugin) {
             return $plugin->getDefinition('version');
         }, $plugins));
     } catch (\Hawk\HawkApiException $e) {
         $updates = array();
     }
     $list = new ItemList(array('id' => 'available-plugins-list', 'reference' => 'name', 'action' => App::router()->getUri('plugins-list'), 'data' => $plugins, 'controls' => array(array('icon' => 'plus', 'class' => 'btn-success', 'label' => Lang::get($this->_plugin . '.new-plugin-btn'), 'href' => App::router()->getUri('create-plugin'), 'target' => 'dialog')), 'fields' => array('controls' => array('display' => function ($value, $field, $plugin) use($updates) {
         $buttons = array();
         $installer = $plugin->getInstallerInstance();
         if (!$plugin->isInstalled()) {
             // the plugin is not installed
             $buttons = array(ButtonInput::create(array('title' => Lang::get($this->_plugin . '.install-plugin-button'), 'icon' => 'upload', 'class' => 'install-plugin', 'href' => App::router()->getUri('install-plugin', array('plugin' => $plugin->getName())))), !$plugin->isMandatoryDependency() ? ButtonInput::create(array('title' => Lang::get($this->_plugin . '.delete-plugin-button'), 'icon' => 'trash', 'class' => 'btn-danger delete-plugin', 'href' => App::router()->getUri('delete-plugin', array('plugin' => $plugin->getName())))) : '');
             $status = Lang::get($this->_plugin . '.plugin-uninstalled-status');
         } else {
             if (!$plugin->isActive()) {
                 // The plugin is installed but not activated
                 $buttons = array(ButtonInput::create(array('title' => Lang::get($this->_plugin . '.activate-plugin-button'), 'class' => 'btn-success activate-plugin', 'icon' => 'check', 'href' => App::router()->getUri('activate-plugin', array('plugin' => $plugin->getName())))), method_exists($installer, 'settings') ? ButtonInput::create(array('icon' => 'cogs', 'title' => Lang::get($this->_plugin . '.plugin-settings-button'), 'href' => App::router()->getUri('plugin-settings', array('plugin' => $plugin->getName())), 'target' => 'dialog', 'class' => 'btn-info')) : '', !$plugin->isMandatoryDependency() ? ButtonInput::create(array('title' => Lang::get($this->_plugin . '.uninstall-plugin-button'), 'class' => 'btn-danger uninstall-plugin', 'icon' => 'chain-broken', 'href' => App::router()->getUri('uninstall-plugin', array('plugin' => $plugin->getName())))) : '');
                 $status = Lang::get($this->_plugin . '.plugin-inactive-status');
             } else {
                 // The plugin is installed and active
                 $buttons = array(method_exists($installer, 'settings') ? ButtonInput::create(array('icon' => 'cogs', 'title' => Lang::get($this->_plugin . '.plugin-settings-button'), 'href' => App::router()->getUri('plugin-settings', array('plugin' => $plugin->getName())), 'target' => 'dialog', 'class' => 'btn-info')) : '', ButtonInput::create(array('title' => Lang::get($this->_plugin . '.deactivate-plugin-button'), 'class' => 'btn-warning deactivate-plugin', 'icon' => 'ban', 'href' => App::router()->getUri('deactivate-plugin', array('plugin' => $plugin->getName())))));
                 $status = Lang::get($this->_plugin . '.plugin-active-status');
             }
         }
         if (isset($updates[$plugin->getName()])) {
             array_unshift($buttons, ButtonInput::create(array('icon' => 'refresh', 'class' => 'btn-info update-plugin', 'title' => Lang::get($this->_plugin . '.update-plugin-button'), 'href' => App::router()->getUri('update-plugin', array('plugin' => $plugin->getName())))));
         }
         return View::make(Plugin::current()->getView('plugin-list-controls.tpl'), array('plugin' => $plugin, 'status' => $status, 'buttons' => $buttons));
     }, 'label' => Lang::get($this->_plugin . '.plugins-list-controls-label'), 'search' => false, 'sort' => false), 'description' => array('search' => false, 'sort' => false, 'label' => Lang::get($this->_plugin . '.plugins-list-description-label'), 'display' => function ($value, $field, $plugin) {
         return View::make(Plugin::current()->getView("plugin-list-description.tpl"), $plugin->getDefinition());
     }))));
     return $list->display();
 }
Ejemplo n.º 4
0
 /**
  * Display the input
  *
  * @return string The HTML to display
  */
 public function display()
 {
     $this->class .= " btn-primary";
     return parent::display();
 }