course details changes done
This commit is contained in:
parent
6da9b62c93
commit
07097254bf
@ -77,30 +77,46 @@ class University_model extends CI_Model
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function addactivity($arrayDetails=null)
|
||||
public function addActivity($arrayDetails=null,$jsonData=null)
|
||||
{
|
||||
$this->db->select('ListName,ListCode,Description');
|
||||
$this->db->where('ListGroup', '2');
|
||||
$this->db->where('ListName', $arrayDetails['ListName']);
|
||||
// $this->db->where('ListCode', $arrayDetails['ListCode']);
|
||||
// $this->db->where('Description', $arrayDetails['Description']);
|
||||
$checkExistActivity = $this->db->get(PICK_LIST_DETAILS);
|
||||
|
||||
// if($checkExistActivity->result()){
|
||||
// $result['activityStatus'] = false;
|
||||
// $result['details'] = "This activity is already added";
|
||||
// }
|
||||
// else{
|
||||
$this->db->insert(PICK_LIST_DETAILS, $arrayDetails);
|
||||
if($this->db->affected_rows() == '1'){
|
||||
$result['activityStatus'] = true;
|
||||
$result['message'] = "Successfully activity is added";
|
||||
}
|
||||
else {
|
||||
$this->db->select('ActivityID,ActivityName');
|
||||
|
||||
$this->db->where('ActivityName', $arrayDetails['ActivityName']);
|
||||
|
||||
if($this->db->get(ACTIVITY)->first_row()){
|
||||
$result['activityStatus'] = false;
|
||||
$result['message'] = "Something went wrong.please try again";
|
||||
$result['message'] = "Activity name is already exist!";
|
||||
}
|
||||
// }
|
||||
else{
|
||||
|
||||
$this->db->insert(ACTIVITY, $arrayDetails);
|
||||
if($this->db->affected_rows() == '1'){
|
||||
$last = $this->db->order_by('ActivityID',"desc")->limit(1)->get(ACTIVITY)->row();
|
||||
$lastActivityID=$last->ActivityID;
|
||||
|
||||
if($jsonData){
|
||||
|
||||
foreach ($jsonData as $srow){
|
||||
$status_array["StatusName"]=$srow['id'];
|
||||
$status_array["ActivityID"]=$lastActivityID;
|
||||
$status_array["IsActive"]=$arrayDetails['IsActive'];
|
||||
$status_array["CreatedBy"]=$arrayDetails['CreatedBy'];
|
||||
$status_array["CreatedOn"]=$arrayDetails['CreatedOn'];
|
||||
$this->db->insert(ACTIVITY_STATUS, $status_array);
|
||||
}
|
||||
}
|
||||
$result['activityStatus'] = true;
|
||||
$result['message'] = "Successfully activity is added";
|
||||
|
||||
}
|
||||
else {
|
||||
$result['activityStatus'] = false;
|
||||
$result['message'] = "Something went wrong.please try again";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
@ -113,39 +129,127 @@ class University_model extends CI_Model
|
||||
|
||||
public function getActivity()
|
||||
{
|
||||
$this->db->select('ListCode,ListName,Description,IsActive');
|
||||
$this->db->where('ListGroup','2');
|
||||
$this->db->order_by('ListCode','DESC');
|
||||
$activityDetails = $this->db->get(PICK_LIST_DETAILS);
|
||||
$this->db->distinct();
|
||||
$this->db->select('ActivityID,ActivityName,Description,IsActive');
|
||||
$activityDetails=$this->db->get(ACTIVITY);
|
||||
if($activityDetails->result()){
|
||||
$result['activityStatus'] = true;
|
||||
$result['details'] = $activityDetails->result();
|
||||
|
||||
$activity_result['activityStatus'] = true;
|
||||
foreach ($activityDetails->result() as $row){
|
||||
$result_array['ActivityID'] = $row->ActivityID;
|
||||
$result_array['ActivityName'] = $row->ActivityName;
|
||||
$result_array['IsActive'] = $row->IsActive;
|
||||
$result_array['Description'] = $row->Description;
|
||||
$this->db->select('AVS.StatusID,PLD.ListCode,PLD.ListName');
|
||||
$this->db->from(ACTIVITY_STATUS .' as AVS');
|
||||
$this->db->join(PICK_LIST_DETAILS.' as PLD', 'PLD.ListCode = AVS.StatusName');
|
||||
$this->db->where('AVS.ActivityID',$row->ActivityID);
|
||||
$this->db->where('AVS.IsActive','1');
|
||||
$result_array['statusDetails']=$this->db->get()->result();
|
||||
$result[]=$result_array;
|
||||
}
|
||||
|
||||
$activity_result['details'] = $result;
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
$result['activityStatus'] = false;
|
||||
$result['message'] = "No records found!";
|
||||
$activity_result['activityStatus'] = false;
|
||||
$activity_result['details'] = "No records found!";
|
||||
}
|
||||
return $result;
|
||||
$activity_result['masterStatusList']=$this->getAllStatusList('1');
|
||||
return $activity_result;
|
||||
|
||||
}
|
||||
/*
|
||||
* get status details
|
||||
* created by kms
|
||||
* */
|
||||
|
||||
public function getAllStatusList($groupName=null)
|
||||
{
|
||||
$this->db->select('ListCode,ListName');
|
||||
$this->db->where('ListGroup',$groupName);
|
||||
$this->db->where('IsActive','1');
|
||||
$this->db->order_by('ListCode','ASC');
|
||||
$status = $this->db->get(PICK_LIST_DETAILS);
|
||||
return $status->result();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* update announcement details
|
||||
* update activity details details
|
||||
* created by Surendiran
|
||||
* */
|
||||
public function updateActivity($arrayDetails=null,$ListCode=null) {
|
||||
|
||||
$this->db->where('ListCode',$ListCode);
|
||||
$updateStatus=$this->db->update(PICK_LIST_DETAILS, $arrayDetails);
|
||||
if($updateStatus){
|
||||
$result['activityStatus'] = true;
|
||||
$result['message'] = "Successfully Activity details updated";
|
||||
}
|
||||
else {
|
||||
$result['activityStatus'] = false;
|
||||
$result['message'] = "Something went wrong.please try again";
|
||||
public function updateActivity($arrayDetails=null,$jsonData=null) {
|
||||
|
||||
$this->db->select('ActivityName');
|
||||
$this->db->where('ActivityName',$arrayDetails['ActivityName']);
|
||||
$this->db->where('ActivityID !=',$arrayDetails['ActivityID']);
|
||||
if($this->db->get(ACTIVITY)->first_row()){
|
||||
$result['activityStatus'] = false;
|
||||
$result['message'] = "Activity name is already exist!";
|
||||
}
|
||||
else{
|
||||
|
||||
$this->db->where('ActivityID ',$arrayDetails['ActivityID']);
|
||||
$updateStatus=$this->db->update(ACTIVITY, $arrayDetails);
|
||||
if($updateStatus){
|
||||
$deactiveStatus['IsActive']=false;
|
||||
$deactiveStatus['UpdatedBy']=$arrayDetails['UpdatedBy'];
|
||||
$deactiveStatus['UpdatedOn']=$arrayDetails['UpdatedOn'];
|
||||
$this->db->where('ActivityID ',$arrayDetails['ActivityID']);
|
||||
$updateActivityStatusDeactive = $this->db->update(ACTIVITY_STATUS, $deactiveStatus);
|
||||
if($updateActivityStatusDeactive){
|
||||
|
||||
if($jsonData){
|
||||
|
||||
foreach ($jsonData as $urow){
|
||||
|
||||
$this->db->select('StatusName');
|
||||
$this->db->where('StatusName',$urow);
|
||||
if($this->db->get(ACTIVITY_STATUS)->first_row()){
|
||||
$existStatusUpdate['IsActive']=true;
|
||||
$existStatusUpdate['UpdatedBy']=$arrayDetails['UpdatedBy'];
|
||||
$existStatusUpdate['UpdatedOn']=$arrayDetails['UpdatedOn'];
|
||||
$this->db->where('StatusName',$urow);
|
||||
$this->db->where('ActivityID',$arrayDetails['ActivityID']);
|
||||
$this->db->update(ACTIVITY_STATUS, $existStatusUpdate);
|
||||
}
|
||||
else{
|
||||
$update_array["StatusName"]=$urow;
|
||||
$update_array["ActivityID"]=$arrayDetails['ActivityID'];
|
||||
$update_array["IsActive"]=true;
|
||||
$update_array["CreatedBy"]=$arrayDetails['UpdatedBy'];
|
||||
$update_array["CreatedOn"]=$arrayDetails['UpdatedOn'];
|
||||
$this->db->insert(ACTIVITY_STATUS, $update_array);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else{
|
||||
$activateStatus['IsActive']=true;
|
||||
$this->db->where('ActivityID ',$arrayDetails['ActivityID']);
|
||||
$this->db->update(ACTIVITY_STATUS, $activateStatus);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
$result['activityStatus'] = true;
|
||||
$result['message'] = "Successfully Activity details updated";
|
||||
}
|
||||
return $result;
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
$result['activityStatus'] = false;
|
||||
$result['message'] = "Something went wrong.please try again";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user