| Server IP : 188.114.97.4 / Your IP : 104.23.197.230 Web Server : Apache/2.4.59 (Debian) System : Linux EDL-STRETCH 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64 User : edlftp ( 1002) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/nicolasj/www/sms.formationlangues.be/application/controllers/BO/ |
Upload File : |
<?php
/*********************
*********************
Aernout Guillaume
http://Codes.Solutions
*********************
*********************/
if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class QuickNotification extends NS_Controller
{
//button to triger event manualy
public function __construct()
{
parent::__construct(array('no_cache'=>1));
$this->load->helper('generator');
$this->load->database();
$this->load->model('users_model');
$this->load->model('email_model');
$this->load->model('event_model');
$this->load->model('crud_model');
}
public function index()
{
echo "ok";
}
public function resend_cred()
{
$isoLang = "fr";
$userId = $_POST['id'];
$userPass = $_POST['pass'];
$role = $_POST['role'];
switch ($role) {
case 'teacher':
$this->event_model->trigger_user('Profile_Creation_Teacher', $isoLang, $userId, $userPass);
break;
case 'parent':
$this->event_model->trigger_user('Profile_Creation_Parent', $isoLang, $userId, $userPass);
break;
case 'student':
$this->event_model->trigger_user('Profile_Creation_Student', $isoLang, $userId, $userPass);
break;
}
echo 1;
}
public function notify_invited()
{
$userId = $_POST['id'];
$this->event_model->trigger_user('Profile_Invited_Pending', 'fr', $userId);
$this->db->set('notified', '1');
$this->db->where('user_id', $userId);
$this->db->update('user');
$this->db->insert('notification_history', array(
'User_ID' => $userId,
'Notification_Trigger' => 'Profile_Invited_Pending'
));
echo "done with :".$userId;
}
public function notify_aborted_cart()
{
$userId = $_POST['id'];
$this->event_model->trigger_user('Shop_Aborted_Cart', 'fr', $userId);
/* $this->db->set('notified','1');
$this->db->where('user_id',$userId);
$this->db->update('user');*/
$this->db->insert('notification_history', array(
'User_ID' => $userId,
'Notification_Trigger' => 'Shop_Aborted_Cart'
));
echo "done with :".$userId;
}
public function notify_teacher_unassign()
{
$userId = $_POST['id'];
$this->event_model->trigger_user('Course_Teacher_Unassignation', 'fr', $userId);
}
public function notify_teacher_student_assignation()
{
$course = $_POST['course'];
$teachers = $this->crud_model->get_course_futur_teacher($course);
var_dump($teachers);
foreach($teachers as $key => $teacher) {
$data = array(
'teacher' =>$teacher[0],
'course' =>$course,
'student' => $this->crud_model->get_name($_POST['user'])
);
//var_dump($data);
var_dump($this->event_model->trigger_assignation('Course_Student_Assignation_To_Teacher', 'fr', $teacher[0], $data));
}
//var_dump($this->event_model->trigger_assignation('Course_Student_Unassignation_To_Teacher','fr',$teacher,$data));
}
public function notify_teacher_student_unassignation()
{
// LESSON : Single Trigger
//unique lesson + one student
$teachers = $this->crud_model->get_lesson_teacher($_POST['lesson']);
//var_dump($_POST);
foreach($teachers as $key => $teacher) {
echo ">>$teacher";
$data = array(
'teacher' =>$teacher,
'course' =>$_POST['course'],
'student' => $this->crud_model->get_name($_POST['student'])
);
//var_dump($data);
var_dump($this->event_model->trigger_assignation('Course_Student_Unassignation_To_Teacher', 'fr', $teacher, $data));
}
//var_dump($this->event_model->trigger_assignation('Course_Student_Unassignation_To_Teacher','fr',$teacher,$data));
}
public function notify_teacher_students_unassignation()
{
// LESSON : Multiple Trigger
//unique lesson + multiple students
$course = $_POST['course'];
$teachers = $this->crud_model->get_course_futur_teacher($course);
//var_dump($_POST);
foreach($teachers as $key => $teacher) {
echo ">>$teacher";
$data = array(
'teacher' =>$teacher[0],
'course' =>$course,
'student' => 'every students'
);
//var_dump($data);
var_dump($this->event_model->trigger_assignation('Course_Student_Unassignation_To_Teacher', 'fr', $teacher[0], $data));
}
//var_dump($this->event_model->trigger_assignation('Course_Student_Unassignation_To_Teacher','fr',$teacher,$data));
}
public function notify_teacher_student_unassignation_global()
{
// Student : Multiple Trigger
//unique student + multiple teacher
$course = $_POST['course'];
$teachers = $this->crud_model->get_course_futur_teacher($course);
//var_dump($teachers);
foreach($teachers as $key => $teacher) {
$data = array(
'teacher' =>$teacher[0],
'course' =>$course,
'student' => $this->crud_model->get_name($_POST['user'])
);
echo "trigger('Course_Student_Unassignation_To_Teacher','fr',$teacher[0],$data)";
//var_dump($data);
var_dump($this->event_model->trigger_assignation('Course_Student_Unassignation_To_Teacher', 'fr', $teacher[0], $data));
}
}
public function notify_teacher_student_unassignation_total()
{
//get every student's course
$s = $_POST['user'];
$cs = $this->crud_model->get_student_courses($s); // course list
$notified = []; // prevent
foreach ($cs as $key => $c) {
$ts = $this->crud_model->get_course_futur_teacher($c);
foreach($ts as $key => $t) {
$data = array(
'teacher' =>$t[0],
'course' =>$c,
'student' => $this->crud_model->get_name($s)
);
if(1) {//!inArray($t[0],$notified)){
echo "trigger('Course_Student_Unassignation_To_Teacher','fr',$t[0],$data)";
var_dump($data);
array_push($notified, $t[0]);
}
}
}
/*
$course = $_POST['course'];
$teachers = $this->crud_model->get_course_futur_teacher($course);
//var_dump($teachers);
foreach($teachers as $key => $teacher) {
$data = array(
'teacher' =>$teacher[0],
'course' =>$course,
'student' => $this->crud_model->get_name($_POST['user'])
);
echo "trigger('Course_Student_Unassignation_To_Teacher','fr',$teacher[0],$data)";
var_dump($data);
//var_dump($this->event_model->trigger_assignation('Course_Student_Unassignation_To_Teacher','fr',$teacher[0],$data));
}
*/
}
}