/adei/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/adei/trunk
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
<?php

require_once($GLOBALS['ADEI_ROOTDIR'] . "/classes/readers/dbreader.php");

class DBController extends DBReader /*implements CONTROLInterface*/ {

 function __construct(&$props) {
    parent::__construct($props);
 }

 public function GetItemList(LOGGROUP $grp = NULL, MASK $mask = NULL, $flags = 0) {
    $list = parent::GetItemList($grp, $mask, $flags);

    foreach ($list as &$item) {
	$item["read"] = 1;
	$item["write"] = 1;
    }

    return $list;
 }

 public function GetControls(LOGGROUP $grp = NULL, MASK $mask = NULL) {
    $res = parent::GetControls($grp, $mask);

    foreach ($res as &$item) {
	$item["write"] = 1;
    }

    return $res;
 }

 function SetRawControls(LOGGROUP $grp = NULL, MASK $mask = NULL, array $values) {
    $grp = $this->CheckGroup($grp, REQUEST::CONTROL);
    if (!$mask) $mask = $this->CreateMask($grp, $minfo = NULL, REQUEST::CONTROL);

    $this->DisposeControlMask($grp, $mask, $values);
    $items = $this->GetItemList($grp, $full_mask = new MASK(), REQUEST::CONTROL);

    $columns = array();
    foreach ($items as $i => $item) {
	if ((!$values[$i])&&(!is_numeric($values[$i]))) $val = "NULL";
	else $val = $values[$i];
	$columns[$item['column']] = $val;
    }

    if (!isset($columns[$this->columns['time']])) {
	$columns[$this->columns['time']] =  $this->ImportUnixTime(gettimeofday(true));
    }

    $sql = $this->db->InsertRequest($grp->table, $columns);
    $this->db->Query($sql);
 } 
}