QUES MAS CHANGED4
This commit is contained in:
parent
48578c2fd4
commit
df59b98b99
@ -86,7 +86,7 @@ defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest auto
|
||||
|
||||
// define login route name for token verification
|
||||
//defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listLessPDDetails/:any)'); // no errors
|
||||
defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'saveNewQuestion'); // no errors
|
||||
defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listAllQuestions/:any)'); // no errors
|
||||
|
||||
/*********************AWS resources Constants*************************************************/
|
||||
defined('PROFILE_PICTURE_BUCKET_NAME') OR define('PROFILE_PICTURE_BUCKET_NAME','sineedgedevprofilepic');
|
||||
|
||||
@ -55,9 +55,10 @@ class Question_Management_Controller extends REST_Controller {
|
||||
if(array_key_exists('answers',$records))
|
||||
{
|
||||
$answers = $records['answers'];
|
||||
unset($records['ansewrs']);
|
||||
unset($records['answers']);
|
||||
}
|
||||
|
||||
|
||||
$question_id = $this->Question_Management_Model->saveRecords($records,QUESTIONS);
|
||||
|
||||
if($question_id != '' || $question_id != null)
|
||||
@ -65,8 +66,10 @@ class Question_Management_Controller extends REST_Controller {
|
||||
//$count++;
|
||||
foreach($answers as $answer)
|
||||
{
|
||||
|
||||
|
||||
$temp_answers = array('fk_question_id' => $question_id, 'answer' =>$answer['answer'] , 'createdon' =>$records['createdon'] , 'fk_createdby' =>$records['fk_createdby']);
|
||||
$child_id = $this->db->saveRecords($temp_answers,QUESTIONANSWERS);
|
||||
$child_id = $this->Question_Management_Models->saveRecords($temp_answers,QUESTIONANSWERS);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@ class SPARQ_Model extends CI_Model {
|
||||
|
||||
}
|
||||
|
||||
public function saveRecords($record_data = array(),$table_name,$print_query = '')
|
||||
public function saveRecords($record_data = array(),$table_name,$print_query = '1')
|
||||
{
|
||||
|
||||
$this->db->insert($table_name,$record_data);
|
||||
|
||||
@ -19,19 +19,19 @@ class Question_Management_Model extends SPARQ_Model {
|
||||
$this->db->JOIN(QUESTIONANSWERTYPE.' as QUESTIONANSWERTYPE','QUESTIONS.fk_question_answertype = QUESTIONANSWERTYPE.question_answer_type_id AND QUESTIONANSWERTYPE.isactive = 1');
|
||||
$this->db->JOIN(QUESTIONCATEGORY.' as QUESTIONCATEGORY','QUESTIONS.fk_question_catagory = QUESTIONCATEGORY.question_categroy_id AND QUESTIONCATEGORY.isactive = 1');
|
||||
$this->db->JOIN(USERPROFILE.' as USERPROFILE','QUESTIONS.fk_createdby = USERPROFILE.userid AND USERPROFILE.isactive = 1');
|
||||
$this->db->JOIN(USERPROFILE.' as USERPROFILE1','QUESTIONS.fk_updatedby = USERPROFILE1.userid AND USERPROFILE1.isactive = 1');
|
||||
$this->db->JOIN(USERPROFILE.' as USERPROFILE1','QUESTIONS.fk_updatedby = USERPROFILE1.userid AND USERPROFILE1.isactive = 1','LEFT');
|
||||
$this->db->ORDER_BY('QUESTIONS.question_id',$sort);
|
||||
$this->db->LIMIT($page,$limit);
|
||||
|
||||
$result = $this->db->GET()->result_array();
|
||||
|
||||
|
||||
foreach($result as $key => $r)
|
||||
{
|
||||
$this->db->SELECT('QUESTIONANSWERS.question_answer_id, QUESTIONANSWERS.fk_question_id, QUESTIONANSWERS.answer, QUESTIONANSWERS.createdon, QUESTIONANSWERS.fk_createdby, QUESTIONANSWERS.updatedon, QUESTIONANSWERS.fk_updatedby, isactive');
|
||||
$this->db->SELECT('QUESTIONANSWERS.question_answer_id, QUESTIONANSWERS.fk_question_id, QUESTIONANSWERS.answer, QUESTIONANSWERS.createdon, QUESTIONANSWERS.fk_createdby, QUESTIONANSWERS.updatedon, QUESTIONANSWERS.fk_updatedby, QUESTIONS.isactive');
|
||||
$this->db->FROM(QUESTIONANSWERS.' as QUESTIONANSWERS');
|
||||
$this->db->JOIN(QUESTIONS.' as QUESTIONS','QUESTIONANSWERS.fk_question_id = QUESTIONS.question_id AND QUESTIONS.isactive');
|
||||
$this->db->JOIN(USERPROFILE.' as USERPROFILE','QUESTIONANSWERS.fk_createdby = USERPROFILE.userid AND USERPROFILE.isactive = 1');
|
||||
$this->db->JOIN(USERPROFILE.' as USERPROFILE1','QUESTIONANSWERS.fk_updatedby = USERPROFILE1.userid AND USERPROFILE1.isactive = 1');
|
||||
$this->db->JOIN(USERPROFILE.' as USERPROFILE1','QUESTIONANSWERS.fk_updatedby = USERPROFILE1.userid AND USERPROFILE1.isactive = 1','LEFT');
|
||||
$this->db->where('QUESTIONS.question_id',$r['question_id']);
|
||||
$answers_data = $this->db->get()->result_array();
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user