Exemplo n.º 1
0
 function form_element(&$form, $value, $opt = array())
 {
     parent::form_element($form, $value, $opt);
     global $lang_str;
     /* set default values for options */
     $opt_err_msg = isset($opt["err_msg"]) ? $opt["err_msg"] : null;
     $reg =& CReg::Singleton();
     $form->add_element(array("type" => "text", "name" => $this->name, "size" => 16, "maxlength" => 255, "value" => $value, "valid_regex" => $this->is_required() ? "^" . $reg->sip_address . "\$" : "^(" . $reg->sip_address . ")?\$", "valid_e" => $opt_err_msg ? $opt_err_msg : "'" . $this->get_description() . "' " . $lang_str['fe_is_not_sip_adr'], "extrahtml" => "onBlur='sip_address_completion(this)'"));
 }
 /**
  *  create html form 
  *
  *  @param array $errors    array with error messages
  *  @return null            FALSE on failure
  */
 function create_html_form(&$errors)
 {
     global $lang_str;
     parent::create_html_form($errors);
     $reg =& CReg::singleton();
     $this->f->add_element(array("type" => "text", "name" => "domainname", "size" => 16, "maxlength" => 128, "value" => "", "valid_regex" => "^(" . $reg->hostname . ")?\$", "valid_e" => $lang_str['fe_not_valid_domainname']));
 }
Exemplo n.º 3
0
 /**
  *	create html form 
  *
  *	@param array $errors	array with error messages
  *	@return null			FALSE on failure
  */
 function create_html_form(&$errors)
 {
     global $data, $lang_str, $config;
     parent::create_html_form($errors);
     $an =& $config->attr_names;
     /* get list of customers */
     if (false === ($this->customers = $data->get_customers(array(), $errors))) {
         return false;
     }
     /* if domain id is set */
     if (!is_null($this->id)) {
         $domain_attrs =& Domain_Attrs::singleton($this->id);
         /* get domain attributes */
         if (false === ($this->domain_attrs = $domain_attrs->get_attributes())) {
             return false;
         }
     }
     $options = array();
     $options[] = array('label' => "--- " . $lang_str['none'] . " ---", 'value' => -1);
     foreach ($this->customers as $v) {
         $options[] = array('label' => $v['name'], 'value' => $v['cid']);
     }
     $selected_owner = null;
     /* set preselected customer */
     if (!is_null($this->opt['preselected_customer'])) {
         $selected_owner = $this->opt['preselected_customer'];
     }
     /* if domain id is set */
     if (!is_null($this->id)) {
         /* get owner of the domain */
         if (isset($this->domain_attrs[$an['dom_owner']])) {
             $this->owner['id'] = $this->domain_attrs[$an['dom_owner']];
             $this->owner['name'] = $this->customers[$this->owner['id']]['name'];
             $selected_owner = $this->owner['id'];
         }
         /* get list of the domain names */
         if (false === $this->get_domain_names($errors)) {
             return false;
         }
     }
     $reg =& CReg::singleton();
     $this->f->add_element(array("type" => "text", "name" => "do_new_name", "size" => 16, "maxlength" => 128, "value" => "", "valid_regex" => "^(" . $reg->host . ")?\$", "valid_e" => $lang_str['fe_not_valid_domainname']));
     $this->f->add_extra_submit("do_okey_add", $this->opt['form_add_submit']);
     $this->f->add_element(array("type" => "select", "name" => "do_customer", "size" => 1, "options" => $options, "value" => $selected_owner));
 }