-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathe_admin.php
More file actions
91 lines (85 loc) · 2.86 KB
/
Copy pathe_admin.php
File metadata and controls
91 lines (85 loc) · 2.86 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
if (!defined('e107_INIT')) { exit; }
e107::lan('escursioni', 'admin');
class escursioni_admin implements e_admin_addon_interface
{
public function load($event, $ids)
{
return array(3 => array('url' => 'https://myurl.com'));
}
public function config(e_admin_ui $ui)
{
global $LAN;
$action = $ui->getAction();
$type = $ui->getEventName();
$config = array();
$defaultValue = 'https://';
switch($type)
{
case 'news':
$config['fields']['url'] = array(
'title' => $LAN['escursioni_eadm_blank_url'],
'type' => 'url',
'tab' => 1,
'writeParms' => array('size' => 'xxlarge', 'placeholder' => '', 'default' => $defaultValue),
'width' => 'auto', 'help' => '', 'readParms' => '', 'class' => 'left', 'thclass' => 'left',
);
$config['fields']['custom'] = array(
'title' => $LAN['escursioni_eadm_blank_custom'],
'type' => 'method',
'tab' => 1,
'writeParms' => array('size' => 'xxlarge', 'placeholder' => '', 'default' => $defaultValue),
'width' => 'auto', 'help' => '', 'readParms' => '', 'class' => 'left', 'thclass' => 'left',
);
$config['batchOptions'] = array('custom' => $LAN['escursioni_eadm_batch_cmd']);
break;
case 'page':
break;
}
return $config;
}
public function process(e_admin_ui $ui, $id = null)
{
$data = $ui->getPosted();
$type = $ui->getEventName();
$action = $ui->getAction();
switch($action)
{
case 'create':
case 'edit':
if(!empty($id) && !empty($data['x_escursioni_url']))
{
// Qui andrebbe la logica di salvataggio nel DB
}
break;
case 'delete':
break;
case 'batch':
$id = (array) $id;
$arrayOfRecordIds = $id['ids'];
$command = $id['cmd'];
break;
}
}
}
class escursioni_admin_form extends e_form
{
function x_escursioni_custom($curval, $mode, $att = null)
{
global $LAN;
$controller = e107::getAdminUI()->getController();
$text = '';
switch($mode)
{
case "read":
$field = $controller->getEventName() . '_id';
$text = "<span class='e-tip' title='".$controller->getFieldVar($field)."'>".$LAN['escursioni_eadm_custom_lbl']."</span>";
break;
case "write":
case "filter":
case "batch":
break;
}
return $text;
}
}