name ?>
title;?>
post_image==NULL){ }else{ ?>post;?>
db->where('post_id',$rowPosts->id); $this->db->where('student_id',$student_id); $cl=$this->db->get('likes')->num_rows(); ?> " href="javascript:;" style="color: inherit;"> 0){?> Unlike Like db->where('post_id',$rowPosts->id)->count_all_results('likes'); ?> Likes db->where('post_id',$rowPosts->id)->count_all_results('comments') + $this->db->where('post_id',$rowPosts->id)->count_all_results('comments_reply')); ?> Comments
comment;?>
} } public function like_post(){ $array = array( 'student_id'=>$this->session->userdata('id'), 'post_id'=>$this->input->post('post_id'), 'date'=>date('Y-m-d'), 'time'=>date('H:i:s'), ); $count = $this->db->where('student_id',$this->session->userdata('id'))->where('post_id',$this->input->post('post_id'))->count_all_results('likes'); if($count > 0){ $this->db->where('student_id',$this->session->userdata('id'))->where('post_id',$this->input->post('post_id'))->delete('likes'); foreach($this->db->where('id',$this->input->post('post_id'))->get('posts')->result() as $post){ $this->db->where('student_id',$post->student_id)->where('notify_id',$this->session->userdata('id'))->where('category','like')->where('activity_id',$this->input->post('post_id'))->delete('notifications'); } }else{ $this->db->insert('likes',$array); $like_id=$this->db->insert_id(); // notifications here foreach($this->db->where('id',$this->input->post('post_id'))->get('posts')->result() as $post){ if($post->student_id != $this->session->userdata('id')){ $note = array( 'student_id'=>$post->student_id, 'notify_id'=>$this->session->userdata('id'), 'content'=>'liked your post', 'category'=>'like', 'activity_id'=>$this->input->post('post_id'), 'action_id'=>$like_id, 'audience'=>'single', 'date'=>date('Y-m-d H:i:s'), ); $this->db->insert('notifications',$note); } } } } public function my_account(){ $mobile=$this->input->post('mobile'); $mobile =str_replace("-","",$mobile); $mobile =str_replace("(","",$mobile); $mobile =str_replace(")","",$mobile); $mobile =str_replace(" ","",$mobile); $email= $this->input->post('email'); $student_id =$this->input->post('id'); if($this->input->post('password')==''){ $data_ary1 = array( 'mobile'=>$mobile, 'email'=>$email, ); $data_ary = $this->security->xss_clean($data_ary); $this->db->where('id',$student_id); $this->db->update('students',$data_ary1); redirect('welcome/my_account?sent'); }else{ $length=strlen($this->input->post('password')); $old_password=""; $student_id =$this->input->post('id'); $this->db->where('id',$student_id); foreach($this->db->get('students')->result() as $row){ $old_password=$row->password1; } if($this->input->post('password') != $this->input->post('password1')){ redirect('welcome/my_account?error1'); }elseif($this->input->post('password') == $old_password){ redirect('welcome/my_account?error2'); }elseif($length<6){ redirect('welcome/my_account?error3'); } $data_ary = array( 'mobile'=>$mobile, 'password'=>md5($this->input->post('password')), 'password1'=>$this->input->post('password'), ); $data_ary = $this->security->xss_clean($data_ary); $this->db->where('id',$student_id); $this->db->update('students',$data_ary); redirect('welcome/my_account?sent'); } } public function change_password(){ $length=strlen($this->input->post('password')); $old_password=""; $student_id =$this->input->post('id'); $old =$this->input->post('old_password'); $this->db->where('id',$student_id); foreach($this->db->get('students')->result() as $row){ $old_password=$row->password1; } if($this->input->post('password') != $this->input->post('password1')){ redirect('welcome/change_password?error1'); }elseif($this->input->post('password') == $old_password){ redirect('welcome/change_password?error2'); }elseif($old != $old_password){ redirect('welcome/change_password?error4'); }elseif($length<6){ redirect('welcome/change_password?error3'); }else{ $data_ary = array( 'password'=>md5($this->input->post('password')), 'password1'=>$this->input->post('password'), ); $data_ary = $this->security->xss_clean($data_ary); $this->db->where('id',$student_id); $this->db->update('students',$data_ary); redirect('welcome/change_password?sent'); } } public function edit_business_profile(){ $student_id =$this->input->post('id'); $data_ary = array( 'business_name'=>$this->input->post('business_name'), 'descriptions'=>$this->input->post('descriptions'), 'business_address'=>$this->input->post('business_address'), 'business_hours'=>$this->input->post('business_hours'), 'call_number'=>$this->input->post('call_number'), 'whatsapp_number'=>$this->input->post('whatsapp_number'), 'business_email'=>$this->input->post('business_email'), 'business_website'=>$this->input->post('business_website'), 'facebook'=>$this->input->post('facebook'), 'instagram'=>$this->input->post('instagram'), 'twitter'=>$this->input->post('twitter'), ); $data_ary = $this->security->xss_clean($data_ary); $this->db->where('student_id',$student_id); $this->db->update('business_profiles',$data_ary); redirect('welcome/edit_business_profile?sent'); } public function enroll_course(){ $student_id =$this->session->userdata('id'); $lesson_id= $this->input->post('lesson_id'); $data_ary = array( 'student_id'=>$student_id, 'lesson_id'=>$lesson_id, 'date'=>date('Y-m-d'), ); $data_ary = $this->security->xss_clean($data_ary); $this->db->where('student_id',$student_id); $this->db->where('lesson_id',$lesson_id); $count=$this->db->count_all_results('enroll_course'); if($count>0){ $this->db->where('student_id',$student_id); $this->db->where('lesson_id',$lesson_id); $this->db->update('enroll_course',$data_ary); }else{ $this->db->insert('enroll_course',$data_ary); //send email to enrolled student //get course foreach($this->db->where('id',$lesson_id)->get('lessons')->result() as $row){ $course=$row->name; } foreach($this->db->where('id',$student_id)->get('students')->result() as $rowOne){ $email=$rowOne->email; } $name=$this->session->userdata('full_name'); $to = $email; $subject = "TWCC Platform Online Course Enrollment "; $url= 'https://womenchamber.or.tz/'; $message = "Dear ".$name.",
comment;?> student_id==$this->session->userdata('id') || $rowComment->student_id==$this->session->userdata('id')){ ?>
comment;?> student_id==$this->session->userdata('id') || $rowComment->student_id==$this->session->userdata('id') || $reply->student_id==$this->session->userdata('id')){ ?> Edit Delete