function createForm()
 {
     $form = new Am_Form_Admin();
     $form->addInteger("tag")->setLabel(___("Sort order"))->addRule('required');
     $form->addAdvCheckbox('_is_disabled')->setLabel(___('Is Disabled?'));
     $form->addText("title")->setLabel(___("Title"))->addRule('required');
     return $form;
 }
Example #2
0
 function createForm()
 {
     $form = new Am_Form_Admin();
     $form->addInteger("tag")->setLabel(___("Sort order"))->addRule('required');
     $form->addAdvCheckbox('_is_disabled')->setLabel(___('Is Disabled?'));
     $form->addText('title')->setLabel(___('Title'))->addRule('required');
     if (!$this->grid->getRecord()->pk()) {
         $gr = $form->addGroup();
         $gr->addStatic()->setContent('<span>' . $this->country . '-</span>');
         $gr->addText('state', array('size' => 5))->addRule('required');
         $gr->setLabel(___('Code'));
     }
     $form->addHidden('country');
     return $form;
 }
Example #3
0
 function createForm()
 {
     $form = new Am_Form_Admin();
     $form->addText('comment', 'size=60')->setLabel(___('Comment'))->addRule('required');
     $form->addText('key', 'size=60 maxlength=50')->setLabel(___('Api Key'))->addRule('required')->addRule('regex', ___('Digits and latin letters only please'), '/^[a-zA-Z0-9]+$/')->addRule('minlength', ___('Key must be 20 chars or longer'), 20);
     $form->addAdvCheckbox('is_disabled')->setLabel(___('Is Disabled'));
     $fs = $form->addFieldset('perms')->setLabel(___('Permissions'));
     $gr = $fs->addGroup('', array('class' => 'no-label'));
     $module = $this->getModule();
     foreach ($module->getControllers() as $alias => $record) {
         $gr->addStatic()->setContent("<div style='width: 30%; font-weight: bold;'>{$alias}  - " . $record['comment'] . '</div>');
         foreach ($record['methods'] as $method) {
             $gr->addCheckbox("_perms[{$alias}][{$method}]")->setContent($method);
         }
         $gr->addStatic()->setContent("<br />");
     }
     return $form;
 }
