Ejemplo n.º 1
0
 protected function add_field_post()
 {
     if ($this->post->title == '') {
         echo 'No field name entered!';
         return;
     }
     $data = array('title' => $this->post->title, 'value' => $this->post->value, 'type' => $this->post->type, 'public' => $this->post->public, 'showinregistration' => $this->post->showinregistration);
     if ($data['public'] == 'yes') {
         $data['public'] = true;
     } else {
         $data['public'] = false;
     }
     if ($data['showinregistration'] == 'yes') {
         $data['showinregistration'] = true;
     } else {
         $data['showinregistration'] = false;
     }
     $ret = SettingsData::AddField($data);
     if (DB::errno() != 0) {
         $this->set('message', 'There was an error saving the settings: ' . DB::error());
         $this->render('core_error.tpl');
     } else {
         LogData::addLog(Auth::$userinfo->pilotid, 'Added custom registration field "' . $this->post->title . '"');
         $this->set('message', 'Added custom registration field "' . $this->post->title . '"');
         $this->render('core_success.tpl');
     }
 }