コード例 #1
0
ファイル: AddBySNMP.php プロジェクト: E-Poludnie/IXP-Manager
 public function init()
 {
     $name = $this->createElement('text', 'name');
     $name->addValidator('stringLength', false, array(1, 255, 'UTF-8'))->setAttrib('class', 'span3')->setRequired(true)->setLabel('Name')->addFilter('StringTrim')->addFilter(new OSS_Filter_StripSlashes());
     $this->addElement($name);
     $hostname = $this->createElement('text', 'hostname');
     $hostname->addValidator('stringLength', false, array(1, 255, 'UTF-8'))->setAttrib('class', 'span3')->setRequired(true)->setLabel('Hostname')->addFilter('StringTrim')->addFilter(new OSS_Filter_StripSlashes());
     $this->addElement($hostname);
     $switchtype = $this->createElement('select', 'switchtype');
     $switchtype->setMultiOptions(\Entities\Switcher::$TYPES)->setAttrib('class', 'span3 chzn-select')->setRegisterInArrayValidator(true)->addValidator('greaterThan', true, array(0))->setLabel('Type')->setErrorMessages(array('Please set the switch type'));
     $this->addElement($switchtype);
     $this->addElement(IXP_Form_Cabinet::getPopulatedSelect('cabinetid'));
     $infrastructure = IXP_Form_Infrastructure::getPopulatedSelect('infrastructure');
     $this->addElement($infrastructure);
     $snmppasswd = $this->createElement('text', 'snmppasswd');
     $snmppasswd->addValidator('stringLength', false, array(1, 255, 'UTF-8'))->setAttrib('class', 'span3')->setLabel('SNMP Community')->addFilter('StringTrim')->addFilter(new OSS_Filter_StripSlashes());
     $this->addElement($snmppasswd);
     $active = $this->createElement('checkbox', 'active');
     $active->setLabel('Active?')->setCheckedValue('1')->setUncheckedValue('0')->setValue('1');
     $this->addElement($active);
     $this->addElement(self::createSubmitElement('submit', _('Next')));
     $this->addElement($this->createCancelElement('cancel', OSS_Utils::genUrl('switch', 'list')));
     $manualAdd = new OSS_Form_Element_Buttonlink('manualAdd');
     $manualAdd->setAttrib('href', OSS_Utils::genUrl('switch', 'add'))->setAttrib('label', _('Manual / Non-SNMP Add'));
     $this->addElement($manualAdd);
 }
コード例 #2
0
 /**
  * A utility function for creating a standard cancel button for forms.
  *
  * @param string $name The element name
  * @param string $cancelLocation The cancel location URL
  * @return Zend_Form_Element_Submit The cancel element
  */
 public function createCancelElement($name = 'cancel', $cancelLocation = null)
 {
     if ($cancelLocation === null) {
         $cancelLocation = $this->cancelLocation;
     }
     $cancel = new OSS_Form_Element_Buttonlink($name);
     return $cancel->setAttrib('href', $cancelLocation)->setAttrib('label', _('Cancel'));
 }
コード例 #3
0
ファイル: Auth.php プロジェクト: opensolutions/oss-framework
 /**
  * A utility function for creating a standard 'return to login' button link.
  *
  * @param string $name The element name
  * @return OSS_Form_Element_Buttonlink - The button link element
  */
 public static function createReturnToLoginElement($name = 'return_to_login')
 {
     $fpw = new OSS_Form_Element_Buttonlink($name);
     return $fpw->setAttrib('href', OSS_Utils::genUrl('auth', 'login'))->setAttrib('label', _('Return to Login'));
 }