Exemple #1
0
 /**
  * {@inheritDoc}
  */
 public function generate_field($profile_row, $preview_options = false)
 {
     $profile_row['field_ident'] = isset($profile_row['var_name']) ? $profile_row['var_name'] : 'pf_' . $profile_row['field_ident'];
     $field_ident = $profile_row['field_ident'];
     $default_value = $profile_row['lang_default_value'];
     $profile_row['field_value'] = $this->request->is_set($field_ident) ? $this->request->variable($field_ident, $default_value, true) : (!isset($this->user->profile_fields[$field_ident]) || $preview_options !== false ? $default_value : $this->user->profile_fields[$field_ident]);
     $this->template->assign_block_vars($this->get_name_short(), array_change_key_case($profile_row, CASE_UPPER));
 }
Exemple #2
0
 /**
  * {@inheritDoc}
  */
 public function prepare_hidden_fields($step, $key, $action, &$field_data)
 {
     if ($key == 'field_length' && $this->request->is_set('rows')) {
         $field_data['rows'] = $this->request->variable('rows', 0);
         $field_data['columns'] = $this->request->variable('columns', 0);
         return $field_data['rows'] . '|' . $field_data['columns'];
     }
     return parent::prepare_hidden_fields($step, $key, $action, $field_data);
 }
Exemple #3
0
 /**
  * {@inheritDoc}
  */
 public function prepare_hidden_fields($step, $key, $action, &$field_data)
 {
     if ($key == 'field_default_value') {
         $field_length = $this->request->variable('field_length', 0);
         // Do a simple is set check if using checkbox.
         if ($field_length == 2) {
             return $this->request->is_set($key);
         }
         return $this->request->variable($key, $field_data[$key], true);
     }
     $default_lang_options = array('l_lang_options' => array(0 => array('')), 'lang_options' => array(0 => ''));
     if (isset($default_lang_options[$key]) && $this->request->is_set($key)) {
         return $this->request->variable($key, $default_lang_options[$key], true);
     }
     return parent::prepare_hidden_fields($step, $key, $action, $field_data);
 }
Exemple #4
0
 /**
  * {@inheritDoc}
  */
 public function prepare_hidden_fields($step, $key, $action, &$field_data)
 {
     if ($key == 'field_default_value') {
         $always_now = $this->request->variable('always_now', 0);
         if ($always_now) {
             return 'now';
         } else {
             if ($this->request->is_set('field_default_value_day')) {
                 $field_data['field_default_value_day'] = $this->request->variable('field_default_value_day', 0);
                 $field_data['field_default_value_month'] = $this->request->variable('field_default_value_month', 0);
                 $field_data['field_default_value_year'] = $this->request->variable('field_default_value_year', 0);
                 return sprintf('%2d-%2d-%4d', $field_data['field_default_value_day'], $field_data['field_default_value_month'], $field_data['field_default_value_year']);
             }
         }
     }
     return parent::prepare_hidden_fields($step, $key, $action, $field_data);
 }
Exemple #5
0
 /**
  * {@inheritDoc}
  */
 public function prepare_hidden_fields($step, $key, $action, &$field_data)
 {
     if (!$this->request->is_set($key)) {
         // Do not set this variable, we will use the default value
         return null;
     } else {
         if ($key == 'field_ident' && isset($field_data[$key])) {
             return $field_data[$key];
         } else {
             $default_value = '';
             $lang_fields = array('l_lang_name', 'l_lang_explain', 'l_lang_default_value', 'l_lang_options');
             if (in_array($key, $lang_fields)) {
                 $default_value = array(0 => '');
             }
             return $this->request->variable($key, $default_value, true);
         }
     }
 }
Exemple #6
0
 /**
  * {@inheritDoc}
  */
 public function generate_field($profile_row, $preview_options = false)
 {
     $profile_row['field_ident'] = isset($profile_row['var_name']) ? $profile_row['var_name'] : 'pf_' . $profile_row['field_ident'];
     $field_ident = $profile_row['field_ident'];
     $default_value = $profile_row['field_default_value'];
     $value = $this->request->is_set($field_ident) ? $this->request->variable($field_ident, $default_value) : (!isset($this->user->profile_fields[$field_ident]) || $preview_options !== false ? $default_value : $this->user->profile_fields[$field_ident]);
     if (!$this->lang_helper->is_set($profile_row['field_id'], $profile_row['lang_id'], 1)) {
         if ($preview_options) {
             $this->lang_helper->load_preview_options($profile_row['field_id'], $profile_row['lang_id'], $preview_options);
         } else {
             $this->lang_helper->load_option_lang($profile_row['lang_id']);
         }
     }
     $profile_row['field_value'] = (int) $value;
     $this->template->assign_block_vars('dropdown', array_change_key_case($profile_row, CASE_UPPER));
     $options = $this->lang_helper->get($profile_row['field_id'], $profile_row['lang_id']);
     foreach ($options as $option_id => $option_value) {
         $this->template->assign_block_vars('dropdown.options', array('OPTION_ID' => $option_id, 'SELECTED' => $value == $option_id ? ' selected="selected"' : '', 'VALUE' => $option_value));
     }
 }
Exemple #7
0
 /**
  * {@inheritDoc}
  */
 public function generate_field($profile_row, $preview_options = false)
 {
     $profile_row['field_ident'] = isset($profile_row['var_name']) ? $profile_row['var_name'] : 'pf_' . $profile_row['field_ident'];
     $field_ident = $profile_row['field_ident'];
     $default_value = $profile_row['field_default_value'];
     if ($this->request->is_set($field_ident)) {
         $value = $this->request->variable($field_ident, '') === '' ? null : $this->request->variable($field_ident, $default_value);
     } else {
         if ($preview_options === false && array_key_exists($field_ident, $this->user->profile_fields) && is_null($this->user->profile_fields[$field_ident])) {
             $value = null;
         } else {
             if (!isset($this->user->profile_fields[$field_ident]) || $preview_options !== false) {
                 $value = $default_value;
             } else {
                 $value = $this->user->profile_fields[$field_ident];
             }
         }
     }
     $profile_row['field_value'] = is_null($value) || $value === '' ? '' : (int) $value;
     $this->template->assign_block_vars('int', array_change_key_case($profile_row, CASE_UPPER));
 }