-
Notifications
You must be signed in to change notification settings - Fork 4
/
munkiinfo_model.php
47 lines (38 loc) · 1.08 KB
/
munkiinfo_model.php
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
<?php
use CFPropertyList\CFPropertyList;
class munkiinfo_model extends \Model
{
public function __construct($serial = '')
{
parent::__construct('id', 'munkiinfo'); //primary key, tablename
$this->rs['id'] = 0;
$this->rs['serial_number'] = $serial;
$this->rs['munkiinfo_key'] = '';
$this->rs['munkiinfo_value'] = '';
if ($serial) {
$this->retrieve_record($serial);
$this->serial = $serial;
}
}
/**
* Process data sent by postflight
*
* @param string data
* @author erikng
**/
public function process($plist)
{
$parser = new CFPropertyList();
$parser->parse($plist);
$plist = $parser->toArray();
$this->deleteWhere('serial_number=?', $this->serial_number);
$item = array_pop($plist);
reset($item);
foreach($item as $key => $val) {
$this->munkiinfo_key = $key;
$this->munkiinfo_value = $val;
$this->id = '';
$this->save();
}
}
}