MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
mobjectgrid.class
Ir para a documentação deste ficheiro.
1<?php
3{
4 var $attribute; // attribute of object
5
6 function __construct($attribute, $title = '', $align = 'left', $nowrap = false, $width = 0, $visible = true,
7 $options = null, $order = false, $filter = false)
8 {
9 parent::__construct($title, $align, $nowrap, $width, $visible, $options, $order, $filter);
10 $this->attribute = $attribute;
11 }
12}
13
15{
16 var $attribute; // attribute of object
17
18 function __construct($attribute, $title = '', $href, $width = 0, $visible = true, $options = null, $order = false,
19 $filter = false)
20 {
21 parent::__construct($title, $href, $width, $visible, $options, $order, $filter);
22 $this->attribute = $attribute;
23 }
24}
25
27{
28 var $attribute; // attribute of object
29
30 function __construct(&$control, $attribute, $title = '', $alinhamento = null, $nowrap = false, $width = 0,
31 $visible = true)
32 {
33 parent::__construct($control, $title, $alinhamento, $nowrap, $width, $visible);
34 $this->attribute = $attribute;
35 }
36}
37
39{
40
41 function __construct($type, $alt, $value, $href, $index = null, $enabled = true)
42 {
43 parent::__construct($type, $alt, $value, $href, $enabled, $index);
44 }
45}
46
47class MObjectGrid extends MGrid
48{
57 protected $objArray;
58 function __construct($array, $columns, $href, $pagelength = 15, $index = 0)
59 {
60 parent::__construct(NULL, $columns, $href, $pagelength, $index);
61 if ( $this->pagelength )
62 {
63 $this->pn = new GridNavigator($this->pagelength, $this->rowCount, $this->GetURL($this->filtered, $this->ordered), $this);
64 }
65 $this->objArray = $array;
66 $this->data = array
67 (
68 );
69
70 $this->rowCount = count($this->objArray);
71 }
72
73 function GenerateData()
74 {
75 global $page, $state;
76
77 if ($this->objArray == NULL)
78 return;
79
80 foreach ($this->objArray as $i => $row)
81 {
82 foreach ($this->columns as $k => $col)
83 {
84 eval("\$v = \$row->{$col->attribute};");
85 $this->data[$i][$k] = $v;
86 }
87 }
88
89 $this->orderby = $page->Request('orderby');
90
91 if ($this->ordered = isset($this->orderby))
92 {
93 $this->ApplyOrder($this->orderby);
94 $state->set('orderby', $this->orderby, $this->name);
95 }
96
97 if ($this->GetFiltered())
98 {
99 $this->ApplyFilter();
100 }
101
102 if ($this->pagelength)
103 {
104 $this->pn->SetGridParameters($this->pagelength, $this->rowCount, $this->GetURL($this->filtered, $this->ordered), $this);
105 $this->data = $this->GetPage();
106 }
107 else
108 $this->pn = null;
109 }
110
111 function CallRowMethod()
112 {
113 if (isset($this->rowmethod))
114 {
116 $row = $this->data[$i];
117 call_user_func($this->rowmethod, $i, $row, $this->actions, $this->columns, $this->query);
118 }
119 }
120}
121
122
123?>
__construct($type, $alt, $value, $href, $index=null, $enabled=true)
__construct($attribute, $title='', $align='left', $nowrap=false, $width=0, $visible=true, $options=null, $order=false, $filter=false)
__construct(&$control, $attribute, $title='', $alinhamento=null, $nowrap=false, $width=0, $visible=true)
__construct($array, $columns, $href, $pagelength=15, $index=0)