本文整理汇总了PHP中Zend_Form_Element_File::setDestination方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_File::setDestination方法的具体用法?PHP Zend_Form_Element_File::setDestination怎么用?PHP Zend_Form_Element_File::setDestination使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_File
的用法示例。
在下文中一共展示了Zend_Form_Element_File::setDestination方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildFileUpload
protected function buildFileUpload()
{
$tenantFromIdentity = OpenSKOS_Db_Table_Tenants::fromIdentity();
// We always need tenant for getting icon path.
if (null !== $tenantFromIdentity) {
$iconUpload = new Zend_Form_Element_File('icon');
$iconUpload->setLabel('Upload a new icon:')->addValidator('Count', false, 1)->setRequired(true);
$editorOptions = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getOption('editor');
if (isset($editorOptions['schemeIcons']) && isset($editorOptions['schemeIcons']['uploadPath'])) {
$iconUpload->setDestination(APPLICATION_PATH . $editorOptions['schemeIcons']['uploadPath'] . '/' . $tenantFromIdentity->code);
} else {
$iconUpload->setDestination(APPLICATION_PATH . self::DEFAULT_UPLOAD_PATH . '/' . $tenantFromIdentity->code);
}
if (isset($editorOptions['schemeIcons']) && isset($editorOptions['schemeIcons']['allowedExtensions'])) {
$iconUpload->addValidator('Extension', false, $editorOptions['schemeIcons']['allowedExtensions']);
} else {
$iconUpload->addValidator('Extension', false, 'jpg, jpeg, png, gif');
}
if (isset($editorOptions['schemeIcons']) && isset($editorOptions['schemeIcons']['maxSize'])) {
$iconUpload->addValidator('Size', false, $editorOptions['schemeIcons']['maxSize']);
$iconUpload->setMaxFileSize($editorOptions['schemeIcons']['maxSize']);
} else {
$iconUpload->addValidator('Size', false, 2097152);
$iconUpload->setMaxFileSize(2097152);
}
$this->addElement($iconUpload, 'icon');
}
return $this;
}
示例2: init
public function init()
{
$media_library_model = new Cms_Model_MediaLibraries();
$media_library = $media_library_model->getByPath($this->_attribs['media_library_path']);
$title = new Zend_Form_Element_Text('title');
$title->setLabel('Title');
$title->setRequired(true);
$title->addFilter('StringTrim');
$title->addValidator('Alnum', false, array('allowWhiteSpace' => true));
$this->addElement($title);
$description = new Zend_Form_Element_Textarea('description');
$description->setLabel('Description');
$description->addFilter('StringTrim');
$description->addValidator('Alnum', false, array('allowWhiteSpace' => true));
$this->addElement($description);
$original = new Zend_Form_Element_File('original');
$original->addValidator('Count', false, 1);
$original->addValidator('Extension', false, 'jpeg,jpg,png');
$original->addFilter('Rename', $this->_attribs['file_name']);
$original->setDestination(My_Utilities::getUploadMediaPathDiffSizes($this->_attribs['file_name'], $this->_attribs['media_library_path'], 'original'));
$original->setLabel('Image:');
$this->addElement($original);
$submit = new Zend_Form_Element_Submit('save');
$submit->setAttrib('class', 'btn btn-primary');
$submit->setLabel('Potvrdi');
$this->setAction('')->setMethod('post')->addElement($submit);
$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+'/cms/medias/index/library_id/" . $media_library->id . "'");
$this->addElement($cancel);
}
示例3: init
public function init()
{
$this->setAttrib('enctype', 'multipart/form-data');
$renameResize = new Zend_Form_Element_File('renameResize');
$renameResize->setDestination('../upload');
$renameResize->setLabel('Rename before resize');
$renameResize->addFilter('Rename', 'rename-resize');
$renameResize->addFilter(new Skoch_Filter_File_Resize(array('width' => 200, 'height' => 300, 'keepRatio' => true)));
$this->addElement($renameResize);
$resizeRename = new Zend_Form_Element_File('resizeRename');
$resizeRename->setDestination('../upload');
$resizeRename->setLabel('Resize before rename');
$resizeRename->addFilter(new Skoch_Filter_File_Resize(array('width' => 200, 'height' => 300, 'keepRatio' => true)));
$resizeRename->addFilter('Rename', 'resize-rename');
$this->addElement($resizeRename);
$multiResize = new Zend_Form_Element_File('multiResize');
$multiResize->setDestination('../upload');
$multiResize->setLabel('Multiple resizes');
$filterChain = new Zend_Filter();
// Create one big image with at most 600x300 pixel
$filterChain->appendFilter(new Skoch_Filter_File_Resize(array('width' => 600, 'height' => 300, 'keepRatio' => true)));
// Create a medium image with at most 500x200 pixels
$filterChain->appendFilter(new Skoch_Filter_File_Resize(array('directory' => '../upload/medium', 'width' => 500, 'height' => 200, 'keepRatio' => true)));
$multiResize->addFilter('Rename', 'multi-resize');
$multiResize->addFilter($filterChain);
$this->addElement($multiResize);
$renameCrop = new Zend_Form_Element_File('renameCrop');
$renameCrop->setDestination('../upload');
$renameCrop->setLabel('Rename before crop');
$renameCrop->addFilter('Rename', 'rename-crop');
$renameCrop->addFilter(new Skoch_Filter_File_Resize(array('width' => 20, 'height' => 30, 'cropToFit' => true, 'keepRatio' => true)));
$this->addElement($renameCrop);
$submit = new Zend_Form_Element_Submit('submit');
$this->addElement($submit);
}
示例4: _processFileElement
/**
* Add appropriate validators, filters, and hidden elements for a file
* upload element.
*
* @param Zend_Form_Element_File $element
*/
private function _processFileElement($element)
{
$element->setDestination(Zend_Registry::get('storage')->getTempDir());
$options = $this->getThemeOptions();
$fileName = @$options[$element->getName()];
if ($fileName) {
$storage = Zend_Registry::get('storage');
$fileUri = $storage->getUri($storage->getPathByType($fileName, 'theme_uploads'));
} else {
$fileUri = null;
}
// Add extension/mimetype filtering.
if (get_option(File::DISABLE_DEFAULT_VALIDATION_OPTION) != '1') {
$element->addValidator(new Omeka_Validate_File_Extension(self::$allowedExtensions));
$element->addValidator(new Omeka_Validate_File_MimeType(self::$allowedMimeTypes));
$element->addValidator(new Zend_Validate_File_Size(array('max' => self::MAX_UPLOAD_SIZE)));
}
// Make sure the file was uploaded before adding the Rename filter to the element
if ($element->isUploaded()) {
$this->_addFileRenameFilter($element);
}
// add a hidden field to store whether already exists
$hiddenElement = new Zend_Form_Element_Hidden(self::THEME_FILE_HIDDEN_FIELD_NAME_PREFIX . $element->getName());
$hiddenElement->setValue($fileUri);
$hiddenElement->setDecorators(array('ViewHelper', 'Errors'));
$hiddenElement->setIgnore(true);
$this->addElement($hiddenElement);
}
示例5: myInit
public function myInit($Id)
{
global $mySession;
$db = new Db();
if ($Id != "") {
$adminData = $db->runQuery("select * from " . TSHIRT_ICONS . " where id='" . $Id . "'");
$title_value = $adminData[0]['title'];
$oldicon_value = $adminData[0]['icon'];
$colorcode_value = $adminData[0]['colorcode'];
} else {
$title_value = '';
$oldicon_value = '';
$colorcode_value = '';
}
$title = new Zend_Form_Element_Text('title');
$title->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'First Name is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($title_value);
$colorcode = new Zend_Form_Element_Text('colorcode');
$colorcode->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Please enter color code.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "Expandable mws-textinput required")->setAttrib("onkeypress", "return checknummspK(event)")->setValue($colorcode_value);
$this->addElement($colorcode);
$this->addElement($title);
if ($Id == "") {
$image = new Zend_Form_Element_File('image');
$image->setDestination(SITE_ROOT . 'images/tshirt-icons/')->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Please select an icon.'))->addValidator('Extension', false, 'jpg,jpeg,png,gif')->setAttrib("class", "textbox")->addDecorator('Errors', array('class' => 'error'));
} else {
$image = new Zend_Form_Element_File('image');
$image->setDestination(SITE_ROOT . 'images/tshirt-icons/')->addValidator('Extension', false, 'jpg,jpeg,png,gif')->setAttrib("class", "textbox");
}
$this->addElement($image);
if ($Id != "") {
$oldicon = new Zend_Form_Element_Hidden('oldicon');
$oldicon->setValue($oldicon_value);
$this->addElement($oldicon);
$this->addElement("hidden", "foo", array("decorators" => array(array(array("img" => "HtmlTag"), array("tag" => "img", "openOnly" => true, "src" => IMAGES_URL . 'tshirt-icons/' . $oldicon_value, "align" => "middle", "class" => "myClass", "style" => "max-width:200px;max-height:200px;")), array("ViewHelper"), array(array("span" => "HtmlTag"), array("tag" => "span", "class" => "myElement", "style" => "text-align:center;display:block;")))));
}
}
示例6: myInit
public function myInit()
{
global $mySession;
$db = new Db();
$public_name = "";
$emailid_val = "";
$bio_value = '';
$old_profile_image_value = '';
$qur = $db->runquery("SELECT * FROM " . USERS . " WHERE user_id='" . $mySession->TeeLoggedID . "' ");
if ($qur != "" and count($qur) > 0) {
$public_name = $qur[0]['public_name'];
$emailid_val = $qur[0]['emailid'];
$bio_value = $qur[0]['bio'];
$old_profile_image_value = $qur[0]['profile_image'];
}
$publicname = new Zend_Form_Element_Text('publicname');
$publicname->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Public name is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changepasstextbox')->setValue($public_name);
$bio = new Zend_Form_Element_Textarea('bio');
$bio->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Bio is required.'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "changepasstextarea")->setAttrib("style", "height:150px;width:354px;")->setAttrib("maxlength", "300")->setAttrib("placeholder", "Max 300 Characters")->setValue($bio_value);
$profile_image = new Zend_Form_Element_File('profile_image');
$profile_image->setDestination(SITE_ROOT . 'images/profileimages/')->addValidator('Extension', false, 'jpg,jpeg,png,gif')->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "textInput")->setAttrib("style", "width:325px");
$old_profile_image = new Zend_Form_Element_Hidden('old_profile_image');
$old_profile_image->setValue($old_profile_image_value);
$emailid = new Zend_Form_Element_Text('emailid');
$emailid->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Email Id is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changepasstextbox')->setValue($emailid_val);
$this->addElements(array($publicname, $emailid, $bio, $profile_image, $old_profile_image));
}
示例7: init
public function init()
{
$this->setMethod("post");
$title = new Zend_Form_Element_Text("title");
$title->setAttrib("placeholder", "Title");
$title->setAttrib("class", "form-control");
$title->setLabel("Title: ");
$title->setRequired();
$body = new Zend_Form_Element_Textarea("body");
$body->setAttrib("class", "form-control");
$body->setAttrib("placeholder", "Write body here....");
$body->setLabel("Body: ");
$body->setAttrib("rows", "5");
$body->setAttrib("cols", "55");
$body->setRequired();
$picture = new Zend_Form_Element_File('picture');
$picture->setLabel("Picture:");
$picture->setRequired();
$picture->setDestination('/var/www/html/RNR/public/images/thread');
$stick = new Zend_Form_Element_Radio("stick");
$stick->setLabel("Sticky:");
$stick->addMultiOption("on", "on");
$stick->addMultiOption("off", "off");
$stick->setRequired();
$id = new Zend_Form_Element_Hidden("id");
$submit = new Zend_Form_Element_Submit("Submit");
$submit->setAttrib("class", "btn btn-primary");
$submit->setLabel("Save");
$rest = new Zend_Form_Element_Submit('Rest');
$rest->setAttrib("class", "btn btn-info");
$this->addElements(array($id, $title, $body, $picture, $stick, $submit, $rest));
}
示例8: init
public function init($categoryId)
{
global $mySession;
$db = new Db();
$CategoryName = "";
$cattitle = "";
$catdesc = "";
$catimage = "";
$rssurl = "";
if ($categoryId != "") {
//category_id, category_name, perent_id, cat_position, cat_title, cat_desc, cat_image, category_status, created_by, created_date
$PageData = $db->runQuery("select * from " . CATEGORIES . " where category_id='" . $categoryId . "'");
$CategoryName = $PageData[0]['category_name'];
$catposition = $PageData[0]['cat_position'];
$cattitle = $PageData[0]['cat_title'];
$catdesc = $PageData[0]['cat_desc'];
$catimage = $PageData[0]['cat_image'];
$rssurl = $PageData[0]['rss_url'];
}
$cat_position = new Zend_Form_Element_Hidden('cat_position');
$cat_position->setValue($catposition);
$cat_image_file = new Zend_Form_Element_Hidden('cat_image_file');
$cat_image_file->setValue($catimage);
$cat_desc = new Zend_Form_Element_Textarea('cat_desc');
$cat_desc->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Category Title is required.'))->setAttrib("style", "width:350px;height:150px")->setValue($catdesc);
$category_name = new Zend_Form_Element_Text('category_name');
$category_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Category Name is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setAttrib("style", "width:350px;")->setValue($CategoryName);
$cat_title = new Zend_Form_Element_Text('cat_title');
$cat_title->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Category Title is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setAttrib("style", "width:350px;")->setValue($cattitle);
$rss_url = new Zend_Form_Element_Text('rss_url');
$rss_url->setAttrib("class", "textInput")->setAttrib("style", "width:350px;")->setValue($rssurl);
$photo_path = new Zend_Form_Element_File('photo_path');
$photo_path->setDestination(SITE_ROOT . 'images/category/')->addValidator('Extension', false, 'jpg,jpeg,png,gif')->setRequired(false)->addDecorator('Errors', array('class' => 'error'));
$this->addElements(array($category_name, $cat_title, $cat_desc, $cat_image_file, $rss_url, $cat_position, $photo_path));
}
示例9: init
public function init()
{
global $mySession;
$PathType = '1';
if (isset($_REQUEST['path_type'])) {
$PathType = $_REQUEST['path_type'];
}
$video_title = new Zend_Form_Element_Text('video_title');
$video_title->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Video title is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput");
$pathtypeArr = array();
$pathtypeArr[0]['key'] = "1";
$pathtypeArr[0]['value'] = "Computer";
$pathtypeArr[1]['key'] = "2";
$pathtypeArr[1]['value'] = "You Tube Url";
$path_type = new Zend_Form_Element_Radio('path_type');
$path_type->addMultiOptions($pathtypeArr)->setAttrib("onclick", "setType(this.value);")->setValue(1);
$video_path = new Zend_Form_Element_File('video_path');
$video_path->setDestination(SITE_ROOT . 'images/videos/')->addValidator('Extension', false, 'flv');
$you_tube_url = new Zend_Form_Element_Text('you_tube_url');
$you_tube_url->setAttrib("class", "textInput");
if ($PathType == '1') {
$video_path->setRequired(true)->addDecorator('Errors', array('class' => 'error'));
} else {
$you_tube_url->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'You tube url is required.'))->addDecorator('Errors', array('class' => 'error'));
}
$this->addElements(array($video_title, $video_path, $you_tube_url, $path_type));
}
示例10: init
public function init()
{
$this->setAttribs(array('id' => 'form-exposicao-add'));
// exposicao_nome
$exposicao_nome = new Zend_Form_Element_Text("exposicao_nome");
$exposicao_nome->setLabel("Nome da Exposição:");
$exposicao_nome->setAttrib('placeholder', 'Digite o nome de sua exposição');
$exposicao_nome->setRequired();
//exposicao_descricao
$exposicao_descricao = new Zend_Form_Element_Textarea("exposicao_descricao");
$exposicao_descricao->setLabel("Descrição da Exposição:");
$exposicao_descricao->setAttrib('placeholder', 'Conte aos usuários sobre sua exposição');
$exposicao_descricao->setAttrib('rows', 10);
$exposicao_descricao->setRequired();
// tipo_exposicao_id
$tipo_exposicao_id = new Zend_Form_Element_Select("tipo_exposicao_id");
$tipo_exposicao_id->setLabel("Categoria da Exposição:");
$tipo_exposicao_id->setRequired();
$tipo_exposicao_id->setMultiOptions($this->getTipoExposicao());
//exposicao_capa
$exposicao_capa = new Zend_Form_Element_File("files");
$exposicao_capa->setLabel("Selecione a capa:");
$exposicao_capa->setDestination(Zend_Registry::get('config')->path->images->exposicao->capa);
$exposicao_capa->addValidator('Extension', false, 'jpg,png,gif');
$exposicao_capa->addValidator('Size', false, 2097152)->setMaxFileSize(2097152);
$exposicao_capa->setAttrib('id', 'exposicao_capa');
$exposicao_capa->setRequired();
// add elements
$this->addElement($exposicao_nome);
$this->addElement($exposicao_descricao);
$this->addElement($tipo_exposicao_id);
$this->addElement($exposicao_capa);
parent::init();
}
示例11: init
public function init()
{
global $mySession;
$db = new Db();
$image = new Zend_Form_Element_File('image');
$image->setDestination(SITE_ROOT . 'images/adminpostimg/')->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Please select a photo.'))->addValidator('Extension', false, 'jpg,jpeg,png,gif')->setAttrib("class", "textbox")->addDecorator('Errors', array('class' => 'error'));
$this->addElement($image);
}
示例12: init
public function init()
{
// projeto_id
$projeto_id = new Zend_Form_Element_Select("projeto_id");
$projeto_id->setLabel("Projeto: ");
$projeto_id->setAttribs(array('class' => 'form-control'));
$projeto_id->setMultiOptions($this->getProjetos());
// cliente_id
$cliente_id = new Zend_Form_Element_Select("cliente_id");
$cliente_id->setLabel("Cliente: ");
$cliente_id->setAttribs(array('class' => 'form-control'));
$cliente_id->setRequired(false);
$cliente_id->setDecorators(App_Forms_Decorators::$checkboxElementDecorators);
$cliente_id->setMultiOptions($this->getClientes());
// faturamento_tipo
$faturamento_tipo = new Zend_Form_Element_Select("faturamento_tipo");
$faturamento_tipo->setLabel("Tipo: ");
$faturamento_tipo->setAttribs(array('class' => 'form-control'));
$faturamento_tipo->setRequired(false);
$faturamento_tipo->setDecorators(App_Forms_Decorators::$checkboxElementDecorators);
$faturamento_tipo->setMultiOptions(array(1 => 'Boleto', 2 => 'Transferência'));
// faturamento_valor
$faturamento_valor = new Zend_Form_Element_Text("faturamento_valor");
$faturamento_valor->setLabel("Valor: ");
$faturamento_valor->setAttribs(array('class' => 'form-control'));
//$faturamento_valor->setRequired();
$faturamento_valor->setDecorators(App_Forms_Decorators::$checkboxElementDecorators);
// faturamento_descricao
$faturamento_descricao = new Zend_Form_Element_Text("faturamento_descricao");
$faturamento_descricao->setLabel("Descrição: ");
$faturamento_descricao->setAttribs(array('class' => 'form-control'));
$faturamento_descricao->setRequired();
$faturamento_descricao->setDecorators(App_Forms_Decorators::$checkboxElementDecorators);
// faturamento_nosso_numero
$faturamento_nosso_numero = new Zend_Form_Element_Text("faturamento_nosso_numero");
$faturamento_nosso_numero->setLabel("Nosso Nº: ");
$faturamento_nosso_numero->setAttribs(array('class' => 'form-control'));
//$faturamento_nosso_numero->setRequired();
$faturamento_nosso_numero->setDecorators(App_Forms_Decorators::$checkboxElementDecorators);
// faturamento_vencimento
$faturamento_vencimento = new Zend_Form_Element_Text("faturamento_vencimento");
$faturamento_vencimento->setLabel("Vencimento: ");
$faturamento_vencimento->setAttribs(array('class' => 'form-control'));
$faturamento_vencimento->setRequired();
$faturamento_vencimento->setDecorators(App_Forms_Decorators::$checkboxElementDecorators);
// faturamento_nota_fiscal
$faturamento_nota_fiscal = new Zend_Form_Element_File("faturamento_nota_fiscal");
$faturamento_nota_fiscal->setLabel("Nota Fiscal:");
$faturamento_nota_fiscal->addDecorators(App_Forms_Decorators::$ElementDecoratorFile);
$faturamento_nota_fiscal->setAttribs(array('class' => 'filestyle', 'data-buttonText' => 'Selecione a Nota Fiscal', 'data-iconName' => 'fa fa-file'));
//$faturamento_nota_fiscal->setRequired();
$faturamento_nota_fiscal->setDestination(Zend_Registry::get('config')->notafiscal->filepath);
$faturamento_nota_fiscal->addValidators(array(array('Extension', false, 'pdf')));
$this->addElements(array($projeto_id, $cliente_id, $faturamento_tipo, $faturamento_vencimento, $faturamento_valor, $faturamento_nosso_numero, $faturamento_descricao, $faturamento_nota_fiscal));
parent::init();
}
示例13: init
public function init()
{
$this->setName('gallery');
$this->setIsArray(true);
$this->id = new Zend_Form_Element_Hidden('id');
$this->source = new Zend_Form_Element_Text('source');
$this->caption = new Zend_Form_Element_Textarea('caption');
$this->caption_en = new Zend_Form_Element_Textarea('caption_en');
$this->image = new Zend_Form_Element_File('image');
$this->submit = new Zend_Form_Element_Submit('submit');
$this->source->setAttribs(array('class' => 'span6'));
$this->caption->setRequired(true)->setAttribs(array('class' => 'span6', 'rows' => 3, 'style' => 'height:auto;font-size: 16px;font-weight:normal;font-family:Helvetica;padding:5px 10px'));
$this->caption_en->setRequired(true)->setAttribs(array('class' => 'span6', 'rows' => '3', 'style' => 'height:auto;font-size: 16px;font-weight:normal;font-family:Helvetica;padding:5px 10px'));
$this->image->setDestination(UPLOAD_FOLDER . 'gallery')->addValidator(new Zend_Validate_File_Extension('jpg, png'));
$this->submit->setLabel('Simpan');
$this->submit->setAttrib('class', 'btn btn-success');
$this->addElements(array($this->id, $this->source, $this->caption, $this->caption_en, $this->image, $this->submit));
$this->setElementDecorators(array('ViewHelper', 'Errors'), array('image'), false);
$this->image->setDecorators(array('file'));
}
示例14: init
public function init()
{
global $mySession;
$photo_title = new Zend_Form_Element_Text('photo_title');
$photo_title->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Photo title is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput");
$photo_path = new Zend_Form_Element_File('photo_path');
$photo_path->setDestination(SITE_ROOT . 'images/floorplan/')->addValidator('Extension', false, 'jpg,pdf')->setAttrib("class", "mws-textinput")->addDecorator('Errors', array('class' => 'error'));
$step = new Zend_Form_Element_Hidden('step');
$step->setValue("5");
$this->addElements(array($photo_path, $step));
}
示例15: init
public function init()
{
// proposta_numero
$proposta_numero = new Zend_Form_Element_Text("proposta_numero");
$proposta_numero->setLabel("Número: ");
$proposta_numero->setAttribs(array('class' => 'form-control'));
// proposta_tipo_id
$proposta_tipo_id = new Zend_Form_Element_Select("proposta_tipo_id");
$proposta_tipo_id->setLabel("Tipo Proposta: ");
$proposta_tipo_id->setAttribs(array('class' => 'form-control'));
$proposta_tipo_id->setRequired();
$proposta_tipo_id->setDecorators(App_Forms_Decorators::$checkboxElementDecorators);
$proposta_tipo_id->setMultiOptions($this->getPropostaTipo());
// cliente_id
$cliente_id = new Zend_Form_Element_Select("cliente_id");
$cliente_id->setLabel("Cliente: ");
$cliente_id->setAttribs(array('class' => 'form-control'));
$cliente_id->setRequired();
$cliente_id->setDecorators(App_Forms_Decorators::$checkboxElementDecorators);
$cliente_id->setMultiOptions($this->getClientes());
// tipo_servico_id
$tipo_servico_id = new Zend_Form_Element_Select("tipo_servico_id");
$tipo_servico_id->setLabel("Tipo de Serviço: ");
$tipo_servico_id->setAttribs(array('class' => 'form-control'));
$tipo_servico_id->setRequired();
$tipo_servico_id->setDecorators(App_Forms_Decorators::$checkboxElementDecorators);
$tipo_servico_id->setMultiOptions($this->getTipoServicos());
// proposta_horas
$proposta_horas = new Zend_Form_Element_Text("proposta_horas");
$proposta_horas->setLabel("Horas: ");
$proposta_horas->setAttribs(array('class' => 'form-control'));
// proposta_valor
$proposta_valor = new Zend_Form_Element_Text("proposta_valor");
$proposta_valor->setLabel("Valor: ");
$proposta_valor->setAttribs(array('class' => 'form-control'));
// proposta_data
$proposta_data = new Zend_Form_Element_Text("proposta_data");
$proposta_data->setLabel("Data: ");
$proposta_data->setAttribs(array('class' => 'form-control'));
// proposta_vencimento
$proposta_vencimento = new Zend_Form_Element_Text("proposta_vencimento");
$proposta_vencimento->setLabel("Vencimento: ");
$proposta_vencimento->setAttribs(array('class' => 'form-control'));
// proposta_documento
$proposta_documento = new Zend_Form_Element_File("proposta_documento");
$proposta_documento->setLabel("Proposta:");
$proposta_documento->addDecorators(App_Forms_Decorators::$ElementDecoratorFile);
$proposta_documento->setAttribs(array('class' => 'filestyle', 'data-buttonText' => 'Selecione o PDF', 'data-iconName' => 'fa fa-file'));
//$proposta_documento->setRequired();
$proposta_documento->setDestination(Zend_Registry::get('config')->proposta->filepath);
$proposta_documento->addValidators(array(array('Extension', false, 'pdf')));
$this->addElements(array($proposta_numero, $cliente_id, $proposta_tipo_id, $tipo_servico_id, $proposta_horas, $proposta_valor, $proposta_data, $proposta_vencimento, $proposta_documento));
parent::init();
}