Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 12 |
CRAP | |
0.00% |
0 / 128 |
CoursePatternService | |
0.00% |
0 / 1 |
|
0.00% |
0 / 12 |
506.00 | |
0.00% |
0 / 128 |
__construct | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 2 |
|||
__clone | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 2 |
|||
getInstance | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 5 |
|||
getAllCoursePatterns | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 8 |
|||
getCoursePatternOfBatch | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 17 |
|||
getCoursePatternsByCourseTypeId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 8 |
|||
getDeptCoursesById | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 15 |
|||
getCoursePatternsByPatternId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
getCoursePatternsByExamregId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 17 |
|||
getSubsidaryCourseByBatchID | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 17 |
|||
getCoursePatternsByCourseTypeIds | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 11 |
|||
getCoursePatternsBySupplyRegId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 17 |
<?php | |
namespace com\linways\core\ams\professional\service; | |
use com\linways\core\ams\professional\exception\ProfessionalException; | |
class CoursePatternService extends BaseService | |
{ | |
private static $_instance = null; | |
// /Condition 2 - Locked down the constructor | |
private function __construct() | |
{ | |
} | |
// Prevent any oustide instantiation of this class | |
// /Condition 3 - Prevent any object or instance of that class to be cloned | |
private function __clone() | |
{ | |
} | |
// Prevent any copy of this object | |
// /Condition 4 - Have a single globally accessible static method | |
public static function getInstance() | |
{ | |
if (!is_object(self::$_instance)) // or if( is_null(self::$_instance) ) or if( self::$_instance == null ) | |
self::$_instance = new self (); | |
return self::$_instance; | |
} | |
/** | |
* @return Object | |
* @throws ProfessionalException | |
*/ | |
public function getAllCoursePatterns() | |
{ | |
$sql = "SELECT patternID as id,patternName as name,patternDesc as description,ssp_course_id FROM course_pattern"; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* @return Object | |
* @throws ProfessionalException | |
*/ | |
public function getCoursePatternOfBatch($batchId) | |
{ | |
$sql = "SELECT | |
cp.patternID AS id, | |
cp.patternName AS name, | |
cp.patternDesc AS description | |
FROM | |
course_pattern cp | |
INNER JOIN | |
batches b ON b.patternID = cp.patternID | |
WHERE | |
b.batchID = $batchId"; | |
try { | |
return $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* @author George | |
* Service for getting course patterns using courseTypeID | |
* @return list of objects | |
*/ | |
public function getCoursePatternsByCourseTypeId($courseTypeId) | |
{ | |
$sql = "SELECT patternID as id,patternName as name,patternDesc as description FROM course_pattern WHERE courseTypeID = $courseTypeId"; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* get dept courses | |
* @return DeptCourses list | |
*/ | |
public function getDeptCoursesById($courseId) { | |
$deptCourses = []; | |
$sql = "SELECT | |
patterncourseID AS deptCourseId, | |
patterncourseName AS courseName, | |
patternID AS patternId, | |
deptID AS deptId, | |
patterncourseCode AS courseCode , | |
patternAbbreviation, | |
concat(patterncourseName,' - ',patterncourseCode) AS displayName | |
FROM | |
pattern_deptcourses | |
WHERE patternID = $courseId"; | |
$deptCourse = $this->executeQueryForObject($sql); | |
return $deptCourse; | |
} | |
/** | |
* Service for getting course patterns using patternID | |
* @return Object | |
*/ | |
public function getCoursePatternsByPatternId($patternId) | |
{ | |
$patternId = $this->realEscapeString($patternId); | |
$sql = "SELECT patternID as id,patternName as name,patternDesc as description FROM course_pattern WHERE patternID = $patternId"; | |
try { | |
return $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* Service for getting course patterns using examregID | |
* @return Object | |
*/ | |
public function getCoursePatternsByExamregId($examregId) | |
{ | |
$examregId = $this->realEscapeString($examregId); | |
$sql = "SELECT distinct cp.patternID as id,cp.patternName as name | |
from exam_registration_batches erb | |
inner join | |
batches b | |
on erb.batchID = b.batchID | |
inner join | |
course_pattern cp | |
on b.patternID = cp.patternID | |
where erb.examregID='$examregId'"; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* Service for getting subsidary course by batchID | |
* @return Object | |
*/ | |
public function getSubsidaryCourseByBatchID($batchID) | |
{ | |
$sql = "SELECT | |
sc.subsiderycoursename | |
FROM | |
subsiderycourse sc | |
INNER JOIN | |
pattern_deptcourses pdc ON pdc.patterncourseID = sc.pattern_deptcourses_id | |
LEFT JOIN | |
batches bat ON pdc.patterncourseID = bat.patterncourseID | |
WHERE | |
bat.batchID = $batchID "; | |
try { | |
return $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* @author Raja | |
* Service for getting course patterns using courseTypeIDs | |
* @return list of objects | |
*/ | |
public function getCoursePatternsByCourseTypeIds($courseTypeIds) | |
{ | |
if(!empty($courseTypeIds)){ | |
$where = " AND courseTypeID IN (".implode(",",$courseTypeIds).") "; | |
} | |
$sql = "SELECT patternID as id,patternName as name,patternDesc as description FROM course_pattern WHERE 1=1 $where "; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* Service for getting course patterns using supply regId | |
* @return Object | |
*/ | |
public function getCoursePatternsBySupplyRegId($examregId) | |
{ | |
$examregId = $this->realEscapeString($examregId); | |
$sql = "SELECT distinct cp.patternID as id,cp.patternName as name | |
from supply_improve_batches erb | |
inner join | |
batches b | |
on erb.batchID = b.batchID | |
inner join | |
course_pattern cp | |
on b.patternID = cp.patternID | |
where erb.exam_supplementary_id='$examregId'"; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
} |