function setHelpGroupControl($id)
 {
     $id = trim($id);
     $hgclf = new HelpGroupControlListFactory();
     if ($this->Validator->isResultSetWithRows('help_group_control', $hgclf->getByID($id), TTi18n::gettext('Help Group Control is invalid'))) {
         $this->data['help_group_control_id'] = $id;
         return TRUE;
     }
     return FALSE;
 }
 */
extract(FormVariables::GetVariables(array('action', 'id', 'help_data', 'script', 'name')));
$hgcf = new HelpGroupControlFactory();
switch ($action) {
    case 'submit':
        Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10);
        $hgcf->setId($help_data['id']);
        $hgcf->setScriptName($help_data['script_name']);
        $hgcf->setName($help_data['name']);
        if ($hgcf->isValid()) {
            $hgcf->Save();
            Redirect::Page(URLBuilder::getURL(NULL, 'HelpGroupControlList.php'));
            break;
        }
    default:
        $hgclf = new HelpGroupControlListFactory();
        if (isset($script) and !isset($id)) {
            Debug::Text('Script and Name were passed, attempt lookup!', __FILE__, __LINE__, __METHOD__, 10);
            $hgclf->getByScriptAndName($script, $name);
            if ($hgclf->getRecordCount() > 0) {
                $id = $hgclf->getCurrent()->getID();
                Debug::Text('Found already existing ID: ' . $id, __FILE__, __LINE__, __METHOD__, 10);
            } else {
                $help_data = array('script_name' => $script, 'name' => $name);
            }
        }
        if (isset($id)) {
            BreadCrumb::setCrumb($title);
            $hgclf->getById($id);
            foreach ($hgclf as $help_obj) {
                //Debug::Arr($station,'Department', __FILE__, __LINE__, __METHOD__,10);
        break;
    case 'delete' or 'undelete':
        if (strtolower($action) == 'delete') {
            $delete = TRUE;
        } else {
            $delete = FALSE;
        }
        $hgclf = new HelpGroupControlListFactory();
        foreach ($ids as $id) {
            $hgclf->getById($id);
            foreach ($hgclf as $help_group_control_obj) {
                $help_group_control_obj->setDeleted($delete);
                $help_group_control_obj->Save();
            }
        }
        Redirect::Page(URLBuilder::getURL(NULL, 'HelpGroupControlList.php'));
        break;
    default:
        $hgclf = new HelpGroupControlListFactory();
        $hgclf->getAll($current_user_prefs->getItemsPerPage(), $page, NULL, $sort_array);
        $pager = new Pager($hgclf);
        foreach ($hgclf as $help_obj) {
            $help[] = array('id' => $help_obj->GetId(), 'script_name' => $help_obj->getScriptName(), 'name' => $help_obj->getName(), 'deleted' => $help_obj->getDeleted());
        }
        $smarty->assign_by_ref('help_groups', $help);
        $smarty->assign_by_ref('sort_column', $sort_column);
        $smarty->assign_by_ref('sort_order', $sort_order);
        $smarty->assign_by_ref('paging_data', $pager->getPageVariables());
        break;
}
$smarty->display('help/HelpGroupControlList.tpl');