Ejemplo n.º 1
0
 /**
  *
  *
  */
 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'patch-panel/form/autogen.tpl'))));
     ////////////////////////////////////////////////
     // Create and configure elements
     ////////////////////////////////////////////////
     $autogen = $this->createElement('checkbox', 'cb_autogen');
     $autogen->setLabel('Autogenerate ports for this patch panel?')->setAttrib('id', 'auto_gen_ports_cb');
     $this->addElement($autogen);
     $num_ports = $this->createElement('text', 'num_ports');
     $num_ports->setAttrib('size', 4)->setAttrib('maxlength', 3)->setLabel('Number of Ports')->setErrorMessages(array('You must provide a numeric number of ports between 1 and 48'));
     $this->addElement($num_ports);
     $edit = $this->createElement('checkbox', 'edit');
     $edit->setLabel('Edit before committing to database?');
     $this->addElement($edit);
     $this->setElementDecorators(array('ViewHelper'));
 }
Ejemplo n.º 2
0
 /**
  *
  *
  */
 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'patch-panel/form/patch-panel.tpl'))));
     ////////////////////////////////////////////////
     // Create and configure elements
     ////////////////////////////////////////////////
     $name = $this->createElement('text', 'name');
     $name->addValidator('stringLength', false, array(1, 255, 'UTF-8'))->setAttrib('size', 50)->setAttrib('maxlength', 255)->setRequired(true)->setLabel('Name')->addFilter('StringTrim')->addFilter(new IXP_Filter_StripSlashes())->setErrorMessages(array('Name is required and cannot be empty'));
     $this->addElement($name);
     $dbCabinets = Doctrine_Query::create()->from('Cabinet')->orderBy('name ASC')->execute();
     $cabinets = array('0' => '');
     $maxId = 0;
     foreach ($dbCabinets as $c) {
         $cabinets[$c['id']] = "{$c->Location->name} :: {$c['name']}";
         if ($c['id'] > $maxId) {
             $maxId = $c['id'];
         }
     }
     $cabinet = $this->createElement('select', 'cabinetid');
     $cabinet->setMultiOptions($cabinets);
     $cabinet->setRegisterInArrayValidator(true)->setLabel('Cabinet')->addValidator('between', false, array(1, $maxId))->setErrorMessages(array('Please select a cabinet'));
     $this->addElement($cabinet);
     $colo_ref = $this->createElement('text', 'colo_ref');
     $colo_ref->addValidator('stringLength', false, array(1, 255, 'UTF-8'))->setAttrib('size', 40)->setAttrib('maxlength', 255)->setRequired(true)->setLabel('Colo Provider\'s Ref')->addFilter('StringTrim')->addFilter(new IXP_Filter_StripSlashes());
     $this->addElement($colo_ref);
     $cable_type = $this->createElement('select', 'cable_type');
     $cable_type->setMultiOptions(PatchPanelPort::$CABLES_TYPES)->setRegisterInArrayValidator(true)->addValidator('greaterThan', true, array(0))->setLabel('Cable Type')->setErrorMessages(array('Please set the cable type'));
     $this->addElement($cable_type);
     $interface_type = $this->createElement('select', 'interface_type');
     $interface_type->setMultiOptions(PatchPanelPort::$INTERFACE_TYPES)->setRegisterInArrayValidator(true)->addValidator('greaterThan', true, array(0))->setLabel('Interface Type')->setErrorMessages(array('Please set the interface type'));
     $this->addElement($interface_type);
     $allow_duplex = $this->createElement('checkbox', 'allow_duplex');
     $allow_duplex->setLabel('Allow Duplex?');
     $this->addElement($allow_duplex);
     $notes = $this->createElement('textarea', 'notes');
     $notes->setLabel('Notes')->setRequired(false)->addFilter(new IXP_Filter_StripSlashes())->setAttrib('cols', 80)->setAttrib('rows', 6);
     $this->addElement($notes);
     $this->setElementDecorators(array('ViewHelper'));
 }
Ejemplo n.º 3
0
 /**
  *
  *
  */
 public function __construct($options = null, $isEdit = false, $cancelLocation)
 {
     parent::__construct($options, $isEdit);
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'patch-panel/form/patch-panel-port.tpl'))));
     ////////////////////////////////////////////////
     // Create and configure elements
     ////////////////////////////////////////////////
     $port = $this->createElement('hidden', 'port');
     $this->addElement($port);
     $side = $this->createElement('hidden', 'side');
     $this->addElement($side);
     $colo_ref = $this->createElement('text', 'colo_ref');
     $colo_ref->addValidator('stringLength', false, array(1, 255, 'UTF-8'))->setAttrib('size', 40)->setAttrib('maxlength', 255)->setRequired(true)->setLabel('Colo Provider\'s Ref')->addFilter('StringTrim')->addFilter(new IXP_Filter_StripSlashes())->setErrorMessages(array('Colocation reference is required'));
     $this->addElement($colo_ref);
     $type = $this->createElement('select', 'type');
     $type->setMultiOptions(PatchPanelPort::$INTERFACE_TYPES)->setRegisterInArrayValidator(true)->addValidator('greaterThan', true, array(0))->setLabel('Interface Type')->setErrorMessages(array('Please set the interface type'));
     $this->addElement($type);
     $cable_type = $this->createElement('select', 'cable_type');
     $cable_type->setMultiOptions(PatchPanelPort::$CABLES_TYPES)->setRegisterInArrayValidator(true)->addValidator('greaterThan', true, array(0))->setLabel('Cable Type')->setErrorMessages(array('Please set the cable type'));
     $this->addElement($cable_type);
     $this->addElement('button', 'cancel', array('label' => 'Cancel', 'onClick' => "parent.location='" . $cancelLocation . "'"));
     $this->addElement('submit', 'commit', array('label' => 'Add'));
     $this->setElementDecorators(array('ViewHelper'));
 }
Ejemplo n.º 4
0
 /**
  *
  *
  */
 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/add-cancel.tpl'))));
     $this->setElementDecorators(array('ViewHelper'));
 }