Skip to content
Snippets Groups Projects
Commit 8ac1ef0f authored by Rasmus Fuhse's avatar Rasmus Fuhse
Browse files

Merge pull request #3 from derfl0/master

Sidebar added
parents f8cc3d77 9b10a363
No related branches found
No related tags found
No related merge requests found
......@@ -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")));
}
......@@ -43,6 +48,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()
{
return _("PluginMarktplatz");
......
assets/sidebar-marketplace.png

32.5 KiB

......@@ -17,14 +17,6 @@ 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("
SELECT pluginmarket_tags.tag, COUNT(*) AS number
......@@ -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();
......
<? 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")) ?>
......
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment