~alexharrington/xibo/1.0.0-rc1-agpl-compliance

« back to all changes in this revision

Viewing changes to server/lib/pages/display.class.php

  • Committer: Dan Garner
  • Date: 2009-01-25 20:33:18 UTC
  • Revision ID: mail@dangarner.co.uk-20090125203318-zwpnq5sj61ymn5kq
[server] Displays converted to ResponseManager

Show diffs side-by-side

added added

removed removed

Lines of Context:
116
116
         */
117
117
        function modify() 
118
118
        {
119
 
                $db =& $this->db;
120
 
                
121
 
                //ajax request handler
122
 
                $arh = new ResponseManager();
 
119
                $db                     =& $this->db;
 
120
                $response               = new ResponseManager();
123
121
 
124
122
                $displayid              = Kit::GetParam('displayid', _POST, _INT);
125
123
                $display                = Kit::GetParam('display', _POST, _STRING);
140
138
                //Validation
141
139
                if ($display == "") 
142
140
                {
143
 
                        $arh->decode_response(false, "Can not have a display with no name");
 
141
                        trigger_error("Can not have a display with no name", E_USER_ERROR);
144
142
                }
145
143
                
146
144
                //Update the display record
185
183
                        $SQL .= " VALUES (%d, %d, '2050-12-31 00:00:00','2050-12-31 00:00:00') ";
186
184
                        
187
185
                        $SQL = sprintf($SQL, $displayid, $layoutid);
188
 
                        
189
 
                        //indicate what we have done
190
 
                        setMessage("Display Default Layout fixed");
191
186
                }
192
187
                else 
193
188
                {
208
203
                        trigger_error("Could not update display - stage 2 (default layout)", E_USER_ERROR);
209
204
                }
210
205
                
211
 
                setMessage("Display Modified");
212
 
                
213
 
                $arh->response(AJAX_REDIRECT,"index.php?p=display");
 
206
                $response->SetFormSubmitResponse('Display Saved.');
 
207
                $response->Respond();
214
208
        }
215
209
 
216
210
        /**
221
215
        {
222
216
                $db                     =& $this->db;
223
217
                $user                   =& $this->user;
224
 
                
225
 
                $helpManager            = new HelpManager($db, $user);
226
 
                
227
 
                //ajax request handler
228
 
                $arh = new ResponseManager();
 
218
                $response               = new ResponseManager();
 
219
                
 
220
                $helpManager    = new HelpManager($db, $user);
229
221
                
230
222
                //get some vars
231
223
                $displayid                      = $this->displayid;
237
229
                $auditing                       = $this->auditing;
238
230
                
239
231
                // Help UI
240
 
                $helpButton     = $helpManager->HelpButton("content/config/displays", true);
241
232
                $nameHelp               = $helpManager->HelpIcon("The Name of the Display - (1 - 50 characters).", true);
242
233
                $defaultHelp    = $helpManager->HelpIcon("The Default Layout to Display where there is no other content.", true);
243
234
                $interleveHelp  = $helpManager->HelpIcon("Whether to always put the default into the cycle.", true);
265
256
                }
266
257
                
267
258
                $form = <<<END
268
 
                <form class="dialog_form" method="post" action="index.php?p=display&q=modify&id=$displayid">
 
259
                <form class="XiboForm" method="post" action="index.php?p=display&q=modify&id=$displayid">
269
260
                        <input type="hidden" name="displayid" value="$displayid">
270
261
                        <table>
271
262
                                <tr>
292
283
                                        <td>
293
284
                                                <input type='submit' value="Save" / >
294
285
                                                <input id="btnCancel" type="button" title="No / Cancel" onclick="$('#div_dialog').dialog('close');return false; " value="Cancel" />     
295
 
                                                $helpButton
296
286
                                        </td>
297
287
                                </tr>
298
288
                        </table>
299
289
                </form>         
300
290
END;
301
 
                $arh->decode_response(true, $form);
302
 
 
303
 
                return true;
 
291
                
 
292
                $response->SetFormRequestResponse($form, 'Edit a Display.', '650px', '250px');
 
293
                $response->Respond();
 
294
        }
 
295
        
 
296
        public function DisplayFilter()
 
297
        {
 
298
                $filterForm = <<<END
 
299
                <div class="FilterDiv" id="LayoutFilter">
 
300
                        <form onsubmit="return false">
 
301
                                <input type="hidden" name="p" value="display">
 
302
                                <input type="hidden" name="q" value="DisplayGrid">
 
303
                        </form>
 
304
                </div>
 
305
END;
 
306
                
 
307
                $id = uniqid();
 
308
                
 
309
                $xiboGrid = <<<HTML
 
310
                <div class="XiboGrid" id="$id">
 
311
                        <div class="XiboFilter">
 
312
                                $filterForm
 
313
                        </div>
 
314
                        <div class="XiboData">
 
315
                        
 
316
                        </div>
 
317
                </div>
 
318
HTML;
 
319
                echo $xiboGrid;
304
320
        }
305
321
        
306
322
        /**
307
323
         * Grid of Displays
308
324
         * @return 
309
325
         */
310
 
        function data_table() 
 
326
        function DisplayGrid() 
311
327
        {
312
 
                $db =& $this->db;               
 
328
                $db             =& $this->db;
 
329
                $user           =& $this->user;
 
330
                $response       = new ResponseManager();                
313
331
                                        
314
332
                //display the display table
315
333
                $SQL = <<<SQL
348
366
                        </thead>
349
367
                        <tbody>
350
368
END;
351
 
                echo $output;
352
369
 
353
370
                while($aRow = $db->get_row($results)) 
354
371
                {
360
377
                        $inc_schedule   = $aRow[5];
361
378
                        $licensed               = $aRow[6];
362
379
                        
363
 
                        $output = <<<END
 
380
                        $output .= <<<END
364
381
                        
365
382
                        <tr>
366
383
                        <td>$displayid</td>
370
387
                        <td>$inc_schedule</td>
371
388
                        <td>$loggedin</td>
372
389
                        <td>$lastaccessed</td>
373
 
                        <td>
374
 
                        <div class='buttons'>
375
 
                                <a class='positive' href='index.php?p=display&q=displayForm&displayid=$displayid' onclick="return init_button(this,'Edit Display','',set_form_size(640,260))"><span>Edit</span></a>
376
 
                        </div>
 
390
                        <td><button class='XiboFormButton' href='index.php?p=display&q=displayForm&displayid=$displayid'><span>Edit</span></a></td>
377
391
END;
378
 
                        echo $output;
379
392
                }
380
 
                echo "</tbody></table></div>";
 
393
                $output .= "</tbody></table></div>";
381
394
                
382
 
                return false;
 
395
                $response->SetGridResponse($output);
 
396
                $response->Respond();
383
397
        }
384
398
 
385
399
        /**