Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 36 |
CRAP | |
0.00% |
0 / 468 |
AdmissionFormDesignService | |
0.00% |
0 / 1 |
|
0.00% |
0 / 36 |
7482.00 | |
0.00% |
0 / 468 |
__construct | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
__clone | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 1 |
|||
getInstance | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 5 |
|||
insertSections | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
showSections | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 14 |
|||
getMaxPriority | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 14 |
|||
isPaymentSection | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 14 |
|||
updateSection | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
deletesection | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 16 |
|||
showFormFields | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 32 |
|||
insertFormFields | |
0.00% |
0 / 1 |
30.00 | |
0.00% |
0 / 24 |
|||
updatePriority | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 12 |
|||
deleteFields | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 21 |
|||
getAllFormFields | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
admissionStarted | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
updatePrioritiesSection | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 14 |
|||
getMessageBelowEligibleCoursesPG | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
getStates | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
saveState | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 18 |
|||
deleteStates | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
getStateDetails | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
getgroupNames | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
saveGroups | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
getAdmissionStates | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
saveDistrict | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 19 |
|||
getDistricts | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 13 |
|||
deleteDistrict | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
getTaluks | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 13 |
|||
getAdmissionDistricts | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 13 |
|||
saveTaluk | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 21 |
|||
deleteTaluk | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
getTalukById | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
getNationality | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
saveNationality | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 18 |
|||
deleteNationality | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
hideReservation | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
<?php | |
namespace com\linways\core\ams\professional\service; | |
use com\linways\core\ams\professional\dto\AdmissionApplicationFormFields; | |
use com\linways\core\ams\professional\dto\AdmissionApplicationFormSection; | |
use com\linways\base\helper\ResultHandler; | |
use com\linways\core\ams\professional\constants\MemCachedConstants; | |
use com\linways\core\ams\professional\mapper\AdmissionGroupNameMapper; | |
use com\linways\core\ams\professional\exception\ProfessionalException; | |
class AdmissionFormDesignService extends BaseService | |
{ | |
private static $_instance = null; | |
private $mapper = []; | |
// /Condition 2 - Locked down the constructor | |
private function __construct() | |
{ | |
$this->mapper = AdmissionGroupNameMapper::getInstance()->getMapper(); | |
} | |
// 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; | |
} | |
/** | |
* Insert sections | |
* | |
* @author Aswin | |
* @param AdmissionApplicationFormSection $section | |
* @throws ProfessionalException | |
*/ | |
public function insertSections($section) | |
{ | |
$query = "insert into admission_appln_forms_section (section,priority,isPayment) values ('$section->sectionName','$section->priority','$section->isPayment')"; | |
$response = null; | |
try { | |
$response = $this->executeQueryForObject($query, true); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $response; | |
} | |
/** | |
* Show Sections | |
* | |
* @author Aswin | |
* @throws ProfessionalException | |
* @return object|array|\com\linways\base\util\$objectList[] | |
*/ | |
public function showSections() | |
{ | |
$query = "select id as sectionID,section as sectionName,priority,isPayment from admission_appln_forms_section order by priority"; | |
try { | |
$response = null; | |
$response = $this->executeQueryForList($query); | |
if (! $response) { | |
throw new ProfessionalException(ProfessionalException::ARRAY_EMPTY, "No sections Found"); | |
} else { | |
return $response; | |
} | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* get maximum of priority | |
* | |
* @author Aswin | |
* @throws ProfessionalException | |
* @return object|NULL|\com\linways\base\util\$objectList[] | |
*/ | |
public function getMaxPriority() | |
{ | |
$response = null; | |
$query = "select MAX(priority) as pmax from admission_appln_forms_section"; | |
try { | |
$response = $this->executeQueryForObject($query); | |
if (! $response->pmax) { | |
throw new ProfessionalException(ProfessionalException::ARRAY_EMPTY, "No priorities in table"); | |
} else { | |
return $response; | |
} | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* gets id of section set as payment | |
* | |
* @author Aswin | |
* @throws ProfessionalException | |
* @return object|NULL|\com\linways\base\util\$objectList[] | |
*/ | |
public function isPaymentSection() | |
{ | |
$response = null; | |
$query = "select id as sectionID from admission_appln_forms_section where isPayment=1"; | |
try { | |
$response = $this->executeQueryForObject($query); | |
if (! $response) { | |
throw new ProfessionalException(ProfessionalException::OBJECT_IS_EMPTY, "No section is set as payment"); | |
} else { | |
return $response; | |
} | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* Update Section | |
* | |
* @author Aswin | |
* @param AdmissionApplicationFormSection $section | |
* @throws ProfessionalException | |
* @return number | |
*/ | |
public function updateSection($section) | |
{ | |
$query = "update admission_appln_forms_section set section='$section->sectionName',isPayment='$section->isPayment' where id='$section->id'"; | |
try { | |
$response = $this->executeQuery($query); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return "success"; | |
} | |
/** | |
* Delete section | |
* | |
* @author Aswin | |
* @param unknown $sectionID | |
* @throws ProfessionalException | |
* @return string | |
*/ | |
public function deletesection($sectionID) | |
{ | |
$sectionID = $this->realEscapeString($sectionID); | |
$query = "delete from admission_appln_forms_fields where sectionID=$sectionID"; | |
try { | |
$response = $this->executeQuery($query); | |
$qry = "delete from admission_appln_forms_section where id=$sectionID"; | |
try { | |
$response = $this->executeQuery($qry); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return "deleted"; | |
} | |
/** | |
* get fields of a section | |
* | |
* @author Aswin | |
* @param $sectionID | |
* @throws ProfessionalException | |
*/ | |
public function showFormFields($sectionID) | |
{ | |
$sectionID = $this->realEscapeString($sectionID); | |
$query = "SELECT | |
id AS fieldID, | |
name AS fieldName, | |
label AS fieldLabel, | |
type AS fieldType, | |
description, | |
required, | |
validator, | |
foreign_key, | |
table_name, | |
value, | |
display_name, | |
default_value, | |
field_relation, | |
event_handlers, | |
field_priority, | |
user_query, | |
groupname | |
FROM admission_appln_forms_fields | |
WHERE sectionID = $sectionID ORDER BY field_priority"; | |
try { | |
$response = null; | |
$response = $this->executeQueryForList($query); | |
if ($response == null) | |
return "nofields"; | |
return $response; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* Insert or update section fields | |
* | |
* @author Aswin | |
* @param AdmissionApplicationFormFields $formField | |
* @throws ProfessionalException | |
* @return string | |
*/ | |
public function insertFormFields($formFields, $sectionID) | |
{ | |
$sectionID = $this->realEscapeString($sectionID); | |
foreach ($formFields as $formField) { | |
$query = "select id from admission_appln_forms_fields where name='$formField->name'"; | |
try { | |
$response = null; | |
$response = $this->executeQueryForObject($query); | |
if ($response != null) { | |
$query = "update admission_appln_forms_fields set label='$formField->label' ,description='$formField->description',required=$formField->required,sectionID='$formField->sectionID' where id=$response->id"; | |
} else { | |
$query = "insert into admission_appln_forms_fields (name,label,type,description,required,validator,foreign_key,table_name,value,display_name,default_value,field_relation,event_handlers,sectionID,user_query,groupname) values ('$formField->name','$formField->label','$formField->type','$formField->description','$formField->required','$formField->validator','$formField->foreign_key','$formField->table','$formField->value','$formField->display_name','$formField->default','$formField->field_relation','$formField->event_handlers','$formField->sectionID','$formField->userquery','$formField->groupname')"; | |
} | |
try { | |
$response = null; | |
$response = $this->executeQuery($query); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
return "success"; | |
} | |
public function updatePriority($arrayFieldNames) | |
{ | |
foreach ($arrayFieldNames as $fieldName => $priority) { | |
$query = "update admission_appln_forms_fields set field_priority=$priority where name='$fieldName'"; | |
try { | |
$response = null; | |
$response = $this->executeQuery($query); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
return "success"; | |
} | |
/** | |
* | |
* @param unknown $fieldID | |
* @throws ProfessionalException | |
* @return string | |
*/ | |
public function deleteFields($fieldID,$relatedFields) | |
{ | |
$fieldID = $this->realEscapeString($fieldID); | |
// $relatedFields=$this->realEscapeString($relatedFields); | |
$response = null; | |
$query = "delete from admission_appln_forms_fields where id=$fieldID"; | |
try { | |
$response = $this->executeQuery($query); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
if($relatedFields!="") | |
{ | |
$query="delete from admission_appln_forms_fields where name in ($relatedFields)"; | |
try{ | |
$response=$this->executeQuery($query); | |
}catch(\Exception $e) | |
{ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
return "success"; | |
} | |
/** | |
* get form fields from xml | |
* @author Aswin | |
* @return SimpleXMLElement|object|NULL|unknown | |
*/ | |
// public function getXMLFormFields() | |
// { | |
// $fromxml=null; | |
// $fromxml=$this->linCache->getValue(MemCachedConstants::ADMISSIONFORMFIELDS); | |
// if($fromxml==null) | |
// { | |
// $fromxml=simplexml_load_file("admission_appln_form_settings.xml"); | |
// $fromxml=$fromxml->saveXML(); | |
// // $linCache->setValue(MemCachedConstants::ADMISSIONFORMFIELDS, $fromxml); | |
// $this->linCache->setValue(MemCachedConstants::ADMISSIONFORMFIELDS, $fromxml); | |
// } | |
// return $fromxml; | |
// } | |
/** | |
* get all fields of all sections | |
* @author Aswin | |
* @throws ProfessionalException | |
* @return object|array|\com\linways\base\util\$objectList[] | |
*/ | |
public function getAllFormFields() | |
{ | |
$query="select aaff.sectionID,aaff.name,aafs.section,aaff.required from admission_appln_forms_fields aaff inner join admission_appln_forms_section aafs on aaff.sectionID=aafs.id"; | |
try{ | |
$response=$this->executeQueryForList($query); | |
}catch (\Exception $e) | |
{ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
return $response; | |
} | |
/** | |
* whether admission started | |
* @author Aswin | |
* @throws ProfessionalException | |
* @return object|NULL|\com\linways\base\util\$objectList[] | |
*/ | |
public function admissionStarted() | |
{ | |
$query="select studentID from admission_appln_current_section limit 1"; | |
try{ | |
$response=null; | |
$response=$this->executeQueryForObject($query); | |
return $response; | |
}catch (\Exception $e) | |
{ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* update priorites of ug section | |
* @param $priorities | |
* @throws ProfessionalException | |
* @return string | |
*/ | |
public function updatePrioritiesSection($priorities) | |
{ | |
$priorities=$this->realEscapeArray($priorities); | |
foreach ($priorities as $priority=>$sectionID) | |
{ | |
$query="update admission_appln_forms_section set priority=$priority where id=$sectionID"; | |
try{ | |
$response=$this->executeQueryForList($query); | |
}catch(\Exception $e) | |
{ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
return "updated"; | |
} | |
/** | |
* get the message to display below the eligible courses listing in student side for pg | |
* | |
* @throws ProfessionalException | |
* @return object | |
*/ | |
public function getMessageBelowEligibleCoursesPG() | |
{ | |
$query="SELECT message FROM pg_admission_description_msg_below_eligible_courses limit 1"; | |
try{ | |
$response=$this->executeQueryForObject($query); | |
}catch (\Exception $e) | |
{ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
return $response; | |
} | |
/**********************************Add States For Admission**************************************/ | |
/** | |
* get states | |
* @author Aswin | |
* @throws ProfessionalException | |
* @return object|array|\com\linways\base\util\$objectList[] | |
*/ | |
public function getStates() | |
{ | |
$query="select * from admission_indian_states order by state_name"; | |
try{ | |
$response=$this->executeQueryForList($query); | |
return $response; | |
}catch(\Exception $e) | |
{ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* save states | |
* @author Aswin | |
* @param $state | |
* @param $id | |
* @throws ProfessionalException | |
* @return string | |
*/ | |
public function saveState($state,$id=null) | |
{ | |
$state=$this->realEscapeString($state); | |
$id=$this->realEscapeString($id); | |
if($id) | |
{ | |
$query="update admission_indian_states set state_name='$state' where id=$id"; | |
} | |
else { | |
$query="insert into admission_indian_states (state_name) values ('$state')"; | |
} | |
try{ | |
$response=$this->executeQueryForList($query); | |
return "inserted"; | |
}catch(\Exception $e) | |
{ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* delete states | |
* @author Aswin | |
* @param $id | |
* @throws ProfessionalException | |
* @return string | |
*/ | |
public function deleteStates($id) | |
{ | |
$id=$this->realEscapeString($id); | |
$query="delete from admission_indian_states where id=$id"; | |
try{ | |
$response=$this->executeQueryForList($query); | |
return "deleted"; | |
}catch(\Exception $e) | |
{ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* get state details by id | |
* @author Aswin | |
* @param unknown $id | |
* @throws ProfessionalException | |
* @return object|NULL|\com\linways\base\util\$objectList[] | |
*/ | |
public function getStateDetails($id) | |
{ | |
$id=$this->realEscapeString($id); | |
$query="select * from admission_indian_states where id='$id'"; | |
try{ | |
$response=$this->executeQueryForObject($query); | |
return $response; | |
}catch (\Exception $e) | |
{ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/*********************************Assign Group Nmes*************************************/ | |
/** | |
* get group names | |
* @author Aswin | |
* @throws ProfessionalException | |
* @return object|array|\com\linways\base\util\$objectList[] | |
*/ | |
public function getgroupNames() | |
{ | |
$query="select id as fieldID,label,groupname from admission_appln_forms_fields where groupname <> '' order by groupname"; | |
try{ | |
$response=$this->executeQueryForList($query,$this->mapper[AdmissionGroupNameMapper::GET_GROUP_NAMES]); | |
return $response; | |
}catch(\Exception $e) | |
{ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* save groups | |
* @author Aswin | |
* @param $groupname | |
* @param $fieldIDs | |
* @throws ProfessionalException | |
* @return object|array|\com\linways\base\util\$objectList[] | |
*/ | |
public function saveGroups($groupname,$fieldIDs) | |
{ | |
$groupname=$this->realEscapeString($groupname); | |
$fieldIDs=$this->realEscapeString($fieldIDs); | |
$query="update admission_appln_forms_fields set groupname='$groupname' where id in ($fieldIDs)"; | |
try{ | |
$response=$this->executeQueryForList($query); | |
return "saved"; | |
}catch(\Exception $e) | |
{ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* Method for getting all states in india | |
* @param unknown $stateId | |
* @throws ProfessionalException | |
* @return object|NULL|\com\linways\base\util\$objectList[] | |
* @author Ranjith Balachandran | |
*/ | |
public function getAdmissionStates($stateId) | |
{ | |
$sql = ''; | |
$stateId = $this->realEscapeObject($stateId); | |
$stateDetails = null; | |
try{ | |
$sql = "SELECT state_name AS stateName FROM admission_indian_states WHERE id = $stateId"; | |
$stateDetails = $this->executeQueryForObject($sql)->stateName; | |
}catch (\Exception $e){ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
return $stateDetails; | |
} | |
/** | |
* Method for adding and updating districts corresponding to a state | |
* @param unknown $districtName | |
* @param unknown $stateId | |
* @param unknown $districtId | |
* @throws ProfessionalException | |
* @return string | |
* @author Ranjith Balachandran | |
*/ | |
public function saveDistrict($districtName,$stateId,$districtId=null) | |
{ | |
$sql = ''; | |
$districtId = $this->realEscapeString($districtId); | |
$districtName = $this->realEscapeString($districtName); | |
$stateId = $this->realEscapeString($stateId); | |
if($districtId) | |
{ | |
$sql = "UPDATE districts SET districtName = '$districtName' WHERE id = $districtId"; | |
} | |
else { | |
$sql = "INSERT INTO districts (districtName,admission_indian_states_id) VALUES ('$districtName',$stateId)"; | |
} | |
try{ | |
$this->executeQuery($sql); | |
}catch(\Exception $e) | |
{ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* Method for getting all districts | |
* @input $stateId | |
* @throws ProfessionalException | |
* @return unknown | |
* @author Ranjith Balachandran | |
*/ | |
public function getDistricts($stateId) | |
{ | |
$sql = ''; | |
$stateId = $this->realEscapeString($stateId); | |
$districtDetails = []; | |
$sql = "SELECT id AS districtId,admission_indian_states_id AS stateId,districtName AS districtName FROM districts WHERE admission_indian_states_id = '$stateId' ORDER BY districtName ASC"; | |
try{ | |
$districtDetails=$this->executeQueryForList($sql); | |
}catch(\Exception $e) | |
{ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
return $districtDetails; | |
} | |
/** | |
* Method for deleting a district | |
* @param unknown $districtId | |
* @throws ProfessionalException | |
* @return string | |
* @author Ranjith Balachandran | |
*/ | |
public function deleteDistrict($districtId) | |
{ | |
$sql = ''; | |
$districtId=$this->realEscapeString($districtId); | |
$sql="DELETE FROM districts WHERE id = $districtId"; | |
try{ | |
$this->executeQuery($sql); | |
}catch(\Exception $e) | |
{ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* Method for getting taluk details for a state and district | |
* @param unknown $districtId | |
* @param unknown $stateId | |
* @throws ProfessionalException | |
* @return object|array|\com\linways\base\util\$objectList[] | |
* @author Ranjith Balachandran | |
*/ | |
public function getTaluks($districtId,$stateId) | |
{ | |
$sql = ''; | |
$stateId = $this->realEscapeString($stateId); | |
$districtId = $this->realEscapeString($districtId); | |
$talukDetails = []; | |
try{ | |
$sql = "SELECT id AS talukId, admission_indian_states_id AS stateId , districts_id AS districtId , talukName AS talukName,student_specify FROM taluks WHERE admission_indian_states_id = '$stateId' AND districts_id = '$districtId'"; | |
$talukDetails = $this->executeQueryForList($sql); | |
}catch (\Exception $e){ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
return $talukDetails; | |
} | |
/** | |
* Method for getting district Name for a state | |
* @param unknown $stateId | |
* @param unknown $districtId | |
* @throws ProfessionalException | |
* @return unknown | |
* @author Ranjith Balachandran | |
*/ | |
public function getAdmissionDistricts($stateId,$districtId) | |
{ | |
$sql = ''; | |
$stateId = $this->realEscapeObject($stateId); | |
$districtId = $this->realEscapeString($districtId); | |
$districtDetails = null; | |
try{ | |
$sql = "SELECT districtName AS districtName FROM districts WHERE id = '$districtId' AND admission_indian_states_id = '$stateId'"; | |
$districtDetails = $this->executeQueryForObject($sql)->districtName; | |
}catch (\Exception $e){ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
return $districtDetails; | |
} | |
/** | |
* Method for asving taluk name for a state and district | |
* @param unknown $talukName | |
* @param unknown $stateId | |
* @param unknown $districtId | |
* @param unknown $talukId | |
* @throws ProfessionalException | |
* @author Ranjith Balachandran | |
*/ | |
public function saveTaluk($student_specify,$talukName,$stateId,$districtId,$talukId = null) | |
{ | |
$sql = ''; | |
$districtId = $this->realEscapeString($districtId); | |
$talukName = $this->realEscapeString($talukName); | |
$stateId = $this->realEscapeString($stateId); | |
$talukId = $this->realEscapeString($talukId); | |
$student_specify=$this->realEscapeString($student_specify); | |
if($talukId) | |
{ | |
$sql = "UPDATE taluks SET talukName = '$talukName',student_specify=$student_specify WHERE id = $talukId"; | |
} | |
else { | |
$sql = "INSERT INTO taluks (talukName,admission_indian_states_id,districts_id,student_specify) VALUES ('$talukName',$stateId,$districtId,$student_specify)"; | |
} | |
try{ | |
$this->executeQuery($sql); | |
}catch(\Exception $e) | |
{ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* Method for deleting thaluk | |
* @param unknown $talukId | |
* @throws ProfessionalException | |
* @author Ranjith Balachandran | |
*/ | |
public function deleteTaluk($talukId) | |
{ | |
$sql = ''; | |
$talukId=$this->realEscapeString($talukId); | |
$sql="DELETE FROM taluks WHERE id = $talukId"; | |
try{ | |
$this->executeQuery($sql); | |
}catch(\Exception $e) | |
{ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* get taluk by id | |
* @author Aswin | |
* @param unknown $id | |
* @throws ProfessionalException | |
* @return object|NULL|\com\linways\base\util\$objectList[] | |
*/ | |
public function getTalukById($id) | |
{ | |
$id=$this->realEscapeString($id); | |
$query="select * from taluks where id='$id'"; | |
try{ | |
$response=$this->executeQueryForObject($query); | |
return $response; | |
}catch(\Exception $e) | |
{ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* Method for getting all nationalities | |
* @throws ProfessionalException | |
* @return object|array|\com\linways\base\util\$objectList[] | |
* @author Ranjith Balachandran | |
*/ | |
public function getNationality() | |
{ | |
$sql = ''; | |
$nationalityDetails = []; | |
try{ | |
$sql = "SELECT id AS nationalityId,nationalityName AS nationalityName FROM nationality"; | |
$nationalityDetails = $this->executeQueryForList($sql); | |
}catch (\Exception $e){ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
return $nationalityDetails; | |
} | |
/** | |
* Method for saving nationality | |
* @param unknown $nationalityName | |
* @param unknown $nationalityId | |
* @throws ProfessionalException | |
* @author Ranjith Balachandran | |
*/ | |
public function saveNationality($nationalityName,$nationalityId = null) | |
{ | |
$sql = ''; | |
$nationalityName = $this->realEscapeString($nationalityName); | |
$nationalityId = $this->realEscapeString($nationalityId); | |
if($nationalityId) | |
{ | |
$sql = "UPDATE nationality SET nationalityName = '$nationalityName' WHERE id = $nationalityId"; | |
} | |
else { | |
$sql = "INSERT INTO nationality (nationalityName) VALUES ('$nationalityName')"; | |
} | |
try{ | |
$this->executeQuery($sql); | |
}catch(\Exception $e) | |
{ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* Method for deleting nationality | |
* @param unknown $nationalityId | |
* @throws ProfessionalException | |
* @author Ranjith Balachandran | |
*/ | |
public function deleteNationality($nationalityId) | |
{ | |
$sql = ''; | |
$nationalityId=$this->realEscapeString($nationalityId); | |
$sql="DELETE FROM nationality WHERE id = $nationalityId"; | |
try{ | |
$this->executeQuery($sql); | |
}catch(\Exception $e) | |
{ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* hide student reservation from admission | |
* @author Aswin | |
* @param $reservationID | |
* @param $hide | |
* @throws ProfessionalException | |
* @return string | |
*/ | |
public function hideReservation($reservationID,$hide) | |
{ | |
$reservationID=$this->realEscapeString($reservationID); | |
$hide=$this->realEscapeString($hide); | |
$query="update reservation_students set hide_admission=$hide where reservationID=$reservationID"; | |
try{ | |
$response=$this->executeQueryForList($query); | |
return "updated"; | |
}catch(\Exception $e) | |
{ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
} | |