diff --git a/api/application/config/constants.php b/api/application/config/constants.php index 84a3e62f..e524715a 100644 --- a/api/application/config/constants.php +++ b/api/application/config/constants.php @@ -85,8 +85,8 @@ defined('EXIT__AUTO_MIN') OR define('EXIT__AUTO_MIN', 9); // lowest automat defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code // 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', 'triggerNewPD'); // no errors +//defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listLessPDDetails/:any)'); // 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'); diff --git a/api/application/controllers/Question_Management_Controller.php b/api/application/controllers/Question_Management_Controller.php index 3ae9caed..6ad0f1cd 100644 --- a/api/application/controllers/Question_Management_Controller.php +++ b/api/application/controllers/Question_Management_Controller.php @@ -23,13 +23,14 @@ class Question_Management_Controller extends REST_Controller { public function listAllQuestions_get() { - $page = 0;$limit = 0;$sort = 'ASC'; + $page = 0;$limit = 0;$sort = 'ASC';$category_id = ''; if($this->get('page')) { $page = $this->get('page'); } if($this->get('limit')){ $limit = $this->get('limit'); } if($this->get('sort')) { $sort = $this->get('sort'); } + if($this->get('cid')) { $category_id = $this->get('cid'); } - $result = $this->Question_Management_Model->listAllQuestions($page,$limit,$sort); + $result = $this->Question_Management_Model->listAllQuestions($page,$limit,$sort,$category_id); if($result['data_status']) { $data['dataStatus'] = true; diff --git a/api/application/models/Question_Management_Model.php b/api/application/models/Question_Management_Model.php index 8583f9fe..8603fa8b 100644 --- a/api/application/models/Question_Management_Model.php +++ b/api/application/models/Question_Management_Model.php @@ -10,7 +10,7 @@ class Question_Management_Model extends SPARQ_Model { } - public function listAllQuestions($page,$limit,$sort) + public function listAllQuestions($page,$limit,$sort,$category_id) { @@ -20,6 +20,10 @@ class Question_Management_Model extends SPARQ_Model { $this->db->JOIN(QUESTIONCATEGORY.' as QUESTIONCATEGORY','QUESTIONS.fk_question_catagory = QUESTIONCATEGORY.question_categroy_id'); $this->db->JOIN(USERPROFILE.' as USERPROFILE','QUESTIONS.fk_createdby = USERPROFILE.userid'); $this->db->JOIN(USERPROFILE.' as USERPROFILE1','QUESTIONS.fk_updatedby = USERPROFILE1.userid','LEFT'); + if($category_id != null || $category_id != '') + { + $this->db->WHERE('QUESTIONS.fk_question_catagory',$category_id); + } $this->db->ORDER_BY('QUESTIONS.question_id',$sort); $this->db->LIMIT($page,$limit);