course details changes done

This commit is contained in:
gandhimathi 2017-12-18 16:46:35 +05:30
parent 1b83e51d12
commit 3f3817b4ef

View File

@ -254,4 +254,115 @@ class University_model extends CI_Model
return $result;
}
/*
* get default activity details
* created by kms
* */
public function getDefaultActivity()
{
$arr = array('ListGroup'=>2,'ListGroup'=>6);
$this->db->distinct();
$this->db->select('ListName,ListCode,IsActive');
$this->db->order_by('ListName','ASC');
$this->db->or_where('ListGroup','2');
$this->db->or_where('ListGroup','6');
$this->db->or_where('ListGroup','7');
$this->db->or_where('ListGroup','8');
$this->db->or_where('ListGroup','9');
$defaultActivityDetails=$this->db->get(PICK_LIST_DETAILS);
if($defaultActivityDetails->result()){
$activity_result['activityStatus'] = true;
foreach ($defaultActivityDetails->result() as $row){
$result_array['ActivityID'] = $row->ListCode;
$result_array['ActivityName'] = $row->ListName;
$result_array['IsActive'] = $row->IsActive;
$this->db->select('DA.StudentActivityCode,PLD.ListCode,PLD.ListName');
$this->db->from(DEFAULTACTIVITY .' as DA');
$this->db->join(PICK_LIST_DETAILS.' as PLD', 'PLD.ListCode = DA.StatusCode');
$this->db->where('PLD.IsActive','1');
$this->db->where('DA.IsActive','1');
$this->db->where('DA.StudentActivityCode',$row->ListCode);
$result_array['statusDetails']=$this->db->get()->result();
$result[]=$result_array;
}
$activity_result['details'] = $result;
}
else {
$activity_result['activityStatus'] = false;
$activity_result['details'] = "No records found!";
}
$activity_result['masterStatusList']=$this->getAllStatusList('1');
return $activity_result;
}
/*
* update default activity status
* created by kms
* */
public function updateDefaultActivity($arrayDetails=null,$jsonData=null) {
$deactiveStatus['IsActive']=false;
$deactiveStatus['UpdatedBy']=$arrayDetails['UpdatedBy'];
$deactiveStatus['UpdatedOn']=$arrayDetails['UpdatedOn'];
$this->db->where('StudentActivityCode ',$arrayDetails['StudentActivityCode']);
$updateActivityStatusDeactive = $this->db->update(DEFAULTACTIVITY, $deactiveStatus);
if($updateActivityStatusDeactive){
if($jsonData){
foreach ($jsonData as $urow){
$this->db->select('StatusCode');
$this->db->where('StatusCode',$urow);
$this->db->where('StudentActivityCode',$arrayDetails['StudentActivityCode']);
if($this->db->get(DEFAULTACTIVITY)->first_row()){
$existStatusUpdate['IsActive']=true;
$existStatusUpdate['UpdatedBy']=$arrayDetails['UpdatedBy'];
$existStatusUpdate['UpdatedOn']=$arrayDetails['UpdatedOn'];
$this->db->where('StatusCode',$urow);
$this->db->where('StudentActivityCode',$arrayDetails['StudentActivityCode']);
$this->db->update(DEFAULTACTIVITY, $existStatusUpdate);
}
else{
$update_array["StatusCode"]=$urow;
$update_array["StudentActivityCode"]=$arrayDetails['StudentActivityCode'];
$update_array["IsActive"]=true;
$update_array["CreatedBy"]=$arrayDetails['UpdatedBy'];
$update_array["CreatedOn"]=$arrayDetails['UpdatedOn'];
$this->db->insert(DEFAULTACTIVITY, $update_array);
}
}
}
/*else{
$activateStatus['IsActive']=true;
$this->db->where('StudentActivityCode ',$arrayDetails['StudentActivityCode']);
$this->db->update(DEFAULTACTIVITY, $activateStatus);
}*/
$result['activityStatus'] = true;
$result['message'] = "Successfully status updated";
}
else {
$result['activityStatus'] = false;
$result['message'] = "Something went wrong.please try again";
}
return $result;
}
}