diff --git a/api/application/config/constants.php b/api/application/config/constants.php index 76d2ef2b..0a714102 100644 --- a/api/application/config/constants.php +++ b/api/application/config/constants.php @@ -85,9 +85,9 @@ 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', '(listLessPDDetails/:any)'); // no errors //defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listAllTemplates/:any)'); // no errors -//defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'getListPDOfficers'); // no errors +defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'getListOfCategories'); // no errors /*********************AWS resources Constants*************************************************/ defined('PROFILE_PICTURE_BUCKET_NAME') OR define('PROFILE_PICTURE_BUCKET_NAME','sineedgedevprofilepic'); @@ -223,7 +223,7 @@ defined('QUESTIONANSWERS') OR define('QUESTIONANSWERS','m_question_answers'); defined('QUESTIONANSWERSID') OR define('QUESTIONANSWERSID','question_answer_id'); defined('QUESTIONCATEGORY') OR define('QUESTIONCATEGORY','m_question_category'); -defined('QUESTIONCATEGORYID') OR define('QUESTIONCATEGORYID','question_categroy_id'); +defined('QUESTIONCATEGORYID') OR define('QUESTIONCATEGORYID','question_category_id'); defined('TEMPLATE') OR define('TEMPLATE','m_template'); defined('TEMPLATEID') OR define('TEMPLATEID','template_id'); diff --git a/api/application/config/routes.php b/api/application/config/routes.php index 9948ee97..309b2eb2 100644 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -101,6 +101,7 @@ $route['getTemplateMaster'] = 'Template_Management_Controller/getTemplateMaster' $route['getTemplateLenders'] = 'Template_Management_Controller/getTemplateLenders'; $route['getTemplateCategories'] = 'Template_Management_Controller/getTemplateCategories'; $route['getTemplateQuestionAnswers'] = 'Template_Management_Controller/getTemplateQuestionAnswers'; +$route['getListOfCategories'] = 'Template_Management_Controller/getListOfCategories'; //QUESTION MANAGEMENT $route['(listAllQuestions/:any)'] = 'Question_Management_Controller/listAllQuestions/'; diff --git a/api/application/controllers/Template_Management_Controller.php b/api/application/controllers/Template_Management_Controller.php index bada6412..e2980c2f 100644 --- a/api/application/controllers/Template_Management_Controller.php +++ b/api/application/controllers/Template_Management_Controller.php @@ -346,4 +346,28 @@ class Template_Management_Controller extends REST_Controller { } + public function getListOfCategories_get() + { + $fields = array('question_categroy_id','categroy_name'); + $where_condition_array = array('isactive' => 1); + $result_data = $this->Template_Management_Model->selectCustomRecords($fields,$where_condition_array,QUESTIONCATEGORY); + if(count($result_data)) + { + + + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = $result_data; + $this->response($data,REST_Controller::HTTP_OK); + } + else + { + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NO_CONTENT; + $this->response($data,REST_Controller::HTTP_OK); + + } + } + + } \ No newline at end of file diff --git a/api/application/models/Template_Management_Model.php b/api/application/models/Template_Management_Model.php index 29830105..e310066a 100644 --- a/api/application/models/Template_Management_Model.php +++ b/api/application/models/Template_Management_Model.php @@ -79,9 +79,9 @@ class Template_Management_Model extends SPARQ_Model { public function getTemplateCategories($template_id) { - $this->db->SELECT('QUESTIONCATEGORY.question_categroy_id,QUESTIONCATEGORY.categroy_name,TEMPLATECATEGORYWEIGHTAGE.template_category_weightage_id, TEMPLATECATEGORYWEIGHTAGE.fk_question_category_id, TEMPLATECATEGORYWEIGHTAGE.fk_template_id, TEMPLATECATEGORYWEIGHTAGE.weigthage, DATE_FORMAT(TEMPLATECATEGORYWEIGHTAGE.createdon,"%d/%m/%Y") as createdon, TEMPLATECATEGORYWEIGHTAGE.fk_createdby, DATE_FORMAT(TEMPLATECATEGORYWEIGHTAGE.updatedon, "%d/%m/%Y") as updatedon, TEMPLATECATEGORYWEIGHTAGE.isactive, TEMPLATECATEGORYWEIGHTAGE.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby'); + $this->db->SELECT('QUESTIONCATEGORY.question_category_id,QUESTIONCATEGORY.category_name,TEMPLATECATEGORYWEIGHTAGE.template_category_weightage_id, TEMPLATECATEGORYWEIGHTAGE.fk_question_category_id, TEMPLATECATEGORYWEIGHTAGE.fk_template_id, TEMPLATECATEGORYWEIGHTAGE.weightage, DATE_FORMAT(TEMPLATECATEGORYWEIGHTAGE.createdon,"%d/%m/%Y") as createdon, TEMPLATECATEGORYWEIGHTAGE.fk_createdby, DATE_FORMAT(TEMPLATECATEGORYWEIGHTAGE.updatedon, "%d/%m/%Y") as updatedon, TEMPLATECATEGORYWEIGHTAGE.isactive, TEMPLATECATEGORYWEIGHTAGE.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby'); $this->db->FROM(QUESTIONCATEGORY .' as QUESTIONCATEGORY'); - $this->db->JOIN(TEMPLATECATEGORYWEIGHTAGE.' as TEMPLATECATEGORYWEIGHTAGE',"TEMPLATECATEGORYWEIGHTAGE.template_category_weightage_id = QUESTIONCATEGORY.question_categroy_id AND TEMPLATECATEGORYWEIGHTAGE.fk_template_id = $template_id",'LEFT'); + $this->db->JOIN(TEMPLATECATEGORYWEIGHTAGE.' as TEMPLATECATEGORYWEIGHTAGE',"TEMPLATECATEGORYWEIGHTAGE.template_category_weightage_id = QUESTIONCATEGORY.question_category_id AND TEMPLATECATEGORYWEIGHTAGE.fk_template_id = $template_id",'LEFT'); $this->db->JOIN(USERPROFILE.' as USERPROFILE','TEMPLATECATEGORYWEIGHTAGE.fk_createdby = USERPROFILE.userid','LEFT'); $this->db->JOIN(USERPROFILE.' as USERPROFILE1','TEMPLATECATEGORYWEIGHTAGE.fk_updatedby = USERPROFILE1.userid','LEFT'); // $this->db->WHERE('TEMPLATECATEGORYWEIGHTAGE.fk_template_id',$template_id); @@ -97,9 +97,9 @@ class Template_Management_Model extends SPARQ_Model { public function getTemplateQuestionAnswers($template_id) { - $this->db->SELECT('QUESTIONCATEGORY.question_categroy_id,QUESTIONCATEGORY.categroy_name,TEMPLATECATEGORYWEIGHTAGE.template_category_weightage_id, TEMPLATECATEGORYWEIGHTAGE.fk_question_category_id, TEMPLATECATEGORYWEIGHTAGE.fk_template_id, TEMPLATECATEGORYWEIGHTAGE.weigthage, TEMPLATECATEGORYWEIGHTAGE.isactive'); + $this->db->SELECT('QUESTIONCATEGORY.question_category_id,QUESTIONCATEGORY.category_name,TEMPLATECATEGORYWEIGHTAGE.template_category_weightage_id, TEMPLATECATEGORYWEIGHTAGE.fk_question_category_id, TEMPLATECATEGORYWEIGHTAGE.fk_template_id, TEMPLATECATEGORYWEIGHTAGE.weightage, TEMPLATECATEGORYWEIGHTAGE.isactive'); $this->db->FROM(QUESTIONCATEGORY .' as QUESTIONCATEGORY'); - $this->db->JOIN(TEMPLATECATEGORYWEIGHTAGE.' as TEMPLATECATEGORYWEIGHTAGE',"TEMPLATECATEGORYWEIGHTAGE.template_category_weightage_id = QUESTIONCATEGORY.question_categroy_id AND TEMPLATECATEGORYWEIGHTAGE.fk_template_id = $template_id",'LEFT'); + $this->db->JOIN(TEMPLATECATEGORYWEIGHTAGE.' as TEMPLATECATEGORYWEIGHTAGE',"TEMPLATECATEGORYWEIGHTAGE.template_category_weightage_id = QUESTIONCATEGORY.question_category_id AND TEMPLATECATEGORYWEIGHTAGE.fk_template_id = $template_id",'LEFT'); // $this->db->JOIN(USERPROFILE.' as USERPROFILE','TEMPLATECATEGORYWEIGHTAGE.fk_createdby = USERPROFILE.userid','LEFT'); // $this->db->JOIN(USERPROFILE.' as USERPROFILE1','TEMPLATECATEGORYWEIGHTAGE.fk_updatedby = USERPROFILE1.userid','LEFT'); $categories = $this->db->GET()->result_array();