本文整理汇总了PHP中Zend_Form_Element_Select::setDescription方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Select::setDescription方法的具体用法?PHP Zend_Form_Element_Select::setDescription怎么用?PHP Zend_Form_Element_Select::setDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_Select
的用法示例。
在下文中一共展示了Zend_Form_Element_Select::setDescription方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createAssetstoreForm
/** Create assetstore form */
public function createAssetstoreForm()
{
$form = new Zend_Form();
$action = $this->webroot . '/assetstore/add';
$form->setAction($action);
$form->setName('assetstoreForm');
$form->setMethod('post');
$form->setAttrib('class', 'assetstoreForm');
// Name of the assetstore
$inputDirectory = new Zend_Form_Element_Text('name', array('label' => $this->t('Give a name'), 'id' => 'assetstorename'));
$inputDirectory->setRequired(true);
$form->addElement($inputDirectory);
// Input directory
$basedirectory = new Zend_Form_Element_Text('basedirectory', array('label' => $this->t('Pick a base directory'), 'id' => 'assetstoreinputdirectory'));
$basedirectory->setRequired(true);
$form->addElement($basedirectory);
// Assetstore type
$assetstoretypes = array('0' => $this->t('Managed by MIDAS'), '1' => $this->t('Remotely linked'));
// Amazon support is not yet implemented, don't present it as an option
// '2' => $this->t('Amazon S3'));
$assetstoretype = new Zend_Form_Element_Select('assetstoretype', array('id' => 'assetstoretype'));
$assetstoretype->setLabel('Select a type')->setMultiOptions($assetstoretypes);
// Add a loading image
$assetstoretype->setDescription('<div class="assetstoreLoading" style="display:none"><img src="' . $this->webroot . '/core/public/images/icons/loading.gif"/></div>')->setDecorators(array('ViewHelper', array('Description', array('escape' => false, 'tag' => false)), array('HtmlTag', array('tag' => 'dd')), array('Label', array('tag' => 'dt')), 'Errors'));
$form->addElement($assetstoretype);
// Submit
$addassetstore = new Zend_Form_Element_Submit('addassetstore', $this->t('Add this assetstore'));
$form->addElement($addassetstore);
return $form;
}
示例2: renderFormElement
public function renderFormElement()
{
$elm = new Zend_Form_Element_Select($this->getName(), array('label' => $this->getLabel() . ':'));
$elm->setDescription($this->getDescription());
$elm->setMultiOptions(array_merge(array('' => '---- Select One ----'), $this->getOptions()));
$elm->setValue($this->getValue());
$elm->setRequired($this->getRequired());
return $elm;
}
示例3: createMigrateForm
/** Main form */
public function createMigrateForm($assetstores)
{
// Setup the form
$form = new Zend_Form();
$form->setAction('migratemidas2');
$form->setName('migrateForm');
$form->setMethod('post');
$form->setAttrib('class', 'migrateForm');
// Input directory
$midas2_hostname = new Zend_Form_Element_Text('midas2_hostname', array('label' => $this->t('MIDAS2 Hostname'), 'size' => 60, 'value' => 'localhost'));
$midas2_hostname->setRequired(true);
$form->addElement($midas2_hostname);
$midas2_port = new Zend_Form_Element_Text('midas2_port', array('label' => $this->t('MIDAS2 Port'), 'size' => 4, 'value' => '5432'));
$midas2_port->setRequired(true);
$midas2_port->setValidators(array(new Zend_Validate_Digits()));
$form->addElement($midas2_port);
$midas2_user = new Zend_Form_Element_Text('midas2_user', array('label' => $this->t('MIDAS2 User'), 'size' => 60, 'value' => 'midas'));
$midas2_user->setRequired(true);
$form->addElement($midas2_user);
$midas2_password = new Zend_Form_Element_Password('midas2_password', array('label' => $this->t('MIDAS2 Password'), 'size' => 60, 'value' => 'midas'));
$midas2_password->setRequired(true);
$form->addElement($midas2_password);
$midas2_database = new Zend_Form_Element_Text('midas2_database', array('label' => $this->t('MIDAS2 Database'), ' size' => 60, 'value' => 'midas'));
$midas2_database->setRequired(true);
$form->addElement($midas2_database);
$midas2_assetstore = new Zend_Form_Element_Text('midas2_assetstore', array('label' => $this->t('MIDAS2 Assetstore Path'), 'size' => 60, 'value' => 'C:/xampp/midas/assetstore'));
$midas2_assetstore->setRequired(true);
$form->addElement($midas2_assetstore);
// Button to select the directory on the server
$midas2_assetstore_button = new Zend_Form_Element_Button('midas2_assetstore_button', $this->t('Choose'));
$midas2_assetstore_button->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'class' => 'browse-button')), array('Label', array('tag' => 'div', 'style' => 'display:none'))));
$form->addElement($midas2_assetstore_button);
// Assetstore
$assetstoredisplay = array();
$assetstoredisplay[0] = $this->t('Choose one...');
// Initialize with the first type (MIDAS)
foreach ($assetstores as $assetstore) {
if ($assetstore->getType() == 0) {
$assetstoredisplay[$assetstore->getAssetstoreId()] = $assetstore->getName();
}
}
$assetstore = new Zend_Form_Element_Select('assetstore');
$assetstore->setLabel($this->t('MIDAS3 Assetstore'));
$assetstore->setMultiOptions($assetstoredisplay);
$assetstore->setDescription(' <a class="load-newassetstore" href="#newassetstore-form" rel="#newassetstore-form" title="' . $this->t('Add a new assetstore') . '"> ' . $this->t('Add a new assetstore') . '</a>')->setDecorators(array('ViewHelper', array('Description', array('escape' => false, 'tag' => false)), array('HtmlTag', array('tag' => 'dd')), array('Label', array('tag' => 'dt')), 'Errors'));
$assetstore->setRequired(true);
$assetstore->setValidators(array(new Zend_Validate_GreaterThan(array('min' => 0))));
$assetstore->setRegisterInArrayValidator(false);
// This array is dynamic so we disable the validator
$form->addElement($assetstore);
// Submit
$submit = new Zend_Form_Element_Button('migratesubmit', $this->t('Migrate'));
$form->addElement($submit);
return $form;
}
示例4: renderFormElement
public function renderFormElement()
{
$elm = new Zend_Form_Element_Select($this->getName(), array('label' => $this->getLabel() . ':'));
$elm->setDescription($this->getDescription());
$elm->setRequired($this->getRequired());
$acl = Zend_Registry::get('acl');
$roles = $acl->getAvailableRoles();
foreach ($roles as $r) {
$elm->addMultiOption($r['roleId'], $r['name']);
}
$elm->setValue($this->getValue());
return $elm;
}
示例5: renderFormElement
public function renderFormElement()
{
$elm = new Zend_Form_Element_Select($this->getName(), array('label' => $this->getLabel() . ':'));
$elm->setRequired($this->getRequired());
$tr = new Ot_Layout_ThemeRegister();
$themes = $tr->getThemes();
foreach ($themes as $t) {
$elm->addMultiOption($t->getName(), $t->getLabel() . ' - ' . $t->getDescription());
}
$elm->setDescription($this->getDescription());
$elm->setValue($this->getValue());
return $elm;
}
示例6: createImportForm
/** Main form */
public function createImportForm($assetstores)
{
// Setup the form
$form = new Zend_Form();
$form->setAction('import/import');
$form->setName('importForm');
$form->setMethod('post');
$form->setAttrib('class', 'importForm');
/** @var RandomComponent $randomComponent */
$randomComponent = MidasLoader::loadComponent('Random');
// Hidden upload id
$uploadId = new Zend_Form_Element_Hidden('uploadid', array('value' => $randomComponent->generateInt()));
$uploadId->setDecorators(array('ViewHelper', array('HtmlTag', array('style' => 'display:none')), array('Label', array('style' => 'display:none'))));
$form->addElement($uploadId);
// Input directory
$inputDirectory = new Zend_Form_Element_Text('inputdirectory', array('label' => $this->t('Directory on the server'), 'id' => 'inputdirectory', 'size' => 60));
$inputDirectory->setRequired(true);
$form->addElement($inputDirectory);
// Button to select the directory on the server
$inputDirectoryButton = new Zend_Form_Element_Button('inputdirectorybutton', $this->t('Choose'));
$inputDirectoryButton->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'class' => 'browse-button')), array('Label', array('tag' => 'div', 'style' => 'display:none'))));
$form->addElement($inputDirectoryButton);
// Select the assetstore type
$assetstoretypes = array();
$assetstoretypes[MIDAS_ASSETSTORE_LOCAL] = $this->t('Copy data on this server');
// manage by MIDAS
$assetstoretypes[MIDAS_ASSETSTORE_REMOTE] = $this->t('Link data from its current location');
// link the data
$assetstoretype = new Zend_Form_Element_Select('importassetstoretype');
$assetstoretype->setLabel($this->t('Storage type'));
$assetstoretype->setMultiOptions($assetstoretypes);
$assetstoretype->setAttrib('onChange', 'assetstoretypeChanged()');
$form->addElement($assetstoretype);
// Assetstore
$assetstoredisplay = array();
$assetstoredisplay[0] = $this->t('Choose one...');
// Initialize with the first type (MIDAS)
foreach ($assetstores as $assetstore) {
if ($assetstore->getType() == 0) {
$assetstoredisplay[$assetstore->getAssetstoreId()] = $assetstore->getName();
}
}
$assetstore = new Zend_Form_Element_Select('assetstore');
$assetstore->setLabel($this->t('Assetstore'));
$assetstore->setMultiOptions($assetstoredisplay);
$assetstore->setDescription(' <a class="load-newassetstore" href="#newassetstore-form" rel="#newassetstore-form" title="' . $this->t('Add a new assetstore') . '"> ' . $this->t('Add a new assetstore') . '</a>')->setDecorators(array('ViewHelper', array('Description', array('escape' => false, 'tag' => false)), array('HtmlTag', array('tag' => 'dd')), array('Label', array('tag' => 'dt')), 'Errors'));
$assetstore->setRequired(true);
$assetstore->setValidators(array(new Zend_Validate_GreaterThan(array('min' => 0))));
$assetstore->setRegisterInArrayValidator(false);
// This array is dynamic so we disable the validator
$form->addElement($assetstore);
// Import empty directories
$emptydirs = new Zend_Form_Element_Checkbox('importemptydirectories');
$emptydirs->setLabel($this->t('Import empty directories'))->setChecked(true);
$form->addElement($emptydirs);
// Where to import the data
$importFolder = new Zend_Form_Element_Text('importFolder', array('label' => $this->t('Folder Id'), 'id' => 'importFolder', 'size' => 3, 'value' => 1));
$importFolder->setRequired(true);
$form->addElement($importFolder);
// Hidden filed to pass the translation of the stop import
$stopimport = new Zend_Form_Element_Hidden('importstop', array('value' => $this->t('Stop import')));
$stopimport->setDecorators(array('ViewHelper', array('HtmlTag', array()), array('Label', array()), 'Errors'));
$form->addElement($stopimport);
// Submit
$submit = new Zend_Form_Element_Button('importsubmit', $this->t('Import data'));
$form->addElement($submit);
return $form;
}
示例7: __construct
/** The constructor
* @access public
* @param array $options
* @return void
*/
public function __construct(array $options = null)
{
$counties = new OsCounties();
$county_options = $counties->getCountyNames();
$periods = new Periods();
$period_options = $periods->getPeriodFrom();
$licenses = new LicenseTypes();
$license = $licenses->getList();
parent::__construct($options);
$this->setName('imageeditfind');
$imagelabel = new Zend_Form_Element_Text('label');
$imagelabel->setLabel('Image label')->setRequired(true)->setAttribs(array('size' => 70, 'class' => 'span6'))->addErrorMessage('You must enter a label')->addFilters(array('StringTrim', 'StripTags'));
$period = new Zend_Form_Element_Select('period');
$period->setLabel('Period: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->setRequired(true)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Choose a period', 'Available periods' => $period_options))->addValidator('inArray', false, array(array_keys($period_options)));
$county = new Zend_Form_Element_Select('county');
$county->setLabel('County: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addFilters(array('StringTrim', 'StripTags'))->addMultiOptions(array(null => 'Choose a county', 'Available counties' => $county_options))->addValidator('inArray', false, array(array_keys($county_options)));
$copyright = new Zend_Form_Element_Select('imagerights');
$copyright->setLabel('Image copyright: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->setRequired(true)->addErrorMessage('You must enter a licence holder')->addMultiOptions(array(null => 'Select a licence holder', 'Valid copyrights' => $this->getCopyrights()))->setDescription('You can set the copyright of your image here
to your institution. If you are a public recorder, it
should default to your full name. For institutions that do
not appear contact head office to suggest its addition.')->setValue($this->getCopyright());
$licenseField = new Zend_Form_Element_Select('ccLicense');
$licenseField->setDescription('Our philosophy is to make our content
available openly, by default we set the license as use by attribution
to gain the best public benefit. You can choose a different license
if you wish.');
$licenseField->setRequired(true)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->setLabel('Creative Commons license:')->addMultiOptions(array(null => 'Select a license', 'Available licenses' => $license))->setValue(4)->addValidator('Int');
$type = new Zend_Form_Element_Select('type');
$type->setLabel('Image type: ')->setRequired(true)->addMultiOptions(array('Please choose publish state' => array('digital' => 'Digital image', 'illustration' => 'Scanned illustration')))->setValue('digital')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addFilters(array('StringTrim', 'StripTags'));
$rotate = new Zend_Form_Element_Radio('rotate');
$rotate->setLabel('Rotate the image: ')->setRequired(false)->addValidator('Int')->addMultiOptions(array(-90 => '90 degrees anticlockwise', -180 => '180 degrees anticlockwise', -270 => '270 degrees anticlockwise', 90 => '90 degrees clockwise', 180 => '180 degrees clockwise', 270 => '270 degrees clockwise'));
$regenerate = new Zend_Form_Element_Checkbox('regenerate');
$regenerate->setLabel('Regenerate thumbnail: ');
$submit = new Zend_Form_Element_Submit('submit');
$this->addElements(array($imagelabel, $county, $period, $copyright, $licenseField, $type, $submit));
$this->setMethod('post');
$this->addDisplayGroup(array('label', 'county', 'period', 'imagerights', 'ccLicense', 'type'), 'details');
$this->addDisplayGroup(array('submit'), 'buttons');
$this->details->setLegend('Edit metadata on an image');
parent::init();
}
示例8: init
public function init()
{
$menu_items_model = new Admin_Model_MenuItems();
$menu_items_icons_model = new Admin_Model_MenuItemsIcons();
$name = new Zend_Form_Element_Text('name');
$name->setLabel('Name');
$name->setAttrib("class", "form-control");
$name->setAttrib("style", "width:200px");
$name->setRequired(true);
$this->addElement($name);
$title = new Zend_Form_Element_Text('title');
$title->setLabel('Title');
$title->setAttrib("class", "form-control");
$title->setAttrib("style", "width:200px");
$title->setRequired(true);
$title->addValidator('Alnum', false, array('allowWhiteSpace' => true));
$this->addElement($title);
$parent = new Zend_Form_Element_Select('parent_id');
$parent->setLabel('Parent menu item')->setRequired(false);
$parent->setAttrib("class", "select2")->setAttrib("style", "width:200px");
$parent->setDescription('If menu item isn\'t a child element, choose None');
$parent->addMultiOption(0, 'None');
foreach ($menu_items_model->getForDropDown() as $key => $v) {
$parent->addMultiOption($key, $v);
}
$this->addElement($parent);
$module = new Zend_Form_Element_Text('module');
$module->setLabel('Module');
$module->setAttrib("class", "form-control");
$module->setAttrib("style", "width:200px");
$module->setRequired(false);
$module->addValidator('Alnum', false, array('allowWhiteSpace' => true));
$this->addElement($module);
$controller = new Zend_Form_Element_Text('controller');
$controller->setLabel('Controller');
$controller->setAttrib("class", "form-control");
$controller->setAttrib("style", "width:200px");
$controller->setRequired(false);
$this->addElement($controller);
$action = new Zend_Form_Element_Text('action');
$action->setLabel('Action');
$action->setAttrib("class", "form-control");
$action->setAttrib("style", "width:200px");
$action->setRequired(false);
$this->addElement($action);
$params = new Zend_Form_Element_Text('params');
$params->setLabel('Params');
$params->setDescription('Insert params in format: key1:value1,key2:value2 ...');
$params->setAttrib("class", "form-control");
$params->setAttrib("style", "width:200px");
$params->setRequired(false);
$this->addElement($params);
$icon_id = new Zend_Form_Element_Hidden('icon_id');
$icon_id->setRequired(false);
$this->addElement($icon_id);
$cancel = new Zend_Form_Element_Button('cancel');
$cancel->setLabel('Cancel');
$cancel->setAttrib('class', 'btn btn-gold')->setAttrib('style', 'color:black');
$cancel->setAttrib("onClick", "window.location = window.location.origin+'/admin/menu-items/'");
$this->addElement($cancel);
$submit = new Zend_Form_Element_Submit('save');
$submit->setAttrib('class', 'btn btn-primary');
$submit->setLabel('Confirm');
$this->setAction('')->setMethod('post')->addElement($submit);
}
示例9: __construct
/** The constructor
* @access public
* @param array $options
* @return void
*/
public function __construct(array $options = null)
{
$counties = new OsCounties();
$county_options = $counties->getCountyNames();
$periods = new Periods();
$period_options = $periods->getPeriodFrom();
$copyrights = new Copyrights();
$copy = $copyrights->getTypes();
$licenses = new LicenseTypes();
$license = $licenses->getList();
if (array_key_exists('id', $options)) {
$slides = new Slides();
$images = $slides->getSlides($options['id']);
}
$auth = Zend_Auth::getInstance();
$this->_auth = $auth;
if ($this->_auth->hasIdentity()) {
$user = $this->_auth->getIdentity();
if (!is_null($user->copyright)) {
$this->_copyright = $user->copyright;
} elseif (!is_null($user->fullname)) {
$this->_copyright = $user->first_name . ' ' . $user->last_name;
} else {
$this->_copyright = $user->fullname;
}
if (!is_null($user->fullname)) {
$copy[] = $user->first_name . ' ' . $user->last_name;
} else {
$copy[] = $user->fullname;
}
}
$copyList = array_filter(array_merge(array($this->_copyright => $this->_copyright), $copy));
parent::__construct($options);
$this->setName('imagetofind');
$period = new Zend_Form_Element_Select('period');
$period->setLabel('Period: ')->setRequired(true)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow required')->addErrorMessage('You must enter a period for the image')->addMultiOptions(array(null => 'Select a period', 'Valid periods' => $period_options))->addValidator('inArray', false, array(array_keys($period_options)));
$country = new Zend_Form_Element_Select('country');
$country->setLabel('Country: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow required')->setRequired(true)->addErrorMessage('You must enter a country of origin')->addMultiOptions(array(null => 'Select a country of origin', 'Valid countries' => array('England' => 'England', 'Wales' => 'Wales')))->addValidator('inArray', false, array(array_keys($county_options)));
$county = new Zend_Form_Element_Select('county');
$county->setLabel('County: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow required')->setRequired(true)->addErrorMessage('You must enter a county of origin')->addMultiOptions(array(null => 'Select a county of origin', 'Valid counties' => $county_options))->addValidator('inArray', false, array(array_keys($county_options)));
$copyright = new Zend_Form_Element_Select('imagerights');
$copyright->setLabel('Image copyright: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->setRequired(true)->addErrorMessage('You must enter a licence holder')->addMultiOptions(array(null => 'Select a licence holder', 'Valid copyrights' => $copyList))->setDescription('You can set the copyright of your image here
to your institution. If you are a public recorder, it should
default to your full name. For institutions that do not
appear contact head office to suggest its addition')->setValue($this->_copyright);
$licenseField = new Zend_Form_Element_Select('ccLicense');
$licenseField->setDescription('Our philosophy is to make our content available openly, by default we
set the license as use by attribution to gain the best public benefit. You can choose a different license
if you wish.');
$licenseField->setRequired(true)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->setLabel('Creative Commons license:')->addMultiOptions(array(null => 'Select a license', 'Available licenses' => $license))->setValue(4)->addValidator('Int');
$type = new Zend_Form_Element_Select('type');
$type->setLabel('Image type: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->setRequired(true)->addMultiOptions(array(null => 'Select the type of image', 'Image types' => array('digital' => 'Digital image', 'illustration' => 'Scanned illustration')))->setValue('digital');
$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel('Add metadata for images');
$this->addElements(array($country, $county, $period, $copyright, $type, $licenseField, $submit));
$this->setMethod('post');
$this->addDisplayGroup(array('country', 'filename', 'county', 'period', 'imagerights', 'ccLicense', 'type'), 'details');
foreach ($images as $image) {
$label = 'label' . $image['imageID'];
$group = 'metadata' . $image['imageID'];
echo '<img src="http://finds.org.uk/images/thumbnails/' . $image['imageID'] . '.jpg"/>';
$image['imageID'] = new Zend_Form_Element_Text($label);
$image['imageID']->setLabel('Image label: ')->setRequired(true)->setAttribs(array('size' => 60, 'class' => 'span6 required'))->addErrorMessage('You must enter a label')->setDescription('This must be descriptive text about the image - NOT THE FILE or FIND NUMBER/NAME - and follow the
conventions outlined below this form')->addFilters(array('StripTags', 'StringTrim'));
$this->addElements(array($image['imageID']));
$this->addDisplayGroup(array($label), $group);
}
$this->addDisplayGroup(array('submit'), 'buttons')->removeDecorator('HtmlTag');
$this->details->setLegend('Attach an image');
parent::init();
}