diff --git a/PluginMarket.class.php b/PluginMarket.class.php index 22661579d15e858ad47e5cfc1ba3cdc4a6c35671..07d7ae2b4463245120afaa610fccd45ed5842e89 100644 --- a/PluginMarket.class.php +++ b/PluginMarket.class.php @@ -17,7 +17,12 @@ class PluginMarket extends StudIPPlugin implements SystemPlugin, HomepagePlugin parent::__construct(); $top = new Navigation($this->getDisplayTitle(), PluginEngine::getURL($this, array(), "presenting/overview")); $top->setImage($this->getPluginURL()."/assets/topicon.svg"); - $top->addSubNavigation("presenting", new Navigation($this->getDisplayTitle(), PluginEngine::getURL($this, array(), "presenting/overview"))); + + $overview = new Navigation($this->getDisplayTitle(), PluginEngine::getURL($this, array(), "presenting/overview")); + $top->addSubNavigation("presenting", $overview); + $overview->addSubNavigation("overview", new AutoNavigation(_('�bersicht'), PluginEngine::getURL($this, array(), "presenting/overview"))); + $overview->addSubNavigation("all", new AutoNavigation(_('Alle Plugins'), PluginEngine::getURL($this, array(), "presenting/all"))); + if ($GLOBALS['perm']->have_perm("autor")) { $top->addSubNavigation("myplugins", new Navigation(_("Meine Plugins"), PluginEngine::getURL($this, array(), "myplugins/overview"))); } @@ -42,6 +47,11 @@ class PluginMarket extends StudIPPlugin implements SystemPlugin, HomepagePlugin NotificationCenter::addObserver($this, "triggerFollowingStudips", "PluginReleaseDidUpdateCode"); } + + public function initialize() { + $sidebar = Sidebar::Get(); + $sidebar->setImage('../../'.$this->getPluginPath().'/assets/sidebar-marketplace.png'); + } public function getDisplayTitle() { diff --git a/assets/sidebar-marketplace.png b/assets/sidebar-marketplace.png new file mode 100644 index 0000000000000000000000000000000000000000..3fdc2042fd3b921e02a2245fb75a55f8e8d4727d Binary files /dev/null and b/assets/sidebar-marketplace.png differ diff --git a/controllers/presenting.php b/controllers/presenting.php index 7b113e34010cb285b77ab9741e242f5f9341c3ca..83e43d80863801f174af1ce14bee2000ad0152ac 100644 --- a/controllers/presenting.php +++ b/controllers/presenting.php @@ -17,16 +17,8 @@ class PresentingController extends PluginController { $config->store("last_pluginmarket_visit", $_SESSION['last_pluginmarket_visit']); } PageLayout::addStylesheet($this->plugin->getPluginURL()."/assets/pluginmarket.css"); - } - - public function overview_action() { - if ($GLOBALS['perm']->have_perm("user")) { - if ($this->last_pluginmarket_visit !== time()) { - $this->new_plugins = MarketPlugin::findBySql("publiclyvisible = 1 AND approved = 1 AND published > ? ORDER BY mkdate DESC", array($this->last_pluginmarket_visit)); - } - } - - $statement = DBManager::get()->prepare(" + + $statement = DBManager::get()->prepare(" SELECT pluginmarket_tags.tag, COUNT(*) AS number FROM pluginmarket_tags INNER JOIN pluginmarket_plugins ON (pluginmarket_plugins.plugin_id = pluginmarket_tags.plugin_id) @@ -40,6 +32,32 @@ class PresentingController extends PluginController { $statement->execute(); $this->tags = $statement->fetchAll(PDO::FETCH_ASSOC); + + // Sidebar + $sidebar = Sidebar::Get(); + + // Create search widget + $searchWidget = new SearchWidget($this->url_for('pluginmarket/presenting/all')); + $searchWidget->addNeedle(_('Suche'), 'search', true); + $sidebar->addWidget($searchWidget); + + // Create cloud + $tagWidget = new LinkCloudWidget(); + $tagWidget->setTitle(_("Beliebte Tags")); + foreach ($this->tags as $tag) { + $tagWidget->addLink($tag['tag'], $this->url_for('pluginmarket/presenting/all', array('tag' => $tag['tag'])), $tag['number']); + } + $sidebar->addWidget($tagWidget); + + } + + public function overview_action() { + if ($GLOBALS['perm']->have_perm("user")) { + if ($this->last_pluginmarket_visit !== time()) { + $this->new_plugins = MarketPlugin::findBySql("publiclyvisible = 1 AND approved = 1 AND published > ? ORDER BY mkdate DESC", array($this->last_pluginmarket_visit)); + } + } + $this->plugins = MarketPlugin::findBySQL("publiclyvisible = 1 AND approved = 1 ORDER BY RAND() LIMIT 6"); } @@ -83,6 +101,7 @@ class PresentingController extends PluginController { } public function details_action($plugin_id) { + Navigation::addItem('/pluginmarket/presenting/details', new AutoNavigation(_('Details'), $this->url_for('pluginmarket/presenting/details/'.$plugin_id))); $this->marketplugin = new MarketPlugin($plugin_id); if (Request::isPost() && Request::submitted("delete_plugin") && $this->marketplugin->isRootable()) { $this->marketplugin->delete(); diff --git a/views/presenting/all.php b/views/presenting/all.php index 0fb2e6355545164741d4a2d208363eb200552c76..3823cb3d4b36b15e0d0aaa8721d5e8907018cc63 100644 --- a/views/presenting/all.php +++ b/views/presenting/all.php @@ -1,19 +1,3 @@ -<? if (!Request::get("tag")) : ?> - <div style="text-align: center;"> - <div> - <form action="<?= PluginEngine::getLink($plugin, array(), "presenting/all") ?>" method="get"> - <input - type="text" - name="search" - placeholder="<?= _("Suche") ?>" - value="<?= htmlReady(Request::get("search")) ?>" - style="padding: 4px; width: 300px; border: 1px solid #7e92b0; line-height: 24px; vertical-align: text-bottom;"><button - style="background-color: #7e92b0; height: 34px; border: 1px solid #7e92b0; vertical-align: text-bottom;"><?= Assets::img("icons/20/white/search", array('class' => "text-bottom")) ?></button> - </form> - </div> - </div> -<? endif ?> - <div class="plugins_shortview"> <? foreach ($plugins as $marketplugin) : ?> <?= $this->render_partial("presenting/_plugin_short.php", compact("marketplugin", "plugin")) ?> diff --git a/views/presenting/overview.php b/views/presenting/overview.php index 1968d3f29163f895cacc40c8c08791162a52b17e..fdf7cbcef71d89c983ff7108bae2820c841df81c 100644 --- a/views/presenting/overview.php +++ b/views/presenting/overview.php @@ -8,72 +8,8 @@ </div> <? endif ?> -<div style="text-align: center; margin-bottom: 30px;"> - <div> - <form action="<?= PluginEngine::getLink($plugin, array(), "presenting/all") ?>" method="get"> - <input - type="text" - name="search" - placeholder="<?= _("Suche") ?>" - value="<?= htmlReady(Request::get("search")) ?>" - style="padding: 4px; width: 300px; border: 1px solid #7e92b0; line-height: 24px; vertical-align: text-bottom;"><button - style="background-color: #7e92b0; height: 34px; border: 1px solid #7e92b0; vertical-align: text-bottom;"><?= Assets::img("icons/20/white/search", array('class' => "text-bottom")) ?></button> - </form> - </div> -</div> - <div class="plugins_shortview"> <? foreach ($plugins as $marketplugin) : ?> <?= $this->render_partial("presenting/_plugin_short.php", compact("marketplugin", "plugin")) ?> <? endforeach ?> </div> - -<? if (count($tags)) : ?> - <h2><?= _("Beliebte Tags") ?></h2> - <table style="text-align: center; margin-left: auto; margin-right: auto;" id="tagcloud"> - <tbody> - <? $max = $tags[0]['number'] ?> - <tr> - <td><?= $this->render_partial("presenting/_cloud_tag.php", array('tag' => $tags[22], 'max' => $max)) ?></td> - <td><?= $this->render_partial("presenting/_cloud_tag.php", array('tag' => $tags[15], 'max' => $max)) ?></td> - <td><?= $this->render_partial("presenting/_cloud_tag.php", array('tag' => $tags[6], 'max' => $max)) ?></td> - <td><?= $this->render_partial("presenting/_cloud_tag.php", array('tag' => $tags[14], 'max' => $max)) ?></td> - <td><?= $this->render_partial("presenting/_cloud_tag.php", array('tag' => $tags[21], 'max' => $max)) ?></td> - </tr> - <tr> - <td><?= $this->render_partial("presenting/_cloud_tag.php", array('tag' => $tags[16], 'max' => $max)) ?></td> - <td><?= $this->render_partial("presenting/_cloud_tag.php", array('tag' => $tags[7], 'max' => $max)) ?></td> - <td><?= $this->render_partial("presenting/_cloud_tag.php", array('tag' => $tags[1], 'max' => $max)) ?></td> - <td><?= $this->render_partial("presenting/_cloud_tag.php", array('tag' => $tags[5], 'max' => $max)) ?></td> - <td><?= $this->render_partial("presenting/_cloud_tag.php", array('tag' => $tags[13], 'max' => $max)) ?></td> - </tr> - <tr> - <td><?= $this->render_partial("presenting/_cloud_tag.php", array('tag' => $tags[8], 'max' => $max)) ?></td> - <td><?= $this->render_partial("presenting/_cloud_tag.php", array('tag' => $tags[2], 'max' => $max)) ?></td> - <td><?= $this->render_partial("presenting/_cloud_tag.php", array('tag' => $tags[0], 'max' => $max)) ?></td> - <td><?= $this->render_partial("presenting/_cloud_tag.php", array('tag' => $tags[4], 'max' => $max)) ?></td> - <td><?= $this->render_partial("presenting/_cloud_tag.php", array('tag' => $tags[12], 'max' => $max)) ?></td> - </tr> - <tr> - <td><?= $this->render_partial("presenting/_cloud_tag.php", array('tag' => $tags[17], 'max' => $max)) ?></td> - <td><?= $this->render_partial("presenting/_cloud_tag.php", array('tag' => $tags[9], 'max' => $max)) ?></td> - <td><?= $this->render_partial("presenting/_cloud_tag.php", array('tag' => $tags[3], 'max' => $max)) ?></td> - <td><?= $this->render_partial("presenting/_cloud_tag.php", array('tag' => $tags[11], 'max' => $max)) ?></td> - <td><?= $this->render_partial("presenting/_cloud_tag.php", array('tag' => $tags[20], 'max' => $max)) ?></td> - </tr> - <tr> - <td><?= $this->render_partial("presenting/_cloud_tag.php", array('tag' => $tags[23], 'max' => $max)) ?></td> - <td><?= $this->render_partial("presenting/_cloud_tag.php", array('tag' => $tags[18], 'max' => $max)) ?></td> - <td><?= $this->render_partial("presenting/_cloud_tag.php", array('tag' => $tags[10], 'max' => $max)) ?></td> - <td><?= $this->render_partial("presenting/_cloud_tag.php", array('tag' => $tags[19], 'max' => $max)) ?></td> - <td><?= $this->render_partial("presenting/_cloud_tag.php", array('tag' => $tags[24], 'max' => $max)) ?></td> - </tr> - </tbody> - </table> -<? endif ?> - - -<h2><?= _("Noch mehr Plugins?") ?></h2> -<div style="text-align: center;"> - <?= \Studip\LinkButton::create(_("Alle Plugins anzeigen ..."), PluginEngine::getLink($plugin, array(), "presenting/all"))?> -</div> \ No newline at end of file