コード例 #1
0
ファイル: ScreenDAO.php プロジェクト: mat33470/PFA
 public function buildDomainObject($row)
 {
     $screen = new Screen();
     $screen->setId($row['screen_id']);
     $screen->setKey($row['screen_key']);
     $screen->setName($row['screen_name']);
     if (array_key_exists('screen_group_id', $row) && !is_null($row['screen_group_id'])) {
         $groupId = $row['screen_group_id'];
         $group = $this->groupDAO->find($groupId);
         $screen->setGroup($group);
     }
     return $screen;
 }
コード例 #2
0
ファイル: routes.php プロジェクト: mat33470/PFA
    }
    return $app['twig']->render('user_form.html.twig', array('level' => 2, 'title' => 'Modifier mon profil', 'userForm' => $userForm->createView()));
})->bind('myprofile');
// Remove a user
$app->match('/manage_users/{id}/delete', function ($id, Request $request) use($app) {
    $app['dao.user']->delete($id);
    $app['session']->getFlashBag()->add('success', 'The user was succesfully removed.');
    // Redirect to admin home page
    return $app->redirect($app['url_generator']->generate('manage_users'));
})->bind('manage_users_delete');
//Add a screen and display slides
$app->match('/client', function (Request $request) use($app) {
    $screen = $app['dao.screen']->findByKey($request->server->get('REMOTE_ADDR'));
    if (is_null($screen)) {
        $screen = new Screen();
        $screen->setKey($request->server->get('REMOTE_ADDR'));
        $screenForm = $app['form.factory']->create(new ScreenType(), $screen, array('groups' => $app['dao.screen_group']->findAll()));
        $screenForm->handleRequest($request);
        if ($screenForm->isSubmitted() && $screenForm->isValid()) {
            $app['dao.screen']->save($screen);
            return $app->redirect($request->getRequestUri());
        }
        $screenFormView = $screenForm->createView();
        return $app['twig']->render('client/new_client_form.html.twig', array('screenForm' => $screenFormView));
    } else {
        $slides = $app['dao.slide']->findByScreen($screen->getId());
        foreach ($slides as &$slide) {
            $slide->formatContent();
        }
        return $app['twig']->render('client/display_screen_slides.html.twig', array('slides' => $slides));
    }