/**
  *
  * Change network background
  *
  */
 public function init()
 {
     $cname = explode('_', get_class());
     $this->preInit(end($cname));
     // use template file
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/SettingsBackground.phtml'))));
     // load settings
     $AppOptions = new Application_Model_AppOptions();
     $all_meta = $AppOptions->getAllOptions();
     // fields
     $background_image = new Zend_Form_Element_File('background');
     $background_image->setDecorators(array('File', 'Errors'))->setLabel($this->translator->translate('Choose Picture (jpg, png or gif)'))->addValidator('Extension', false, 'jpg,jpeg,png,gif');
     $background_color = new Zend_Form_Element_Text('background_color');
     $background_color->setDecorators(array('ViewHelper', 'Errors'))->addFilter('StringTrim')->setValue(isset($all_meta['background_color']) ? $all_meta['background_color'] : 'ff0000')->setErrorMessages(array($this->translator->translate('Please pick a color')))->setLabel($this->translator->translate('Background Color'))->setRequired(true)->setAttrib('class', 'form-control colorpicker-input');
     $background_repeat = new Zend_Form_Element_Checkbox('background_repeat');
     $background_repeat->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['background_repeat']) && $all_meta['background_repeat'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Repeat background'))->setCheckedValue("1")->setUncheckedValue("0");
     $background_scroll = new Zend_Form_Element_Checkbox('background_scroll');
     $background_scroll->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['background_scroll']) && $all_meta['background_scroll'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Scroll background'))->setCheckedValue("1")->setUncheckedValue("0");
     $background_stretch = new Zend_Form_Element_Checkbox('background_stretch');
     $background_stretch->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['background_stretch']) && $all_meta['background_stretch'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Stretch background'))->setCheckedValue("1")->setUncheckedValue("0");
     $disable_image = new Zend_Form_Element_Checkbox('background_noimage');
     $disable_image->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['background_noimage']) && $all_meta['background_noimage'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Disable custom image'))->setCheckedValue("1")->setUncheckedValue("0");
     $submit = new Zend_Form_Element_Submit('formsubmit');
     $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Save'))->setAttrib('class', 'submit btn btn-default');
     $this->addElements(array($background_image, $background_repeat, $background_scroll, $background_stretch, $disable_image, $background_color, $submit));
     $this->postInit();
 }
예제 #2
0
 public function init()
 {
     $this->setName('figure');
     $this->setIsArray(true);
     $this->name = new Zend_Form_Element_Text('name');
     $this->image = new Zend_Form_Element_File('image');
     $this->description = new Zend_Form_Element_Textarea('description');
     $this->draft = new Zend_Form_Element_Submit('draft');
     $this->submit = new Zend_Form_Element_Submit('submit');
     $this->name->setRequired(true)->setAttrib('class', 'span6');
     $this->description->setRequired(true);
     $this->draft->setAttrib('class', 'btn');
     $this->submit->setAttrib('class', 'btn btn-success');
     $this->image->addValidator(new Zend_Validate_File_Extension('jpg'));
     $this->addElements(array($this->name, $this->image, $this->description, $this->draft, $this->submit));
     $this->setElementDecorators(array('ViewHelper', 'Errors'), array('image'), false);
     $this->image->setDecorators(array('File'));
 }
예제 #3
0
 public function init()
 {
     $this->setName('news');
     $this->setIsArray(true);
     $this->title = new Zend_Form_Element_Text('title');
     $this->content = new Zend_Form_Element_Textarea('content');
     $this->image = new Zend_Form_Element_File('image');
     $this->publish_date = new Zend_Form_Element_Text('publish_date');
     $this->draft = new Zend_Form_Element_Submit('draft');
     $this->submit = new Zend_Form_Element_Submit('submit');
     $this->title->setRequired(true)->setAttrib('class', 'span6');
     $this->content->setRequired(true);
     $this->publish_date->setRequired(true)->addValidator(new Zend_Validate_Date(array('format' => 'dd-mm-yy')));
     $this->draft->setAttrib('class', 'btn');
     $this->submit->setAttrib('class', 'btn btn-success');
     $this->addElements(array($this->image, $this->publish_date, $this->draft, $this->submit, $this->title, $this->content));
     $this->setElementDecorators(array('ViewHelper', 'Errors'), array('image'), false);
     $this->image->setDecorators(array('File'));
 }
