Example #1
0
 public function __construct($options = null)
 {
     $periods = new Periods();
     $period_actives = $periods->getCoinsPeriod();
     parent::__construct($options);
     $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li')));
     $this->setName('coinsclass');
     $referenceName = new Zend_Form_Element_Text('referenceName');
     $referenceName->setLabel('Reference volume title: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setDecorators($decorators)->setAttrib('size', 60);
     $valid = new Zend_Form_Element_Checkbox('valid');
     $valid->SetLabel('Is this volume currently valid: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setDecorators($decorators);
     $period = new Zend_Form_Element_Select('period');
     $period->setLabel('Period: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('inArray', false, array(array_keys($period_actives)))->addMultiOptions(array(NULL => NULL, 'Choose period:' => $period_actives))->addErrorMessage('You must enter a period for this mint')->setDecorators($decorators);
     //Submit button
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submit')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag');
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(60);
     $this->addElement($hash);
     $this->addElements(array($referenceName, $valid, $period, $submit));
     $this->addDisplayGroup(array('referenceName', 'period', 'valid'), 'details')->removeDecorator('HtmlTag');
     $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul'))));
     $this->details->setLegend('Mint details: ');
     $this->details->removeDecorator('DtDdWrapper');
     $this->addDisplayGroup(array('submit'), 'submit');
 }
Example #2
0
 public function init()
 {
     $this->setName(strtolower(get_class()));
     $this->setMethod("post");
     $oFormName = new Zend_Form_Element_Hidden("form_name");
     $oFormName->setValue(get_class());
     $oFormName->setIgnore(FALSE)->removeDecorator("Label");
     $this->addElement($oFormName);
     $oMessage = new Zend_Form_Element_Textarea("message");
     $oMessage->setFilters($this->_aFilters);
     $oMessage->setRequired(FALSE);
     $oMessage->removeDecorator("label");
     $this->addElement($oMessage);
     $oIsDing = new Zend_Form_Element_Checkbox("is_ding");
     $oIsDing->setLabel("Włącz dźwięk");
     $oIsDing->setValue(1);
     $this->addElement($oIsDing);
     $oSubmit = new Zend_Form_Element_Submit("send_message");
     $oSubmit->setLabel("Wyślij wiadomość");
     $this->addElement($oSubmit);
     $oViewScript = new Zend_Form_Decorator_ViewScript();
     $oViewScript->setViewModule("admin");
     $oViewScript->setViewScript("_forms/chat.phtml");
     $this->clearDecorators();
     $this->setDecorators(array(array($oViewScript)));
     $oElements = $this->getElements();
     foreach ($oElements as $oElement) {
         $oElement->setFilters($this->_aFilters);
         $oElement->removeDecorator("Errors");
     }
 }
 /**
  * @param string $content
  * @return string
  */
 public function render($content)
 {
     $prepend = $this->getElement()->getAttrib('prepend');
     $append = $this->getElement()->getAttrib('append');
     if (null === $prepend && null === $append) {
         return $content;
     }
     $placement = 'prepend';
     $addOn = $prepend;
     if (null !== $append) {
         $placement = 'append';
         $addOn = $append;
     }
     if (is_array($addOn)) {
         $addOn = new Zend_Config($addOn, true);
     }
     $addOnClass = 'add-on';
     if ($addOn instanceof Zend_Config) {
         if (isset($addOn->active) && true === $addOn->active) {
             $addOnClass .= ' active';
             unset($addOn->active);
         }
         $prependedElement = new Zend_Form_Element_Checkbox($addOn);
         $prependedElement->setDecorators(array(array('ViewHelper')));
         $addOn = $prependedElement->render($this->getElement()->getView());
     }
     $this->getElement()->setAttrib('prepend', null);
     $this->getElement()->setAttrib('append', null);
     $span = '<span class="' . $addOnClass . '">' . $addOn . '</span>';
     return '<div class="input-' . $placement . '">
                 ' . ('prepend' == $placement ? $span : '') . $content . ('append' == $placement ? $span : '') . '
             </div>';
 }
 /**
  *
  * Themes & styles
  *
  */
 public function init()
 {
     $cname = explode('_', get_class());
     $this->preInit(end($cname));
     // use template file
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/SettingsStyles.phtml'))));
     // load settings
     $AppOptions = new Application_Model_AppOptions();
     $all_meta = $AppOptions->getAllOptions();
     // fields
     $themes_array = array('/bootstrap/css/bootstrap.min.css' => 'Bootstrap');
     $css_theme = new Zend_Form_Element_Select('css_theme');
     $css_theme->setDecorators(array('ViewHelper', 'Errors'))->setMultiOptions($themes_array)->setErrorMessages(array($this->translator->translate('Please select')))->setLabel($this->translator->translate('Choose css theme'))->setRequired(true)->setValue(isset($all_meta['css_theme']) ? $all_meta['css_theme'] : 'bootstrap')->setAttrib('class', 'form-control');
     $wide_layout = new Zend_Form_Element_Checkbox('wide_layout');
     $wide_layout->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['wide_layout']) && $all_meta['wide_layout'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Extra-wide layout on large screens'))->setCheckedValue("1")->setUncheckedValue("0");
     $cover_ysize = new Zend_Form_Element_Text('cover_ysize');
     $cover_ysize->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Cover image height'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['cover_ysize']) ? $all_meta['cover_ysize'] : '220')->setAttrib('class', 'form-control');
     $user_background = new Zend_Form_Element_Checkbox('user_background');
     $user_background->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['user_background']) && $all_meta['user_background'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Users can have custom background image'))->setCheckedValue("1")->setUncheckedValue("0");
     $subscriber_background = new Zend_Form_Element_Checkbox('subscriber_background');
     $subscriber_background->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['subscriber_background']) && $all_meta['subscriber_background'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Subscribers can have custom background image'))->setCheckedValue("1")->setUncheckedValue("0");
     $custom_css = new Zend_Form_Element_Textarea('css_custom');
     $custom_css->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('COLS', '')->setAttrib('ROWS', '15')->setValue(isset($all_meta['css_custom']) ? $all_meta['css_custom'] : '')->setLabel($this->translator->translate('Custom css'))->setAttrib('class', 'form-control');
     $submit = new Zend_Form_Element_Submit('submitbtn');
     $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Update'))->setAttrib('class', 'submit btn btn-default');
     $this->addElements(array($css_theme, $wide_layout, $cover_ysize, $user_background, $subscriber_background, $custom_css, $submit));
     $this->postInit();
 }
Example #5
0
 public function init()
 {
     $obj = new Application_Model_DbTable_Juego();
     $primaryKey = $obj->getPrimaryKey();
     $this->setMethod('post');
     $this->setEnctype('multipart/form-data');
     $this->setAttrib('idjuego', $primaryKey);
     $this->setAction('/admin/juego/new');
     $e = new Zend_Form_Element_Hidden($primaryKey);
     $this->addElement($e);
     $this->addElement($e);
     $e = new Zend_Form_Element_Checkbox('estado');
     $e->setValue(true);
     $this->addElement($e);
     $e = new Zend_Form_Element_Text('url');
     $this->addElement($e);
     $e = new Zend_Form_Element_Text('nombre');
     $this->addElement($e);
     $i = new Zend_Form_Element_File('avanzado');
     $this->addElement($i);
     $this->getElement('avanzado')->setDestination(ROOT_IMG_DINAMIC . '/juego/avanzado/')->addValidator('Size', false, 10024000)->addValidator('Extension', true, 'jpg,png,gif,jpeg')->setRequired(false);
     $i = new Zend_Form_Element_File('basico360');
     $this->addElement($i);
     $this->getElement('basico360')->setDestination(ROOT_IMG_DINAMIC . '/juego/basico360/')->addValidator('Size', false, 10024000)->addValidator('Extension', true, 'jpg,png,gif,jpeg')->setRequired(false);
     foreach ($this->getElements() as $element) {
         $element->removeDecorator('Label');
         $element->removeDecorator('DtDdWrapper');
         $element->removeDecorator('HtmlTag');
     }
 }
Example #6
0
 /**
  * Form initialization
  *
  * @return void
  */
 public function init()
 {
     $this->setName('loginForm');
     $this->setElementsBelongTo('loginForm');
     $element = new Zend_Form_Element_Text('username');
     $element->setLabel('Username')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim');
     $this->addElement($element);
     $element = new Zend_Form_Element_Password('password');
     $element->setLabel('Password')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim');
     $this->addElement($element);
     $element = new Zend_Form_Element_Checkbox('rememberMe');
     $element->setLabel('Remember me');
     $this->addElement($element);
     /**
      * @var $request Zend_Controller_Request_Http
      */
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $element = new Zend_Form_Element_Hidden('redirect');
     $element->setValue($request->getParam('from', '/'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim');
     $element->getDecorator('HtmlTag')->setOption('class', 'hidden');
     $element->getDecorator('Label')->setOption('tagClass', 'hidden');
     $this->addElement($element);
     $element = new Zend_Form_Element_Submit('submit');
     $element->setLabel('Connection');
     $this->addElement($element);
 }
Example #7
0
 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->setName('Decmethods');
     $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'apppend', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li')));
     $term = new Zend_Form_Element_Text('term');
     $term->setLabel('Decoration style term: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter a valid title for this decorative method!')->setDecorators($decorators);
     $termdesc = new Pas_Form_Element_RTE('termdesc');
     $termdesc->setLabel('Description of decoration style: ')->setRequired(false)->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds')->addFilters(array('BasicHtml', 'EmptyParagraph'))->addFilter('WordChars');
     $valid = new Zend_Form_Element_Checkbox('valid');
     $valid->setLabel('Is this term valid?: ')->setRequired(true)->setDecorators($decorators);
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(60);
     $this->addElement($hash);
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag');
     $this->addElements(array($term, $termdesc, $valid, $submit));
     $this->addDisplayGroup(array('term', 'termdesc', 'valid'), 'details')->removeDecorator('HtmlTag');
     $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul'))));
     $this->details->removeDecorator('DtDdWrapper');
     $this->details->removeDecorator('HtmlTag');
     $this->addDisplayGroup(array('submit'), 'submit');
     $this->submit->removeDecorator('DtDdWrapper');
     $this->submit->removeDecorator('HtmlTag');
     $this->details->setLegend('Decoration method details: ');
 }
Example #8
0
 public function __construct($options = null)
 {
     $projecttypes = new ProjectTypes();
     $projectype_list = $projecttypes->getTypes();
     ZendX_JQuery::enableForm($this);
     parent::__construct($options);
     $this->setName('research');
     $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li')));
     $investigator = new Zend_Form_Element_Text('investigator');
     $investigator->setLabel('Principal work conducted by: ')->setRequired(true)->setAttrib('size', 60)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a lead for this project.')->setDecorators($decorators)->addValidator('Alnum', false, array('allowWhiteSpace' => true));
     $level = new Zend_Form_Element_Select('level');
     $level->setLabel('Level of research: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL => NULL, 'Choose type of research' => $projectype_list))->addValidator('inArray', false, array(array_keys($projectype_list)))->setDecorators($decorators);
     $title = new Zend_Form_Element_Text('title');
     $title->setLabel('Project title: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 60)->addErrorMessage('Choose title for the project.')->setDecorators($decorators)->addValidator('Alnum', false, array('allowWhiteSpace' => true));
     $description = $this->addElement('RTE', 'description', array('label' => 'Short description of project: '));
     $description = $this->getElement('description')->setRequired(false)->addFilter('stringTrim')->setAttribs(array('cols' => 80, 'rows' => 10))->addFilters(array('BasicHtml', 'StringTrim', 'EmptyParagraph'))->addDecorator('HtmlTag', array('tag' => 'li'));
     $startDate = new ZendX_JQuery_Form_Element_DatePicker('startDate');
     $startDate->setLabel('Start date of project')->setAttrib('size', 20)->setJQueryParam('dateFormat', 'yy-mm-dd')->addValidator('Date')->setRequired(false)->addErrorMessage('You must enter a start date for this project')->setDecorators($decorators);
     $endDate = new ZendX_JQuery_Form_Element_DatePicker('endDate');
     $endDate->setLabel('End date of project')->setAttrib('size', 20)->setJQueryParam('dateFormat', 'yy-mm-dd')->setRequired(false)->addValidator('Date')->addErrorMessage('You must enter an end date for this project')->setDecorators($decorators);
     $valid = new Zend_Form_Element_Checkbox('valid');
     $valid->setLabel('Make public: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Digits')->setDecorators($decorators);
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submit')->removeDecorator('label')->setAttrib('class', 'large')->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper');
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(4800);
     $this->addElements(array($title, $description, $level, $startDate, $endDate, $valid, $investigator, $submit, $hash));
     $this->addDisplayGroup(array('title', 'investigator', 'level', 'description', 'startDate', 'endDate', 'valid'), 'details')->removeDecorator('HtmlTag');
     $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul'))));
     $this->details->removeDecorator('DtDdWrapper');
     $this->addDisplayGroup(array('submit'), 'submit');
 }
Example #9
0
 public function init()
 {
     $tr = Zend_Registry::get('tr');
     $name = new Zend_Form_Element_Text('name');
     $name->setLabel($tr->_('NAME'));
     $name->setRequired(true);
     $this->addElement($name);
     $enabled = new Zend_Form_Element_Checkbox('enabled');
     $enabled->setLabel($tr->_('IS_ACTION_ENABLED'));
     $this->addElement($enabled);
     $public = new Zend_Form_Element_Checkbox('public');
     $public->setLabel($tr->_('IS_ACTION_PUBLIC'));
     $this->addElement($public);
     $route = new Zend_Form_Element_Text('route');
     $route->setLabel($tr->_('ROUTE'));
     $route->setRequired(true);
     $this->addElement($route);
     $desc = new Zend_Form_Element_Textarea('description');
     $desc->cols = 35;
     $desc->rows = 15;
     $desc->setLabel($tr->_('DESCRIPTION'));
     $desc->setRequired(false);
     $this->addElement($desc);
     parent::init();
 }
Example #10
0
    public function init()
    {
        $tr = Zend_Registry::get('tr');
        $locale = Zend_Registry::get('Zend_Locale');

        $available_languages = array (
            'en' => 'English',
            'fr' => 'Francais',
            'it' => 'Italiano',
            'ru' => 'Русский',
        );

        $this->setAction('/language');
        $this->setAttrib('id', 'language-form');

        $languages = new Zend_Form_Element_Select('languages');
        $languages->setLabel($tr->_('LANGUAGE'));
        $languages->addMultiOptions($available_languages);
        $languages->setValue(isset($locale->value) ? $locale->value : 'en');
        $this->addElement($languages);

        $system_wide = new Zend_Form_Element_Checkbox('system_wide');
        $system_wide->setLabel($tr->_('UPDATE_SYSTEM_WIDE') . '?');
        $system_wide->setRequired(false);
        $this->addElement($system_wide);

        $this->addElement(new Zend_Form_Element_Submit($tr->_('SAVE')));

        parent::init();
    }
Example #11
0
 /**
  *
  * @param array $options Options to build the form
  */
 public function __construct($options = null)
 {
     parent::__construct($options);
     // Title
     $title = new Zend_Form_Element_Text('FSI_Title');
     $title->setLabel($this->getView()->getCibleText('form_section_title_label') . " <span class='field_required'>*</span>")->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'section_title_edit', 'id' => 'title'))))->setAttrib('class', 'stdTextInput');
     $this->addElement($title);
     // Show title
     $showTitle = new Zend_Form_Element_Checkbox('FS_ShowTitle');
     $showTitle->setLabel($this->getView()->getCibleText('form_section_showtitle_label'));
     $showTitle->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox'))));
     $this->addElement($showTitle);
     // Repeat section
     $repeat = new Zend_Form_Element_Checkbox('FS_Repeat');
     $repeat->setLabel($this->getView()->getCibleText('form_label_has_profil'));
     $repeat->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox'))));
     $this->addElement($repeat);
     // Repeat min
     $repeatMin = new Zend_Form_Element_Text('FS_RepeatMin');
     $repeatMin->setLabel($this->getView()->getCibleText('form_section_repeatMin_label') . " <span class='field_required'>*</span>")->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'section_RepeatMin');
     $this->addElement($repeatMin);
     // Repeat max
     $repeatMax = new Zend_Form_Element_Text('FS_RepeatMax');
     $repeatMax->setLabel($this->getView()->getCibleText('form_section_repeatMax_label') . " <span class='field_required'>*</span>")->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'section_RepeatMax');
     $this->addElement($repeatMax);
     // Sequence - hidden input
     $sequence = new Zend_Form_Element_Hidden('FS_Seq');
     $this->addElement($sequence);
     // page break - hiden input
     $pageBreak = new Zend_Form_Element_Hidden('FS_PageBreak');
     $this->addElement($pageBreak);
     // Set the form id
     $this->setAttrib('id', 'section');
 }
