|
Revision 3700, 2.3 kB
(checked in by Shadowhand, 12 days ago)
|
|
Updates to trunk:
- Removed all SYSPATH file checks
- Deleted some modules: code_coverage (3.0), shoutbox (defunct), user_guide (defunct), kobot (3.0), object_db (3.0)
- Updated ORM and ORM_Iterator to match 3.0, enabling the new HABTM stuff, see r3636 and r3640
|
-
Property svn:eol-style set to
LF
-
Property copyright set to
Copyright (c) 2008 Kohana Team
-
Property svn:keywords set to
Id
|
| Line | |
|---|
| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | class Flot_Core { |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | protected $type = 'div'; |
|---|
| 16 | protected $attr = array(); |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | protected $dataset; |
|---|
| 20 | protected $options; |
|---|
| 21 | |
|---|
| 22 | public function __construct($id, $attr = array(), $type = NULL) |
|---|
| 23 | { |
|---|
| 24 | |
|---|
| 25 | $attr['id'] = $id; |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | $this->attr += $attr; |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | empty($type) or $this->type = $type; |
|---|
| 32 | |
|---|
| 33 | |
|---|
| 34 | $this->dataset = array(); |
|---|
| 35 | |
|---|
| 36 | |
|---|
| 37 | $this->options = new StdClass; |
|---|
| 38 | } |
|---|
| 39 | |
|---|
| 40 | public function __get($key) |
|---|
| 41 | { |
|---|
| 42 | if ( ! isset($this->options->$key)) |
|---|
| 43 | { |
|---|
| 44 | |
|---|
| 45 | $this->options->$key = new StdClass; |
|---|
| 46 | } |
|---|
| 47 | |
|---|
| 48 | |
|---|
| 49 | return $this->options->$key; |
|---|
| 50 | } |
|---|
| 51 | |
|---|
| 52 | public function __set($key, $value) |
|---|
| 53 | { |
|---|
| 54 | |
|---|
| 55 | $this->options->$key = $value; |
|---|
| 56 | } |
|---|
| 57 | |
|---|
| 58 | |
|---|
| 59 | |
|---|
| 60 | |
|---|
| 61 | |
|---|
| 62 | |
|---|
| 63 | public function __toString() |
|---|
| 64 | { |
|---|
| 65 | return $this->render(); |
|---|
| 66 | } |
|---|
| 67 | |
|---|
| 68 | |
|---|
| 69 | |
|---|
| 70 | |
|---|
| 71 | |
|---|
| 72 | |
|---|
| 73 | |
|---|
| 74 | |
|---|
| 75 | public function add(Flot_Dataset $set, $label = NULL) |
|---|
| 76 | { |
|---|
| 77 | |
|---|
| 78 | empty($label) or $set->label = $label; |
|---|
| 79 | |
|---|
| 80 | |
|---|
| 81 | $this->dataset[] = $set; |
|---|
| 82 | |
|---|
| 83 | return $this; |
|---|
| 84 | } |
|---|
| 85 | |
|---|
| 86 | |
|---|
| 87 | |
|---|
| 88 | |
|---|
| 89 | |
|---|
| 90 | |
|---|
| 91 | |
|---|
| 92 | |
|---|
| 93 | |
|---|
| 94 | public function set($key, $value) |
|---|
| 95 | { |
|---|
| 96 | |
|---|
| 97 | $this->__set($key, $value); |
|---|
| 98 | |
|---|
| 99 | return $this; |
|---|
| 100 | } |
|---|
| 101 | |
|---|
| 102 | |
|---|
| 103 | |
|---|
| 104 | |
|---|
| 105 | |
|---|
| 106 | |
|---|
| 107 | public function render($template = 'kohana_flot') |
|---|
| 108 | { |
|---|
| 109 | |
|---|
| 110 | return View::factory($template) |
|---|
| 111 | |
|---|
| 112 | ->set('type', $this->type) |
|---|
| 113 | ->set('attr', $this->attr) |
|---|
| 114 | |
|---|
| 115 | ->set('dataset', array_map('json_encode', $this->dataset)) |
|---|
| 116 | ->set('options', json_encode($this->options)) |
|---|
| 117 | |
|---|
| 118 | ->render(); |
|---|
| 119 | } |
|---|
| 120 | |
|---|
| 121 | } |
|---|