| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | // |
|---|
| 4 | // Open Web Analytics - An Open Source Web Analytics Framework |
|---|
| 5 | // |
|---|
| 6 | // Copyright 2006 Peter Adams. All rights reserved. |
|---|
| 7 | // |
|---|
| 8 | // Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html |
|---|
| 9 | // |
|---|
| 10 | // Unless required by applicable law or agreed to in writing, software |
|---|
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
|---|
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|---|
| 13 | // See the License for the specific language governing permissions and |
|---|
| 14 | // limitations under the License. |
|---|
| 15 | // |
|---|
| 16 | // $Id$ |
|---|
| 17 | // |
|---|
| 18 | |
|---|
| 19 | require_once(OWA_BASE_CLASSES_DIR.'owa_template.php'); |
|---|
| 20 | require_once(OWA_BASE_CLASSES_DIR.'owa_requestContainer.php'); // ?? |
|---|
| 21 | |
|---|
| 22 | /** |
|---|
| 23 | * Abstract View Class |
|---|
| 24 | * |
|---|
| 25 | * @author Peter Adams <peter@openwebanalytics.com> |
|---|
| 26 | * @copyright Copyright © 2006 Peter Adams <peter@openwebanalytics.com> |
|---|
| 27 | * @license http://www.gnu.org/copyleft/gpl.html GPL v2.0 |
|---|
| 28 | * @category owa |
|---|
| 29 | * @package owa |
|---|
| 30 | * @version $Revision$ |
|---|
| 31 | * @since owa 1.0.0 |
|---|
| 32 | */ |
|---|
| 33 | |
|---|
| 34 | class owa_view extends owa_base { |
|---|
| 35 | |
|---|
| 36 | /** |
|---|
| 37 | * Main view template object |
|---|
| 38 | * |
|---|
| 39 | * @var object |
|---|
| 40 | */ |
|---|
| 41 | var $t; |
|---|
| 42 | |
|---|
| 43 | /** |
|---|
| 44 | * Body content template object |
|---|
| 45 | * |
|---|
| 46 | * @var object |
|---|
| 47 | */ |
|---|
| 48 | var $body; |
|---|
| 49 | |
|---|
| 50 | /** |
|---|
| 51 | * Sub View object |
|---|
| 52 | * |
|---|
| 53 | * @var object |
|---|
| 54 | */ |
|---|
| 55 | var $subview; |
|---|
| 56 | |
|---|
| 57 | /** |
|---|
| 58 | * Rednered subview |
|---|
| 59 | * |
|---|
| 60 | * @var string |
|---|
| 61 | */ |
|---|
| 62 | var $subview_rendered; |
|---|
| 63 | |
|---|
| 64 | /** |
|---|
| 65 | * CSS file for main template |
|---|
| 66 | * |
|---|
| 67 | * @var unknown_type |
|---|
| 68 | */ |
|---|
| 69 | var $css_file; |
|---|
| 70 | |
|---|
| 71 | /** |
|---|
| 72 | * The priviledge level required to access this view |
|---|
| 73 | * @depricated |
|---|
| 74 | * @var string |
|---|
| 75 | */ |
|---|
| 76 | var $priviledge_level; |
|---|
| 77 | |
|---|
| 78 | /** |
|---|
| 79 | * Type of page |
|---|
| 80 | * |
|---|
| 81 | * @var unknown_type |
|---|
| 82 | */ |
|---|
| 83 | var $page_type; |
|---|
| 84 | |
|---|
| 85 | /** |
|---|
| 86 | * Request Params |
|---|
| 87 | * |
|---|
| 88 | * @var unknown_type |
|---|
| 89 | */ |
|---|
| 90 | var $params; |
|---|
| 91 | |
|---|
| 92 | /** |
|---|
| 93 | * Authorization object |
|---|
| 94 | * |
|---|
| 95 | * @var object |
|---|
| 96 | */ |
|---|
| 97 | var $auth; |
|---|
| 98 | |
|---|
| 99 | var $module; // set by factory. |
|---|
| 100 | |
|---|
| 101 | var $data; |
|---|
| 102 | |
|---|
| 103 | var $default_subview; |
|---|
| 104 | |
|---|
| 105 | var $is_subview; |
|---|
| 106 | |
|---|
| 107 | var $js = array(); |
|---|
| 108 | |
|---|
| 109 | var $css = array(); |
|---|
| 110 | |
|---|
| 111 | /** |
|---|
| 112 | * Constructor |
|---|
| 113 | * |
|---|
| 114 | * @return owa_view |
|---|
| 115 | */ |
|---|
| 116 | function owa_view($params = null) { |
|---|
| 117 | |
|---|
| 118 | return owa_view::__construct($params); |
|---|
| 119 | } |
|---|
| 120 | |
|---|
| 121 | function __construct($params = null) { |
|---|
| 122 | |
|---|
| 123 | parent::__construct($params); |
|---|
| 124 | |
|---|
| 125 | $this->t = new owa_template(); |
|---|
| 126 | $this->body = new owa_template($this->module); |
|---|
| 127 | $this->setTheme(); |
|---|
| 128 | return; |
|---|
| 129 | |
|---|
| 130 | } |
|---|
| 131 | |
|---|
| 132 | /** |
|---|
| 133 | * Assembles the view using passed model objects |
|---|
| 134 | * |
|---|
| 135 | * @param unknown_type $data |
|---|
| 136 | * @return unknown |
|---|
| 137 | */ |
|---|
| 138 | function assembleView($data) { |
|---|
| 139 | |
|---|
| 140 | $this->e->debug('Assembling view: '.get_class($this)); |
|---|
| 141 | |
|---|
| 142 | // set view name in template class. used for navigation. |
|---|
| 143 | $this->body->caller_params['view'] = $this->data['view']; |
|---|
| 144 | |
|---|
| 145 | if (array_key_exists('params', $this->data)): |
|---|
| 146 | $this->body->set('params', $this->data['params']); |
|---|
| 147 | endif; |
|---|
| 148 | |
|---|
| 149 | if (array_key_exists('subview', $this->data)): |
|---|
| 150 | $this->body->caller_params['subview'] = $this->data['subview']; |
|---|
| 151 | endif; |
|---|
| 152 | |
|---|
| 153 | // Assign status msg |
|---|
| 154 | if (array_key_exists('status_msg', $this->data)): |
|---|
| 155 | $this->t->set('status_msg', $this->data['status_msg']); |
|---|
| 156 | endif; |
|---|
| 157 | |
|---|
| 158 | // get status msg from code passed on the query string from a redirect. |
|---|
| 159 | if (array_key_exists('status_code', $this->data)): |
|---|
| 160 | $this->t->set('status_msg', $this->getMsg($this->data['status_code'])); |
|---|
| 161 | endif; |
|---|
| 162 | |
|---|
| 163 | // set error msg directly if passed from constructor |
|---|
| 164 | if (array_key_exists('error_msg', $this->data)): |
|---|
| 165 | $this->t->set('error_msg', $this->data['error_msg']); |
|---|
| 166 | endif; |
|---|
| 167 | |
|---|
| 168 | // auth user |
|---|
| 169 | //$auth_data = $this->auth->authenticateUser($this->priviledge_level); |
|---|
| 170 | |
|---|
| 171 | // authentication status |
|---|
| 172 | if (array_key_exists('auth_status', $this->data)): |
|---|
| 173 | $this->t->set('authStatus', $this->data['auth_status']); |
|---|
| 174 | endif; |
|---|
| 175 | |
|---|
| 176 | // get error msg from error code passed on the query string from a redirect. |
|---|
| 177 | if (array_key_exists('error_code', $this->data)): |
|---|
| 178 | $this->t->set('error_msg', $this->getMsg($this->data['error_code'])); |
|---|
| 179 | endif; |
|---|
| 180 | |
|---|
| 181 | // load subview |
|---|
| 182 | if (!empty($this->data['subview']) || !empty($this->default_subview)): |
|---|
| 183 | // Load subview |
|---|
| 184 | $this->loadSubView($this->data['subview']); |
|---|
| 185 | endif; |
|---|
| 186 | |
|---|
| 187 | // construct main view. This might set some properties of the subview. |
|---|
| 188 | if (method_exists($this, 'render')) { |
|---|
| 189 | $this->render($this->data); |
|---|
| 190 | } else { |
|---|
| 191 | // old style |
|---|
| 192 | $this->construct($this->data); |
|---|
| 193 | } |
|---|
| 194 | //array of errors usually used for field validations |
|---|
| 195 | if (array_key_exists('validation_errors', $this->data)): |
|---|
| 196 | $this->body->set('validation_errors', $this->data['validation_errors']); |
|---|
| 197 | endif; |
|---|
| 198 | |
|---|
| 199 | // pagination |
|---|
| 200 | if (array_key_exists('pagination', $this->data)): |
|---|
| 201 | $this->body->set('pagination', $this->data['pagination']); |
|---|
| 202 | endif; |
|---|
| 203 | |
|---|
| 204 | $this->_setLinkState(); |
|---|
| 205 | |
|---|
| 206 | // assemble subview |
|---|
| 207 | if (!empty($this->data['subview'])): |
|---|
| 208 | |
|---|
| 209 | // set view name in template. used for navigation. |
|---|
| 210 | $this->subview->body->caller_params['view'] = $this->data['subview']; |
|---|
| 211 | |
|---|
| 212 | // Set validation errors |
|---|
| 213 | $this->subview->body->set('validation_errors', $this->data['validation_errors']); |
|---|
| 214 | |
|---|
| 215 | // pagination |
|---|
| 216 | if (array_key_exists('pagination', $this->data)): |
|---|
| 217 | $this->subview->body->set('pagination', $this->data['pagination']); |
|---|
| 218 | endif; |
|---|
| 219 | |
|---|
| 220 | if (array_key_exists('params', $this->data)): |
|---|
| 221 | $this->subview->body->set('params', $this->data['params']); |
|---|
| 222 | $this->subview->body->set('do', $this->data['params']['do']); |
|---|
| 223 | endif; |
|---|
| 224 | |
|---|
| 225 | // Load subview |
|---|
| 226 | $this->renderSubView($this->data); |
|---|
| 227 | |
|---|
| 228 | // assign subview to body template |
|---|
| 229 | $this->body->set('subview', $this->subview_rendered); |
|---|
| 230 | |
|---|
| 231 | |
|---|
| 232 | endif; |
|---|
| 233 | |
|---|
| 234 | if (!empty($this->data['validation_errors'])): |
|---|
| 235 | $ves = new owa_template('base'); |
|---|
| 236 | $ves->set_template('error_validation_summary.tpl'); |
|---|
| 237 | $ves->set('validation_errors', $this->data['validation_errors']); |
|---|
| 238 | $validation_errors_summary = $ves->fetch(); |
|---|
| 239 | $this->t->set('error_msg', $validation_errors_summary); |
|---|
| 240 | endif; |
|---|
| 241 | |
|---|
| 242 | // assign css and js ellements if the view is not a subview. |
|---|
| 243 | // subview css/js have been merged/pulls from subview and assigned here. |
|---|
| 244 | if ($this->is_subview != true): |
|---|
| 245 | if (!empty($this->css)): |
|---|
| 246 | $this->t->set('css', $this->css); |
|---|
| 247 | endif; |
|---|
| 248 | |
|---|
| 249 | if (!empty($this->js)): |
|---|
| 250 | $this->t->set('js', $this->js); |
|---|
| 251 | endif; |
|---|
| 252 | endif; |
|---|
| 253 | |
|---|
| 254 | //Assign body to main template |
|---|
| 255 | $this->t->set('config', $this->config); |
|---|
| 256 | |
|---|
| 257 | //Assign body to main template |
|---|
| 258 | $this->t->set('body', $this->body); |
|---|
| 259 | |
|---|
| 260 | if ($this->postProcessView === true) { |
|---|
| 261 | return $this->postProcess(); |
|---|
| 262 | } else { |
|---|
| 263 | // Return fully asembled View |
|---|
| 264 | return $this->t->fetch(); |
|---|
| 265 | } |
|---|
| 266 | } |
|---|
| 267 | |
|---|
| 268 | function postProcess() { |
|---|
| 269 | return false; |
|---|
| 270 | } |
|---|
| 271 | |
|---|
| 272 | /** |
|---|
| 273 | * Sets the theme to be used by a view |
|---|
| 274 | * |
|---|
| 275 | */ |
|---|
| 276 | function setTheme() { |
|---|
| 277 | |
|---|
| 278 | $this->t->set_template($this->config['report_wrapper']); |
|---|
| 279 | |
|---|
| 280 | return; |
|---|
| 281 | } |
|---|
| 282 | |
|---|
| 283 | /** |
|---|
| 284 | * Abstract method for assembling a view |
|---|
| 285 | * @depricated |
|---|
| 286 | * @param array $data |
|---|
| 287 | */ |
|---|
| 288 | function construct($data) { |
|---|
| 289 | |
|---|
| 290 | return; |
|---|
| 291 | |
|---|
| 292 | } |
|---|
| 293 | |
|---|
| 294 | /** |
|---|
| 295 | * Assembles subview |
|---|
| 296 | * |
|---|
| 297 | * @param array $data |
|---|
| 298 | */ |
|---|
| 299 | function loadSubView($subview) { |
|---|
| 300 | |
|---|
| 301 | if (empty($subview)): |
|---|
| 302 | if (!empty($this->default_subview)): |
|---|
| 303 | $subview = $this->default_subview; |
|---|
| 304 | $this->data['subview'] = $this->default_subview; |
|---|
| 305 | else: |
|---|
| 306 | return $this->e->debug("No Subview was specified by caller."); |
|---|
| 307 | endif; |
|---|
| 308 | endif; |
|---|
| 309 | |
|---|
| 310 | $this->subview = owa_coreAPI::subViewFactory($subview); |
|---|
| 311 | //print_r($subview.'///'); |
|---|
| 312 | $this->subview->setData($this->data); |
|---|
| 313 | |
|---|
| 314 | return; |
|---|
| 315 | |
|---|
| 316 | } |
|---|
| 317 | |
|---|
| 318 | /** |
|---|
| 319 | * Assembles subview |
|---|
| 320 | * |
|---|
| 321 | * @param array $data |
|---|
| 322 | */ |
|---|
| 323 | function renderSubView($data) { |
|---|
| 324 | |
|---|
| 325 | // Stores subview as string into $this->subview |
|---|
| 326 | $this->subview_rendered = $this->subview->assembleSubView($data); |
|---|
| 327 | |
|---|
| 328 | // pull css and jas elements needed by subview |
|---|
| 329 | $this->css = array_merge($this->css, $this->subview->css); |
|---|
| 330 | $this->js = array_merge($this->js, $this->subview->js); |
|---|
| 331 | |
|---|
| 332 | return; |
|---|
| 333 | |
|---|
| 334 | } |
|---|
| 335 | |
|---|
| 336 | /** |
|---|
| 337 | * Assembles the view using passed model objects |
|---|
| 338 | * |
|---|
| 339 | * @param unknown_type $data |
|---|
| 340 | * @return unknown |
|---|
| 341 | */ |
|---|
| 342 | function assembleSubView($data) { |
|---|
| 343 | |
|---|
| 344 | // construct main view. This might set some properties of the subview. |
|---|
| 345 | if (method_exists($this, 'render')) { |
|---|
| 346 | $this->render($data); |
|---|
| 347 | } else { |
|---|
| 348 | // old style |
|---|
| 349 | $this->construct($data); |
|---|
| 350 | } |
|---|
| 351 | |
|---|
| 352 | $this->t->set_template('wrapper_subview.tpl'); |
|---|
| 353 | |
|---|
| 354 | //Assign body to main template |
|---|
| 355 | $this->t->set('body', $this->body); |
|---|
| 356 | |
|---|
| 357 | // Return fully asembled View |
|---|
| 358 | $page = $this->t->fetch(); |
|---|
| 359 | |
|---|
| 360 | return $page; |
|---|
| 361 | |
|---|
| 362 | } |
|---|
| 363 | |
|---|
| 364 | function setCss($file, $path = '') { |
|---|
| 365 | |
|---|
| 366 | if(empty($path)): |
|---|
| 367 | $path = $this->config['public_url'].'css'.DIRECTORY_SEPARATOR; |
|---|
| 368 | endif; |
|---|
| 369 | |
|---|
| 370 | $this->css[] = $path.$file; |
|---|
| 371 | return; |
|---|
| 372 | } |
|---|
| 373 | |
|---|
| 374 | function setJs($file, $path = '') { |
|---|
| 375 | |
|---|
| 376 | if(empty($path)): |
|---|
| 377 | $path = $this->config['public_url'].'js'.DIRECTORY_SEPARATOR; |
|---|
| 378 | endif; |
|---|
| 379 | |
|---|
| 380 | $this->js[] = $path.$file; |
|---|
| 381 | return; |
|---|
| 382 | } |
|---|
| 383 | |
|---|
| 384 | |
|---|
| 385 | /** |
|---|
| 386 | * Sets the Priviledge Level required to access this view |
|---|
| 387 | * |
|---|
| 388 | * @param string $level |
|---|
| 389 | */ |
|---|
| 390 | function _setPriviledgeLevel($level) { |
|---|
| 391 | |
|---|
| 392 | $this->priviledge_level = $level; |
|---|
| 393 | |
|---|
| 394 | return; |
|---|
| 395 | } |
|---|
| 396 | |
|---|
| 397 | /** |
|---|
| 398 | * Sets the page type of this view. Used for tracking. |
|---|
| 399 | * |
|---|
| 400 | * @param string $page_type |
|---|
| 401 | */ |
|---|
| 402 | function _setPageType($page_type) { |
|---|
| 403 | |
|---|
| 404 | $this->page_type = $page_type; |
|---|
| 405 | |
|---|
| 406 | return; |
|---|
| 407 | } |
|---|
| 408 | |
|---|
| 409 | |
|---|
| 410 | /** |
|---|
| 411 | * Sets properties that are needed to maintain state across most |
|---|
| 412 | * report and widget requests. This is used by many template functions. |
|---|
| 413 | * |
|---|
| 414 | */ |
|---|
| 415 | function _setLinkState() { |
|---|
| 416 | |
|---|
| 417 | // array of params to check |
|---|
| 418 | $p = $this->get('params'); |
|---|
| 419 | |
|---|
| 420 | // control array - will check for these params. If they exist it will return. |
|---|
| 421 | $sp = array('period' => null, |
|---|
| 422 | 'startDate' => null, |
|---|
| 423 | 'endDate' => null, |
|---|
| 424 | 'site_id' => null, |
|---|
| 425 | 'startTime' => null, |
|---|
| 426 | 'endTime' => null); |
|---|
| 427 | |
|---|
| 428 | // result array |
|---|
| 429 | $link_params = array(); |
|---|
| 430 | |
|---|
| 431 | if (!empty($p)): |
|---|
| 432 | $link_params = owa_lib::array_intersect_key($p, $sp); |
|---|
| 433 | endif; |
|---|
| 434 | |
|---|
| 435 | $this->body->caller_params['link_state'] = $link_params; |
|---|
| 436 | |
|---|
| 437 | if(!empty($this->subview)): |
|---|
| 438 | $this->subview->body->caller_params['link_state'] = $link_params; |
|---|
| 439 | endif; |
|---|
| 440 | |
|---|
| 441 | return; |
|---|
| 442 | } |
|---|
| 443 | |
|---|
| 444 | function get($name) { |
|---|
| 445 | |
|---|
| 446 | return $this->data[$name]; |
|---|
| 447 | } |
|---|
| 448 | |
|---|
| 449 | function set($name, $value) { |
|---|
| 450 | |
|---|
| 451 | $this->data[$name] = $value; |
|---|
| 452 | return; |
|---|
| 453 | } |
|---|
| 454 | |
|---|
| 455 | function setSubViewProperty($name, $value) { |
|---|
| 456 | |
|---|
| 457 | $this->subview->set($name, $value); |
|---|
| 458 | return; |
|---|
| 459 | } |
|---|
| 460 | |
|---|
| 461 | function getSubViewProperty($name) { |
|---|
| 462 | return $this->subview->get($name); |
|---|
| 463 | } |
|---|
| 464 | |
|---|
| 465 | function setData($data) { |
|---|
| 466 | $this->data = $data; |
|---|
| 467 | } |
|---|
| 468 | |
|---|
| 469 | } |
|---|
| 470 | |
|---|
| 471 | /** |
|---|
| 472 | * Generic HTMl Table View |
|---|
| 473 | * |
|---|
| 474 | * Will produce a generic html table |
|---|
| 475 | * |
|---|
| 476 | */ |
|---|
| 477 | class owa_genericTableView extends owa_view { |
|---|
| 478 | |
|---|
| 479 | function __construct() { |
|---|
| 480 | |
|---|
| 481 | return parent::__construct(); |
|---|
| 482 | |
|---|
| 483 | } |
|---|
| 484 | |
|---|
| 485 | function owa_genericTableView() { |
|---|
| 486 | |
|---|
| 487 | return owa_genericTableView::__construct(); |
|---|
| 488 | } |
|---|
| 489 | |
|---|
| 490 | function render($data) { |
|---|
| 491 | |
|---|
| 492 | $this->t->set_template('wrapper_blank.tpl'); |
|---|
| 493 | $this->body->set_template('generic_table.tpl'); |
|---|
| 494 | |
|---|
| 495 | if (!empty($data['labels'])): |
|---|
| 496 | $this->body->set('labels', $data['labels']); |
|---|
| 497 | $this->body->set('col_count', count($data['labels'])); |
|---|
| 498 | else: |
|---|
| 499 | $this->body->set('labels', ''); |
|---|
| 500 | $this->body->set('col_count', count($data['rows'][0])); |
|---|
| 501 | endif; |
|---|
| 502 | |
|---|
| 503 | if (!empty($data['rows'])): |
|---|
| 504 | $this->body->set('rows', $data['rows']); |
|---|
| 505 | $this->body->set('row_count', count($data['rows'])); |
|---|
| 506 | else: |
|---|
| 507 | $this->body->set('rows', ''); |
|---|
| 508 | $this->body->set('row_count', 0); |
|---|
| 509 | endif; |
|---|
| 510 | |
|---|
| 511 | if (array_key_exists('table_class', $data)): |
|---|
| 512 | $this->body->set('table_class', $data['table_class']); |
|---|
| 513 | else: |
|---|
| 514 | $this->body->set('table_class', 'data'); |
|---|
| 515 | endif; |
|---|
| 516 | |
|---|
| 517 | if (array_key_exists('header_orientation', $data)): |
|---|
| 518 | $this->body->set('header_orientation', $data['header_orientation']); |
|---|
| 519 | else: |
|---|
| 520 | $this->body->set('header_orientation', 'col'); |
|---|
| 521 | endif; |
|---|
| 522 | |
|---|
| 523 | if (array_key_exists('table_footer', $data)): |
|---|
| 524 | $this->body->set('table_footer', $data['table_footer']); |
|---|
| 525 | else: |
|---|
| 526 | $this->body->set('table_footer', ''); |
|---|
| 527 | endif; |
|---|
| 528 | |
|---|
| 529 | if (array_key_exists('table_caption', $data)): |
|---|
| 530 | $this->body->set('table_caption', $data['table_caption']); |
|---|
| 531 | else: |
|---|
| 532 | $this->body->set('table_caption', ''); |
|---|
| 533 | endif; |
|---|
| 534 | |
|---|
| 535 | if (array_key_exists('is_sortable', $data)) { |
|---|
| 536 | if ($data['is_sortable'] != true) { |
|---|
| 537 | $this->body->set('sort_table_class', ''); |
|---|
| 538 | } |
|---|
| 539 | } else { |
|---|
| 540 | $this->body->set('sort_table_class', 'tablesorter'); |
|---|
| 541 | } |
|---|
| 542 | |
|---|
| 543 | if (array_key_exists('table_row_template', $data)): |
|---|
| 544 | $this->body->set('table_row_template', $data['table_row_template']); |
|---|
| 545 | else: |
|---|
| 546 | ; |
|---|
| 547 | endif; |
|---|
| 548 | |
|---|
| 549 | // show the no data error msg |
|---|
| 550 | if (array_key_exists('show_error', $data)): |
|---|
| 551 | $this->body->set('show_error', $data['show_error']); |
|---|
| 552 | else: |
|---|
| 553 | $this->body->set('show_error', true); |
|---|
| 554 | endif; |
|---|
| 555 | |
|---|
| 556 | $this->body->set('table_id', str_replace('.', '-', $data['params']['do']).'-table'); |
|---|
| 557 | |
|---|
| 558 | return; |
|---|
| 559 | |
|---|
| 560 | |
|---|
| 561 | } |
|---|
| 562 | |
|---|
| 563 | } |
|---|
| 564 | |
|---|
| 565 | class owa_openFlashChartView extends owa_view { |
|---|
| 566 | |
|---|
| 567 | function owa_openFlashChartView() { |
|---|
| 568 | |
|---|
| 569 | owa_openFlashChartView::__construct(); |
|---|
| 570 | |
|---|
| 571 | return; |
|---|
| 572 | } |
|---|
| 573 | |
|---|
| 574 | function __construct() { |
|---|
| 575 | |
|---|
| 576 | return parent::__construct(); |
|---|
| 577 | |
|---|
| 578 | } |
|---|
| 579 | |
|---|
| 580 | function render($data) { |
|---|
| 581 | |
|---|
| 582 | // load template |
|---|
| 583 | $this->t->set_template('wrapper_blank.tpl'); |
|---|
| 584 | $this->body->set_template('ofc.tpl'); |
|---|
| 585 | // set |
|---|
| 586 | $this->body->set('widget', $this->get('widget')); |
|---|
| 587 | $this->body->set('height', $this->get('height')); |
|---|
| 588 | $this->body->set('width', $this->get('width')); |
|---|
| 589 | $this->body->set('dom_id', $this->get('dom_id')); |
|---|
| 590 | $this->body->set('params', $this->get('params')); |
|---|
| 591 | |
|---|
| 592 | return; |
|---|
| 593 | |
|---|
| 594 | } |
|---|
| 595 | |
|---|
| 596 | } |
|---|
| 597 | |
|---|
| 598 | class owa_sparklineJsView extends owa_view { |
|---|
| 599 | |
|---|
| 600 | function owa_sparklineJsView() { |
|---|
| 601 | |
|---|
| 602 | return owa_sparklinejSView::__construct(); |
|---|
| 603 | } |
|---|
| 604 | |
|---|
| 605 | function __construct() { |
|---|
| 606 | |
|---|
| 607 | return parent::__construct(); |
|---|
| 608 | |
|---|
| 609 | } |
|---|
| 610 | |
|---|
| 611 | function render($data) { |
|---|
| 612 | |
|---|
| 613 | // load template |
|---|
| 614 | $this->t->set_template('wrapper_blank.tpl'); |
|---|
| 615 | $this->body->set_template('sparklineJs.tpl'); |
|---|
| 616 | // set |
|---|
| 617 | $this->body->set('widget', $data['widget']); |
|---|
| 618 | $this->body->set('type', $data['type']); |
|---|
| 619 | $this->body->set('height', $data['height']); |
|---|
| 620 | $this->body->set('width', $data['width']); |
|---|
| 621 | $this->body->set('values', $data['series']['values']); |
|---|
| 622 | $this->body->set('dom_id', $data['dom_id'].rand()); |
|---|
| 623 | //$this->setJs("includes/jquery/jquery.sparkline.js"); |
|---|
| 624 | return; |
|---|
| 625 | } |
|---|
| 626 | |
|---|
| 627 | |
|---|
| 628 | } |
|---|
| 629 | |
|---|
| 630 | class owa_chartView extends owa_view { |
|---|
| 631 | |
|---|
| 632 | function owa_chartView() { |
|---|
| 633 | |
|---|
| 634 | return owa_chartView::__construct(); |
|---|
| 635 | } |
|---|
| 636 | |
|---|
| 637 | function __construct() { |
|---|
| 638 | |
|---|
| 639 | return parent::__construct(); |
|---|
| 640 | |
|---|
| 641 | } |
|---|
| 642 | |
|---|
| 643 | function render($data) { |
|---|
| 644 | |
|---|
| 645 | // load template |
|---|
| 646 | $this->t->set_template('wrapper_blank.tpl'); |
|---|
| 647 | $this->body->set_template('chart_dom.tpl'); |
|---|
| 648 | // set |
|---|
| 649 | $this->body->set('widget', $data['widget']); |
|---|
| 650 | $this->body->set('type', $data['type']); |
|---|
| 651 | //print_r($this->get('height')); |
|---|
| 652 | //height should be passed in as a request params as it sets the height of the actual flash object |
|---|
| 653 | $this->body->set('height', $this->get('height')); |
|---|
| 654 | //width should always be 100% |
|---|
| 655 | $this->body->set('width', $this->get('width')); |
|---|
| 656 | $this->body->set('data', $this->get('chart_data')); |
|---|
| 657 | $this->body->set('dom_id', $data['dom_id'].rand().'Chart'); |
|---|
| 658 | $this->setJs("includes/swfobject.js"); |
|---|
| 659 | return; |
|---|
| 660 | } |
|---|
| 661 | |
|---|
| 662 | } |
|---|
| 663 | |
|---|
| 664 | class owa_mailView extends owa_view { |
|---|
| 665 | |
|---|
| 666 | // post office |
|---|
| 667 | var $po; |
|---|
| 668 | var $postProcessView = true; |
|---|
| 669 | |
|---|
| 670 | function owa_mailView() { |
|---|
| 671 | |
|---|
| 672 | |
|---|