Exemplo n.º 1
0
function setUpGroups($lang)
{
    if (!file_exists(GROUP_FILE_LOCATION)) {
        $aGroupDB = new Groups();
        $aGroupDB->setFileName(GROUP_FILE_LOCATION);
        $names = ImageTypes::getMenuNames();
        foreach ($names as $name) {
            $aGroup = new Group();
            $aGroup->setType($lang[$name]);
            $aGroup->setGroupImage($name);
            $aGroup->rebuildElementLine();
            $aGroupDB->addElement($aGroup);
        }
        $aGroupDB->save();
    } else {
        // validate we have all the default groups
        $addedElement = false;
        $aGroupDB = new Groups(GROUP_FILE_LOCATION);
        $names = ImageTypes::getMenuNames();
        foreach ($names as $name) {
            if ($aGroupDB->getAGroup($name) == "") {
                $aGroup = new Group();
                $aGroup->setType($lang[$name]);
                $aGroup->setGroupImage($name);
                $aGroup->rebuildElementLine();
                $aGroupDB->addElement($aGroup);
                $addedElement = true;
            }
        }
        if ($addedElement) {
            $aGroupDB->save();
        }
    }
}
Exemplo n.º 2
0
require_once '..' . DIRECTORY_SEPARATOR . 'include.php';
require_once '..' . DIRECTORY_SEPARATOR . 'include_globals.php';
require_once CLASS_FILE_LOCATION . '/imagetypes.class.php';
## Security validation's
$authCheck = new Login(USERDB_FILE_LOCATION, $config['use_domus_security']);
if (!$authCheck->login()) {
    header("Location: ../login.php?from=admin/users");
    exit;
}
if ($authCheck->getUser()->getSecurityLevel() != 0) {
    header("Location: ../index.php");
    exit;
}
$tpl->set('sec_level', $authCheck->getUser()->getSecurityLevel());
$groupings = $groups->getElementObjects(ALL_OBJECTS_D);
$thenamelist = ImageTypes::getMenuNames();
## Set template parameters
$tpl->set('title', $lang['groups']);
$tpl->set('page', 'groups');
$tpl_body = new Template(TPL_FILE_LOCATION . 'groups_view.tpl');
$tpl_body->set('lang', $lang);
$tpl_body->set('groups', $groupings);
$tpl_body->set('config', $config);
$mustSave = false;
if (!isset($_GET["action"])) {
    $tpl_add = new Template(TPL_FILE_LOCATION . 'groups_add.tpl');
    $tpl_add->set('lang', $lang);
    $tpl_add->set('config', $config);
    $tpl_add->set('imagenames', $thenamelist);
    $tpl_body->set('form', $tpl_add);
} else {