mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-03-27 02:02:36 -04:00
Add Menu_Items table to store per-item enabled state, custom labels, and sort order. Admins can enable/disable menu items, set custom labels, and reorder via drag-and-drop in Options > Menu tab. Refactor hardcoded get*HTML() calls in buildSidebarMenu(), getNormalNavBarHTML(), and getCollapsedNavBarHTML() to data-driven renderMenuItems() that reads from DB with fallback for empty table. Remove deprecated Cycle view from menu (functionality merged into Watch view). Add reset button to restore default menu configuration. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
32 lines
793 B
PHP
32 lines
793 B
PHP
<?php
|
|
namespace ZM;
|
|
require_once('database.php');
|
|
require_once('Object.php');
|
|
|
|
class MenuItem extends ZM_Object {
|
|
protected static $table = 'Menu_Items';
|
|
|
|
protected $defaults = array(
|
|
'Id' => null,
|
|
'MenuKey' => '',
|
|
'Enabled' => 1,
|
|
'Label' => null,
|
|
'SortOrder' => 0,
|
|
);
|
|
|
|
public static function find($parameters = array(), $options = array()) {
|
|
return ZM_Object::_find(self::class, $parameters, $options);
|
|
}
|
|
|
|
public static function find_one($parameters = array(), $options = array()) {
|
|
return ZM_Object::_find_one(self::class, $parameters, $options);
|
|
}
|
|
|
|
public function displayLabel() {
|
|
if ($this->{'Label'} !== null && $this->{'Label'} !== '') {
|
|
return $this->{'Label'};
|
|
}
|
|
return translate($this->{'MenuKey'});
|
|
}
|
|
}
|