function manage() { global $db; expHistory::set('manageable', $this->params); $classes = array(); $dir = BASE . "framework/modules/ecommerce/billingcalculators"; if (is_readable($dir)) { $dh = opendir($dir); while (($file = readdir($dh)) !== false) { if (is_file("{$dir}/{$file}") && substr("{$dir}/{$file}", -4) == ".php") { include_once "{$dir}/{$file}"; $classname = substr($file, 0, -4); $id = $db->selectValue('billingcalculator', 'id', 'calculator_name="' . $classname . '"'); if (empty($id)) { $calobj = null; $calcobj = new $classname(); if ($calcobj->isSelectable() == true) { $obj = new billingcalculator(array('title' => $calcobj->name(), 'user_title' => $calcobj->title, 'body' => $calcobj->description(), 'calculator_name' => $classname, 'enabled' => false)); $obj->save(); } } } } } $bcalc = new billingcalculator(); $calculators = $bcalc->find('all'); assign_to_template(array('calculators' => $calculators)); }