90 lines
3.7 KiB
PHP
Executable File
90 lines
3.7 KiB
PHP
Executable File
<?php
|
|
|
|
if (!defined('BASEPATH'))
|
|
exit('No direct script access allowed');
|
|
|
|
class Formbuilder extends MX_Controller {
|
|
|
|
function __construct() { parent::__construct();
|
|
$this->load->model('Formbuilder_model');
|
|
}
|
|
|
|
|
|
function index() {
|
|
$this->load->view('home/dashboard'); // just the header file
|
|
$this->load->view('namelist');
|
|
$this->load->view('home/footer'); // just the header file
|
|
}
|
|
function getFromData(){
|
|
$formid=$this->input->get('formid');
|
|
$output=$this->Formbuilder_model->getFormData($formid);
|
|
print_r($output);
|
|
}
|
|
function Delete(){
|
|
$id = $_GET['id'];
|
|
$this->Formbuilder_model->delete($id);
|
|
$this->session->set_flashdata('deleted','The template is successfully updated');
|
|
redirect("formbuilder");
|
|
}
|
|
public function getList()
|
|
{
|
|
$requestData = $_REQUEST;
|
|
$start = $requestData['start'];
|
|
$limit = $requestData['length'];
|
|
$orderColumn=$requestData['order'][0]['column'];
|
|
$orderType=$requestData['order'][0]['dir'];
|
|
$search = $this->input->post('search')['value'];
|
|
|
|
if (!empty($search)) {
|
|
$data['name'] = $this->Formbuilder_model->getNameByLimitBySearch($limit, $start, $search,$orderColumn, $orderType);
|
|
} else {
|
|
$data['name'] = $this->Formbuilder_model->getNameByLimit($limit, $start, $orderColumn, $orderType);
|
|
}
|
|
|
|
$listCount = sizeof($data['name']);
|
|
foreach ($data['name'] as $data) {
|
|
static $slno = 1;
|
|
//$options1 = '<a class="btn btn-primary" title="' . lang('Edit') .'" href="'.base_url().'php-form-builder/drag-n-drop-form-builder/?id='. $data->id .'" ><i class="la la-edit"></i>' . lang('Edit') .' </a>';
|
|
$options1 = '<a class="btn btn-primary" title="' . lang('Edit') .'" href="#" onclick="editForm(this);"><i class="la la-edit"></i>' . lang('Edit') .' </a>';
|
|
$options2 = '<a class="btn btn-primary" title="' . lang('Preview') .'" href="#" onclick="previewModal('. $data->id .');" ><i class="la la-edit"></i>' . lang('Preview') .' </a>';
|
|
$options3 = '<a class="btn btn-danger" title="' . lang('Delete') .'" href="'.base_url().'formbuilder/Delete/?id='.$data->id.'" ><i class="la la-trash"></i>' . lang('Delete') .' </a>';
|
|
$hiddenData='<div style="display:none;">
|
|
<textarea use="formJsonDatafromDB">'.$data->form_data.'</textarea>
|
|
<input type="hidden" use="formJsonTempIdfromDB" value="'.$data->id.'">
|
|
<input type="hidden" use="formJsonFormNamefromDB" value="'.$data->form_name.'">
|
|
</div>';
|
|
$info[] = array(
|
|
$slno,
|
|
$data->form_name,
|
|
//$switch,
|
|
$options1.' '.$options2.' '.$options3.' '.$hiddenData,
|
|
);
|
|
$slno++;
|
|
}
|
|
|
|
$csrf_name = $this->security->get_csrf_token_name();
|
|
$csrf_hash = $this->security->get_csrf_hash();
|
|
if ($listCount > 0) {
|
|
$output = array(
|
|
"draw" => intval($requestData['draw']),
|
|
"recordsTotal" => $this->Formbuilder_model->total_list(),
|
|
"recordsFiltered" => $listCount,
|
|
"data" => $info
|
|
);
|
|
}
|
|
else {
|
|
$output = array(
|
|
// "draw" => 1,
|
|
"recordsTotal" => 0,
|
|
"recordsFiltered" => 0,
|
|
"data" => []
|
|
);
|
|
$output[$csrf_name] = $csrf_hash;
|
|
}
|
|
echo json_encode($output);
|
|
}
|
|
}
|
|
|
|
/* End of file accountant.php */
|
|
/* Location: ./application/modules/accountant/controllers/accountant.php */
|