Example #12
0
 public function init()
 {
     $obj = new Application_Model_DbTable_Link();
     $primaryKey = $obj->getPrimaryKey();
     $this->setMethod('post');
     $this->setEnctype('multipart/form-data');
     $this->setAttrib('idlink', $primaryKey);
     $this->setAction('/link/index');
     $e = new Zend_Form_Element_Hidden($primaryKey);
     $this->addElement($e);
     $e = new Zend_Form_Element_Checkbox('chkEstado[]');
     $e->setValue(true);
     $this->addElement($e);
     $e = new Zend_Form_Element_Text('txtTitulo[]');
     $this->addElement($e);
     $e = new Zend_Form_Element_Text('txtLink[]');
     $this->addElement($e);
     $e = new Zend_Form_Element_Hidden('txtImagen[]');
     $this->addElement($e);
     foreach ($this->getElements() as $element) {
         $element->removeDecorator('Label');
         $element->removeDecorator('DtDdWrapper');
         $element->removeDecorator('HtmlTag');
     }
 }
 public function __construct($options = null)
 {
     parent::__construct($options);
     $services = new WebServices();
     $servicesListed = $services->getValidServices();
     $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'apppend', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li')));
     $this->setName('socialweb');
     $username = new Zend_Form_Element_Text('account');
     $username->setLabel('Account username: '******'StringTrim', 'StripTags'))->setAttrib('size', 30)->addErrorMessage('Please enter a valid username!')->setDecorators($decorators);
     $service = new Zend_Form_Element_Select('accountName');
     $service->setLabel('Social services: ')->addFilters(array('StringTrim', 'StripTags'))->addMultiOptions(array(NULL => 'Choose a service', 'Valid services' => $servicesListed))->addValidator('InArray', false, array(array_keys($servicesListed)))->setDecorators($decorators);
     $public = new Zend_Form_Element_Checkbox('public');
     $public->setLabel('Show this to public users?: ')->addFilters(array('StringTrim', 'StripTags'))->setRequired(true)->setDecorators($decorators)->addErrorMessage('You must set the status of this account');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submit')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag');
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(4800);
     $this->addElements(array($service, $hash, $username, $public, $submit));
     $this->addDisplayGroup(array('accountName', 'account', 'public'), 'details')->removeDecorator('HtmlTag');
     $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul'))));
     $this->details->removeDecorator('DtDdWrapper');
     $this->details->removeDecorator('HtmlTag');
     $this->addDisplayGroup(array('submit'), 'submit');
     $this->submit->removeDecorator('DtDdWrapper');
     $this->submit->removeDecorator('HtmlTag');
 }
