Пример #1
0
 public function get_html()
 {
     if (!empty($this->fields)) {
         return parent::get_html();
     }
     return node::create('span');
 }
Пример #2
0
 public function do_form_submit()
 {
     if ($_REQUEST['type'] == 8 || $_REQUEST['type'] == 9) {
         $this->get_field_from_name('link_field')->required = true;
         $this->get_field_from_name('link_module')->required = true;
     }
     parent::do_form_submit();
 }
Пример #3
0
 public function do_validate()
 {
     if (!$this->agree) {
         $this->validation_errors['agree'] = 'You must agree to the terms to continue';
     }
     if (!empty($this->coords) && !preg_match('/^((h[l-z]|n[a-hj-z]|s[a-hj-z]|t[abfglmqrvw])[0-9]{6};?){2,5}$/i', $this->coords)) {
         $this->validation_errors['coords'] = 'Coordinated are not valid';
     }
     return parent::do_validate();
 }
Пример #4
0
 public function get_html()
 {
     \core::$inline_script[] = '$("#' . $this->id . ' #layout").change(function() {
         if($(this).val() == 2) {
             $("#' . $this->id . ' #pilot").attr("disabled", false);
         } else {
             $("#' . $this->id . ' #pilot").attr("disabled", true);
         }
     });';
     return parent::get_html();
 }
Пример #5
0
 public function set_from_request()
 {
     parent::set_from_request();
     if (!$this->identifier) {
         $this->identifier = clean_uri;
     }
     if (ajax && $_REQUEST['act'] == 'do_sort_submit') {
         if (isset($this->identifier)) {
             session::set($this->sort, $this->calling_class, $this->identifier, 'sort');
         }
     }
 }
Пример #6
0
 public function set_from_request()
 {
     parent::set_from_request();
     if (!$this->identifier) {
         $this->identifier = clean_uri;
     }
     if (ajax && $_REQUEST['act'] == 'do_filter_submit') {
         if (isset($this->identifier)) {
             session::set([], get_class($this->source_data), $this->identifier, 'filter');
             foreach ($this->fields as $field) {
                 if (isset($this->{$field->field_name})) {
                     session::set($this->{$field->field_name}, get_class($this->source_data), $this->identifier, 'filter', $field->field_name);
                 }
             }
         }
     }
 }
Пример #7
0
 public function __construct()
 {
     $fields = [form::create('field_string', 'site_name')->set_attr('label', 'Site Name')->set_attr('fieldset', 'Database Details'), form::create('field_string', 'username')->set_attr('label', 'Database'), form::create('field_password', 'password')->set_attr('label', 'Password'), form::create('field_checkboxes', 'modules', $this->get_modules())->set_attr('label', 'Modules')->set_attr('required', false)->set_attr('fieldset', 'Modules')];
     $i = 0;
     do {
         $fields['user_' . $i] = form::create('field_string', 'user_' . $i)->set_attr('label', 'User ' . ($i + 1))->set_attr('fieldset', 'User ' . ($i + 1) . ' Details')->set_attr('required', false);
         $fields['password_' . $i] = form::create('field_password', 'password_' . $i)->set_attr('label', 'Password ' . ($i + 1))->set_attr('required', false);
         $fields['user_level_' . $i] = form::create('field_select', 'user_level' . ($i + 1))->set_attr('options', [1 => 'User', 2 => 'Webmaster', 3 => 'Admin'])->set_attr('label', 'User Level ' . $i)->set_attr('required', false);
         $i++;
     } while (isset($_REQUEST['user' . $i]));
     parent::__construct($fields);
     foreach ($this->fields as $field) {
         $field->attributes['placeholder'] = $field->label;
     }
     $this->set_required_modules();
     $this->h2 = 'Site Creation';
     $this->submit = 'Create';
     $this->id = 'cms_builder';
 }
 public function set_from_request()
 {
     parent::set_from_request();
     switch ($this->source) {
         case 0:
             $this->OS8 = null;
             $this->OSGB36_lat = null;
             $this->OSGB36_lng = null;
             $this->WGS84_lat = null;
             $this->WGS84_lng = null;
             break;
         case 1:
             $this->OS6 = null;
             $this->OSGB36_lat = null;
             $this->OSGB36_lng = null;
             $this->WGS84_lat = null;
             $this->WGS84_lng = null;
             break;
         case 2:
             $this->OS6 = null;
             $this->OS8 = null;
             $this->WGS84_lat = null;
             $this->WGS84_lng = null;
             $this->OSGB36_lat = geometry::coordinate_normalise($this->OSGB36_lat);
             $this->OSGB36_lng = geometry::coordinate_normalise($this->OSGB36_lng);
             break;
         case 3:
             $this->OS6 = null;
             $this->OS8 = null;
             $this->OSGB36_lat = null;
             $this->OSGB36_lng = null;
             $this->WGS84_lat = geometry::coordinate_normalise($this->WGS84_lat);
             $this->WGS84_lng = geometry::coordinate_normalise($this->WGS84_lng);
             break;
         default:
             break;
     }
     $this->set_disabled();
 }
