本文整理汇总了PHP中Zend_Form_Element_File::setValueDisabled方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_File::setValueDisabled方法的具体用法?PHP Zend_Form_Element_File::setValueDisabled怎么用?PHP Zend_Form_Element_File::setValueDisabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_File
的用法示例。
在下文中一共展示了Zend_Form_Element_File::setValueDisabled方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
$image = new Zend_Form_Element_File('imageLoadFile');
$image->setValueDisabled(true)->addValidator('Size', false, 1024000)->addValidator('Extension', false, 'jpg,png,gif')->setAttribs(array('class' => 'hidden', 'data-input' => 'image', 'data-upload' => '/upload/manufacture/category'));
$this->addElement($image);
$this->addElement('hidden', 'image');
$this->addElement('image', 'imageLoad', array('label' => null, 'class' => 'img-thumbnail', 'data-toggle' => 'tooltip', 'data-placement' => 'bottom', 'data-input' => 'image', 'title' => 'Загрузить изображение'));
$this->addDisplayGroup(array('imageLoad', 'imageLoadFile', 'image'), 'imageGroup', array());
$this->addElement('hidden', 'id');
$this->addElement('hidden', 'parentId');
$this->addElement('text', 'title', array('label' => 'Заголовок страницы', 'placeholder' => 'Заголовок страницы', 'required' => true));
$refreshPath = '<button type="button" class="refreshSlugify btn btn-default" data-slugify="path" data-sourse="title">
<span class="glyphicon glyphicon-refresh"></span>
</button>';
$this->addElement('text', 'path', array('label' => 'Url страницы', 'placeholder' => 'Url страницы', 'required' => true, 'prepend_btn' => $refreshPath));
$this->addDisplayGroup(array('title', 'path', 'parentId', 'id'), 'basic', array());
$this->addElement('textarea', 'description', array('label' => 'Краткое описание страницы', 'placeholder' => 'Краткое описание страницы', 'rows' => '4'));
$this->addElement('textarea', 'contentMarkdown', array('label' => 'Текст на странице (markdown)', 'placeholder' => 'Текст', 'rows' => '8'));
$this->addDisplayGroup(array('description', 'contentMarkdown'), 'desc', array('class' => 'tab-pane active', 'role' => 'tabpanel'));
$this->addElement('text', 'metaTitle', array('label' => 'SEO title', 'placeholder' => 'meta title'));
$this->addElement('textarea', 'metaDescription', array('label' => 'SEO description', 'placeholder' => 'meta description', 'rows' => '8'));
$this->addElement('textarea', 'metaKeywords', array('label' => 'SEO keywords', 'placeholder' => 'meta keywords', 'rows' => '4'));
$this->addDisplayGroup(array('metaTitle', 'metaDescription', 'metaKeywords'), 'seo', array('class' => 'tab-pane', 'role' => 'tabpanel'));
$this->addElement('text', 'sorting', array('label' => 'Сортировка'));
$this->addElement('checkbox', 'active', array('label' => 'Активность'));
$this->addElement('checkbox', 'deleted', array('label' => 'Cтраница удалена'));
$this->addDisplayGroup(array('sorting', 'active', 'deleted'), 'additionally', array('class' => 'tab-pane', 'role' => 'tabpanel'));
$this->addElement('button', 'submit', array('label' => 'Сохранить', 'type' => 'submit', 'buttonType' => 'success', 'ignore' => true));
}
示例2: init
public function init()
{
// Set the method for the display form to POST
$this->setMethod('post');
$this->setName('blogEntryForm');
$this->addPrefixPath('Application_Form_Decorator', APPLICATION_PATH . '/forms/decorators/', 'decorator');
$categoryForm = new Admin_Form_CategorySelect(array('categories' => $this->getCategories()));
$element = $categoryForm->getElement('categoryId');
$this->addElement($element);
$this->addElement('text', 'postDateAsString', array('label' => 'Post Date:', 'attribs' => array('maxlength' => 10, 'size' => 30), 'required' => true, 'validators' => array(array('Date', false, array('format' => 'dd/MM/YYYY'))), 'decorators' => array('ViewHelper', 'Errors', array('HtmlTag', array('tag' => 'dd', 'id' => 'postdate-element')), 'RequiredLabel')));
$this->addElement('hidden', 'useExisting', array('required' => true, 'value' => 0, 'decorators' => array('ViewHelper')));
$element = new Zend_Form_Element_File('image');
$element->setValueDisabled(true);
$element->setLabel('Upload an image:');
$element->addValidator('Count', false, 1);
$element->addValidator('Size', false, 9000000);
$element->addValidator('Extension', false, 'jpg,png,gif');
$this->addElement($element, 'image');
$this->addElement('text', 'title', array('label' => 'Title:', 'attribs' => array('maxlength' => 128, 'size' => 30), 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 255))), 'decorators' => array('ViewHelper', 'Errors', array('HtmlTag', array('tag' => 'dd', 'id' => 'title-element')), 'RequiredLabel')));
$this->addElement('textarea', 'summary', array('label' => 'Summary:', 'attribs' => array('cols' => 60, 'rows' => 6), 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength')), 'decorators' => array('ViewHelper', 'Errors', array('HtmlTag', array('tag' => 'dd', 'id' => 'summary-element')), 'RequiredLabel')));
$this->addElement('textarea', 'content', array('label' => 'Content:', 'attribs' => array('cols' => 50, 'rows' => 6), 'required' => false, 'decorators' => array('ViewHelper', 'Wysiwyg', 'Errors', array('HtmlTag', array('tag' => 'dd', 'id' => 'content-element')), 'WarningLinkLabel')));
$this->addElement('textarea', 'content', array('label' => 'Content:', 'attribs' => array('cols' => 50, 'rows' => 6), 'required' => false, 'decorators' => array('ViewHelper', 'Wysiwyg', 'Errors', array('HtmlTag', array('tag' => 'dd', 'id' => 'content-element')), 'WarningLinkLabel')));
$this->addElement('submit', 'submit', array('label' => 'Submit', 'Description' => 'Fields marked with an asterisk (*) are required', 'ignore' => true, 'decorators' => array('ViewHelper', 'Description', array('HtmlTag', array('tag' => 'dd', 'id' => 'submit-element')), array('Label', array('tag' => 'dt', 'style' => 'display:none')))));
$this->addElement('hash', 'csrf', array('ignore' => true, 'decorators' => array('ViewHelper')));
$this->addElement('hidden', 'id', array('ignore' => false, 'decorators' => array('ViewHelper')));
}
示例3: init
public function init()
{
$this->addElement('hidden', 'id');
$this->addElement('hidden', 'fullPath');
//$this->addElement('hidden', 'path');
$image = new Zend_Form_Element_File('imageLoadFile');
$image->setValueDisabled(true)->addValidator('Size', false, 1024000)->addValidator('Extension', false, 'jpg,png,gif')->setAttribs(array('class' => 'hidden', 'data-input' => 'image', 'data-upload' => '/upload/media/items'));
$this->addElement($image);
$this->addElement('hidden', 'image');
$this->addElement('image', 'imageLoad', array('label' => null, 'class' => 'img-thumbnail', 'data-toggle' => 'tooltip', 'data-placement' => 'bottom', 'data-input' => 'image', 'title' => 'Загрузить изображение'));
$this->addDisplayGroup(array('imageLoad', 'imageLoadFile', 'image'), 'imageGroup', array());
$this->addElement('select', 'categoryId', array('label' => 'Категория', 'required' => true, 'multiOptions' => $this->getCategoryArray()));
$this->addElement('text', 'name', array('label' => 'Заголовок', 'placeholder' => 'Заголовок статьи', 'required' => true));
$refreshPath = '<button type="button" class="refreshSlugify btn btn-default" data-slugify="path" data-sourse="name">
<span class="glyphicon glyphicon-refresh"></span>
</button>';
$this->addElement('text', 'path', array('label' => 'Url', 'placeholder' => 'Url', 'required' => true, 'prepend_btn' => $refreshPath));
$this->addElement('select', 'sectionSiteId', array('label' => 'Привязать к разделу сайта', 'multiOptions' => $this->getSectionSiteArray()));
$this->addDisplayGroup(array('categoryId', 'name', 'path', 'sectionSiteId', 'fullPath', 'id'), 'basic', array());
$this->addElement('textarea', 'sContent', array('label' => 'Краткое описание страницы', 'placeholder' => 'Краткое описание страницы', 'rows' => '4'));
$this->addElement('textarea', 'contentMarkdown', array('label' => 'Текст на странице (markdown)', 'placeholder' => 'Текст', 'rows' => '8'));
$this->addElement('text', 'timestamp', array('label' => 'Дата статьи', 'placeholder' => 'Дата'));
$this->addElement('hidden', 'content');
$this->addDisplayGroup(array('sContent', 'contentMarkdown', 'timestamp', 'content'), 'desc', array('class' => 'tab-pane active', 'role' => 'tabpanel'));
$this->addElement('text', 'metaTitle', array('label' => 'SEO title', 'placeholder' => 'meta title'));
$this->addElement('textarea', 'metaDescription', array('label' => 'SEO description', 'placeholder' => 'meta description', 'rows' => '8'));
$this->addElement('textarea', 'metaKeywords', array('label' => 'SEO keywords', 'placeholder' => 'meta keywords', 'rows' => '4'));
$this->addDisplayGroup(array('metaTitle', 'metaDescription', 'metaKeywords'), 'seo', array('class' => 'tab-pane', 'role' => 'tabpanel'));
$this->addElement('text', 'sorting', array('label' => 'Сортировка'));
$this->addElement('checkbox', 'active', array('label' => 'Активность'));
$this->addElement('checkbox', 'deleted', array('label' => 'Cтраница удалена'));
$this->addElement('text', 'author', array('label' => 'Автор', 'placeholder' => 'Автор статьи'));
$this->addDisplayGroup(array('sorting', 'active', 'deleted', 'author'), 'additionally', array('class' => 'tab-pane', 'role' => 'tabpanel'));
}
示例4: init
public function init()
{
$image = new Zend_Form_Element_File('imageLoadFile');
$image->setValueDisabled(true)->addValidator('Size', false, 1024000)->addValidator('Extension', false, 'jpg,png,gif')->setAttribs(array('class' => 'hidden', 'data-input' => 'image', 'data-upload' => '/upload/media/categories'));
$this->addElement($image);
$this->addElement('hidden', 'image');
$this->addElement('image', 'imageLoad', array('label' => null, 'class' => 'img-thumbnail', 'data-toggle' => 'tooltip', 'data-placement' => 'bottom', 'data-input' => 'image', 'title' => 'Загрузить изображение'));
$this->addElement('hidden', 'id');
$this->addElement('hidden', 'parentId');
/*$this->addElement('select', 'parentId', array(
'label' => 'Родительская категория',
'required' => true,
'multiOptions' => $this->getCategoryArray(),
));*/
$this->addElement('text', 'name', array('label' => 'Наименование категории', 'placeholder' => 'Нименование категории', 'required' => true));
$refreshPath = '<button type="button" class="refreshSlugify btn btn-default" data-slugify="path" data-sourse="name">
<span class="glyphicon glyphicon-refresh"></span>
</button>';
$this->addElement('text', 'path', array('label' => 'Url', 'placeholder' => 'Url', 'required' => true, 'prepend_btn' => $refreshPath));
$this->addElement('textarea', 'description', array('label' => 'Краткое описание категории', 'placeholder' => 'Краткое описание категории', 'rows' => '8'));
$this->addElement('text', 'metaTitle', array('label' => 'SEO title', 'placeholder' => 'meta title'));
$this->addElement('textarea', 'metaDescription', array('label' => 'SEO description', 'placeholder' => 'meta description', 'rows' => '4'));
$this->addElement('textarea', 'metaKeywords', array('label' => 'SEO keywords', 'placeholder' => 'meta keywords', 'rows' => '4'));
$this->addElement('text', 'sorting', array('label' => 'Сортировка'));
$this->addElement('checkbox', 'active', array('label' => 'Активность'));
$this->addElement('checkbox', 'deleted', array('label' => 'Cтраница удалена'));
$this->addDisplayGroup(array('name', 'parentId', 'path', 'id'), 'basic', array());
$this->addDisplayGroup(array('imageLoad', 'imageLoadFile', 'image'), 'imageGroup', array());
$this->addDisplayGroup(array('description'), 'desc', array('class' => 'tab-pane active', 'role' => 'tabpanel'));
$this->addDisplayGroup(array('metaTitle', 'metaDescription', 'metaKeywords'), 'seo', array('class' => 'tab-pane', 'role' => 'tabpanel'));
$this->addDisplayGroup(array('sorting', 'active', 'deleted'), 'additionally', array('class' => 'tab-pane', 'role' => 'tabpanel'));
$this->addElement('button', 'submit', array('label' => 'Сохранить изменения', 'type' => 'submit', 'buttonType' => 'success', 'ignore' => true, 'form' => 'itemEdit', 'id' => 'saveItemEdit', 'class' => 'hidden'));
$this->getElement('submit')->removeDecorator('label');
}
示例5: init
public function init()
{
// Set the method for the display form to POST
$this->setMethod('post');
$this->addPrefixPath('Application_Form_Decorator', APPLICATION_PATH . '/forms/decorators/', 'decorator');
$this->addElement('text', 'name', array('label' => 'Name:', 'attribs' => array('maxlength' => 256, 'size' => 30), 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 256))), 'decorators' => array('ViewHelper', 'Errors', array('HtmlTag', array('tag' => 'dd', 'id' => 'name-element')), 'RequiredLabel')));
$this->addElement('text', 'country', array('label' => 'Country:', 'attribs' => array('maxlength' => 256, 'size' => 30), 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 256))), 'decorators' => array('ViewHelper', 'Errors', array('HtmlTag', array('tag' => 'dd', 'id' => 'country-element')), 'RequiredLabel')));
$this->addElement('text', 'town', array('label' => 'Town:', 'attribs' => array('maxlength' => 256, 'size' => 30), 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 256))), 'decorators' => array('ViewHelper', 'Errors', array('HtmlTag', array('tag' => 'dd', 'id' => 'town-element')), 'RequiredLabel')));
$this->addElement('text', 'link', array('label' => 'Link:', 'attribs' => array('maxlength' => 256, 'size' => 30), 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 256)))));
$this->addElement('hidden', 'useExisting', array('required' => true, 'value' => 0, 'decorators' => array('ViewHelper')));
$element = new Zend_Form_Element_File('filename');
$element->setValueDisabled(true);
$element->setRequired(true);
$element->setLabel('Upload an image:');
$element->addValidator('Count', false, 1);
$element->addValidator('Size', false, 9000000);
$element->addValidator('Extension', false, 'jpg,png,gif');
$this->addElement($element, 'filename');
$this->addElement('submit', 'submit', array('label' => 'Submit', 'Description' => 'Fields marked with an asterisk (*) are required', 'ignore' => true, 'decorators' => array('ViewHelper', 'Description', array('HtmlTag', array('tag' => 'dd', 'id' => 'submit-element')), array('Label', array('tag' => 'dt', 'style' => 'display:none')))));
$this->addElement('hidden', 'id', array('ignore' => false, 'decorators' => array('ViewHelper')));
}
示例6: buildForm
//.........这里部分代码省略.........
$field = new Zend_Form_Element_Radio($fieldname);
break;
/**
* Список
*/
/**
* Список
*/
case "Select":
$field = new Zend_Form_Element_Select($fieldname);
$haystack = array();
$optionsdata = explode("\n", $data["optionsdata"]);
foreach ($optionsdata as $k => $v) {
$haystack[$k] = trim($v);
}
$field->addMultiOption("", $this->_translate->_("---Выберите---"));
foreach ($haystack as $value) {
$field->addMultiOption($value, $value);
}
$haystack[$this->_translate->_("---Выберите---")] = "";
$field->addValidator("InArray", true, array("haystack" => $haystack, "messages" => array("notInArray" => $this->_translate->_("Не выбрано ни одного значения"))));
break;
/**
* Список с множественным выбором
*/
/**
* Список с множественным выбором
*/
case "Multiselect":
$field = new Zend_Form_Element_Multiselect($fieldname);
$haystack = array();
$optionsdata = explode("\n", $data["optionsdata"]);
foreach ($optionsdata as $k => $v) {
$haystack[$k] = trim($v);
}
foreach ($optionsdata as $value) {
$field->addMultiOption($value, $value);
}
$field->addValidator("InArray", true, array("haystack" => $haystack, "messages" => array("notInArray" => $this->_translate->_("Не выбрано ни одного значения"))));
break;
/**
* Файл
*/
/**
* Файл
*/
case "File":
$field = new Zend_Form_Element_File($fieldname);
if ($data["filestypes"] == "Images") {
$field->addValidator("Extension", false, array("extension" => "png,jpg,gif,jpeg,bmp", "messages" => array("fileExtensionFalse" => $this->_translate->_("Файл '%value%' не является изображением"))));
} elseif ($data["filestypes"] == "Documents") {
$field->addValidator("Extension", false, array("extension" => "doc,xls,odt,docx,xlsx,pdf,txt", "messages" => array("fileExtensionFalse" => $this->_translate->_("Файл '%value%' не является документом"))));
} elseif ($data["filestypes"] == "Archives") {
$field->addValidator("Extension", false, array("extension" => "zip,rar,7z,gz,tgz", "messages" => array("fileExtensionFalse" => $this->_translate->_("Файл '%value%' не является файловым архивом"))));
}
//$field -> setDestination($this->paths["html"]."forms/files/");
$field->setValueDisabled(true);
break;
/**
* Refferer
*/
/**
* Refferer
*/
case "Refferer":
$field = new Zend_Form_Element_Hidden($fieldname);
if (isset($_SERVER["HTTP_REFERER"])) {
$field->setValue($_SERVER["HTTP_REFERER"]);
}
break;
/**
* CAPTCHA
*/
/**
* CAPTCHA
*/
case "Captcha":
$captcha = Phorm_Captcha_Image::getCaptcha();
$captcha->setOptions(array("messages" => array("badCaptcha" => $this->_translate->_("Неверно указан код подтверждения"), "missingID" => $this->_translate->_("Неверный идентификатор Captcha"))));
$field = new Zend_Form_Element_Captcha($fieldname, array("captcha" => $captcha));
break;
default:
continue;
}
// Если поле обязательно для заполнения
if ($data["isrequired"] == "yes") {
$field->setRequired(true)->addValidator("NotEmpty", true, array("messages" => array("isEmpty" => $this->_translate->_("Не заполнено поле"))));
}
// Устанавливаем заголовок и описание поля
if ($field instanceof Zend_Form_Element_Hidden) {
$field->removeDecorator("label")->removeDecorator("HtmlTag");
} else {
$field->setLabel($data["fieldname"])->setDescription($data["fieldtxt"]);
}
$form->addElement($field);
}
$form->addElement(new Zend_Form_Element_Submit("Send", $this->_translate->_("Отправить")));
$form->setAttrib('enctype', 'multipart/form-data');
return $form;
}
示例7: init
public function init()
{
$image = new Zend_Form_Element_File('imageLoadFile');
$image->setValueDisabled(true)->addValidator('Size', false, 1024000)->addValidator('Extension', false, 'jpg,png')->setAttribs(array('class' => 'hidden', 'data-input' => 'image', 'data-upload' => '/upload/pipeline/items'));
$this->addElement($image);
$this->addElement('hidden', 'image');
$this->addElement('image', 'imageLoad', array('label' => null, 'class' => 'img-thumbnail', 'data-toggle' => 'tooltip', 'data-placement' => 'bottom', 'data-input' => 'image', 'title' => 'Загрузить изображение'));
$this->addDisplayGroup(array('imageLoad', 'imageLoadFile', 'image'), 'imageGroup', array());
/*$imageDraft = new Zend_Form_Element_File('imageDraftLoadFile');
$imageDraft->setDestination(APPLICATION_ROOT.'/upload/pipeline/items/')
->addValidator('Size', false, 1024000)
->addValidator('Extension', false, 'jpg,png')
->setAttribs(
array(
'class' => 'hidden',
)
);
$this->addElement($imageDraft);
$this->addElement('image', 'imageDraftLoad', array(
'label' => null,//'Чертеж',
'class' => 'img-thumbnail',
'data-toggle' => 'tooltip',
'data-placement'=> 'bottom',
'title' => 'Загрузить чертеж',
));
$this->addElement('hidden', 'imageDraft');
$this->addDisplayGroup(
array(
'imageDraftLoad',
'imageDraftLoadFile',
'imageDraft',
),
'imageDraftGroup',
array()
);*/
$imageTable = new Zend_Form_Element_File('imageTableLoadFile');
$imageTable->setValueDisabled(true)->addValidator('Size', false, 1024000)->addValidator('Extension', false, 'jpg,png,pdf')->setAttribs(array('class' => 'hidden', 'data-input' => 'imageTable', 'data-upload' => '/upload/pipeline/items'));
$this->addElement($imageTable);
$this->addElement('text', 'imageTable', array('label' => 'ГОСТ / Стандарт (*.pdf)', 'placeholder' => 'ГОСТ (Стандарт) *.pdf', 'class' => ''));
$this->addDisplayGroup(array('imageTable', 'imageTableLoadFile'), 'imageTableGroup', array());
$this->addElement('hidden', 'id');
$this->addElement('hidden', 'fullPath');
$this->addElement('text', 'title', array('label' => 'Наименование товара', 'placeholder' => 'Наименование товара', 'required' => true));
$this->addElement('select', 'categoryId', array('label' => 'Категория', 'required' => true, 'data-controller' => 'pipeline-categories', 'multiOptions' => $this->getCategoryArray()));
$refreshPath = '<button type="button" class="refreshSlugify btn btn-default" data-slugify="path" data-sourse="title"><span class="glyphicon glyphicon-refresh"></span></button>';
$this->addElement('text', 'path', array('label' => 'Url страницы', 'placeholder' => 'Url страницы', 'required' => true, 'prepend_btn' => $refreshPath));
$this->addDisplayGroup(array('title', 'path', 'categoryId', 'fullPath', 'id'), 'basic', array());
$this->addElement('textarea', 'description', array('label' => 'Краткое описание страницы', 'placeholder' => 'Краткое описание страницы', 'rows' => '4'));
$this->addElement('textarea', 'contentMarkdown', array('label' => 'Текст на странице (markdown)', 'placeholder' => 'Текст', 'rows' => '8'));
$this->addDisplayGroup(array('description', 'contentMarkdown'), 'desc', array('class' => 'tab-pane', 'role' => 'tabpanel'));
$this->addElement('text', 'metaTitle', array('label' => 'SEO title', 'placeholder' => 'meta title'));
$this->addElement('textarea', 'metaDescription', array('label' => 'SEO description', 'placeholder' => 'meta description', 'rows' => '8'));
$this->addElement('textarea', 'metaKeywords', array('label' => 'SEO keywords', 'placeholder' => 'meta keywords', 'rows' => '4'));
$this->addDisplayGroup(array('metaTitle', 'metaDescription', 'metaKeywords'), 'seo', array('class' => 'tab-pane', 'role' => 'tabpanel'));
$this->addElement('text', 'sorting', array('label' => 'Сортировка'));
$this->addElement('checkbox', 'active', array('label' => 'Активность'));
$this->addElement('checkbox', 'deleted', array('label' => 'Cтраница удалена'));
$this->addDisplayGroup(array('sorting', 'active', 'deleted'), 'additionally', array('class' => 'tab-pane', 'role' => 'tabpanel'));
$this->addElement('button', 'submit', array('label' => 'Сохранить изменения', 'type' => 'submit', 'buttonType' => 'success', 'ignore' => true, 'form' => 'itemEdit', 'id' => 'saveItemEdit', 'class' => 'hidden'));
$this->getElement('submit')->removeDecorator('label');
}