Example #4
0
    function createForm()
    {
        $form = new Am_Form_Admin();
        $record = $this->getRecord();
        $plugins = $this->getDi()->plugins_newsletter->loadEnabled()->getAllEnabled();
        if ($record->isLoaded()) {
            if ($record->plugin_id) {
                $group = $form->addFieldset();
                $group->setLabel(ucfirst($record->plugin_id));
                $form->addStatic()->setLabel(___('Plugin List Id'))->setContent(Am_Controller::escape($record->plugin_list_id));
            }
        } else {
            if (count($plugins) > 1) {
                $sel = $form->addSelect('plugin_id')->setLabel(___('Plugin'));
                $sel->addOption(___('Standard'), '');
                foreach ($plugins as $pl) {
                    if (!$pl->canGetLists() && $pl->getId() != 'standard') {
                        $sel->addOption($pl->getTitle(), $pl->getId());
                    }
                }
            }
            foreach ($plugins as $pl) {
                $group = $form->addFieldset($pl->getId())->setId('headrow-' . $pl->getId());
                $group->setLabel($pl->getTitle());
            }
            $form->addText('plugin_list_id')->setLabel(___("Plugin List Id\nvalue required"));
            $form->addScript()->setScript(<<<END
\$(function(){
    function showHidePlugins(el, skip)
    {
        var txt = \$("input[name='plugin_list_id']");
        var enabled = el.size() && (el.val() != '');
        txt.closest(".row").toggle(enabled);
        if (enabled)
            txt.rules("add", { required : true});
        else if(skip)
            txt.rules("remove", "required");
        var selected = (el.size() && el.val()) ? el.val() : 'standard';
        \$("[id^='headrow-']").hide();
        \$("[id=headrow-"+selected+"-legend]").show();
        \$("[id=headrow-"+selected+"-pluginoptions]").show();
        \$("[id=headrow-"+selected+"]").show();
    }
    \$("select[name='plugin_id']").change(function(){
        showHidePlugins(\$(this), true);
    });
    showHidePlugins(\$("select[name='plugin_id']"), false);
});
END
);
        }
        $form->addText('title', array('class' => 'el-wide'))->setLabel(___('Title'))->addRule('required');
        $form->addText('desc', array('class' => 'el-wide'))->setLabel(___('Description'));
        $form->addAdvCheckbox('hide')->setLabel(___("Hide\n" . "do not display this item in members area"));
        $form->addAdvCheckbox('auto_subscribe')->setLabel(___("Auto-Subscribe users to list\n" . "once it becomes accessible for them"));
        foreach ($plugins as $pl) {
            $group = $form->addElement(new Am_Form_Container_PrefixFieldset('_vars'))->setId('headrow-' . $pl->getId() . '-pluginoptions');
            $gr = $group->addElement(new Am_Form_Container_PrefixFieldset($pl->getId()));
            $pl->getIntegrationFormElements($gr);
        }
        $group = $form->addFieldset('access')->setLabel(___('Access'));
        $group->addElement(new Am_Form_Element_ResourceAccess())->setName('_access')->setLabel(___('Access Permissions'))->setAttribute('without_free_without_login', 'true')->setAttribute('without_period', 'true');
        return $form;
    }
    function createForm()
    {
        $form = new Am_Form_Admin();
        $form->setAttribute('enctype', 'multipart/form-data');
        $form->setAttribute('target', '_top');
        $maxFileSize = min(ini_get('post_max_size'), ini_get('upload_max_filesize'));
        $el = $form->addElement(new Am_Form_Element_Upload('path', array(), array('prefix' => 'video')))->setLabel(___("Video/Audio File\n" . "(max upload size %s)\n" . "You can use this feature only for video and\naudio formats that %ssupported by %s%s", $maxFileSize, $this->getDi()->config->get('video_player', 'Flowplayer') == 'Flowplayer' ? '<a href="http://flowplayer.org/documentation/installation/formats.html" class="link" target="_blank">' : '<a href="http://www.longtailvideo.com/support/jw-player/28836/media-format-support/" class="link" target="_blank">', $this->getDi()->config->get('video_player', 'Flowplayer') == 'Flowplayer' ? 'Flowplayer' : 'JWPlayer', '</a>'))->setId('form-path');
        $jsOptions = <<<CUT
{
    onFileAdd : function (info) {
        var txt = \$(this).closest("form").find("input[name='title']");
        if (txt.data('changed-value')) return;
        txt.val(info.name);
    }
}
CUT;
        $el->setJsOptions($jsOptions);
        $form->addScript()->setScript(<<<CUT
\$(function(){
    \$("input[name='title']").change(function(){
        \$(this).data('changed-value', true);
    });
});
CUT
);
        $el->addRule('required');
        $form->addUpload('poster_id', null, array('prefix' => 'video-poster'))->setLabel(___("Poster Image\n" . "applicable only for video files"));
        $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->addAdvCheckbox('hide')->setLabel(___("Hide\n" . "do not display this item link in members area"));
        $form->addElement(new Am_Form_Element_PlayerConfig('config'))->setLabel(___("Player Configuration\n" . 'this option is applied only for video files'));
        $form->addSelect('tpl')->setLabel(___("Template\nalternative template for this video\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->addElement(new Am_Form_Element_ResourceAccess())->setName('_access')->setLabel(___('Access Permissions'));
        $form->addText('no_access_url', array('class' => 'el-wide'))->setLabel(___("No Access URL\n" . "customer without required access will see link to this url in " . "the player window\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'));
        $form->addEpilog('<div class="info">' . ___('In case of video do not start play before
full download and you use <a class="link" href="http://en.wikipedia.org/wiki/MPEG-4_Part_14">mp4 format</a>
more possible that metadata (moov atom) is located
at the end of file. There is special programs that allow to relocate
this metadata to the beginning of your file and allow play video before full
download (On Linux mashine you can use <em>qt-faststart</em> utility to do it).
Also your video editor can has option to locate metadata at beginning of file
(something like <em>FastStart</em> or <em>Web Optimized</em> option).
You need to relocate metadata for this file and reupload
it to aMember. You can use such utilites as <em>AtomicParsley</em> or similar
to check your file structure.') . '</div>');
        return $form;
    }
 public function createAccessForm()
 {
     static $form;
     if (!$form) {
         $form = new Am_Form_Admin();
         $form->setAction($url = $this->getUrl(null, 'addaccess', null, 'user_id', $this->user_id));
         $sel = $form->addSelect('product_id', array('class' => 'el-wide am-combobox'));
         $options = $this->getDi()->productTable->getOptions();
         $sel->addOption(___('Please select an item...'), '');
         foreach ($options as $k => $v) {
             $sel->addOption($v, $k);
         }
         $sel->addRule('required', ___('This field is required'));
         $form->addText('comment', array('class' => 'el-wide', 'placeholder' => ___('Comment for Your Reference')));
         $form->addDate('begin_date')->addRule('required', ___('This field is required'));
         $form->addDate('expire_date')->addRule('required', ___('This field is required'));
         $form->addAdvCheckbox('does_not_send_autoresponder');
         $form->addSaveButton(___('Add Access Manually'));
     }
     return $form;
 }
    function createForm()
    {
        $form = new Am_Form_Admin();
        $form->setAttribute('enctype', 'multipart/form-data');
        $form->setAttribute('target', '_top');
        $maxFileSize = min(ini_get('post_max_size'), ini_get('upload_max_filesize'));
        $el = $form->addElement(new Am_Form_Element_Upload('path', array(), array('prefix' => 'video')))->setLabel(___("Video File\n(max upload size %s)", $maxFileSize))->setId('form-path');
        $jsOptions = <<<CUT
{
    onFileAdd : function (info) {
        var txt = \$(this).closest("form").find("input[name='title']");
        if (txt.data('changed-value')) return;
        txt.val(info.name);
    }
}
CUT;
        $el->setJsOptions($jsOptions);
        $form->addScript()->setScript(<<<CUT
\$(function(){
    \$("input[name='title']").change(function(){
        \$(this).data('changed-value', true);
    });
});
CUT
);
        $el->addRule('required');
        $form->addText('title', array('size' => 50))->setLabel(___('Title'))->addRule('required', 'This field is required');
        $form->addText('desc', array('size' => 50))->setLabel(___('Description'))->addRule('required', 'This field is required');
        $form->addAdvCheckbox('hide')->setLabel(___("Hide\n" . "do not display this item link in members area"));
        $form->addElement(new Am_Form_Element_ResourceAccess())->setName('_access')->setLabel(___('Access Permissions'));
        return $form;
    }
    function createCleanUpForm()
    {
        $form = new Am_Form_Admin();
        $total_products = $this->getDi()->db->selectCell('SELECT count(product_id) FROM ?_product');
        $imported_products = $this->getDi()->db->selectCell("SELECT COUNT(id) FROM ?_data WHERE `table`='product' AND `key`='am3:id'");
        $total_users = $this->getDi()->db->selectCell('SELECT count(user_id) FROM ?_user');
        $imported_users = $this->getDi()->db->selectCell("SELECT COUNT(id) FROM ?_data WHERE `table`='user' AND `key`='am3:id'");
        $form->addStatic()->setLabel('IMPORTANT INFO')->setContent(<<<EOL
    <font color=red><b>Clean UP process cannot be reversed, so if you don't understand what are you doing, please navigate away from this page!</b></font><br/>
Sometimes this is necessary to remove all data from aMember's database and start import over. This form helps to do this in one go. <b>Please make sure that you don't have any importand data in database</b>, because it can't be restored after clean up. This is good idea to <b>make a backup</b> before "Clean Up" operation. <br/>
<b>DATA WHICH WILL BE REMOVED BY THIS OPERATION:</b><br/>
User Accounts<br/>
User Invoices/Payments<br/>
User CC info<br/>
Products enabled by setting below<br/>
Affiliate data(if aff module is enabled)<br/>
Newsletter subscriptions data(if newsletter module is enabled)<br/>
Helpdesk tickets(if helpdesk module is enabled)<br/>

EOL
);
        $form->addAdvCheckbox('remove_products')->setLabel('Remove products');
        $form->addPassword('password')->setLabel('Please confirm your Admin password');
        $form->addSaveButton('Clean Up');
        return $form;
    }
Example #9
0
 function createSaveReportForm($title)
 {
     $form = new Am_Form_Admin();
     $form->addText('title', array('class' => 'el-wide'))->setLabel(___('Title of Report for your Reference'))->setValue($title)->addRule('required');
     $form->addAdvCheckbox('add-to-dashboard')->setLabel(___('Add Report to My Dashboard'))->setValue(1);
     return $form;
 }