protected function setProfile() { if (!$this->request_exists('profile') || !($profile = $this->request('profile'))) { I2CE::raiseError("No profile named"); return false; } if (!I2CE_MagicDataNode::checkKey($profile)) { I2CE::rasieError("Invalid profile"); return false; } $path = "/modules/CachedForms/export/profiles/{$profile}"; $config = I2CE::getConfig()->traverse($path, true); if (!$config instanceof I2CE_MagicDataNode) { I2CE::rasieError("Invalid profile structure "); return false; } if ($this->request_exists('export') && is_array($forms = $this->request('export'))) { $forms = array_keys($forms); } else { $forms = array(); } foreach ($config->getKeys() as $form) { if (!in_array($form, $forms)) { $config->{$form} = 0; } } foreach ($forms as $form) { $config->{$form} = 1; } return true; }