TEMPLATE FORMS
This commit is contained in:
parent
9698f7723d
commit
6c84454ab1
@ -114,6 +114,8 @@ $route['getFormAndQuestionKeys'] = 'Template_Management_Controller/getFormAndQue
|
|||||||
$route['getScorecardDetails'] = 'Template_Management_Controller/getScorecardDetails';
|
$route['getScorecardDetails'] = 'Template_Management_Controller/getScorecardDetails';
|
||||||
$route['savePDReportTemplate'] = 'Template_Management_Controller/savePDReportTemplate';
|
$route['savePDReportTemplate'] = 'Template_Management_Controller/savePDReportTemplate';
|
||||||
$route['getPDReportTemplate'] = 'Template_Management_Controller/getPDReportTemplate';
|
$route['getPDReportTemplate'] = 'Template_Management_Controller/getPDReportTemplate';
|
||||||
|
$route['getTemplateForms'] = 'Template_Management_Controller/getTemplateForms';
|
||||||
|
$route['saveTemplateForms'] = 'Template_Management_Controller/saveTemplateForms';
|
||||||
|
|
||||||
//QUESTION MANAGEMENT
|
//QUESTION MANAGEMENT
|
||||||
$route['(listAllQuestions/:any)'] = 'Question_Management_Controller/listAllQuestions/';
|
$route['(listAllQuestions/:any)'] = 'Question_Management_Controller/listAllQuestions/';
|
||||||
|
|||||||
@ -800,6 +800,81 @@ class Template_Management_Controller extends REST_Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getTemplateForms_get()
|
||||||
|
{
|
||||||
|
|
||||||
|
$template_id = $this->get('template_id');
|
||||||
|
|
||||||
|
$fields = array('form_id');
|
||||||
|
$where_condition_array = array('fk_template_id'=>$template_id,'isactive'=>1);
|
||||||
|
$result_array = $this->Template_Management_Model->selectCustomRecords($fields,$where_condition_array,TEMPLATEFORMS);
|
||||||
|
//print_r($this->db->last_query());
|
||||||
|
$temp = array();
|
||||||
|
foreach($result_array as $r)
|
||||||
|
{
|
||||||
|
$formid = (int)$r['form_id'];
|
||||||
|
$temp = array_merge($temp,array($formid));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(count($result_array))
|
||||||
|
{
|
||||||
|
$data['dataStatus'] = true;
|
||||||
|
$data['status'] = REST_Controller::HTTP_OK;
|
||||||
|
$data['records'] = $temp;
|
||||||
|
$this->response($data,REST_Controller::HTTP_OK);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$data['dataStatus'] = false;
|
||||||
|
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
|
||||||
|
$data['msg'] = 'No Data Available';
|
||||||
|
$this->response($data,REST_Controller::HTTP_OK);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function saveTemplateForms_post()
|
||||||
|
{
|
||||||
|
$records = $this->post("records");
|
||||||
|
$template_id = $records['template_id'];
|
||||||
|
$forms = $records['forms'];
|
||||||
|
//print_r($forms);
|
||||||
|
|
||||||
|
|
||||||
|
$this->db->where('fk_template_id',$template_id);
|
||||||
|
$this->db->where_not_in('form_id',$forms);
|
||||||
|
$this->db->SET('isactive',0);
|
||||||
|
$this->db->UPDATE(TEMPLATEFORMS);
|
||||||
|
|
||||||
|
$fields = array('form_id');
|
||||||
|
$where_condition_array = array('fk_template_id'=>$template_id);
|
||||||
|
$result_array = $this->Template_Management_Model->selectCustomRecords($fields,$where_condition_array,TEMPLATEFORMS);
|
||||||
|
|
||||||
|
$insert_array = array();
|
||||||
|
foreach($forms as $form)
|
||||||
|
{
|
||||||
|
$i = 0;
|
||||||
|
foreach($result_array as $result)
|
||||||
|
{
|
||||||
|
if($form == $result['form_id'])
|
||||||
|
{
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if($i == 0) {$insert_array[] = $form; }
|
||||||
|
}
|
||||||
|
// $fields = array('isactive' => 1);
|
||||||
|
// $where_condition_array = array('fk_template_id' => $template_id, 'form_id not in' => array($f));
|
||||||
|
// $pk_id = $this->Template_Management_Model->updateRecords($fields,TEMPLATEFORMS,$where_condition_array);
|
||||||
|
print_r($insert_array);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user