QUES MAS FILTER

This commit is contained in:
velz 2018-09-28 18:02:18 +05:30
parent 658478b3be
commit ff97178553
3 changed files with 10 additions and 5 deletions

View File

@ -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');

View File

@ -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;

View File

@ -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);