@EXT\Route(
"/chart/eleve/{eleve}",
name="laurentBulletinShowEleveDataChart",
options = {"expose"=true}
)

@param User $eleve

@return Response
483630
public function showDataChartAction(Request $request, User $eleve)
    {
        $this->checkOpenPrintPdf($request);
        $json = $this->totauxManager->getDataChart($eleve, true);
        $jsonNoCeb = $this->totauxManager->getDataChart($eleve, false);

        return $this->render(
            'LaurentBulletinBundle::BulletinShowDataChart.html.twig',
            array('json' => $json, 'jsonNoCeb' => $jsonNoCeb, 'eleve' => $eleve)
        );
    }
214386
public function addScheduleMenuItem(UserMenuCollectionEvent $event): void
    {
        // Get the menu from the event.
        $menu = $event->getMenu();

        // Create a separator first.
        $separator = $this->factory->createItem('schedule_separator', [
            'extras' => [
                'separator' => true,
                'translation_domain' => false,
            ],
        ]);
        $menu->addChild($separator);

        // Add link to user's calendar.
        $schedule = $this->factory->createItem('menu_item.my_schedule', [
            'route' => 'bkstg_calendar_personal',
            'extras' => [
                'icon' => 'calendar',
                'translation_domain' => BkstgScheduleBundle::TRANSLATION_DOMAIN,
            ],
        ]);
        $menu->addChild($schedule);
    }
698865
public function bulletinWidgetAction(User $user)
    {

        $totauxMatieres = $this->totauxManager->getTotalPeriodesMatiere($user);
        $periodes = $this->periodeRepo->findAll();

        $matCeb = array("Français", "Math", "Néerlandais", "Histoire", "Géographie", "Sciences");
        $cebWithPoints = array();
        $nocebWithPoints = array();

        foreach ($totauxMatieres as $matiereId => $datas) {
            $matiereName = $datas['name'];

            if (in_array($matiereName, $matCeb)) {
                $cebWithPoints[$matiereId] = $datas;
            } else {
                $nocebWithPoints[$matiereId] = $datas;
            }
        }
        $params = array(
            'user' => $user,
            'totauxMatieresCeb' => $cebWithPoints,
            'totauxMatieresNoCeb' => $nocebWithPoints,
            'periodes' => $periodes
        );

        return $this->render('LaurentBulletinBundle::BulletinWidget.html.twig', $params);
    }
1166865
public function getChartAction(ServerRequestInterface $request, Tree $tree, UserInterface $user): ResponseInterface
    {
        Auth::checkComponentAccess($this, 'chart', $tree, $user);

        $ajax      = (bool) $request->get('ajax');
        $xrefs     = (array) $request->get('xrefs', []);
        $addxref   = $request->get('addxref', '');
        $addfam    = (bool) $request->get('addfam', false);
        $placename = $request->get('placename', '');
        $start     = $request->get('start', '');
        $end       = $request->get('end', '');

        $place      = new Place($placename, $tree);
        $start_date = new Date($start);
        $end_date   = new Date($end);

        $xrefs = array_unique($xrefs);

        // Add an individual, and family members
        $individual = Individual::getInstance($addxref, $tree);
        if ($individual !== null) {
            $xrefs[] = $addxref;
            if ($addfam) {
                $xrefs = array_merge($xrefs, $this->closeFamily($individual));
            }
        }

        // Select by date and/or place.
        if ($start_date->isOK() && $end_date->isOK() && $placename !== '') {
            $date_xrefs  = $this->findIndividualsByDate($start_date, $end_date, $tree);
            $place_xrefs = $this->findIndividualsByPlace($place, $tree);
            $xrefs       = array_intersect($date_xrefs, $place_xrefs);
        } elseif ($start_date->isOK() && $end_date->isOK()) {
            $xrefs = $this->findIndividualsByDate($start_date, $end_date, $tree);
        } elseif ($placename !== '') {
            $xrefs = $this->findIndividualsByPlace($place, $tree);
        }

        // Filter duplicates and private individuals.
        $xrefs = array_unique($xrefs);
        $xrefs = array_filter($xrefs, static function (string $xref) use ($tree): bool {
            $individual = Individual::getInstance($xref, $tree);

            return $individual !== null && $individual->canShow();
        });

        if ($ajax) {
            $subtitle = $this->subtitle(count($xrefs), $start_date, $end_date, $placename);

            return $this->chart($tree, $xrefs, $subtitle);
        }

        $ajax_url = route('module', [
            'ajax'   => true,
            'module' => $this->name(),
            'action' => 'Chart',
            'ged'    => $tree->name(),
            'xrefs'  => $xrefs,
        ]);

        $reset_url = route('module', [
            'module' => $this->name(),
            'action' => 'Chart',
            'ged'    => $tree->name(),
        ]);

        return $this->viewResponse('modules/lifespans-chart/page', [
            'ajax_url'    => $ajax_url,
            'module_name' => $this->name(),
            'reset_url'   => $reset_url,
            'title'       => $this->title(),
            'xrefs'       => $xrefs,
        ]);
    }
