Layouts::validateForm PHP Method

validateForm() private method

private validateForm ( )
    private function validateForm()
    {
        $this->form_validation->set_rules('name', 'lang:label_name', 'xss_clean|trim|required|min_length[2]|max_length[128]');
        if ($this->input->post('routes')) {
            foreach ($this->input->post('routes') as $key => $value) {
                $this->form_validation->set_rules('routes[' . $key . '][uri_route]', 'lang:label_route', 'xss_clean|trim|required');
            }
        }
        if ($this->input->post('modules')) {
            foreach ($this->input->post('modules') as $partial => $modules) {
                foreach ($modules as $key => $value) {
                    $this->form_validation->set_rules('modules[' . $partial . '][' . $key . '][module_code]', '[' . $partial . '] ' . $this->lang->line('label_module_code'), 'xss_clean|trim|required|alpha_dash');
                    $this->form_validation->set_rules('modules[' . $partial . '][' . $key . '][partial]', '[' . $partial . '] ' . $this->lang->line('label_module_partial'), 'xss_clean|trim|required|alpha_dash');
                    $this->form_validation->set_rules('modules[' . $partial . '][' . $key . '][title]', '[' . $partial . '] ' . $this->lang->line('label_module_title'), 'xss_clean|trim|min_length[2]');
                    $this->form_validation->set_rules('modules[' . $partial . '][' . $key . '][fixed]', '[' . $partial . '] ' . $this->lang->line('label_module_fixed'), 'xss_clean|trim|required|integer');
                    if ($this->input->post('modules[' . $partial . '][' . $key . '][fixed]') === '1') {
                        $this->form_validation->set_rules('modules[' . $partial . '][' . $key . '][fixed_top_offset]', '[' . $partial . '] ' . $this->lang->line('label_fixed_offset'), 'xss_clean|trim|required|integer');
                        $this->form_validation->set_rules('modules[' . $partial . '][' . $key . '][fixed_bottom_offset]', '[' . $partial . '] ' . $this->lang->line('label_fixed_offset'), 'xss_clean|trim|required|integer');
                    }
                    $this->form_validation->set_rules('modules[' . $partial . '][' . $key . '][status]', '[' . $partial . '] ' . $this->lang->line('label_module_status'), 'xss_clean|trim|required|integer');
                }
            }
        }
        if ($this->form_validation->run() === TRUE) {
            return TRUE;
        } else {
            return FALSE;
        }
    }