예제 #4
0
 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'));
 }
예제 #5
0
파일: FileTest.php 프로젝트: jsnshrmn/Suma
 public function testMarkerInterfaceForFileElement()
 {
     $this->element->setDecorators(array('ViewHelper'));
     $this->assertEquals(1, count($this->element->getDecorators()));
     try {
         $content = $this->element->render(new Zend_View());
         $this->fail();
     } catch (Zend_Form_Element_Exception $e) {
         $this->assertContains('No file decorator found', $e->getMessage());
     }
 }
예제 #6
0
 public function init()
 {
     $this->setName('partner');
     $this->setIsArray(true);
     $this->id = new Zend_Form_Element_Hidden('id');
     $this->language_id = new Zend_Form_Element_HIdden('language_id');
     $this->name = new Zend_Form_Element_Text('name');
     $this->logo = new Zend_Form_Element_File('logo');
     $this->website = new Zend_Form_Element_Text('website');
     $this->description = new Zend_Form_Element_Textarea('description');
     $this->submit = new Zend_Form_Element_Submit('submit');
     $this->name->setRequired(true)->setAttribs(array('class' => 'span6', 'placeholder' => 'Tulis nama partner disini...', 'style' => 'font-size: 16px;font-weight:normal;font-family:Helvetica;padding:5px 10px'));
     $this->website->addValidator(new Budpar_Form_Validator_Url())->setAttribs(array('class' => 'span11', 'placeholder' => 'http://www.example.com'));
     $this->logo->setDestination(UPLOAD_FOLDER . 'partners-logo')->addValidator(new Zend_Validate_File_Extension('jpg, png'));
     $this->description->setRequired(true)->setAttribs(array('cols' => 100, 'rows' => 20));
     $this->submit->setLabel('Simpan');
     $this->submit->setAttrib('class', 'btn btn-success');
     $this->addElements(array($this->id, $this->language_id, $this->name, $this->logo, $this->website, $this->description, $this->submit));
     $this->setElementDecorators(array('ViewHelper', 'Errors'), array('logo'), false);
     $this->logo->setDecorators(array('file'));
 }
예제 #7
0
 /**
  *
  * Change cover form
  *
  */
 public function init()
 {
     $cname = explode('_', get_class());
     $this->preInit(end($cname));
     // use template file
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/CoverPicture.phtml'))));
     // fields
     $cover_file = new Zend_Form_Element_File('coverfile', array('onchange' => '$("html").addClass("busy"); submit();'));
     $cover_file->setDecorators(array('File', 'Errors'))->setLabel($this->translator->translate('Choose Picture (jpg, png or gif)'))->addValidator('Count', false, 1)->addValidator('Size', false, Zend_Registry::get('config')->get('max_file_upload_size'))->addValidator('Extension', false, 'jpg,jpeg,png,gif');
     $submit = new Zend_Form_Element_Submit('formsubmit');
     $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Next'))->setAttrib('class', 'submit btn btn-default');
     $this->addElements(array($cover_file, $submit));
     $this->postInit();
 }
예제 #8
0
 /**
  *
  * Change network logo
  *
  */
 public function init()
 {
     $cname = explode('_', get_class());
     $this->preInit(end($cname), true, false);
     // use template file
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/SettingsLogo.phtml'))));
     // load settings
     $AppOptions = new Application_Model_AppOptions();
     $all_meta = $AppOptions->getAllOptions();
     // fields
     $logo_image = new Zend_Form_Element_File('logo_image');
     $logo_image->setDecorators(array('File', 'Errors'))->setLabel($this->translator->translate('Choose Picture (jpg, png or gif)'))->addValidator('Extension', false, 'jpg,jpeg,png,gif');
     $disable_image = new Zend_Form_Element_Checkbox('logo_noimage');
     $disable_image->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['logo_noimage']) && $all_meta['logo_noimage'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Disable custom image'))->setCheckedValue("1")->setUncheckedValue("0");
     $submit = new Zend_Form_Element_Submit('formsubmit');
     $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Save'))->setAttrib('class', 'submit btn btn-default');
     $this->addElements(array($logo_image, $disable_image, $submit));
     $this->postInit();
 }
