function settings($action) { global $_out, $_struct; if (($xml = $this->getDataXML()) && ($e = $xml->getElementById('settings'))) { $form = new form($e); $form->replaceURI(array('MODULE' => $this->getId(), 'SECTION' => $this->getSection()->getId(), 'PATH_DATA_FILE_CLIENT' => ABS_PATH_DATA_CLIENT . ap::id($this->getSection()->getId()) . '.xml', 'PATH_DATA_FILE_AP' => ABS_PATH_DATA_AP . ap::id($this->getSection()->getId()) . '.xml')); if ($ff = $form->getField('section')) { apSectionEdit::seclist(ap::getClientstructure()->de(), $ff, $ar = array()); } switch ($action) { case 'update': case 'apply_update': $form->save($_REQUEST); break; case 'edit': if (($id = param('section')) && ($sec = $_struct->getSection($id)) && ($modules = $sec->getModules())) { $xml = new xml(null, 'modules', false); foreach ($modules as $m) { $xml->de()->appendChild($xml->importNode($m->getRootElement(), false)); } ap::ajaxResponse($xml); } break; } $form->load(); $_out->addSectionContent($form->getRootElement()); $this->addTemplate('tpl.xsl'); } }
static function removeSection($id) { global $_struct; if ($sec = $_struct->getSection(ap::id($id))) { $modules = $sec->getModules(); foreach ($modules as $m) { apModuleManager::removeModule($sec->getId(), $m->getId()); } ap::getClientstructure()->removeSection($sec->getId(), true); ap::getClientstructure()->save(); $sec->remove(true); } }
static function addSection($id, $title, $section = null, $save = true) { global $_struct; if ($s = ap::getClientstructure()->addSection($id, $title, $section)) { if ($section instanceof section) { $section = $_struct->getElementById($section->getId()); } $_struct->addSection($id, $title, $section); } if ($save) { ap::getClientstructure()->save(); } return $s; }
static function getClientSection($id) { $struct = ap::getClientstructure(); return $struct->getSection(ap::id($id)); }