本文整理汇总了PHP中Am_Form_Admin::setAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP Am_Form_Admin::setAttribute方法的具体用法?PHP Am_Form_Admin::setAttribute怎么用?PHP Am_Form_Admin::setAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Am_Form_Admin
的用法示例。
在下文中一共展示了Am_Form_Admin::setAttribute方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$form = new Am_Form_Admin('form-grid-config');
$form->setAttribute('name', 'customize');
$form->addSortableMagicSelect('fields')->loadOptions($this->getFieldsOptions())->setLabel(___('Fields to Display in Grid'))->setJsOptions(<<<CUT
{
allowSelectAll:true,
sortable: true
}
CUT
);
foreach ($this->grid->getVariablesList() as $k) {
$form->addHidden($this->grid->getId() . '_' . $k)->setValue($this->grid->getRequest()->get($k, ""));
}
$form->addSaveButton();
$form->setDataSources(array($this->grid->getCompleteRequest()));
if ($form->isSubmitted()) {
$values = $form->getValue();
$this->setConfig($values['fields']);
$this->grid->redirectBack();
} else {
$form->setDataSources(array(new HTML_QuickForm2_DataSource_Array(array('fields' => $this->getSelectedFields()))));
echo $this->renderTitle();
echo sprintf('<div class="info">%s</div>', ___('You can change Number of %sRecords per Page%s in section %sSetup/Configuration%s', '<strong>', '</strong>', '<a class="link" href="' . REL_ROOT_URL . '/admin-setup" target="_top">', '</a>'));
echo $form;
}
}
示例2: createForm
public function createForm()
{
$form = new Am_Form_Admin();
$form->setAttribute('enctype', 'multipart/form-data');
$file = $form->addElement('file', 'upload[]')->setLabel(___('File'))->setAttribute('class', 'styled');
$file->addRule('required');
$form->addText('desc', array('class' => 'el-wide'))->setLabel(___('Description'));
$form->addHidden('prefix')->setValue($this->prefix);
return $form;
}
示例3: run
function run()
{
$form = new Am_Form_Admin('form-grid-payout');
$form->setAttribute('name', 'payout');
$date = $form->addDate('payout_date')->setLabel(___('Payout Date'))->setValue(sqlDate($this->getDi()->dateTime));
foreach ($this->grid->getVariablesList() as $k) {
$form->addHidden($this->grid->getId() . '_' . $k)->setValue($this->grid->getRequest()->get($k, ""));
}
$form->addSaveButton(___("Run Payout"));
$form->setDataSources(array($this->grid->getCompleteRequest()));
if ($form->isSubmitted() && $form->validate()) {
$values = $form->getValue();
$this->getDi()->affCommissionTable->runPayout($values['payout_date']);
$this->grid->redirectBack();
} else {
echo $this->renderTitle();
echo $form;
}
}
示例4: run
function run()
{
$form = new Am_Form_Admin('form-vomm-void');
$form->setAttribute('name', 'void');
$comm = $this->grid->getRecord();
$form->addText('amount', array('size' => 6))->setlabel(___('Void Amount'));
foreach ($this->grid->getVariablesList() as $k) {
$form->addHidden($this->grid->getId() . '_' . $k)->setValue($this->grid->getRequest()->get($k, ""));
}
$g = $form->addGroup();
$g->setSeparator(' ');
$g->addSubmit('_save', array('value' => ___("Void")));
$g->addStatic()->setContent(sprintf('<a href="%s" class="link" style="margin-left:0.5em">%s</a>', $this->grid->getBackUrl(), ___('Cancel')));
$form->setDataSources(array($this->grid->getCompleteRequest(), new HTML_QuickForm2_DataSource_Array(array('amount' => $comm->amount))));
if ($form->isSubmitted() && $form->validate()) {
$values = $form->getValue();
$this->void($values['amount']);
$this->grid->redirectBack();
} else {
echo $this->renderTitle();
echo $form;
}
}
示例5: createUploadForm
protected function createUploadForm($force_submited = false)
{
$form = new Am_Form_Admin('upload');
$form->setAction($this->getUrl(null, ''));
$form->setAttribute('enctype', 'multipart/form-data');
$file = $form->addElement('file', 'file[]')->setLabel(___('File'));
$file->setAttribute('class', 'styled');
$file->addRule('required', ___('This field is a requried field'));
$form->addElement('submit', '_submit_', array('value' => ___('Next')));
return $form;
}
示例6: run
public function run()
{
$form = new Am_Form_Admin();
$form->setAction($this->getUrl());
$form->setAttribute('name', 'export');
$form->setAttribute('target', '_blank');
$form->addElement('magicselect', 'fields_to_export')->loadOptions($this->getExportOptions())->setLabel(___('Fields To Export'));
$form->addElement('select', 'export_type')->loadOptions(Am_Grid_Export_Processor_Factory::getOptions())->setLabel(___('Export Format'))->setId('form-export-type');
foreach (Am_Grid_Export_Processor_Factory::createAll() as $id => $obj) {
$obj->buildForm($form->addElement('fieldset', $id)->setId('form-export-options-' . $id));
}
$form->addSubmit('export', array('value' => ___('Export')));
$script = <<<CUT
(function(\$){
\$(function(){
function update_options(\$sel) {
\$('[id^=form-export-options-]').hide();
\$('#form-export-options-' + \$sel.val()).show();
}
update_options(\$('#form-export-type'));
\$('#form-export-type').bind('change', function() {
update_options(\$(this));
})
})
})(jQuery)
CUT;
$form->addScript('script')->setScript($script);
$this->initForm($form);
if ($form->isSubmitted()) {
$values = $form->getValue();
$fields = array();
foreach ($values['fields_to_export'] as $fieldName) {
$fields[$fieldName] = $this->getField($fieldName);
}
$export = Am_Grid_Export_Processor_Factory::create($values['export_type']);
$export->run($this->grid, $this->getDataSource($fields), $fields, $values);
exit;
} else {
echo $this->renderTitle();
echo $form;
}
}
示例7: createForm
protected function createForm()
{
$form = new Am_Form_Admin();
$form->setAttribute('class', 'am-form-helpdesk');
return $form;
}
示例8: createForm
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;
}
示例9: createForm
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;
}
示例10: run
function run()
{
$form = new Am_Form_Admin('form-grid-merge');
$form->setAttribute('name', 'merge');
$user = $this->grid->getRecord();
$login = $form->addText('login');
$login->setId('login')->setLabel(___("Username of Source User\nmove information from"));
$login->addRule('callback', ___('Can not find user with such username'), array($this, 'checkUser'));
$login->addRule('callback', ___('You can not merge user with itself'), array($this, 'checkIdenticalUser'));
$target = $form->addStatic()->setContent(sprintf('<div>%s</div>', Am_Controller::escape($user->login)));
$target->setLabel(___("Target User\nmove information to"));
$script = <<<CUT
\$("input#login").autocomplete({
minLength: 2,
source: window.rootUrl + "/admin-users/autocomplete"
});
CUT;
$form->addStatic('', array('class' => 'no-label'))->setContent('<div class="info"><strong>' . ___("WARNING! Once [Merge] button clicked, all invoices, payments, logs\n" . "and other information regarding 'Source User' will be moved\n" . "to the 'Target User' account. 'Source User' account will be deleted.\n" . "There is no way to undo this operation!") . '</strong></div>');
$form->addScript('script')->setScript($script);
foreach ($this->grid->getVariablesList() as $k) {
$form->addHidden($this->grid->getId() . '_' . $k)->setValue($this->grid->getRequest()->get($k, ""));
}
$form->addSaveButton(___("Merge"));
$form->setDataSources(array($this->grid->getCompleteRequest()));
if ($form->isSubmitted() && $form->validate()) {
$values = $form->getValue();
$this->merge($this->grid->getRecord(), Am_Di::getInstance()->userTable->findFirstByLogin($values['login']));
$this->grid->redirectBack();
} else {
echo $this->renderTitle();
echo $form;
}
}