예제 #9
0
 /**
  *
  * Change network background
  *
  */
 public function init()
 {
     $cname = explode('_', get_class());
     $this->preInit(end($cname));
     // use template file
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/CustomBackground.phtml'))));
     // load settings
     $Profiles = new Application_Model_Profiles();
     $ProfilesMeta = new Application_Model_ProfilesMeta();
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $request_profile_id = $request->getParam('id', false);
     $profile = $Profiles->getProfileByField('id', $request_profile_id);
     if (Zend_Auth::getInstance()->getIdentity()->role == 'admin' && $request_profile_id || $request_profile_id && $Profiles->getProfile($profile->name, false, true)) {
         // admin or own group & page
         $profile_id = $request_profile_id;
     } else {
         // editing profile
         $profile_id = Zend_Auth::getInstance()->getIdentity()->id;
     }
     $all_meta = $ProfilesMeta->getMetaValues($profile_id);
     // fields
     $background_image = new Zend_Form_Element_File('background');
     $background_image->setDecorators(array('File', 'Errors'))->setLabel($this->translator->translate('Choose Picture (jpg, png or gif)'))->addValidator('Count', false, 1)->addValidator('Size', false, Zend_Registry::get('config')->get('max_file_upload_size'))->addValidator('Extension', false, 'jpg,jpeg,png,gif');
     $background_image->getValidator('Count')->setMessage($this->translator->translate('File not allowed or too big'));
     $background_image->getValidator('Size')->setMessage($this->translator->translate('File not allowed or too big'));
     $background_image->getValidator('Extension')->setMessage($this->translator->translate('File not allowed or too big'));
     $background_repeat = new Zend_Form_Element_Checkbox('background_repeat');
     $background_repeat->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['background_repeat']) && $all_meta['background_repeat'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Repeat background'))->setCheckedValue("1")->setUncheckedValue("0");
     $background_scroll = new Zend_Form_Element_Checkbox('background_scroll');
     $background_scroll->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['background_scroll']) && $all_meta['background_scroll'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Scroll background'))->setCheckedValue("1")->setUncheckedValue("0");
     $background_stretch = new Zend_Form_Element_Checkbox('background_stretch');
     $background_stretch->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['background_stretch']) && $all_meta['background_stretch'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Stretch background'))->setCheckedValue("1")->setUncheckedValue("0");
     $disable_image = new Zend_Form_Element_Checkbox('background_noimage');
     $disable_image->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['background_noimage']) && $all_meta['background_noimage'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Disable custom image'))->setCheckedValue("1")->setUncheckedValue("0");
     $submit = new Zend_Form_Element_Submit('formsubmit');
     $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Save'))->setAttrib('class', 'submit btn btn-default');
     $this->addElements(array($background_image, $background_repeat, $background_scroll, $background_stretch, $disable_image, $submit));
     $this->postInit();
 }