12318
private function mapUserToVersion(User $user, Request $request)
    {
        $content = $this->repository->getContentService()->loadContent($user->id);
        $request->headers->set('Url', $request->getPathInfo());

        return new Version(
            $content,
            $this->repository->getContentTypeService()->loadContentType($content->contentInfo->contentTypeId),
            $this->repository->getContentService()->loadRelations($content->getVersionInfo()),
            $request->getPathInfo()
        );
    }
379796
public function checkCurrentUser(GetResponseUserEvent $event)
    {
        $currentUser = $this->tokenStorage->getToken()->getUser();

        if ($currentUser instanceof UserInterface) {
            $resetUser = $event->getUser();

            if ($currentUser->getId() !== $resetUser->getId()) {
                $this->setRedirecToLogin($event);
            }
        }
    }
737047
public function renderToolUserModalNewRightsAction()
    {
        $melisKey = $this->params()->fromRoute('melisKey', '');


        $view = new ViewModel();
        $view->melisKey = $melisKey;

        return $view;
    }
558488
public function renderToolUserContentActionDeleteAction()
    {
        $melisKey = $this->params()->fromRoute('melisKey', '');

        $view = new ViewModel();
        $view->melisKey = $melisKey;

        return $view;
    }
394408
public function globalFeed($filter = array(), $orderBy = 'ID DESC', $since = null, $number = 10, $markViewed = true) {
		$number = (int) $number;
		
		if (!count($filter)) {
			$filter = array('ParentID' => 0);
		}
		$filter['Deleted'] = 0;

		$items = MicroPost::get()->filter($filter)->sort($orderBy);
		
		if ($since) {
			$since = (int) $since;
			$items = $items->filter('ID:GreaterThan', $since);
		}

		if ($markViewed) {
			$this->recordUserAction();
		}
		$items = $this->updatePostList($items);
		return $items->limit($number)->restrict();
	}
1170021
public function userPanelAction()
    {
        if (!$this->getDispatcher()->hasListeners(ThemeEvents::THEME_SIDEBAR_USER)) {
            return new Response();
        }
        $userEvent = $this->getDispatcher()->dispatch(ThemeEvents::THEME_SIDEBAR_USER, new ShowUserEvent());

        return $this->render(
                    'AvanzuAdminThemeBundle:Sidebar:user-panel.html.twig',
                        [
                            'user' => $userEvent->getUser(),
                        ]
        );
    }
35692
public function view($user, Event $event)
    {
        if ($event->creator->id == $user->id) {
            return true;
        }

        return User::findOrFail($user->id)->hasPermission('laralum::events.view');
    }
1314508
public function PrintPdfEleveAction(Periode $periode, User $user)
    {
        $this->checkOpen();

        $classe = $this->classeRepo->findUserClasse($user);
        $filename = $user->getLastName() . $user->getFirstName(). '-'. date("Y-m-d-H-i-s") . '.pdf';
        $dir = $this->pdfDir . $classe->getName() . '/' . $filename;

        $eleveUrl = $this->generateUrl('laurentBulletinPrintEleve', array('periode' => $periode->getId(), 'eleve' => $user->getId()), true);


        $this->get('knp_snappy.pdf')->generate($eleveUrl, $dir);

        $headers = array(
            'Content-Type'          => 'application/pdf',
            'Content-Disposition'   => 'attachment; filename="'.$filename.'"'
        );

        return new Response(file_get_contents($dir), 200, $headers);

    }
1362811
public function afterUserLogin(UserEvent $event)
    {
        $settings = DefaultDashboard::$plugin->getSettings();

        // For the moment, only check on CP requests
        if (!Craft::$app->getRequest()->isCpRequest) {
            DefaultDashboard::log("Not a CP request");
            return;
        }

        $currentUser = $event->identity;
        $defaultUser = Craft::$app->users->getUserById($settings->userDashboard);

        if (!$defaultUser) {
            DefaultDashboard::error("Default User not found for ID: $settings->userDashboard");
            return;
        }

        // Proceed if we've got a setting for the default user, and its not that user logging in
        if ($currentUser->id == $defaultUser->id) {
            DefaultDashboard::log("Skip setting dashboard - this is the default user");
            return;
        }

        $currentUserWidgets = $this->_getUserWidgets($currentUser->id);
        $defaultUserWidgets = $this->_getUserWidgets($defaultUser->id);

        DefaultDashboard::log("Current User ID: " . $currentUser->id);
        DefaultDashboard::log("Default User ID: " . $defaultUser->id);
        DefaultDashboard::log("Current User Widget: " . json_encode($this->_widgets($currentUserWidgets)));
        DefaultDashboard::log("Default User Widget: " . json_encode($this->_widgets($defaultUserWidgets)));

        // If this user has no widgets, create them and finish - or, if we're forcing override
        if (!$currentUserWidgets || $settings->override) {
            // To prevent massive re-creating of widgets each login, check if default vs current is different
            if ($this->_compareWidgets($currentUserWidgets, $defaultUserWidgets)) {
                DefaultDashboard::log("Users widgets are the same");
                return;
            }

            // Remove any existing widgets for the user
            $this->_deleteUserWidgets($currentUser->id);

            // Update the logged in users widgets
            $this->_setUserWidgets($currentUser, $defaultUserWidgets);

            // Update the user with their dashboard-set flag so the default widgets aren't added
            Craft::$app->getDb()->createCommand()
                ->update('{{%users}}', ['hasDashboard' => true], ['id' => $currentUser->id])
                ->execute();
        }
    }
1117610
public function update(ServerRequestInterface $request, UserInterface $user): ResponseInterface
    {
        $user_id        = (int) $request->getParsedBody()['user_id'];
        $username       = $request->getParsedBody()['username'];
        $real_name      = $request->getParsedBody()['real_name'];
        $email          = $request->getParsedBody()['email'];
        $password       = $request->getParsedBody()['password'];
        $theme          = $request->getParsedBody()['theme'];
        $language       = $request->getParsedBody()['language'];
        $timezone       = $request->getParsedBody()['timezone'];
        $contact_method = $request->getParsedBody()['contact_method'];
        $comment        = $request->getParsedBody()['comment'];
        $auto_accept    = (bool) ($request->getParsedBody()['auto_accept'] ?? false);
        $canadmin       = (bool) ($request->getParsedBody()['canadmin'] ?? false);
        $visible_online = (bool) ($request->getParsedBody()['visible_online'] ?? false);
        $verified       = (bool) ($request->getParsedBody()['verified'] ?? false);
        $approved       = (bool) ($request->getParsedBody()['approved'] ?? false);

        $edit_user = $this->user_service->find($user_id);

        if ($edit_user === null) {
            throw new NotFoundHttpException(I18N::translate('%1$s does not exist', 'user_id:' . $user_id));
        }

        // We have just approved a user.  Tell them
        if ($edit_user->getPreference('verified_by_admin') !== '1' && $approved) {
            I18N::init($edit_user->getPreference('language'));

            Mail::send(
                Auth::user(),
                $edit_user,
                Auth::user(),
                /* I18N: %s is a server name/URL */
                I18N::translate('New user at %s', WT_BASE_URL),
                view('emails/approve-user-text', ['user' => $edit_user, 'site_url' => WT_BASE_URL]),
                view('emails/approve-user-html', ['user' => $edit_user, 'site_url' => WT_BASE_URL])
            );
        }

        $edit_user
            ->setRealName($real_name)
            ->setPreference('theme', $theme)
            ->setPreference('language', $language)
            ->setPreference('TIMEZONE', $timezone)
            ->setPreference('contactmethod', $contact_method)
            ->setPreference('comment', $comment)
            ->setPreference('auto_accept', (string) $auto_accept)
            ->setPreference('visibleonline', (string) $visible_online)
            ->setPreference('verified', (string) $verified)
            ->setPreference('verified_by_admin', (string) $approved);

        if ($password !== '') {
            $edit_user->setPassword($password);
        }

        // We cannot change our own admin status. Another admin will need to do it.
        if ($edit_user->id() !== $user->id()) {
            $edit_user->setPreference('canadmin', $canadmin ? '1' : '0');
        }

        foreach (Tree::getAll() as $tree) {
            $path_length = (int) $request->getParsedBody()['RELATIONSHIP_PATH_LENGTH' . $tree->id()];
            $gedcom_id   = $request->getParsedBody()['gedcomid' . $tree->id()];
            $can_edit    = $request->getParsedBody()['canedit' . $tree->id()];

            // Do not allow a path length to be set if the individual ID is not
            if ($gedcom_id === '') {
                $path_length = 0;
            }

            $tree->setUserPreference($edit_user, 'gedcomid', $gedcom_id);
            $tree->setUserPreference($edit_user, 'canedit', $can_edit);
            $tree->setUserPreference($edit_user, 'RELATIONSHIP_PATH_LENGTH', (string) $path_length);
        }

        if ($edit_user->email() !== $email && $this->user_service->findByEmail($email) instanceof User) {
            FlashMessages::addMessage(I18N::translate('Duplicate email address. A user with that email already exists.') . $email, 'danger');

            return redirect(route('admin-users-edit', ['user_id' => $edit_user->id()]));
        }

        if ($edit_user->userName() !== $username && $this->user_service->findByUserName($username) instanceof User) {
            FlashMessages::addMessage(I18N::translate('Duplicate username. A user with that username already exists. Please choose another username.'), 'danger');

            return redirect(route('admin-users-edit', ['user_id' => $edit_user->id()]));
        }

        $edit_user
            ->setEmail($email)
            ->setUserName($username);

        return redirect(route('admin-users'));
    }
230934
public function formAction(Request $request, $userId)
    {
        $user = $this->get('open_orchestra_user.repository.user')->find($userId);

        if ($user instanceof UserInterface) {
            $this->denyAccessUnlessGranted(ContributionActionInterface::EDIT, $user);
            $user = $this->refreshLanguagesByAliases($user);

            return $this->renderForm($request, $user, false);
        }

        throw new UserNotFoundHttpException();
    }
350169
public function printEleveAction(Request $request, Periode $periode, User $eleve)
    {
        $this->checkOpenPrintPdf($request);

        if ($periode->getTemplate() === 'FinalExamPrint') {

            return $this->printFinalExam($periode, $eleve);
        }
        $totaux = [];
        $totauxMatieres = [];
        $recap = 0;

        if (!$periode->getOnlyPoint()){
            $pemps = $this->pempRepo->findPeriodeEleveMatiere($eleve, $periode);
            $pemds = $this->pemdRepo->findPeriodeElevePointDivers($eleve, $periode);

        } else {
            $pemps = array();
            $pemds = array();

            $periodes = array(1, 2, 3);

            foreach ($periodes as $per){
                $periode = $this->periodeRepo->findOneById($per);
                $pemps[] = $this->pempRepo->findPeriodeEleveMatiere($eleve, $periode);
                $pemds[] = $this->pemdRepo->findPeriodeElevePointDivers($eleve, $periode);

                $totaux[] = $this->totauxManager->getTotalPeriode($periode, $eleve);

            }
            $totauxMatieres = $this->totauxManager->getTotalPeriodes($eleve);
        }

        $template = 'LaurentBulletinBundle::Templates/'.$periode->getTemplate().'.html.twig';


        foreach ($totaux as $total) {
            $recap += $total['totalPourcentage'] / 3;
        }

        $recap = round($recap, 1);

        $params = array('pemps' => $pemps, 'pemds' => $pemds, 'eleve' => $eleve, 'periode' => $periode, 'totaux' => $totaux, 'totauxMatieres' => $totauxMatieres, 'recap' => $recap);

        return $this->render($template, $params);
    }
446278
public function show($id)
    {
        try
        {
            $throttle = $this->users->getUserThrottle($id);
            $user = $throttle->getUser();
            $permissions = $user->getMergedPermissions();

            return View::make(Config::get('cpanel::views.users_show'))
                ->with('user',$user)
                ->with('groups',$user->getGroups())
                ->with('permissions',$permissions)
                ->with('throttle',$throttle);
        }
        catch ( UserNotFoundException $e)
        {
            return Redirect::route('cpanel.users.index')
                ->with('error', $e->getMessage());
        }
    }