Added possibility to add additional map_values to queries.
[ajatus.git] / plugins / ajatus / helpers.php
blob68bdf2b55843f2bf3a5704aa1d38c2e0b4a03799
1 <?php
2 /**
3 * This file is part of
4 * Ajatus - Distributed CRM
5 *
6 * Copyright (c) 2008 Jerry Jalava <jerry.jalava@gmail.com>
7 * Copyright (c) 2008 Nemein Oy <http://nemein.com>
8 * Website: http://ajatus.info
9 * Licensed under the GPL license
10 * http://www.gnu.org/licenses/gpl.html
14 class ajatus_helpers
16 private $connection;
17 private $configuration;
18 private $cache;
20 public function __construct(&$connection, $configuration)
22 $this->connection =& $connection;
23 $this->configuration =& $configuration;
26 public function __get($helper)
28 return $this->load_helper($helper);
31 private function &load_helper($name)
33 if (isset($this->cache[$name]))
35 return $this->cache[$name];
38 $classname = "ajatus_helpers_{$name}";
40 if (! class_exists($classname))
42 throw new ajatus_helper_exception("No helper {$name} found!");
45 $this->cache[$name] = new $classname(&$this->connection, &$this->configuration);
47 return $this->cache[$name];