예제 #10
0
$message = new Zend_Form_Element_Textarea('message');
$message->setRequired(TRUE)->setAttrib('id', 'message')->addErrorMessage('Please specify a message');
// Create a submit button
$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel('Submit')->setAttrib('id', 'submit');
// Set the ViewScript decorator for the form and tell it which
// template file to use
$form->setDecorators(array(array('ViewScript', array('viewScript' => 'form-contact.tpl.php'))));
// Add the form elements AFTER the viewscript decorator has been set
$form->addElements(array($file, $message, $submit));
// Get rid of all element decorators except for ViewHelper to render
// the individual elements and Errors decorator to render the errors.
$form->setElementDecorators(array('ViewHelper', 'Errors'));
// The file element requires the File decorator instead of the
// ViewHelper decorator
$file->setDecorators(array('File', 'Errors'));
// Create an instance of Zend_View and set the directory
// for the template files
$view = new Zend_View();
$view->setScriptPath(__DIR__);
// Tell all the elements in the form which view to use when rendering
foreach ($form as $item) {
    $item->setView($view);
}
// process or display the form
if (isset($_POST['submit']) && $form->isValid($_POST)) {
    $uploadHandler = new Zend_File_Transfer_Adapter_Http();
    $uploadHandler->setDestination(__DIR__ . '/uploads/');
    try {
        $uploadHandler->receive();
        $data = $form->getValues();
예제 #11
0
파일: ZFTAA.php 프로젝트: Tony133/zf-web
<?php

/*
	PHP 5.2.0
	ZF 1.6.2
	running this script throws the following in Zend_File_Transfer_Adapter_Abstract on my machine:
	PHP Notice: 
	Undefined variable: result in /Users/michel/web-lib/ZendFramework-1.6.2-minimal/library/Zend/File/Transfer/Adapter/Abstract.php on line 803 
	PHP Warning: Invalid argument supplied for foreach() in /Users/michel/web-lib/ZendFramework-1.6.2-minimal/library/Zend/Form/Element.php on line 524
*/
// edit as required:
set_include_path('/Users/michel/web-lib/ZendFramework-1.6.2-minimal/library');
require_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();
$element = new Zend_Form_Element_File('test');
$element->setDecorators(array('ViewHelper'));
$element->setDestination('/tmp');
$element->clearFilters();
$element->render(new Zend_View());
예제 #12
0
 public function init()
 {
     $seccion = new Application_Model_Seccion();
     $array = $seccion->listarSeccionesPeriodoActualActivos();
     $include = new Application_Model_Includes();
     //$q2a=$include->query2array($array, 'iSeccIdSeccion','vSeccDescripcion');
     $q2a = $include->querytoeach($array, "iSeccIdSeccion");
     $validator = new Zend_Validate_InArray($q2a);
     $validator->setHaystack($q2a);
     $validator->setMessages(array(Zend_Validate_InArray::NOT_IN_ARRAY => 'Eliga una sección'));
     $this->setAction('/admin/agregaralumno')->setMethod('post')->setAttrib('id', 'formLogin')->setAttrib('enctype', 'multipart/form-data');
     $nombreusuario = $this->createElement('text', 'nombreusuario', array('label' => 'Nombre del Usuario', 'placeholder' => 'Máximo 25 caracteres'));
     $nombreusuario->addValidator('notEmpty', true, array('messages' => array('isEmpty' => 'Campo Requerido')))->addValidator('alpha')->addValidator('stringLength', false, array(5, 25, 'messages' => "Entre 5 y 25 caracteres"))->setRequired(true)->addFilter("StringToUpper");
     $nombreusuario->setDecorators(array('ViewHelper', 'Description', 'Errors', array(array('elementDiv' => 'HtmlTag'), array('tag' => 'div')), array(array('td' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td'))));
     $clave = $this->createElement('password', 'clave', array('label' => 'Contraseña'));
     $clave->addValidator('notEmpty', true, array('messages' => array('isEmpty' => 'Campo Requerido')))->addFilter('alnum', array('allowwhitespace' => true))->addValidator('stringLength', false, array(5, 20, 'messages' => "Entre 5 y 20 caracteres"))->setRequired(true)->addFilter("StringToUpper");
     $clave->setDecorators(array('ViewHelper', 'Description', 'Errors', array(array('elementDiv' => 'HtmlTag'), array('tag' => 'div')), array(array('td' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td'))));
     $email = $this->createElement('text', 'email', array('label' => 'Direccion de Correo', 'placeholder' => '*****@*****.**'));
     $email->addValidator('notEmpty', true, array('messages' => array('isEmpty' => 'Campo Requerido')))->addValidator('regex', true, array('patern' => '/^[(a-zA-Z0-9@)].+$/', array('regexNotMatch' => 'Solo Letras y numeros')))->addValidator('stringLength', false, array(5, 100, 'messages' => "Entre 5 y 100 caracteres"))->setRequired(true)->addFilter("StringToUpper");
     $email->setDecorators(array('ViewHelper', 'Description', 'Errors', array(array('elementDiv' => 'HtmlTag'), array('tag' => 'div')), array(array('td' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td'))));
     $dni = $this->createElement('text', 'dni', array('label' => 'Numero Dni', 'placeholder' => '8 Dígitos'));
     $dni->addValidator('notEmpty', true, array('messages' => array('isEmpty' => 'Campo Requerido')))->addValidator('regex', true, array('patern' => '/^[(0-9)]+$/', array('regexNotMatch' => 'Solo Numeros')))->addValidator('stringLength', false, array(8, 8, 'messages' => "DNI se Compone e 8 Carateres"))->setRequired(true)->addFilter("StringTrim");
     $dni->setDecorators(array('ViewHelper', 'Description', 'Errors', array(array('elementDiv' => 'HtmlTag'), array('tag' => 'div')), array(array('td' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td'))));
     $dniapo = $this->createElement('text', 'dniapo', array('label' => 'DNI Apoderado', 'disabled' => true));
     $dniapo->addValidator('notEmpty', true, array('messages' => array('isEmpty' => 'Campo Requerido')))->addValidator('regex', true, array('patern' => '/^[(0-9)]+$/', array('regexNotMatch' => 'Solo Numeros')))->addValidator('stringLength', false, array(8, 8, 'messages' => "DNI se Compone e 8 Carateres"))->addFilter("StringTrim");
     $dniapo->setDecorators(array('ViewHelper', 'Description', 'Errors', array(array('elementDiv' => 'HtmlTag'), array('tag' => 'div')), array(array('td' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td'))));
     $nombreapo = $this->createElement('text', 'nombreapo', array('label' => 'Nombre del Apoderado', 'disabled' => true));
     $nombreapo->addValidator('notEmpty', true, array('messages' => array('isEmpty' => 'Campo Requerido')))->addValidator('regex', true, array('patern' => '/^[(a-z A-Z)]+$/', array('regexNotMatch' => 'Solo Letras')))->addValidator('stringLength', false, array(2, 150, 'messages' => "Entre 2 y 150 caracteres"))->addFilter("StringToUpper")->addFilter("StringTrim");
     $nombreapo->setDecorators(array('ViewHelper', 'Description', 'Errors', array(array('elementDiv' => 'HtmlTag'), array('tag' => 'div')), array(array('td' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td'))));
     $idapoderado = $this->createElement('text', 'idapoderado', array('label' => 'Id del Apoderado', 'disabled' => true));
     $idapoderado->addValidator('notEmpty', true, array('messages' => array('isEmpty' => 'Campo Requerido')))->addValidator('regex', true, array('patern' => '/^[(0-9)]+$/', array('regexNotMatch' => 'Solo Numeros')))->addValidator('stringLength', false, array(1, 8, 'messages' => "Elegir DNI"))->addFilter("StringTrim");
     $idapoderado->setDecorators(array('ViewHelper', 'Description', 'Errors', array(array('elementDiv' => 'HtmlTag'), array('tag' => 'div')), array(array('td' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td'))));
     // creating object for Zend_Form_Element_File
     $doc_file = new Zend_Form_Element_File('foto');
     $doc_file->setLabel('Foto: ')->setRequired(true)->setDestination('main/fotos')->addValidator('Extension', false, 'jpg,png,gif')->addValidator('Size', false, 5120000);
     //5Mb
     $doc_file->setDecorators(array(array('Description', array('tag' => 'p', 'class' => 'description', 'escape' => false)), array('File'), array('Errors'), array('HtmlTag', array('tag' => 'div')), array('Label')));
     $nombre = $this->createElement('text', 'nombre', array('label' => 'Nombre '));
     $nombre->addValidator('notEmpty', true, array('messages' => array('isEmpty' => 'Campo Requerido')))->addValidator('stringLength', false, array(2, 150, 'messages' => "Entre 2 y 150 caracteres"))->setRequired(true)->addFilter("StringToUpper")->addFilter('alpha', array('allowwhitespace' => true))->addFilter("StringTrim");
     $nombre->setDecorators(array('ViewHelper', 'Description', 'Errors', array(array('elementDiv' => 'HtmlTag'), array('tag' => 'div')), array(array('td' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td'))));
     $appaterno = $this->createElement('text', 'appaterno', array('label' => 'Apellido Paterno '));
     $appaterno->addValidator('notEmpty', true, array('messages' => array('isEmpty' => 'Campo Requerido')))->addValidator('stringLength', false, array(2, 150, 'messages' => "Entre 2 y 150 caracteres"))->setRequired(true)->addFilter("StringToUpper")->addFilter('alpha', array('allowwhitespace' => true))->addFilter("StringTrim");
     $appaterno->setDecorators(array('ViewHelper', 'Description', 'Errors', array(array('elementDiv' => 'HtmlTag'), array('tag' => 'div')), array(array('td' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td'))));
     $apmaterno = $this->createElement('text', 'apmaterno', array('label' => 'Apellido Materno '));
     $apmaterno->addValidator('notEmpty', true, array('messages' => array('isEmpty' => 'Campo Requerido')))->addValidator('stringLength', false, array(2, 150, 'messages' => "Entre 2 y 150 caracteres"))->setRequired(true)->addFilter("StringToUpper")->addFilter('alpha', array('allowwhitespace' => true))->addFilter("StringTrim");
     $apmaterno->setDecorators(array('ViewHelper', 'Description', 'Errors', array(array('elementDiv' => 'HtmlTag'), array('tag' => 'div')), array(array('td' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td'))));
     $btnregistrar = $this->createElement('submit', 'registrar', array('label' => 'Registrar'));
     $btnregistrar->setDecorators(array('ViewHelper', 'Description', 'Errors', array(array('elementDiv' => 'HtmlTag'), array('tag' => 'div')), array(array('td' => 'HtmlTag'), array('tag' => 'td'))));
     $btnapoderado = $this->createElement('button', 'buscar', array('label' => 'Buscar Apoderado', 'onclick' => 'buscaapoderado();'));
     $btnapoderado->setDecorators(array('ViewHelper', 'Description', 'Errors', array(array('elementDiv' => 'HtmlTag'), array('tag' => 'div')), array(array('td' => 'HtmlTag'), array('tag' => 'td'))));
     $gradosactuales = new Application_Model_Grado();
     $includes = new Application_Model_Includes();
     $arraygrados = $gradosactuales->listarGradosActivos();
     $arraygradostoarray = $includes->query2array($arraygrados, 'iGradoIdGrado', 'vGradoDescripcion');
     $grado = $this->createElement('select', 'cbogrado', array('label' => 'Grado', 'autocomplete' => false, 'multiOptions' => $arraygradostoarray, 'onChange' => 'cargarseccion();'));
     $grado->setDecorators(array('ViewHelper', 'Description', 'Errors', array(array('elementDiv' => 'HtmlTag'), array('tag' => 'div')), array(array('td' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td'))));
     $seccion = $this->createElement('select', 'cboseccion', array('label' => 'Seccion', 'multiOptions' => array("0" => "Seleccionar Sección")));
     $seccion->addValidator($validator);
     $seccion->addValidator('notEmpty', true, array('messages' => array('isEmpty' => 'Campo requerido')));
     $seccion->setDecorators(array('ViewHelper', 'Description', 'Errors', array(array('elementDiv' => 'HtmlTag'), array('tag' => 'div')), array(array('td' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td'))));
     $sexo = $this->createElement('radio', 'sexo', array('value' => 'M', 'checked' => 'true', 'Label' => 'Sexo'));
     $sexo->addMultiOptions(array('M' => 'Masculino', 'F' => 'Femenino'));
     $sexo->setDecorators(array('ViewHelper', 'Description', 'Errors', array(array('elementDiv' => 'HtmlTag'), array('tag' => 'div')), array(array('td' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td'))));
     $idapo = $this->createElement('hidden', 'idapo');
     $this->addElement($btnapoderado)->addElement($idapo)->addElement($idapoderado)->addElement($nombreapo)->addElement($dniapo)->addElement($grado)->addElement($seccion)->addElement($nombre)->addElement($appaterno)->addElement($apmaterno)->addElement($sexo)->addElement($doc_file)->addElement($dni)->addElement($email)->addElement($nombreusuario)->addElement($clave)->addElement($btnregistrar);
 }