css.php
1.16 KB
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
<?php
class N2SystemCssModel extends N2Model {
public $storage;
public function __construct($tableName = null) {
$this->storage = N2Base::getApplication('system')->storage;
parent::__construct($tableName);
}
protected function getPath() {
return dirname(__FILE__);
}
public function addVisual($type, $visual) {
$visualId = $this->storage->add($type, '', $visual);
$visual = $this->storage->getById($visualId, $type);
if (!empty($visual) && $visual['section'] == $type) {
return $visual;
}
return false;
}
public function deleteVisual($type, $id) {
$visual = $this->storage->getById($id, $type);
if (!empty($visual) && $visual['section'] == $type) {
$this->storage->deleteById($id);
return $visual;
}
return false;
}
public function changeVisual($type, $id, $value) {
if ($this->storage->setById($id, $value)) {
return $this->storage->getById($id, $type);
}
return false;
}
public function getVisuals($type) {
return $this->storage->getAll($type);
}
}