コード例 #1
0
ファイル: Callshop_booths.php プロジェクト: sayemk/a2billing
<?php

require_once "./lib/defines.php";
require_once "./lib/module.access.php";
require_once "a2blib/Class.CallShop.inc.php";
require_once "a2blib/Form/Class.SelectionForm.inc.php";
require_once "a2blib/Form/Class.SqlRefField.inc.php";
$menu_section = 'menu_agents';
$CS_Form = new CallshopPage();
$CS_Form->checkRights(ACX_AGENTS);
$CS_Form->init();
// TODO: select agent!
$CS_Form->ask_agent = true;
$SEL_Form = new SelectionForm();
$SEL_Form->init();
$SEL_Form->model[] = new SqlRefField(_("Agent"), 'agentid', 'cc_agent', 'id', 'name');
$CS_Form->agentid = $SEL_Form->getpost_single('agentid');
$PAGE_ELEMS[] =& $SEL_Form;
if (!empty($CS_Form->agentid)) {
    $PAGE_ELEMS[] =& $CS_Form;
}
require "PP_page.inc.php";
コード例 #2
0
/* We will be using different tables, fields, according to one selection box
   at the top of the page: */
$sub_cats = array();
$sub_cats[] = array("all", _("All"));
$sub_cats[] = array("only", _("Generic only"));
$sub_cats[] = array("feature", _("Features"));
$SEL_Form = new SelectionForm();
$SEL_Form->init();
$SEL_Form->model[] = new RefField(_("Category"), 'cat', $sub_cats, _("Select the category of templates."));
// Prepare the model for the base table.
$HD_Form = new FormHandler('subscription_template', _("Templates"), _("Template"));
$HD_Form->checkRights(ACX_MISC);
$HD_Form->init();
$HD_Form->addAllFollowParam($SEL_Form->prefix . 'cat', $SEL_Form->getpost_dirty('cat'), false);
// Modify the model according to the selection:
switch ($SEL_Form->getpost_single('cat')) {
    case 'all':
    default:
        $HD_Form->views['ask-edit'] = $HD_Form->views['ask-edit2'] = $HD_Form->views['edit'] = $HD_Form->views['ask-add'] = $HD_Form->views['ask-add2'] = $HD_Form->views['add'] = $HD_Form->views['ask-delete'] = $HD_Form->views['delete'] = new IdleView();
        break;
    case 'feature':
        $HD_Form->model_table = 'subscription_feature_templ';
        break;
    case 'only':
        $HD_Form->model_table = 'ONLY subscription_template';
        break;
}
$PAGE_ELEMS[] =& $SEL_Form;
$PAGE_ELEMS[] =& $HD_Form;
$HD_Form->model[] = new PKeyFieldEH(_("ID"), 'id');
$HD_Form->model[] = new TextFieldEH(_("Name"), 'name', _("Internal name"));