Example #14
0
 public function init()
 {
     $this->setName('add_video_link');
     //$this->setAction('newExpert');
     $this->setMethod('Post');
     $this->setAttrib('enctype', 'multipart/form-data');
     $title = new Zend_Form_Element_Text('title', array('disableLoadDefaultDecorators' => true));
     $title->setRequired(true)->setLabel('* Video Title:')->setAttrib('id', 'video_title')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
     $url_video = new Zend_Form_Element_Text('url_video', array('disableLoadDefaultDecorators' => true));
     $url_video->setRequired(true)->setLabel('* Video URL:')->setAttrib('id', 'url_video')->addValidator('NotEmpty')->setAttrib("class", "form-control")->addFilter('StripTags')->addFilter('StringTrim')->removeDecorator('htmlTag');
     $short_description = new Zend_Form_Element_Textarea('short_description', array('disableLoadDefaultDecorators' => true));
     $short_description->setRequired(true)->setAttrib("id", "short_description")->setLabel(' *Short Description:')->setAttrib("class", "form-control")->setAttrib('ROWS', '5')->setAttrib('COLS', '3')->addFilter('StringTrim');
     $video_img = new Zend_Form_Element_File('video_img');
     //$video_img->setRequired(true)
     $video_img->addValidator('Count', false, 1)->addValidator('ImageSize', false, array('minwidth' => 100, 'maxwidth' => 1000, 'minheight' => 100, 'maxheight' => 1000))->addValidator('Size', false, 1000240000)->setErrorMessages(array("Upload an image:"))->addValidator('Extension', false, 'jpg,png,gif,jpeg');
     // only JPEG, PNG, and GIFs
     $is_featured = new Zend_Form_Element_Checkbox('is_featured', array('disableLoadDefaultDecorators' => true));
     $is_featured->setAttrib("id", "is_featured")->setLabel('Featured:')->setAttrib("class", "form-control")->addFilter('StripTags')->addFilter('StringTrim');
     $is_main = new Zend_Form_Element_Checkbox('is_main', array('disableLoadDefaultDecorators' => true));
     $is_main->setAttrib("id", "is_main")->setLabel('Mark main video:')->setAttrib("class", "form-control")->addFilter('StripTags')->addFilter('StringTrim');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submit-btn');
     $submit->setAttrib('class', 'btn btn-lg btn-primary float-right')->removeDecorator('HtmlTag')->removeDecorator('Label')->setLabel("Save");
     $this->setElementDecorators(array('Errors', 'ViewHelper', array('decorator' => array('td' => 'HtmlTag'), 'options' => array('tag' => 'td')), array('Label', array('tag' => 'td')), array('decorator' => array('tr' => 'HtmlTag'), 'options' => array('tag' => 'tr'))), array('title', 'short_description', 'url_video', 'video_img', 'is_featured', 'is_main'));
     //$this->addElement('hash', 'csrf', array('ignore' => true,));
     $this->addElements(array($title, $short_description, $video_img, $url_video, $is_featured, $is_main, $submit));
 }
