コード例 #1
0
    function createForm()
    {
        $form = new Am_Form_Admin();
        $form->addText('title', array('class' => 'el-wide'))->setLabel(___('Title'))->addRule('required', 'This field is required');
        $form->addText('desc', array('class' => 'el-wide'))->setLabel(___('Description'));
        $form->addText('path', array('class' => 'el-wide'))->setId('page-path')->setLabel(___("Path\n" . 'will be used to construct user-friendly url, in case of you leave ' . 'it empty aMember will use id of this page to do it'));
        $root_url = Am_Controller::escape(Am_Di::getInstance()->config->get('root_url'));
        $form->addStatic()->setLabel(___('Permalink'))->setContent(<<<CUT
<div data-root_url="{$root_url}" id="page-permalink"></div>
CUT
);
        $form->addScript()->setScript(<<<CUT
\$('#page-path').bind('keyup', function(){
    \$('#page-permalink').closest('.row').toggle(\$(this).val() != '');
    \$('#page-permalink').html(\$('#page-permalink').data('root_url') + '/page/' + encodeURIComponent(\$(this).val()).replace(/%20/g, '+'))
}).trigger('keyup')
CUT
);
        $form->addAdvCheckbox('hide')->setLabel(___("Hide\n" . "do not display this item link in members area"));
        $placeholder_items =& $options['placeholder_items'];
        foreach ($this->getUserTagOptions() as $k => $v) {
            $placeholder_items[] = array($v, $k);
        }
        $form->addHtmlEditor('html')->setMceOptions($options);
        $form->addAdvCheckbox('use_layout')->setId('use-layout')->setLabel(___("Display inside layout\nWhen displaying to customer, will the\nheader/footer from current theme be displayed?"));
        $form->addSelect('tpl')->setId('use-layout-tpl')->setLabel(___("Template\nalternative template for this page") . "\n" . ___("aMember will look for templates in [application/default/views/] folder\n" . "and in theme's [/] folder\n" . "and template filename must start with [layout]"))->loadOptions($this->getTemplateOptions());
        $form->addScript()->setScript(<<<CUT
\$('#use-layout').change(function(){
    \$('#use-layout-tpl').closest('.row').toggle(this.checked);
}).change()
CUT
);
        $form->addElement(new Am_Form_Element_ResourceAccess())->setName('_access')->setLabel(___('Access Permissions'));
        $form->addText('no_access_url', array('class' => 'el-wide'))->setLabel(___("No Access URL\ncustomer without required access will be redirected to this url\nleave empty if you want to redirect to default 'No access' page"));
        $this->addCategoryToForm($form);
        $fs = $form->addAdvFieldset('meta', array('id' => 'meta'))->setLabel(___('Meta Data'));
        $fs->addText('meta_title', array('class' => 'el-wide'))->setLabel(___('Title'));
        $fs->addText('meta_keywords', array('class' => 'el-wide'))->setLabel(___('Keywords'));
        $fs->addText('meta_description', array('class' => 'el-wide'))->setLabel(___('Description'));
        return $form;
    }
コード例 #2
0
 function createForm()
 {
     $form = new Am_Form_Admin();
     $form->addText('title', array('size' => 80))->setLabel('Title')->addRule('required', 'This field is required');
     $form->addText('desc', array('size' => 80))->setLabel(___('Description'));
     $form->addAdvCheckbox('hide')->setLabel(___("Hide\n" . "do not display this item link in members area"));
     $form->addAdvCheckbox('use_layout')->setLabel("Dislpay inside layout\nwhen displaying to customer will\nthe header/footer from current theme be displayed?");
     $form->addHtmlEditor('html');
     //->setLabel('HTML code')->addRule('required', 'This field is required');
     $form->addElement(new Am_Form_Element_ResourceAccess())->setName('_access')->setLabel(___('Access Permissions'));
     return $form;
 }