@@ -15,6 +15,7 @@ class linkedobject extends module
15
15
{
16
16
var $ property_field ;
17
17
var $ method_field ;
18
+
18
19
/**
19
20
* linkedobject
20
21
*
@@ -40,16 +41,16 @@ function __construct()
40
41
function saveParams ($ data = 0 )
41
42
{
42
43
$ p = array ();
43
- if (IsSet ($ this ->id )) {
44
+ if (isset ($ this ->id )) {
44
45
$ p ["id " ] = $ this ->id ;
45
46
}
46
- if (IsSet ($ this ->view_mode )) {
47
+ if (isset ($ this ->view_mode )) {
47
48
$ p ["view_mode " ] = $ this ->view_mode ;
48
49
}
49
- if (IsSet ($ this ->edit_mode )) {
50
+ if (isset ($ this ->edit_mode )) {
50
51
$ p ["edit_mode " ] = $ this ->edit_mode ;
51
52
}
52
- if (IsSet ($ this ->tab )) {
53
+ if (isset ($ this ->tab )) {
53
54
$ p ["tab " ] = $ this ->tab ;
54
55
}
55
56
return parent ::saveParams ($ p );
@@ -102,10 +103,10 @@ function run()
102
103
} else {
103
104
$ this ->usual ($ out );
104
105
}
105
- if (IsSet ($ this ->owner ->action )) {
106
+ if (isset ($ this ->owner ->action )) {
106
107
$ out ['PARENT_ACTION ' ] = $ this ->owner ->action ;
107
108
}
108
- if (IsSet ($ this ->owner ->name )) {
109
+ if (isset ($ this ->owner ->name )) {
109
110
$ out ['PARENT_NAME ' ] = $ this ->owner ->name ;
110
111
}
111
112
@@ -122,9 +123,9 @@ function run()
122
123
}
123
124
124
125
if (isset ($ this ->width )) {
125
- $ ifPX = substr ($ this ->width , -1 );
126
- if ($ ifPX != 'x ' && $ ifPX != '% ' ) $ this ->width = $ this ->width . 'px ' ;
127
-
126
+ $ ifPX = substr ($ this ->width , -1 );
127
+ if ($ ifPX != 'x ' && $ ifPX != '% ' ) $ this ->width = $ this ->width . 'px ' ;
128
+
128
129
$ out ['WIDTH ' ] = $ this ->width ;
129
130
} else {
130
131
$ out ['WIDTH ' ] = '90% ' ;
@@ -137,8 +138,13 @@ function run()
137
138
}
138
139
139
140
if ($ op == 'redirect ' ) {
140
- global $ object ;
141
- global $ sub ;
141
+ $ device_id = gr ('device_id ' , 'int ' );
142
+ if ($ device_id ) {
143
+ redirect (ROOTHTML . 'panel/devices/ ' . $ device_id . '.html?tab=settings ' );
144
+ }
145
+
146
+ $ object = gr ('object ' );
147
+ $ sub = gr ('sub ' );
142
148
if (!$ object ) {
143
149
redirect (ROOTHTML );
144
150
}
@@ -162,7 +168,7 @@ function run()
162
168
for ($ i = 0 ; $ i < $ total ; $ i ++) {
163
169
$ res [] = $ tmp [$ i ];
164
170
}
165
- $ res []= array ('ID ' => 'scripts ' ,'TITLE ' => 'AllScripts ' ,'DESCRIPTION ' => LANG_SCRIPTS );
171
+ $ res [] = array ('ID ' => 'scripts ' , 'TITLE ' => 'AllScripts ' , 'DESCRIPTION ' => LANG_SCRIPTS );
166
172
$ res ['OBJECTS ' ] = $ res ;
167
173
168
174
//$tmp=SQLSelectOne("SELECT TITLE FROM objects ORDER BY ID DESC LIMIT 1");
@@ -177,8 +183,11 @@ function run()
177
183
$ properties = array ();
178
184
do {
179
185
if (!$ object ) break ;
180
- if ($ object== 'AllScripts ' ) break ;
186
+ if ($ object == 'AllScripts ' ) break ;
181
187
$ obj = getObject ($ object );
188
+ if ($ obj ->device_id ) {
189
+ $ res ['DEVICE_ID ' ] = $ obj ->device_id ;
190
+ }
182
191
if (!$ obj ) break ;
183
192
$ parent_properties = $ obj ->getParentProperties ($ obj ->class_id , '' , 1 );
184
193
if ($ parent_properties && is_array ($ parent_properties )) {
@@ -203,8 +212,8 @@ function run()
203
212
$ properties = array ();
204
213
do {
205
214
if (!$ object ) break ;
206
- if ($ object== 'AllScripts ' ) {
207
- $ properties= SQLSelect ("SELECT TITLE FROM scripts ORDER BY TITLE " );
215
+ if ($ object == 'AllScripts ' ) {
216
+ $ properties = SQLSelect ("SELECT TITLE FROM scripts ORDER BY TITLE " );
208
217
break ;
209
218
}
210
219
$ obj = getObject ($ object );
@@ -238,36 +247,39 @@ function run()
238
247
}
239
248
240
249
if ($ this ->object_field ) {
241
- $ objects = SQLSelect ("SELECT objects.CLASS_ID, objects.TITLE, objects.DESCRIPTION, classes.TITLE AS CLASS_NAME FROM objects JOIN classes WHERE CLASS_ID=classes.ID ORDER BY CLASS_ID, TITLE " );
250
+ $ objects = SQLSelect ("SELECT objects.CLASS_ID, objects.TITLE, objects.DESCRIPTION, classes.TITLE AS CLASS_NAME FROM objects JOIN classes ON CLASS_ID=classes.ID ORDER BY CLASS_ID, TITLE " );
242
251
243
- $ objects []= array ('ID ' => 'scripts ' ,'TITLE ' => 'AllScripts ' ,'DESCRIPTION ' => LANG_SCRIPTS );
252
+ $ objects [] = array ('ID ' => 'scripts ' , 'TITLE ' => 'AllScripts ' , 'DESCRIPTION ' => LANG_SCRIPTS );
244
253
245
254
$ total = count ($ objects );
246
- $ old_class_id= 0 ;
255
+ $ old_class_id = 0 ;
247
256
248
- $ list_result= '' ;
257
+ $ list_result = '' ;
249
258
250
259
if ($ total ) {
251
- $ objects [0 ]['FIRST ' ]= 1 ;
252
- $ objects [$ total- 1 ]['LAST ' ]= 1 ;
253
- for ($ i= 0 ; $ i < $ total ;$ i ++) {
254
- if (isset ($ objects [$ i ]['CLASS_ID ' ]) && $ objects [$ i ]['CLASS_ID ' ]!= $ old_class_id ) {
255
- $ objects [$ i ]['NEW_GROUP ' ]= 1 ;
256
- $ old_class_id= $ objects [$ i ]['CLASS_ID ' ];
257
- if ($ i> 0 ) {
258
- $ list_result.= '</optgroup> ' ;
260
+ $ objects [0 ]['FIRST ' ] = 1 ;
261
+ $ objects [$ total - 1 ]['LAST ' ] = 1 ;
262
+ for ($ i = 0 ; $ i < $ total ; $ i ++) {
263
+ if (isset ($ objects [$ i ]['CLASS_ID ' ]) && $ objects [$ i ]['CLASS_ID ' ] != $ old_class_id ) {
264
+ $ objects [$ i ]['NEW_GROUP ' ] = 1 ;
265
+ $ old_class_id = $ objects [$ i ]['CLASS_ID ' ];
266
+ if ($ i > 0 ) {
267
+ $ list_result .= '</optgroup> ' ;
259
268
}
260
- $ list_result.= '<optgroup label=" ' . $ objects [$ i ]['CLASS_NAME ' ]. '"> ' ;
269
+ $ list_result .= '<optgroup label=" ' . $ objects [$ i ]['CLASS_NAME ' ] . '"> ' ;
261
270
}
262
- $ list_result .='<option value=" ' .$ objects [$ i ]['TITLE ' ].'"> ' .$ objects [$ i ]['TITLE ' ];
263
- if ($ objects [$ i ]['DESCRIPTION ' ]!='' ) {
264
- $ list_result .=' - ' .$ objects [$ i ]['DESCRIPTION ' ];
271
+
272
+ $ value = $ objects [$ i ]['TITLE ' ];
273
+ $ list_result .= '<option value=" ' . $ value . '"> ' ;
274
+ $ list_result .= $ objects [$ i ]['TITLE ' ];
275
+ if ($ objects [$ i ]['DESCRIPTION ' ] != '' ) {
276
+ $ list_result .= ' - ' . $ objects [$ i ]['DESCRIPTION ' ];
265
277
}
266
- $ list_result.= '</option> ' ;
278
+ $ list_result .= '</option> ' ;
267
279
}
268
- $ list_result.= '</optgroup> ' ;
280
+ $ list_result .= '</optgroup> ' ;
269
281
}
270
- $ out ['OBJECTS_LIST_RESULT ' ]= $ list_result ;
282
+ $ out ['OBJECTS_LIST_RESULT ' ] = $ list_result ;
271
283
272
284
/*
273
285
foreach($objects as $key => $object) {
@@ -283,12 +295,11 @@ function run()
283
295
}
284
296
}
285
297
*/
286
-
287
298
288
- //echo '<pre>';
289
- //var_dump($objects);
290
- //die();
291
299
300
+ //echo '<pre>';
301
+ //var_dump($objects);
302
+ //die();
292
303
293
304
294
305
$ out ['OBJECTS ' ] = $ objects ;
0 commit comments