Example #15
0
 /**
  *
  * Edit Group form
  *
  */
 public function init()
 {
     $cname = explode('_', get_class());
     $this->preInit(end($cname));
     // use template file
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/EditGroup.phtml'))));
     // get group from database
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $group = $request->getParam('name');
     $Profiles = new Application_Model_Profiles();
     $ProfilesMeta = new Application_Model_ProfilesMeta();
     $profile = $Profiles->getProfile($group, false, true);
     $owners_profile = $Profiles->getProfileByField('id', $profile->owner);
     $username_minchars = Zend_Registry::get('config')->get('username_minchars');
     $username_maxchars = Zend_Registry::get('config')->get('username_maxchars');
     // fields
     $id = new Zend_Form_Element_Hidden('id');
     $id->setValue($profile->id);
     $name = new Zend_Form_Element_Text('name');
     $name->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Group Name'))->setValue($profile->name)->setIgnore(true)->setAttrib('readonly', true)->setAttrib('class', 'form-control');
     $screenname = new Zend_Form_Element_Text('screen_name');
     $screenname->setDecorators(array('ViewHelper', 'Errors'))->addFilter('StringTrim')->setValue($profile->screen_name)->addValidator('alnum', false, array('allowWhiteSpace' => true))->addValidator('stringLength', false, array($username_minchars, $username_maxchars))->setErrorMessages(array(sprintf($this->translator->translate('Please choose a valid name between %d and %d characters'), $username_minchars, $username_maxchars)))->setLabel($this->translator->translate('Screen Name'))->setRequired(true)->setAttrib('class', 'form-control');
     $description = new Zend_Form_Element_Textarea('description');
     $description->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('COLS', '')->setAttrib('ROWS', '4')->addFilter('StripTags')->setValue($ProfilesMeta->getMetaValue('description', $profile->id))->setLabel($this->translator->translate('About this group'))->setAttrib('class', 'form-control');
     $profile_privacy = new Zend_Form_Element_Select('profile_privacy');
     $profile_privacy->setDecorators(array('ViewHelper', 'Errors'))->setMultiOptions(Zend_Registry::get('group_privacy_array'))->setErrorMessages(array($this->translator->translate('Select group visibility')))->setLabel($this->translator->translate('Select group visibility'))->setRequired(true)->setValue($profile->profile_privacy)->setAttrib('class', 'form-control');
     $is_hidden = new Zend_Form_Element_Checkbox('is_hidden');
     $is_hidden->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($profile->is_hidden) && $profile->is_hidden == 1 ? 1 : 0)->setLabel($this->translator->translate('Remove?'))->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($id, $name, $screenname, $profile_privacy, $description, $is_hidden, $submit));
     $this->postInit();
 }
Example #16
0
File: Event.php Project: GEANT/CORE
 public function init()
 {
     $this->setAction('/core/event/new');
     $this->setAttrib('enctype', 'multipart/form-data');
     $eventModel = new Core_Model_Event();
     $category = new Zend_Form_Element_Select('category_id');
     $category->setLabel('Category')->setMultiOptions($eventModel->getCategories())->setAttrib('class', 'medium')->setDecorators(array('Composite'));
     $title = new Zend_Form_Element_Text('title');
     $title->setLabel('Title')->setRequired(true)->addValidator('regex', true, array('pattern' => '/^.*$/', 'messages' => array(Zend_Validate_Regex::NOT_MATCH => 'Wrong format')))->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'sessions', 'field' => 'title')))->setAttrib('class', 'medium')->setDescription('Must be between 2 and 30 characters, only letters, numbers and spaces allowed')->setDecorators(array('Composite'));
     $desc = new Zend_Form_Element_Textarea('description');
     $desc->setLabel('Description')->setAttrib('class', 'medium')->setDescription('Please don\'t make your description too long')->setRequired(false)->addValidator('StringLength', true, array(1, 5000, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Please provide a longer description', Zend_Validate_StringLength::TOO_LONG => 'Your description is too long')))->setDecorators(array('Composite'));
     $locationModel = new Core_Model_Location();
     $location = new Zend_Form_Element_Select('location_id');
     $location->setLabel('Location')->setDescription('<a href="/core/location/new/type/2">Add a new location</a>')->setMultiOptions($locationModel->getLocationsForSelect())->setAttrib('class', 'medium')->setDecorators(array('Composite'));
     $closed = new Zend_Form_Element_Checkbox('closed');
     $closed->setLabel('Closed meeting')->setRequired(false)->setDecorators(array('Composite'));
     $cancelled = new Zend_Form_Element_Checkbox('cancelled');
     $cancelled->setLabel('Meeting cancelled')->setRequired(false)->setDecorators(array('Composite'));
     $registration = new Zend_Form_Element_Text('registration');
     $registration->setLabel('Registration link')->addValidator('Url')->setAttrib('class', 'medium')->setDescription('Please supply a valid Url')->setDecorators(array('Composite'));
     $person = new Zend_Form_Element_Text('persons');
     $person->setLabel('Persons')->setAttrib('class', 'medium')->setDescription('Please add person(s)')->setDecorators(array('Composite'));
     $start = new Zend_Form_Element_Text('tstart');
     $start->setLabel('Start')->setDescription('dd/MM/yyyy HH:mm - 23/11/2011 14:30')->setAttrib('class', 'medium')->addFilter('Null')->setRequired(false)->setDecorators(array('Composite'));
     $end = new Zend_Form_Element_Text('tend');
     $end->setLabel('End')->setDescription('dd/MM/yyyy HH:mm')->setAttrib('class', 'medium')->addFilter('Null')->addValidator('DateIsLater', false, array('tstart'))->setRequired(false)->setDecorators(array('Composite'));
     $resize = new TA_Filter_ImageResize();
     $resize->setWidth(260)->setHeight(170);
     $image = new TA_Form_Element_MagicFile('file');
     $image->setLabel('Image')->setDescription('This image will show on the event details page')->addDecorators($this->_magicFileElementDecorator)->addFilter($resize)->addValidators(array(array('Count', true, 1), array('IsImage', true), array('Size', true, array('max' => '5Mb')), array('ImageSize', true, array('minwidth' => 300, 'minheight' => 200))));
     $this->addElements(array($category, $title, $person, $start, $end, $registration, $desc, $location, $closed, $cancelled, $image));
     $this->addElement('submit', 'submit', array('label' => 'Submit', 'decorators' => $this->_buttonElementDecorator));
 }
 public function init()
 {
     // Set form options
     $this->setName('userShippingAddress')->setMethod('post');
     // Address One
     $addressOne = new Zend_Form_Element_Text('addressOne');
     $addressOne->setRequired(true);
     // Address One
     $addressTwo = new Zend_Form_Element_Text('addressTwo');
     $addressTwo->setRequired(false);
     // City
     $city = new Zend_Form_Element_Text('city');
     $city->setRequired(true);
     // State
     $state = new Zend_Form_Element_Text('state');
     $state->setRequired(true);
     // Country
     $country = new Zend_Form_Element_Text('country');
     $country->setRequired(true);
     // ZIP
     $zip = new Zend_Form_Element_Text('zip');
     $zip->setRequired(true);
     // Is Default Shipping?
     $defaultShipping = new Zend_Form_Element_Checkbox('defaultShipping');
     $defaultShipping->setRequired(false);
     // Add all the elements to the form
     $this->addElement($addressOne)->addElement($addressTwo)->addElement($city)->addElement($state)->addElement($country)->addElement($zip)->addElement($defaultShipping);
 }
 public function init()
 {
     $this->setMethod('post')->setAttrib('enctype', 'multipart/form-data');
     $this->clearDecorators();
     $this->addDecorator('FormElements')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'div_form'))->addDecorator('Form');
     $this->setElementDecorators(array(array('ViewHelper'), array('Errors'), array('Label', array('separator' => ' ')), array('HtmlTag', array('tag' => 'p', 'class' => 'element-group'))));
     $this->addElement('text', 'nombre', array('label' => 'Nombre * ', 'required' => true, 'filters' => array('StripTags')));
     $validator = new Zend_Validate_Alpha(array('allowWhiteSpace' => true));
     $this->nombre->setAttrib('placeholder', 'Nombre');
     $this->nombre->addValidator($validator);
     $this->nombre->setErrorMessages(array('messages' => 'El campo nombre solo puede contener letras'));
     $this->addElement('text', 'apellido', array('label' => 'Apellido  *', 'value' => '', 'required' => true, 'filters' => array('StripTags')));
     $this->apellido->setAttrib('placeholder', 'Apellido');
     $this->apellido->addValidator($validator)->setErrorMessages(array('messages' => 'El campo nombre solo puede contener letras'));
     $this->addElement('text', 'telefono', array('label' => 'Telefono', 'filters' => array('StringTrim', 'StripTags', 'StringToLower')));
     $this->telefono->addValidator('digits')->setErrorMessages(array('messages' => 'El campo nombre solo puede contener numeros'));
     $this->addElement('text', 'domicilio', array('label' => 'Domicilio', 'filters' => array('StringTrim', 'StripTags')));
     $this->addElement('password', 'contraseña', array('label' => 'Contraseña *', 'filters' => array('StringTrim', 'StripTags')));
     $this->contraseña->addValidator('stringLength', false, array(6, 50))->setErrorMessages(array('messages' => 'La Contraseña debe tener como minimo 6 caracteres'));
     $this->addElement('password', 'verifypassword', array('label' => 'Verifica la Contraseña', 'required' => true, 'validators' => array(array('identical', true, array('contraseña')))));
     $this->addElement('text', 'email', array('label' => 'Email *', 'required' => true, 'filters' => array('StringTrim', 'StripTags', 'StringToLower')));
     $this->email->setAttrib('placeholder', '*****@*****.**');
     $this->email->addValidator('EmailAddress', TRUE);
     $db_lookup_validator = new Zend_Validate_Db_NoRecordExists('usuarios', 'email');
     $this->email->addValidator($db_lookup_validator);
     $element = new Zend_Form_Element_File('element');
     $element->setRequired(false)->setLabel('Subir Imagen de Perfil')->setValueDisabled(true)->addValidator('Extension', false, 'jpg,png,gif,jpeg');
     $this->addElement($element);
     $check = new Zend_Form_Element_Checkbox('check');
     $check->setLabel('Acepto el envio de promociones e Informacion por parte del Restaurant *')->setUncheckedValue(null)->setRequired()->setDecorators(array('ViewHelper', 'Description', 'Errors', array('Label', array('separator' => ' ')), array('HtmlTag', array('tag' => 'div', 'class' => 'terminos'))));
     $this->addElement($check);
     $this->addElement('submit', 'Enviar', array('ignore' => true, 'decorators' => array(array('ViewHelper'), array('HtmlTag', array('tag' => 'p', 'class' => 'submit-group')))));
 }
Example #19
0
 /** The constructor
  * @access public
  * @param array $options
  * @return void
  */
 public function __construct(array $options = null)
 {
     $projecttypes = new ProjectTypes();
     $projectype_list = $projecttypes->getTypes();
     $authors = new Users();
     $authorOptions = $authors->getAuthors();
     parent::__construct($options);
     $this->setName('activity');
     $title = new Zend_Form_Element_Text('title');
     $title->setLabel('Project title: ')->setRequired(true)->setAttrib('size', 60)->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->addErrorMessage('Choose title for the project.');
     $description = new Pas_Form_Element_CKEditor('description');
     $description->setLabel('Short description of project: ')->setRequired(true)->setAttribs(array('rows' => 10, 'cols' => 40, 'Height' => 400))->setAttrib('ToolbarSet', 'Basic')->addFilters(array('BasicHtml', 'EmptyParagraph', 'StringTrim'));
     $length = new Zend_Form_Element_Text('length');
     $length->setLabel('Length of project: ')->setAttrib('size', 12)->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a duration for this project in months')->addValidator('Digits')->setDescription('Enter length in months');
     $managedBy = new Zend_Form_Element_Select('managedBy');
     $managedBy->setLabel('Managed by: ')->addMultiOptions(array('Choose an author' => $authorOptions))->setRequired(false)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addFilters(array('StripTags', 'StringTrim'))->addValidator('InArray', false, array(array_keys($authorOptions)))->addErrorMessage('You must enter a manager for this project.');
     $suitableFor = new Zend_Form_Element_Select('suitableFor');
     $suitableFor->setLabel('Suitable for: ')->addMultiOptions(array(null => 'Choose type of research', 'Available types' => $projectype_list))->setRequired(false)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('InArray', false, array(array_keys($projectype_list)))->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter suitability for this task.');
     $location = new Zend_Form_Element_Text('location');
     $location->setLabel('Where would this be located?: ')->setAttrib('size', 12)->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a location for the task.');
     $valid = new Zend_Form_Element_Checkbox('status');
     $valid->setLabel('Publish this task? ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'));
     $submit = new Zend_Form_Element_Submit('submit');
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_salt)->setTimeout(480);
     $this->addElements(array($title, $description, $length, $valid, $managedBy, $suitableFor, $location, $submit, $hash));
     $this->addDisplayGroup(array('title', 'description', 'length', 'location', 'suitableFor', 'managedBy', 'status', 'submit'), 'details');
     $this->details->setLegend('Activity details: ');
     parent::init();
 }
Example #20
0
 public function init()
 {
     $name = new Zend_Form_Element_Text('name');
     $name->setLabel('Name');
     $name->setRequired(true);
     $this->addElement($name);
     $enabled = new Zend_Form_Element_Checkbox('enabled');
     $enabled->setLabel('Is the action enabled ?');
     $this->addElement($enabled);
     $public = new Zend_Form_Element_Checkbox('public');
     $public->setLabel('Is the action public ?');
     $this->addElement($public);
     $use_custom_route = new Zend_Form_Element_Checkbox('use_custom_route');
     $use_custom_route->setLabel('Custom Route');
     $this->addElement($use_custom_route);
     $custom_route = new Zend_Form_Element_Text('route');
     //$custom_route->setLabel('Custom Route');
     $this->addElement($custom_route);
     $desc = new Zend_Form_Element_Textarea('description');
     $desc->cols = 40;
     $desc->rows = 15;
     $desc->setLabel('Description');
     $desc->setRequired(false);
     $this->addElement($desc);
     parent::init();
 }
Example #21
0
 public function init()
 {
     $country_code = new Zend_Form_Element_Text('country_code');
     $country_code->setLabel('Country code');
     $country_code->setDescription('List of codes you can see here: http://framework.zend.com/manual/1.12/en/zend.locale.appendix.html');
     $country_code->setRequired(true);
     $this->addElement($country_code);
     $name = new Zend_Form_Element_Text('name');
     $name->setLabel('Name');
     $name->setRequired(true);
     $this->addElement($name);
     $is_active = new Zend_Form_Element_Checkbox('is_active');
     $is_active->setLabel('Active');
     $is_active->setRequired(true);
     $this->addElement($is_active);
     $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+'/locale/languages/'");
     $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);
 }
 public function init()
 {
     $this->setAction(URL_BASE . '/action');
     $tr = Zend_Registry::get('tr');
     $name = new Zend_Form_Element_Text('name');
     $name->setLabel($tr->_('NAME'));
     $name->setRequired(true);
     $name->addValidator('NotEmpty', true, array('messages' => $tr->_('GENERAL_MISSING_TEXT_VALUE')));
     $this->addElement($name);
     $enabled = new Zend_Form_Element_Checkbox('enabled');
     $enabled->setLabel($tr->_('IS_ACTION_ENABLED'));
     $this->addElement($enabled);
     $public = new Zend_Form_Element_Checkbox('public');
     $public->setLabel($tr->_('IS_ACTION_PUBLIC'));
     $this->addElement($public);
     $route = new Zend_Form_Element_Text('route');
     $route->setLabel($tr->_('CUSTOM_ROUTE'));
     $route->setRequired(true);
     $route->addValidator('NotEmpty', true, array('messages' => $tr->_('GENERAL_MISSING_TEXT_VALUE')));
     $this->addElement($route);
     $desc = new Zend_Form_Element_Textarea('description');
     $desc->cols = 35;
     $desc->rows = 15;
     $desc->setLabel($tr->_('DESCRIPTION'));
     $desc->setRequired(false);
     $this->addElement($desc);
     parent::init();
 }
Example #23
0
 public function __construct($options = null)
 {
     $projecttypes = new ProjectTypes();
     $projectype_list = $projecttypes->getTypes();
     $periods = new Periods();
     $period_options = $periods->getPeriodFrom();
     parent::__construct($options);
     $this->setName('suggested');
     $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li')));
     $level = new Zend_Form_Element_Select('level');
     $level->setLabel('Level of research: ')->setRequired(true)->addMultiOptions(array('Please choose a level' => NULL, 'Research levels' => $projectype_list))->addValidator('InArray', false, array(array_keys($projectype_list)))->addFilters(array('StringTrim', 'StripTags'))->setDecorators($decorators);
     $period = new Zend_Form_Element_Select('period');
     $period->setLabel('Broad research period: ')->setRequired(true)->addMultiOptions(array('Please choose a period' => NULL, 'Periods available' => $period_options))->addValidator('InArray', false, array(array_keys($period_options)))->addFilters(array('StringTrim', 'StripTags'))->setDecorators($decorators);
     $title = new Zend_Form_Element_Text('title');
     $title->setLabel('Project title: ')->setRequired(true)->setAttrib('size', 60)->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('Choose title for the project.')->setDecorators($decorators);
     $description = $this->addElement('Textarea', 'description', array('label' => 'Short description of project: '));
     $description = $this->getElement('description')->setRequired(false)->addFilters(array('StringTrim', 'BasicHtml', 'EmptyParagraph', 'WordChars'))->setAttribs(array('cols' => 80, 'rows' => 10))->addDecorator('HtmlTag', array('tag' => 'li'));
     $valid = new Zend_Form_Element_Checkbox('taken');
     $valid->setLabel('Is the topic taken: ')->setRequired(true)->setDecorators($decorators)->addValidator('Int');
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(4800);
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submit')->removeDecorator('label')->removeDecorator('HtmlTag')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper');
     $this->addElements(array($title, $level, $period, $description, $valid, $submit, $hash));
     $this->addDisplayGroup(array('title', 'level', 'period', 'description', 'taken'), 'details')->removeDecorator('HtmlTag');
     $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul'))));
     $this->details->removeDecorator('DtDdWrapper');
     $this->details->removeDecorator('HtmlTag');
     $this->addDisplayGroup(array('submit'), 'submit');
 }
