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

remove unused code, fixes #564

Closes #564

Merge request studip/studip!1244
parent 198c0781
No related branches found
No related tags found
No related merge requests found
......@@ -10,11 +10,6 @@ class ContentGroupMenu
{
const THRESHOLD = 1;
const TEMPLATE_FILE_SINGLE = 'shared/action-menu-single.php';
const TEMPLATE_FILE_MULTIPLE = 'shared/action-menu.php';
const TEMPLATE_FILE_ROWS = 'shared/contentgroup-row.php';
const TEMPLATE_FILE_TABLE = 'shared/contentgroup-table.php';
/**
* Returns an instance.
*
......@@ -29,8 +24,6 @@ class ContentGroupMenu
private $condition_all = null;
private $condition = true;
private $rows = 1;
private $columns = 1;
private $image = null;
private $image_link_attributes = [];
private $label;
......@@ -203,12 +196,7 @@ class ContentGroupMenu
return '';
}
//if ($this->rows > 1 || $this->columns > 1 || $this->image) {
if ($this->rows > 1 || $this->columns > 1) {
$template_file = self::TEMPLATE_FILE_TABLE;
} else {
$template_file = self::TEMPLATE_FILE_ROWS;
}
$template_file = 'shared/contentgroup-row.php';
$template = $GLOBALS['template_factory']->open($template_file);
$template->actions = $this->actions;
......@@ -221,9 +209,6 @@ class ContentGroupMenu
}
$template->has_link_icons = $has_link_icons;
$template->rows = $this->rows;
$template->columns = $this->columns;
if ($this->image) {
$template->image = $this->image;
$template->image_link_attributes = $this->image_link_attributes;
......@@ -236,37 +221,9 @@ class ContentGroupMenu
$template->attributes = $this->attributes;
/*} else {
$template_file = count($this->actions) <= self::THRESHOLD
? self::TEMPLATE_FILE_SINGLE
: self::TEMPLATE_FILE_MULTIPLE;
$template = $GLOBALS['template_factory']->open($template_file);
$template->actions = $this->actions;
}*/
return $template->render();
}
/**
* Sets the number of rows to layout the elements.
*
* @param integer $rows number of rows
*/
public function setRows($rows)
{
$this->rows = $rows;
}
/**
* Sets the number of columns to layout the elements.
*
* @param integer $columns number of columns
*/
public function setcolumns($columns)
{
$this->columns = $columns;
}
/**
* Sets the icon of the menu.
*
......
<?php
$table_rows = 0;
$table_cols = 0;
$max_rows = 0;
$max_cols = 0;
if ($rows > 1) {
$max_rows = $rows;
} else {
$max_cols = $columns;
}
?>
<? // class "action-menu" will be set from API ?>
<nav <?= arrayToHtmlAttributes($attributes) ?>>
<a class="action-menu-icon" title="<?= htmlReady($label) ?>"
aria-expanded="false" aria-label="<?= htmlReady($aria_label) ?>">
<?= $image ?>
</a>
<div class="action-menu-content">
<div class="action-menu-title">
<?= htmlReady($label) ?>
</div>
<table class="action-menu-table">
<tr>
<? foreach ($actions as $action): ?>
<td>
<? if ($action['type'] === 'link'): ?>
<a href="<?= $action['link'] ?>" <?= arrayToHtmlAttributes($action['attributes']) ?>>
<? if ($action['icon']): ?>
<?= $action['icon'] ?>
<? else: ?>
<span class="action-menu-no-icon"></span>
<? endif; ?>
<br>
<div class="navtitle"><?= htmlReady($action['label']) ?></div>
</a>
<? elseif ($action['type'] === 'button'): ?>
<label>
<? if ($action['icon']): ?>
<?= $action['icon']->asInput(['name' => $action['name']]) ?>
<? else: ?>
<span class="action-menu-no-icon"></span>
<button type="submit" name="<?= htmlReady($action['name']) ?>" style="display: none;"></button>
<? endif; ?>
<?= htmlReady($action['label']) ?>
</label>
<? elseif ($action['type'] === 'multi-person-search'): ?>
<?= $action['object']->render() ?>
<? endif; ?>
</td>
<?php
$table_cols += 1;
if ($table_cols >= $max_cols) {
$table_rows += 1;
$table_cols = 0;
echo '</tr><tr>'; // Open next row
}
?>
<? endforeach; ?>
</tr>
</table>
</div>
</nav>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment