function showEditGroupGeneralRes() { $displaySysAdmin = new DisplaySysAdmin(); $survey = new Survey($_SESSION['SUID']); $gid = getFromSessionParams('gid'); $_SESSION['GID'] = $gid; $content = ""; if ($gid != '') { //edit $group = $survey->getGroup($gid); $content = $displaySysAdmin->displaySuccess(Language::messageGroupChanged(loadvar(SETTING_GROUP_NAME))); } else { //add group! if (loadvar(SETTING_GROUP_NAME) != "") { $group = new Group(); $group->setSuid($_SESSION['SUID']); $_SESSION['GID'] = $group->getGid(); $content = $displaySysAdmin->displaySuccess(Language::messageGroupAdded(loadvar(SETTING_GROUP_NAME))); } } $checker = new Checker($_SESSION['SUID']); if ($gid == '') { $checks = $checker->checkName(loadvar(SETTING_GROUP_NAME)); if (sizeof($checks) > 0) { $content = implode("<br/>", $checks); return $this->showAddGroup($content); } } /* ADD ALL SORTS OF CHECKS!! */ if ($gid != '' || loadvar(SETTING_GROUP_NAME) != "") { $group->setName(trim(loadvar(SETTING_GROUP_NAME))); $group->setTemplate(loadvar(SETTING_GROUP_TEMPLATE)); if (loadvar(SETTING_GROUP_TEMPLATE) == TABLE_TEMPLATE_CUSTOM) { $group->setCustomTemplate(loadvarAllowHTML(SETTING_GROUP_CUSTOM_TEMPLATE)); } else { $group->setCustomTemplate(""); } if (Config::xiExtension()) { $group->setXiTemplate(loadvar(SETTING_GROUP_XI_TEMPLATE)); } $group->save(); $checker = new Checker($_SESSION['SUID']); $checks = $checker->checkGroup($group); if (sizeof($checks) > 0) { $content .= $displaySysAdmin->displayError(implode("<br/>", $checks)); } } /* compile */ $compiler = new Compiler($_SESSION['SUID'], getSurveyVersion($survey)); $mess = $compiler->generateGroups(array($group)); if (loadvar(SETTING_GROUP_TEMPLATE) == TABLE_TEMPLATE_CUSTOM) { $mess = $compiler->generateGetFillsGroups(array($group)); $mess = $compiler->generateInlineFieldsGroups(array($group)); } /* update last page */ $_SESSION['LASTPAGE'] = substr($_SESSION['LASTPAGE'], 0, strripos($_SESSION['LASTPAGE'], "res")); if ($gid != '') { return $displaySysAdmin->showEditGroup($_SESSION['GID'], $content); } else { return $this->showSection($content); } }