Example #24
0
 public function __construct($options = null)
 {
     $periods = new Periods();
     $period_options = $periods->getCoinsPeriod();
     parent::__construct($options);
     $this->setName('ruler');
     $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li')));
     $issuer = new Zend_Form_Element_Text('issuer');
     $issuer->setLabel('Ruler or issuer name: ')->setRequired(true)->addErrorMessage('Please enter a name for this issuer or ruler.')->setDecorators($decorators)->setAttrib('size', 70)->addValidator('Alnum', false, array('allowWhiteSpace' => true))->addFilters(array('StripTags', 'StringTrim'));
     $date1 = new Zend_Form_Element_Text('date1');
     $date1->setLabel('Date issued from: ')->setRequired(true)->setDecorators($decorators)->addErrorMessage('You must enter a date for the start of their issue.')->addFilters(array('StripTags', 'StringTrim'))->addValidator('Digits');
     $date2 = new Zend_Form_Element_Text('date2');
     $date2->setLabel('Date issued to: ')->setRequired(true)->setDecorators($decorators)->addErrorMessage('You must enter a date for the end of their issue.')->addFilters(array('StripTags', 'StringTrim'))->addValidator('Digits');
     $valid = new Zend_Form_Element_Checkbox('valid');
     $valid->SetLabel('Is this ruler or issuer currently valid: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int')->setDecorators($decorators);
     $period = new Zend_Form_Element_Select('period');
     $period->setLabel('Broad period attributed to: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL => NULL, 'Choose reason' => $period_options))->addValidator('InArray', false, array(array_keys($period_options)))->setDecorators($decorators)->addErrorMessage('You must enter a period for this ruler/issuer');
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(4800);
     //Submit button
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag');
     $this->addElements(array($issuer, $date1, $date2, $period, $valid, $submit, $hash));
     $this->addDisplayGroup(array('issuer', 'date1', 'date2', 'period', 'valid', 'submit'), 'details');
     $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul'))));
     $this->details->setLegend('Issuer or ruler details: ');
     $this->details->removeDecorator('DtDdWrapper');
     $this->details->removeDecorator('HtmlTag');
 }
Example #25
0
 /** The constructor
  * @access public
  * @param array $options
  * @return void
  */
 public function __construct(array $options = null)
 {
     $periods = new Periods();
     $period_options = $periods->getPeriodFrom();
     parent::__construct($options);
     $this->setName('period');
     $term = new Zend_Form_Element_Text('term');
     $term->setLabel('Period name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToUpper'))->addValidator('Alpha', false, array('allowWhiteSpace' => true))->setAttrib('size', 60)->addErrorMessage('You must enter a period name');
     $fromdate = new Zend_Form_Element_Text('fromdate');
     $fromdate->setLabel('Date period starts: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int')->addErrorMessage('You must enter a start date');
     $todate = new Zend_Form_Element_Text('todate');
     $todate->setLabel('Date period ends: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int')->addErrorMessage('You must enter an end date');
     $notes = new Pas_Form_Element_CKEditor('notes');
     $notes->setLabel('Period notes: ')->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds')->addFilters(array('StringTrim', 'BasicHtml', 'EmptyParagraph', 'WordChars'));
     $valid = new Zend_Form_Element_Checkbox('valid');
     $valid->setLabel('Period is currently in use: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int')->addErrorMessage('You must enter a status');
     $parent = new Zend_Form_Element_Select('parent');
     $parent->setLabel('Period belongs to: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Choose period to', 'Available periods' => $period_options))->addValidator('InArray', false, array(array_keys($period_options)))->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int');
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_salt)->setTimeout(4800);
     //Submit button
     $submit = new Zend_Form_Element_Submit('submit');
     $this->addElements(array($term, $fromdate, $todate, $valid, $notes, $parent, $submit, $hash));
     $this->addDisplayGroup(array('term', 'fromdate', 'todate', 'parent', 'notes', 'valid'), 'details');
     $this->details->setLegend('Period details: ');
     $this->addDisplayGroup(array('submit'), 'buttons');
     parent::init();
 }
Example #26
0
 /** The constructor
  * @access public
  * @param array $options
  * @return void
  */
 public function __construct(array $options = null)
 {
     $projecttypes = new ProjectTypes();
     $projectype_list = $projecttypes->getTypes();
     $periods = new Periods();
     $period_options = $periods->getPeriodFrom();
     parent::__construct($options);
     $this->setName('suggested');
     $level = new Zend_Form_Element_Select('level');
     $level->setLabel('Level of research: ')->setRequired(true)->addMultiOptions(array(null => 'Please choose a level', 'Research levels' => $projectype_list))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('InArray', false, array(array_keys($projectype_list)))->addFilters(array('StringTrim', 'StripTags'));
     $period = new Zend_Form_Element_Select('period');
     $period->setLabel('Broad research period: ')->setRequired(true)->addMultiOptions(array(null => 'Please choose a period', 'Periods available' => $period_options))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('InArray', false, array(array_keys($period_options)))->addFilters(array('StringTrim', 'StripTags'));
     $title = new Zend_Form_Element_Text('title');
     $title->setLabel('Project title: ')->setRequired(true)->setAttrib('size', 60)->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('Choose title for the project.');
     $description = new Pas_Form_Element_CKEditor('description');
     $description->setLabel('Short description of project: ')->setRequired(false)->setAttribs(array('cols' => 80, 'rows' => 10))->addFilters(array('BasicHtml', 'StringTrim', 'EmptyParagraph'));
     $valid = new Zend_Form_Element_Checkbox('taken');
     $valid->setLabel('Is the topic taken: ')->setRequired(true)->addValidator('Int');
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_salt)->setTimeout(4800);
     $submit = new Zend_Form_Element_Submit('submit');
     $this->addElements(array($title, $level, $period, $description, $valid, $submit, $hash));
     $this->addDisplayGroup(array('title', 'level', 'period', 'description', 'taken'), 'details');
     $this->addDisplayGroup(array('submit'), 'buttons');
     parent::init();
 }
Example #27
0
 /** the constructor
  * @access public
  * @param array $options
  * @return void
  */
 public function __construct(array $options = null)
 {
     $periods = new Periods();
     $period_options = $periods->getCoinsPeriod();
     parent::__construct($options);
     $this->setName('moneyers');
     $name = new Zend_Form_Element_Text('name');
     $name->setLabel('Moneyer\'s name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->addErrorMessage('Enter a moneyer\'s name');
     $period = new Zend_Form_Element_Select('period');
     $period->setLabel('Broad period: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->setRequired(true)->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('You must enter a period for this type')->addMultioptions(array(null => 'Choose a period', 'Available Options' => $period_options));
     $date_1 = new Zend_Form_Element_Text('date_1');
     $date_1->setLabel('Issued coins from: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a date for the start of moneyer period');
     $date_2 = new Zend_Form_Element_Text('date_2');
     $date_2->setLabel('Issued coins until: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a date for the end of moneyer period');
     $appear = new Zend_Form_Element_Text('appear');
     $appear->setLabel('Appearance on coins: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'));
     $RRC = new Zend_Form_Element_Text('RRC');
     $RRC->setLabel('RRC ID number: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'));
     $bio = new Pas_Form_Element_CKEditor('bio');
     $bio->setLabel('Biography: ')->setRequired(true)->addFilters(array('StringTrim', 'WordChars', 'BasicHtml', 'EmptyParagraph'))->setAttribs(array('rows' => 10, 'cols' => 40, 'Height' => 400))->setAttrib('ToolbarSet', 'Finds')->addErrorMessage('You must enter a biography');
     $valid = new Zend_Form_Element_Checkbox('valid');
     $valid->setLabel('Is this term valid?: ');
     $submit = new Zend_Form_Element_Submit('submit');
     $this->addElements(array($period, $name, $date_1, $date_2, $bio, $appear, $RRC, $valid, $submit));
     $this->addDisplayGroup(array('name', 'period', 'date_1', 'date_2', 'appear', 'RRC', 'bio', 'valid', 'submit'), 'details');
     parent::init();
 }
