mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-21 10:49:10 -04:00
ALPHA 3.0.3
This commit is contained in:
@@ -445,8 +445,15 @@ class CalendarController extends Controller
|
||||
$schedule->save();
|
||||
|
||||
/** Logs and Notification */
|
||||
Log::saveLog("Ajout de l'activité, ".$schedule->event_name." à l'horaire le ".$schedule->event_date);
|
||||
Log::saveLog("Ajout de l'activité, ".$schedule->event_name." à l'horaire le ".$schedule->date);
|
||||
|
||||
$userToNotify = $schedule->getUserToNotify();
|
||||
\Notification::send($userToNotify, new Alert(\Auth::User()->id,"Ajout de l'activité, ".$schedule->event_name." à l'horaire le ".$schedule->date,"/admin/calendar"));
|
||||
|
||||
if(\App\Config::where('name','is_schedule_build')->first()->state == 1)
|
||||
{
|
||||
\Notification::send($userToNotify, new mail(\Auth::User(),"Ajout d'une activité a l'horaire",\Auth::User()->fullname()." à ajouté l'activité, ".$schedule->event_name." à l'horaire le ".$schedule->date));
|
||||
}
|
||||
return redirect('/admin/calendar');
|
||||
|
||||
}
|
||||
@@ -527,5 +534,4 @@ class CalendarController extends Controller
|
||||
|
||||
$schedule->delete();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -165,4 +165,12 @@ class UserController extends Controller
|
||||
|
||||
$user->delete();
|
||||
}
|
||||
|
||||
public function notificationmark($id)
|
||||
{
|
||||
$notification = \Auth::User()->unreadNotifications->where('id',$id)->first();
|
||||
|
||||
$notification->delete();
|
||||
return redirect(request('url'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,10 +19,11 @@ class Alert extends Notification
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($user,$msg)
|
||||
public function __construct($user,$msg,$url)
|
||||
{
|
||||
$this->myNotification = $msg;
|
||||
$this->fromUser = $user;
|
||||
$this->myUrl = $url;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,6 +48,7 @@ class Alert extends Notification
|
||||
return [
|
||||
'from' => $this->fromUser,
|
||||
'msg' => $this->myNotification,
|
||||
'url' => $this->myUrl,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,4 +54,24 @@ class Schedule extends Model
|
||||
|
||||
return $dispo_item;
|
||||
}
|
||||
|
||||
public function getUserToNotify($priority = 0)
|
||||
{
|
||||
$users = \App\User::all();
|
||||
|
||||
if($priority == 0)
|
||||
{
|
||||
$userToNotify = collect();
|
||||
foreach ($users as $user) {
|
||||
if ($user->getPerm('schedule_notify')) {
|
||||
$userToNotify->push($user);
|
||||
}
|
||||
}
|
||||
|
||||
return $userToNotify;
|
||||
} else if ($priority == 1)
|
||||
{
|
||||
return $users;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,13 +65,13 @@ class User extends Authenticatable
|
||||
$user_perm_value = $this->$perm;
|
||||
|
||||
if ($user_perm_value == 1 ) {
|
||||
$perm_value = 1;
|
||||
$perm_value = true;
|
||||
} else if ($job_perm_value== 1) {
|
||||
$perm_value = 1;
|
||||
$perm_value = true;
|
||||
} else if ($rank_perm_value == 1) {
|
||||
$perm_value = 1;
|
||||
$perm_value = true;
|
||||
} else {
|
||||
$perm_value = 0;
|
||||
$perm_value = false;
|
||||
}
|
||||
|
||||
return $perm_value;
|
||||
|
||||
Reference in New Issue
Block a user