Пример #9
0
 /**
  *
  */
 public function do_update_selector()
 {
     $field = form::create('field_link', 'gid')->set_attr('link_module', '\\object\\glider')->set_attr('link_field', ['manufacturer.title', 'name'])->set_attr('options', ['join' => ['manufacturer' => 'manufacturer.mid = glider.mid'], 'order' => 'manufacturer.title, glider.name']);
     $field->parent_form = $this;
     ajax::update($field->get_html());
 }
Пример #10
0
 public function get_html()
 {
     $html = parent::get_html();
     $script = '';
     if (!isset($this->kml) || empty($this->kml)) {
         $script .= '$("#kml_calc").hide();';
     }
     if (!isset($this->coords) || !$this->coords) {
         $script .= '$("#add_flight_box .fieldset_1").hide();';
     }
     if (ajax) {
         ajax::add_script($script);
     } else {
         \core::$inline_script[] = $script;
     }
     return $html;
 }
Пример #11
0
 public function __construct(table $table)
 {
     $this->source_table = $table;
     parent::__construct($table->get_fields()->getArrayCopy());
 }
Пример #12
0
 /**
  *
  */
 public function do_update_selector()
 {
     $field = form::create('field_link', 'pid')->set_attr('link_module', '\\object\\pilot')->set_attr('link_field', 'name')->set_attr('options', ['order' => 'name']);
     $field->parent_form = $this;
     ajax::update($field->get_html());
 }
Пример #13
0
 public function do_form_submit()
 {
     controller::do_database_repair();
     parent::do_form_submit();
 }
Пример #14
0
 public function __construct()
 {
     $fields = [form::create('field_int', 'mid')->set_attr('hidden', true), form::create('field_link', 'gid')->set_attr('label', 'Group')->set_attr('link_module', 19)->set_attr('link_field', 123)];
     parent::__construct($fields);
 }
Пример #15
0
 public function __construct()
 {
     parent::__construct([form::create('field_link', 'gid', ['link_module' => '\\module\\cms\\object\\_cms_group', 'link_field' => 'title', 'label' => 'Group']), form::create('field_string', 'primary_key', ['label' => 'Primary Key']), form::create('field_string', 'title', ['label' => 'Title']), form::create('field_string', 'table_name', ['label' => 'Table Name']), form::create('field_string', 'namespace', ['label' => 'Namespace <small>can be blank</small>', 'required' => false]), form::create('field_boolean', 'nestable', ['label' => 'Nestable']), form::create('field_int', 'mid', ['hidden' => true])]);
     $this->id = 'module_edit';
 }
Пример #16
0
 public function __construct()
 {
     parent::__construct([form::create('field_link', 'wgid')->set_attr('label', 'Waypoint Set')->set_attr('link_field', 'title')->set_attr('link_module', '\\module\\planner\\object\\waypoint_group')]);
     $this->submit = 'Load';
     $this->id = 'planner_load_waypoints';
 }
Пример #17
0
 public function __construct()
 {
     parent::__construct([form::create('field_link', 'gid', ['link_module' => '\\module\\cms\\object\\_cms_group', 'link_field' => 'title', 'label' => 'Group']), form::create('field_string', 'primary_key', ['label' => 'Primary Key']), form::create('field_string', 'title', ['label' => 'Title']), form::create('field_string', 'title_label', ['label' => 'Title Label']), form::create('field_string', 'table_name', ['label' => 'Table Name']), form::create('field_string', 'namespace')->set_attr('label', 'Namespace <small>can be blank</small>')->set_attr('required', false), form::create('field_boolean', 'nestable', ['label' => 'Nestable'])]);
     $this->id = 'new_module';
 }
Пример #18
0
 public function __construct()
 {
     parent::__construct();
     $this->add_field(form::create('field_hidden', 'fid'));
 }
Пример #19
0
 public function do_validate()
 {
     if (!$this->agree) {
         $this->validation_errors['agree'] = 'You must agree to the terms to continue';
     }
     return parent::do_validate();
 }