Documentation/Index/DocumentFormOnToHtml: DocumentOnToHtml.inc

Plik DocumentOnToHtml.inc, 1.3 KB (dodany przez TS, 5 years temu)
xx
Line 
1<?php
2
3/**
4 * DocumentOnToHtml
5 *
6 * @author Tomasz Świenty
7 * @version 0.1
8 * @copyright Copyright (c) eDokumenty
9 */
10final class DocumentOnToHtml {
11
12
13
14    public static function init($args) {
15
16        if (!isset($args['container'])) {
17            return FALSE;
18        }
19
20        // obiekt całego formularza dokumentu
21        if (!is_object($args['container']) OR !is_a($args['container'], 'DocumentForm')) {
22            return FALSE;
23        }
24
25        // bean dokumentu
26        if (!is_object($args['document']) OR !is_a($args['document'], 'Bean')) {
27            return FALSE;
28        }
29
30        // warunek dla jakiego ma pojawić się dodatkowa szarfa
31        if ($args['document']->get('dctpid') == 2) {
32            require_once(LIB_PATH.'widgets/Ribbon.inc');
33
34            $ribbon = new Ribbon($args['container']->name.'asdd', Ribbon::LB);
35            $ribbon->height = '300px';
36            $ribbon->width = '300px';
37            $ribbon->bottom = '0px';
38            $ribbon->left = '0px';
39            $ribbon->style = 'background-color: red;';
40            $ribbon->title = 'Dodatkowy opis';
41            $ribbon->text = 'Tajny dokumentu';
42            $args['container']->add($ribbon);
43        }
44
45    }
46
47}
48
49if (isset($args)) {
50    DocumentOnToHtml::init($args);
51}