/** * Create and Set as active the isp panels * @param unknown_type $panelvar */ public static function setAsActive($panelvar, $ispId) { // Disable all the control panels Doctrine_Query::create()->update('Panels')->set('active', '?', 0)->execute(); if (!empty($panelvar)) { $isppanel = Doctrine_Query::create()->from('Panels')->where("name = ?", $panelvar)->limit(1)->execute(array(), Doctrine::HYDRATE_ARRAY); // ISP Panel module has not been created yet if (empty($isppanel)) { $panel = new Panels(); $path = PROJECT_PATH . "/library/Shineisp/Plugins/Panels/{$panelvar}"; if (!empty($panelvar)) { $config = simplexml_load_file($path . "/config.xml"); if ($config) { $conf = array(); $attributes = $config->attributes(); // create the params array foreach ($config->configuration->children() as $field => $value) { $conf[$field] = (string) $value; } // Save the configuration $panel['name'] = $attributes['name']; $panel['isp_id'] = $ispId; $panel['params'] = json_encode($conf); $panel['active'] = 0; $panel->save(); } } } // Enable only the set isp panel in the ISP Profile return Doctrine_Query::create()->update('Panels')->set('active', '?', 1)->where('name = ?', $panelvar)->execute(); } }
// we posted . characters, but something converts them to _ (HTTP 1.1 standard) $r = array(); foreach ($_REQUEST as $i => $v) { $r[join('.', explode('_', $i))] = $v; //convert _ back to . } $Panels = array(); for ($i0 = 0; isset($r['0.' . $i0]); $i0++) { $Panels[$i0] = array('id' => @$r['0.' . $i0 . '.0'], 'panel' => @$r['0.' . $i0 . '.0'], 'court' => @$r['0.' . $i0 . '.1']); $Panels[$i0]['members'] = array(); for ($i1 = 0; isset($r['0.' . $i0 . '.2.' . $i1]); $i1++) { $Panels[$i0]['members'][$i1] = @$r['0.' . $i0 . '.2.' . $i1 . '']; } } $Panels = new Panels($Panels); if ($Panels->save() !== false) { die('ok:' . $_SERVER['PHP_SELF']); } else { die(''); } exit; // do not show the interface } $buttons = ""; if (isset($_REQUEST['edit'])) { $edit = true; } else { $edit = false; } $Panels = new Panels(); writeHead("<TITLE>Panels - VIRO - ADL Prototype</TITLE>" . ($edit ? '<SCRIPT type="text/javascript" src="edit.js"></SCRIPT>' : '<SCRIPT type="text/javascript" src="navigate.js"></SCRIPT>') . "\n");