if ($errkey) {
            $err = strpos($errkey, 'err') === 0;
            if ($err) {
                $message = $this->Lang('err_chart') . '<br /><br />' . $this->Lang($errkey);
            } else {
                $message = $this->Lang($errkey);
            }
        } else {
            $err = TRUE;
            $message = $this->Lang('err_chart');
        }
        DisplayErrorPage($this, $smarty, $db, $params, $err, $message);
        return;
    }
} else {
    $res = $lyt->GetList($this, $bdata);
    if (is_array($res)) {
        $smarty->assign('items', $res);
        $smarty->assign('chart', $this->CreateInputSubmit($id, 'chart', $this->Lang('chart')));
        $fn = cms_join_path(dirname(__FILE__), 'templates', 'list.tpl');
        $tpl = @file_get_contents($fn);
        $hidden = $this->CreateInputHidden($id, 'view', 'list');
    } else {
        if ($res) {
            $err = strpos($res, 'err') === 0;
            if ($err) {
                $message = $this->Lang('err_list') . '<br /><br />' . $this->Lang($res);
            } else {
                $message = $this->Lang($res);
            }
        } else {
        $smarty->assign('image', $this->CreateImageObject($config['root_url'] . '/tmp/' . $basename, (int) $height + 30));
        $tpl = 'admin_chart.tpl';
        if ($titles == 0) {
            //force refresh next time
            $db->Execute('UPDATE ' . $pref . 'module_tmt_brackets SET chartbuild = 1 WHERE bracket_id=?', array($bracket_id));
        }
    } else {
        $message = $this->PrettyMessage('err_chart', FALSE);
        if ($errkey) {
            $message .= '<br /><br />' . $this->Lang($errkey);
        }
        $newparms = $this->GetEditParms($params, 'charttab', $message);
        $this->Redirect($id, 'addedit_comp', $returnid, $newparms);
    }
} else {
    $res = $lyt->GetList($this, $bdata, FALSE);
    if (is_array($res)) {
        $smarty->assign('pagetitle', $bdata['name']);
        if (!empty($bdata['description'])) {
            $smarty->assign('pagedesc', $bdata['description']);
        } else {
            $smarty->assign('pagedesc', null);
        }
        $smarty->assign('items', $res);
        $tpl = 'admin_list.tpl';
    } else {
        $message = $this->Lang('err_list');
        if ($res) {
            $message .= ': ' . strtolower($this->Lang($res));
        }
        $newparms = $this->GetEditParms($params, 'charttab', $message);