Skip to content
Snippets Groups Projects
Commit 96cc878d authored by Elmar Ludwig's avatar Elmar Ludwig Committed by David Siegfried
Browse files

add option ACTION_MENU_THRESHOLD, re #1033

Merge request studip/studip!600
parent c8da4884
No related branches found
No related tags found
No related merge requests found
<?php
class AddActionMenuThreshold extends Migration
{
public function description()
{
return 'add option for when to render action menu as separate icons';
}
public function up()
{
$query = 'INSERT INTO `config` (`field`, `value`, `type`, `section`, `mkdate`, `chdate`, `description`)
VALUES (:name, :value, :type, :section, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), :description)';
$statement = DBManager::get()->prepare($query);
$statement->execute([
'name' => 'ACTION_MENU_THRESHOLD',
'description' => 'Obergrenze an Einträgen, bis zu der ein Aktionsmenü als Icons dargestellt wird',
'section' => 'global',
'type' => 'integer',
'value' => '1'
]);
}
public function down()
{
$query = "DELETE `config`, `config_values`
FROM `config` LEFT JOIN `config_values` USING (`field`)
WHERE `field` = 'ACTION_MENU_THRESHOLD'";
DBManager::get()->exec($query);
}
}
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
*/ */
class ActionMenu class ActionMenu
{ {
const THRESHOLD = 1;
const TEMPLATE_FILE_SINGLE = 'shared/action-menu-single.php'; const TEMPLATE_FILE_SINGLE = 'shared/action-menu-single.php';
const TEMPLATE_FILE_MULTIPLE = 'shared/action-menu.php'; const TEMPLATE_FILE_MULTIPLE = 'shared/action-menu.php';
...@@ -242,7 +241,7 @@ class ActionMenu ...@@ -242,7 +241,7 @@ class ActionMenu
return ''; return '';
} }
$template_file = count($this->actions) <= self::THRESHOLD $template_file = count($this->actions) <= Config::get()->ACTION_MENU_THRESHOLD
? self::TEMPLATE_FILE_SINGLE ? self::TEMPLATE_FILE_SINGLE
: self::TEMPLATE_FILE_MULTIPLE; : self::TEMPLATE_FILE_MULTIPLE;
......
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