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

Merge pull request #61 from derfl0/master

#20 let multiple plugin usages be reported

Besten Dank!
parents 91ebf8d9 8622d6a7
No related branches found
No related tags found
No related merge requests found
......@@ -27,6 +27,26 @@ class UpdateController extends MarketController
$this->render_text("Insecure request.");
}
}
public function usage_action() {
$this->plugins = MarketPlugin::findManyByName(Request::getArray('plugins'));
$this->mostlikely = MarketPluginUsage::findOneBySQL('user_id = ? GROUP BY name ORDER BY count(*) DESC', array(User::findCurrent()->id))->name;
}
public function save_usage_action() {
// delete old usage
MarketPluginUsage::deleteBySQL('user_id = ? AND name = ?', array(User::findCurrent()->id, Request::get('tag')));
// create new usages
foreach (Request::getArray('plugins') as $pluginid) {
MarketPluginUsage::create(array(
'plugin_id' => $pluginid,
'user_id' => User::findCurrent()->id,
'name' => Request::get('tag')
));
$this->done++;
}
}
protected function verify_secret($secret)
{
......
<p>
<?= sprintf(_('%s Benutzungen eingetragen'), $done) ?>
</p>
\ No newline at end of file
<form class="studip_form" method="post" action="<?= PluginEngine::getLink($plugin, array(), 'update/save_usage/') ?>">
<fieldset>
<legend>
<?= _('Pluginnutzung') ?>
</legend>
<fieldset>
<legend>
<?= _('Plugins') ?>
</legend>
<? foreach ($plugins as $plugin): ?>
<label>
<input type="checkbox" name="plugins[]" value="<?= $plugin->id ?>" checked>
<?= htmlReady($plugin->name); ?>
</label>
<? endforeach; ?>
</fieldset>
<label>
<?= _('In Benutzung bei') ?>
<input type="text" name="tag" value="<?= htmlReady($mostlikely) ?>">
</label>
<?= Studip\Button::create(_('Eintragen')) ?>
</fieldset>
</form>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment