public function update($id, $request)
 {
     $param = $request->getParameters();
     switch ($id) {
         case 'edit_users':
             $ticket_levels = TicketLevels::find('all');
             $team = User::getTeam();
             foreach ($team as $user) {
                 foreach ($ticket_levels as $tkt_lvls) {
                     $hasLevel = isset($param[$tkt_lvls->id . '_' . $user->id]);
                     UserTicketsCapability::setLevel($user->id, $tkt_lvls->id, $hasLevel);
                 }
             }
             $r = $this->edit_users();
             $r->addMessage(ViewMessage::success('Modifications enregistrées'));
             return $r;
             break;
         case 'edit_levels':
             $id = $param['id'];
             $lvl = TicketLevels::find($id);
             $lvl->label = $param['label'];
             $lvl->save();
             $r = $this->edit_levels();
             $r->addMessage(ViewMessage::success('Modifications enregistrées'));
             return $r;
             break;
     }
 }
 public function index($request)
 {
     $data['team'] = User::getTeam();
     $data['notif_page'] = true;
     $data['notifs'] = StaffNotification::getInternStaffNotifications(100);
     $data['is_notif_enabled'] = StaffNotification::isEnabled(Session::get());
     $data['push_mail'] = Session::get()->details->push_bullet_email;
     return new ViewResponse('admin/notifications/index', $data);
 }
Example #3
0
 public function get($id, $request)
 {
     if (file_exists(ROOT . 'app/views/pages/' . $id . '.php')) {
         $data = [];
         $data['team'] = User::getTeam();
         return new ViewResponse('pages/' . $id, $data);
     } else {
         return Utils::getNotFoundResponse();
     }
 }
Example #4
0
 public function index($request)
 {
     $data['storage_server'] = ['local_server', 'stor1'];
     $data['tickets'] = Ticket::getSize(Session::get());
     $data['all_tickets'] = Ticket::getSize();
     $data['news'] = News::getLastNews();
     $data['notifs'] = StaffNotification::getInternStaffNotifications();
     $data['team'] = User::getTeam();
     $data['is_notif_enabled'] = StaffNotification::isEnabled(Session::get());
     return new ViewResponse('admin/dashboard/index', $data);
 }
Example #5
0
 public static function createNotif($type, $id_one = null, $id_two = null, $value = null, $level = '', $viewers = 'team_or_more', $force_push = false)
 {
     $staff_notif = StaffNotification::create(['type' => $type, 'id_one' => $id_one, 'id_two' => $id_two, 'value' => $value, 'viewers' => $viewers, 'level' => $level, 'timestamp' => Utils::tps()]);
     $emails = [];
     $title = 'DreamVids';
     $sub_title = '';
     $is_link = !is_null($staff_notif->getLink());
     $link_url = "http://" . @$_SERVER['HTTP_HOST'] . WEBROOT . $staff_notif->getLink();
     foreach (User::getTeam() as $user) {
         $content = $staff_notif->getContent();
         if (Utils::getRankArray($user)[$viewers] && (self::isEnabled($user) || $force_push)) {
             if (!is_null($user->details->push_bullet_email) && $user->details->push_bullet_email != '') {
                 switch ($type) {
                     case 'ticket_level_change':
                         $ticket = $staff_notif->getAssociatedValue('Ticket');
                         $sub_title = 'Tickets';
                         if (in_array($ticket->ticket_levels_id, $user->getAssignedLevelsIds()) || $user->isAdmin()) {
                             $emails[] = $user->details->push_bullet_email;
                         }
                         break;
                     case 'ticket':
                         $sub_title = 'Tickets';
                         $emails[] = $user->details->push_bullet_email;
                         break;
                     case 'news':
                         $sub_title = 'News';
                         $emails[] = $user->details->push_bullet_email;
                         break;
                     case 'private':
                         $sub_title = "Message privé";
                         $content = $staff_notif->value;
                         if ($staff_notif->id_two == $user->id) {
                             $emails[] = $user->details->push_bullet_email;
                         }
                         break;
                     case 'private':
                         $sub_title = "Message";
                         $content = $staff_notif->value;
                         $emails[] = $user->details->push_bullet_email;
                         break;
                     default:
                         $emails[] = $user->details->push_bullet_email;
                         break;
                 }
             }
         }
     }
     $notif = new PushBulletNotification($title . ($sub_title != '' ? ' - ' . $sub_title : ''), $content, $emails, $is_link, $link_url);
     $notif->send();
 }
 public function index($request)
 {
     $data = [];
     $data['infos'] = User::getTeam(true);
     return new ViewResponse('admin/staffContactDetails/index', $data);
 }