<?php

/**
 * $Id: ajax_edit_configuration.php 19290 2013-05-26 19:48:24Z phenxdesign $
 *
 * @package    Mediboard
 * @subpackage System
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 19290 $
 */
$inherit = CValue::get("inherit");
$module = CValue::get("module");
if (!is_array($inherit)) {
    $inherit = array($inherit);
}
$all_inherits = array_keys(CConfiguration::getModel($inherit));
$smarty = new CSmartyDP();
$smarty->assign("module", $module);
$smarty->assign("inherit", $inherit);
$smarty->assign("all_inherits", $all_inherits);
$smarty->display("inc_edit_configuration.tpl");
    if (!is_array($values)) {
        addLocale("Config", "global", "config-{$prefix}");
        if ($add_desc) {
            addLocale("Config", "global", "config-{$prefix}-desc");
        }
        return;
    }
    foreach ($values as $key => $value) {
        addLocale("Config", $category, "config-{$prefix}-{$key}");
        if ($add_desc) {
            addLocale("Config", $category, "config-{$prefix}-{$key}-desc");
        }
    }
}
if ($module && $module != "common") {
    $model = CConfiguration::getModel();
    $features = array();
    foreach ($model as $_model) {
        foreach ($_model as $_feature => $_submodel) {
            if (strpos($_feature, $module) === 0) {
                $parts = explode(" ", $_feature);
                array_shift($parts);
                // Remove module name
                $item = array_pop($parts);
                // Remove config name
                $prefix = implode("-", $parts);
                if (!isset($features[$prefix])) {
                    $features[$prefix] = array();
                }
                $features[$prefix][$item] = $item;
            }