Example #28
0
 public function startFrom()
 {
     $setting = $this->setting;
     if (Application_Model_Preference::GetPlanLevel() == 'disabled') {
         $output_sound_device = new Zend_Form_Element_Checkbox('output_sound_device');
         $output_sound_device->setLabel('Hardware Audio Output')->setRequired(false)->setValue($setting['output_sound_device'] == "true" ? 1 : 0)->setDecorators(array('ViewHelper'));
         if (Application_Model_Preference::GetEnableStreamConf() == "false") {
             $output_sound_device->setAttrib("readonly", true);
         }
         $this->addElement($output_sound_device);
         $output_types = array("ALSA" => "ALSA", "AO" => "AO", "OSS" => "OSS", "Portaudio" => "Portaudio", "Pulseaudio" => "Pulseaudio");
         $output_type = new Zend_Form_Element_Select('output_sound_device_type');
         $output_type->setLabel("Output Type")->setMultiOptions($output_types)->setValue($setting['output_sound_device_type'])->setDecorators(array('ViewHelper'));
         if ($setting['output_sound_device'] != "true") {
             $output_type->setAttrib("disabled", "disabled");
         }
         $this->addElement($output_type);
     }
     $icecast_vorbis_metadata = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata');
     $icecast_vorbis_metadata->setLabel('Icecast Vorbis Metadata')->setRequired(false)->setValue($setting['icecast_vorbis_metadata'] == "true" ? 1 : 0)->setDecorators(array('ViewHelper'));
     if (Application_Model_Preference::GetEnableStreamConf() == "false") {
         $icecast_vorbis_metadata->setAttrib("readonly", true);
     }
     $this->addElement($icecast_vorbis_metadata);
     $stream_format = new Zend_Form_Element_Radio('streamFormat');
     $stream_format->setLabel('Stream Label:');
     $stream_format->setMultiOptions(array("Artist - Title", "Show - Artist - Title", "Station name - Show name"));
     $stream_format->setValue(Application_Model_Preference::GetStreamLabelFormat());
     $stream_format->setDecorators(array('ViewHelper'));
     $this->addElement($stream_format);
 }
 /** The constructor
  * @access public
  * @param array $options
  * @return void
  */
 public function __construct(array $options = null)
 {
     $finds = new Findspots();
     $schema = $finds->info();
     $fields = array_flip($schema['cols']);
     $remove = array('updated', 'created', 'updatedBy', 'createdBy', 'institution', 'findID', 'address', 'fourFigure', 'gridlen', 'postcode', 'easting', 'northing', 'declong', 'declat', 'fourFigureLat', 'fourFigureLon', 'woeid', 'geonamesID', 'osmNode', 'elevation', 'geohash', 'country', 'map25k', 'map10k', 'soiltype', 'smrref', 'otherref', 'id', 'accuracy', 'secuid', 'old_occupierid', 'occupier', 'old_findspotid', 'date');
     foreach ($remove as $rem) {
         unset($fields[$rem]);
     }
     $labels = array('gridrefcert' => 'Grid reference certainty', 'gridref' => 'Grid reference', 'knownas' => 'Known as', 'disccircum' => 'Discovery circumstances', 'gridrefsrc' => 'Grid reference source', 'landusevalue' => 'Land use value', 'landusecode' => 'Land use code', 'depthdiscovery' => 'Depth of discovery', 'Highsensitivity' => 'High sensitivity');
     parent::__construct($options);
     $this->setName('configureFindSpotCopy');
     $elements = array();
     foreach (array_keys($fields) as $field) {
         $label = $field;
         $field = new Zend_Form_Element_Checkbox($field);
         if (array_key_exists($label, $labels)) {
             $clean = ucfirst($labels[$label]);
         } else {
             $clean = ucfirst($label);
         }
         $field->setLabel($clean)->setRequired(false)->addValidator('NotEmpty', 'boolean');
         $elements[] = $field;
         $this->addElement($field);
     }
     $this->addDisplayGroup($elements, 'details');
     //Submit button
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Submit find spot configuration');
     $this->addElement($submit);
     $this->details->setLegend('Choose fields: ');
     parent::init();
 }
Example #30
0
 public function init()
 {
     // Set the method for the display form to POST
     $this->setMethod('post');
     $this->setAttribs(array('class' => 'form-horizontal'));
     $decoratorField = new My_Decorator_FieldLogin();
     $elements = array();
     // Add email field
     $input = new Zend_Form_Element_Text('email', array('required' => true, 'label' => 'Email Address:', 'id' => 'email', 'placeholder' => 'Your email..', 'class' => 'form-control', 'type' => 'email'));
     $validator = new Zend_Validate_EmailAddress();
     $validator->setOptions(array('domain' => false));
     $input->addValidators(array($validator, new Zend_Validate_NotEmpty()));
     $input->addDecorator($decoratorField);
     $elements[] = $input;
     // Add password field
     $input = new Zend_Form_Element_Password('password', array('required' => true, 'label' => 'Password:'******'id' => 'password', 'class' => 'form-control', 'placeholder' => 'Your password..'));
     $input->addValidators(array(new Zend_Validate_NotEmpty()));
     $input->addDecorator($decoratorField);
     $elements[] = $input;
     // Add checkbox field
     $input = new Zend_Form_Element_Checkbox('rememberMe', array('label' => 'Remember me', 'id' => 'rememberMe', 'class' => 'checkbox', 'type' => 'checkbox'));
     $decoratorCheckBox = new My_Decorator_CheckBox();
     $input->addDecorator($decoratorCheckBox);
     $elements[] = $input;
     $input = new Zend_Form_Element('resetpass', array('label' => 'Reset your password', 'id' => 'resetpass', 'class' => 'form-control', 'value' => 'resetpass'));
     $input->addDecorator(new My_Decorator_AnchoraForm());
     $elements[] = $input;
     //Add Submit button
     $input = new Zend_Form_Element_Submit('submit', array('Label' => '', 'class' => 'btn btn-default', 'value' => 'Login'));
     $input->addDecorator($decoratorField);
     $elements[] = $input;
     $this->addElements($elements);
     $this->addDisplayGroup(array('email', 'password', 'resetpass', 'rememberMe', 'submit'), 'displgrp', array('decorators' => array('FormElements', 'Fieldset')));
 }