function save($id = 0) { $rules = array(array('field' => 'menu_name', 'label' => 'Menu Name', 'rules' => 'required'), array('field' => 'active', 'label' => 'Active', 'rules' => 'required'), array('field' => 'menu_type', 'label' => 'Menu Type', 'rules' => 'required'), array('field' => 'position', 'label' => 'Position', 'rules' => 'required')); $this->form_validation->set_rules($rules); if ($this->form_validation->run()) { $pos = $this->input->post('position', true); $data = $this->validatePost('tb_menu'); if (CNF_MULTILANG == 1) { $lang = SiteHelpers::langOption(); $language = array(); foreach ($lang as $l) { if ($l['folder'] != 'en') { $menu_lang = isset($_POST['language_title'][$l['folder']]) ? $_POST['language_title'][$l['folder']] : ''; $language['title'][$l['folder']] = $menu_lang; } } $data['menu_lang'] = json_encode($language); } $arr = array(); $groups = $this->db->get('tb_groups')->result(); foreach ($groups as $g) { $arr[$g->group_id] = isset($_POST['groups'][$g->group_id]) ? "1" : "0"; } $data['access_data'] = json_encode($arr); $data['allow_guest'] = isset($_POST['allow_guest']) ? '1' : '0'; //echo '<pre>';print_r($data);echo '</pre>';exit; unset($data['ordering']); $this->model->insertRow($data, $this->input->post('menu_id')); redirect('sximo/menu?pos=' . $pos); } else { redirect('sximo/menu?pos=' . $pos); } }
function postSave(Request $request, $id = 0) { $rules = array('menu_name' => 'required', 'active' => 'required', 'menu_type' => 'required', 'position' => 'required'); $validator = Validator::make($request->all(), $rules); if ($validator->passes()) { $pos = $request->input('position'); $data = $this->validatePost('tb_menu'); if (CNF_MULTILANG == 1) { $lang = \SiteHelpers::langOption(); $language = array(); foreach ($lang as $l) { if ($l['folder'] != 'en') { $menu_lang = isset($_POST['language_title'][$l['folder']]) ? $_POST['language_title'][$l['folder']] : ''; $language['title'][$l['folder']] = $menu_lang; } } $data['menu_lang'] = json_encode($language); } $arr = array(); $groups = \DB::table('tb_groups')->get(); foreach ($groups as $g) { $arr[$g->group_id] = isset($_POST['groups'][$g->group_id]) ? "1" : "0"; } $data['access_data'] = json_encode($arr); $data['allow_guest'] = $request->input('allow_guest'); $this->model->insertRow($data, $request->input('menu_id')); return Redirect::to('sximo/menu?pos=' . $pos)->with('messagetext', 'Data Has Been Save Successfull')->with('msgstatus', 'success'); } else { return Redirect::to('sximo/menu?pos=' . $pos)->with('messagetext', 'The following errors occurred')->with('msgstatus', 'error')->withErrors($validator)->withInput(); } }
public function postSavetable(Request $request) { //$this->beforeFilter('csrf', array('on'=>'post')); $id = $request->input('module_id'); $row = \DB::table('tb_module')->where('module_id', $id)->get(); if (count($row) <= 0) { return Redirect::to('sximo/module')->with('messagetext', 'Can not find module')->with('msgstatus', 'error'); } $row = $row[0]; $config = \SiteHelpers::CF_decode_json($row->module_config); $lang = \SiteHelpers::langOption(); $grid = array(); $total = count($_POST['field']); extract($_POST); for ($i = 1; $i <= $total; $i++) { $language = array(); $grid[] = array('field' => $field[$i], 'alias' => $alias[$i], 'language' => $language, 'label' => $label[$i], 'view' => isset($view[$i]) ? 1 : 0, 'detail' => isset($detail[$i]) ? 1 : 0, 'sortable' => isset($sortable[$i]) ? 1 : 0, 'search' => isset($search[$i]) ? 1 : 0, 'download' => isset($download[$i]) ? 1 : 0, 'frozen' => isset($frozen[$i]) ? 1 : 0, 'limited' => isset($limited[$i]) ? $limited[$i] : '', 'width' => $width[$i], 'align' => $align[$i], 'sortlist' => $sortlist[$i], 'conn' => array('valid' => $conn_valid[$i], 'db' => $conn_db[$i], 'key' => $conn_key[$i], 'display' => $conn_display[$i]), 'attribute' => array('hyperlink' => array('active' => isset($attr_link_active[$i]) ? 1 : 0, 'link' => $attr_link[$i], 'target' => $attr_target[$i], 'html' => $attr_link_html[$i]), 'image' => array('active' => isset($attr_image_active[$i]) ? 1 : 0, 'path' => $attr_image[$i], 'size_x' => $attr_image_width[$i], 'size_y' => $attr_image_height[$i], 'html' => $attr_image_html[$i]))); } unset($config["grid"]); $new_config = array_merge($config, array("grid" => $grid)); $data['module_config'] = \SiteHelpers::CF_encode_json($new_config); // echo '<pre>'; print_r($new_config); echo '</pre>'; exit; \DB::table('tb_module')->where('module_id', '=', $id)->update(array('module_config' => \SiteHelpers::CF_encode_json($new_config))); return Redirect::to('sximo/module/table/' . $row->module_name)->with('messagetext', 'Module Table Has Been Save Successfull')->with('msgstatus', 'success'); }
?> </td> <td> <div class="input-group input-group-sm"> <span class="input-group-addon xlick bg-default btn-xs " >EN</span> <input type="text" name="label[<?php echo $id; ?> ]" class="form-control input-sm" value="<?php echo $rows['label']; ?> " /> </div> <?php $lang = SiteHelpers::langOption(); if (CNF_MULTILANG == 1) { foreach ($lang as $l) { if ($l['folder'] != 'en') { ?> <div class="input-group input-group-sm" style="margin:1px 0 !important;"> <span class="input-group-addon xlick bg-default btn-sm " ><?php echo strtoupper($l['folder']); ?> </span> <input name="language[<?php echo $id; ?> ][<?php echo $l['folder']; ?>
<div class="row "> <nav style="margin-bottom: 0;" role="navigation" class="navbar navbar-static-top gray-bg"> <div class="navbar-header"> <a href="javascript:void(0)" class="navbar-minimalize minimalize-btn btn btn-primary "><i class="fa fa-bars"></i> </a> </div> <ul class="nav navbar-top-links navbar-right"> <?php if (CNF_MULTILANG == 1) { ?> <li class="user dropdown"><a href="javascript:void(0)" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-flag"></i><i class="caret"></i></a> <ul class="dropdown-menu dropdown-menu-right icons-right"> <?php foreach (SiteHelpers::langOption() as $lang) { ?> <li><a href="<?php echo site_url('page/lang/' . $lang['folder']); ?> "><i class="fa fa-flag"></i> <?php echo $lang['name']; ?> </a></li> <?php } ?> </ul> </li> <?php }
function postSaveform() { $id = Input::get('module_id'); $row = DB::table('tb_module')->where('module_id', $id)->get(); if (count($row) <= 0) { return Redirect::to($this->module)->with('messagetext', 'Can not find module')->with('msgstatus', 'error'); } $row = $row[0]; $this->data['row'] = $row; $config = SiteHelpers::CF_decode_json($row->module_config); $lang = SiteHelpers::langOption(); $this->data['tables'] = $config['grid']; $total = count($_POST['field']); extract($_POST); $f = array(); for ($i = 1; $i <= $total; $i++) { $language = array(); $f[] = array("field" => $field[$i], "alias" => $alias[$i], "language" => $language, "label" => $label[$i], 'form_group' => $form_group[$i], 'required' => isset($required[$i]) ? $required[$i] : 0, 'view' => isset($view[$i]) ? 1 : 0, 'type' => $type[$i], 'add' => 1, 'size' => '0', 'edit' => 1, 'search' => isset($search[$i]) ? $search[$i] : 0, "sortlist" => $sortlist[$i], 'option' => array("opt_type" => $opt_type[$i], "lookup_query" => $lookup_query[$i], "lookup_table" => $lookup_table[$i], "lookup_key" => $lookup_key[$i], "lookup_value" => $lookup_value[$i], 'is_dependency' => $is_dependency[$i], 'is_multiple' => isset($is_multiple[$i]) ? $is_multiple[$i] : 0, 'lookup_dependency_key' => $lookup_dependency_key[$i], 'path_to_upload' => $path_to_upload[$i], 'resize_width' => $resize_width[$i], 'resize_height' => $resize_height[$i], 'upload_type' => $upload_type[$i], 'tooltip' => $tooltip[$i], 'attribute' => $attribute[$i], 'extend_class' => $extend_class[$i])); } unset($config["forms"]); $new_config = array_merge($config, array("forms" => $f)); $data['module_config'] = SiteHelpers::CF_encode_json($new_config); //echo '<pre>'; print_r($new_config); echo '</pre>'; exit; $affected = DB::table('tb_module')->where('module_id', '=', $id)->update(array('module_config' => SiteHelpers::CF_encode_json($new_config))); return Redirect::to($this->module . '/form/' . $row->module_name)->with('messagetext', 'Module Forms Has Changed Successful.')->with('msgstatus', 'success'); }