-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbase_menu.php
executable file
·61 lines (57 loc) · 2.28 KB
/
base_menu.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
abstract class BaseMenu
{
protected $iconFile = "gui_skin://small_icons/folder.aai";
protected $action = PLUGIN_OPEN_FOLDER_ACTION_ID;
protected static function CompareCaption($a, $b)
{
$al = strtolower($a["caption"]);
$bl = strtolower($b["caption"]);
if ($al == $bl) {
return 0;
} else {
return ($al > $bl) ? +1 : -1;
}
}
protected function create_folder_view($items)
{
$folderItems = array();
foreach ($items as $item) {
$folderItems[] = array(
PluginRegularFolderItem::media_url => $item["url"],
PluginRegularFolderItem::caption => $item["caption"],
PluginRegularFolderItem::view_item_params => array()
);
}
return array(
PluginFolderView::view_kind => PLUGIN_FOLDER_VIEW_REGULAR,
PluginFolderView::data => array(
PluginRegularFolderView::initial_range => array(
PluginRegularFolderRange::items => $folderItems,
PluginRegularFolderRange::total => count($folderItems),
PluginRegularFolderRange::count => count($folderItems),
PluginRegularFolderRange::more_items_available => false,
PluginRegularFolderRange::from_ndx => 0
),
PluginRegularFolderView::view_params => array(
ViewParams::num_cols => 1,
ViewParams::num_rows => 11
),
PluginRegularFolderView::base_view_item_params => array(
ViewItemParams::icon_path => $this->iconFile,
ViewItemParams::item_layout => HALIGN_LEFT,
ViewItemParams::icon_valign => VALIGN_TOP,
ViewItemParams::item_caption_dx => 60,
ViewItemParams::icon_dx => 10
),
PluginRegularFolderView::not_loaded_view_item_params => array(),
PluginRegularFolderView::actions => array(
GUI_EVENT_KEY_ENTER => array(
GuiAction::handler_string_id => $this->action
)
)
)
);
}
abstract public function generate_menu();
}