Диплом: Автоматизация учета рабочего времени сотрудников ООО "Центр Плюс"

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам
97
->where('1=1');
if ($form->isSubmitted() && $form->isValid())
{
$id = $form->get('id')->getData();
$status = $form->get('status')->getData();
$my = $form->get('my')->getData();
}
if (!empty($id)) {
$tickets->andWhere('t.id = :id ')-
>setParameter('id', $id);
}
if (!empty($status)) {
$tickets->andWhere('s.id = :status ')-
>setParameter('status', $status);
}
if (!empty($my)) {
$tickets->andWhere('u.id = :user ')-
>setParameter('user', $this->user->getId());
}
}
else {
$form=$this->createForm(new
TicketFilterFormType());
$id = null;
$status=null;
$form->handleRequest($this->request);
$tickets = $this->getRepository('Ticket')-
>createQueryBuilder('t')
->leftJoin('t.status', 's')
->leftJoin('t.author', 'u')
->where('1=1');
if ($form->isSubmitted() && $form->isValid())
{
$id = $form->get('id')->getData();
$status = $form->get('status')->getData();
}
if (!empty($id)) {
$tickets->andWhere('t.id = :id ')-
>setParameter('id', $id);
}
if (!empty($status)) {
$tickets->andWhere('s.id = :status ')-
>setParameter('status', $status);
}
$tickets->andWhere('u.id = :user ')-
>setParameter('user', $this->user->getId());
}
$tickets=$tickets->getQuery()->getResult();
98
$this->view['tickets'] = $tickets;
$this->view['form'] = $form->createView();
$this->navigation = array('active' => 'tickets');
return $this-
>render('AppBundle:Tickets:index.html.twig');
}
/**
* @return RedirectResponse|Response
* @Config\Route("/tickets/add", name =
"site_tickets_add")
*/
public function addAction()
{
$ticket = new Ticket();
$form = $this->createForm(new TicketFormType(),
$ticket);
$form->handleRequest($this->request);
if ($form->isSubmitted() && $form->isValid()) {
$ticket->setAuthor($this->user);
/* @var TicketStatus $status*/
$status=$this-
>getRepository('TicketStatus')->findOneBy(array('id'=>1));
$ticket->setStatus($status);
$this->manager->persist($ticket);
$this->manager->flush();
$this->addNotice('success',
'tickets.html.twig',
array('notice' => 'added', 'id' =>
$ticket->getId())
);
return $this-
>redirectToRoute('site_tickets_index');
}
$this->forms['ticket'] = $form->createView();
$this->navigation = array('active' => 'tickets');
$this->view['ticket']=null;
return $this-
>render('AppBundle:Tickets:add.html.twig');
}
/**
* @param Ticket $ticket
* @return RedirectResponse|Response
* @Config\Route("/tickets/{ticket}/edit", name =
"site_tickets_edit")
* @Config\ParamConverter("ticket", options =
{"mapping": {"ticket": "id"}})
*/
public function editAction(Ticket $ticket)
99
{
$comment= new Comment();
$form = $this->createForm(new
TicketCommentFormType(), $comment);
$form->handleRequest($this->request);
if ($form->isSubmitted() && $form->isValid()) {
$comment->setTicket($ticket);
$comment->setAuthor($this->user);
if (is_null($ticket->getUser()) && $this->user
!= $ticket->getAuthor()) {
$ticket->setUser($this->user);
$this->manager->persist($ticket);
}
$comment->upload();
$this->manager->persist($comment);
$this->manager->flush();
return $this-
>redirectToRoute('site_tickets_edit',
array('ticket'=>$ticket->getId()));
}
$this->forms['comment'] = $form->createView();
$this->view['ticket'] = $ticket;
$this->navigation = array('active' => 'tickets');
return $this-
>render('AppBundle:Tickets:edit.html.twig');
}
/**
* @param Ticket $ticket
* @param TicketStatus $status
* @return RedirectResponse|Response
* @Config\Route("/tickets/{ticket}/change/{status}",
name = "site_tickets_change")
* @Config\ParamConverter("ticket", options =
{"mapping": {"ticket": "id"}})
* @Config\ParamConverter("status", options =
{"mapping": {"srarus": "id"}})
*/
public function changeAction(Ticket $ticket,
TicketStatus $status)
{
$ticket->setStatus($status);
if ($status->getId()==4) {
$this->addNotice('success',
'tickets.html.twig',
array('notice' => 'closed', 'id' =>
$ticket->getId())
);
100
}
if ($status->getId()==3) {
$this->addNotice('info',
'tickets.html.twig',
array('notice' => 'sendmodified', 'id' =>
$ticket->getId())
);
$ticket->setUser(null);
}
$this->manager->persist($ticket);
$this->manager->flush();
$this->navigation = array('active' => 'tickets');
return $this-
>render('AppBundle:Tickets:index.html.twig');
}
}
<?php
namespace AppBundle\Controller;
use AppBundle\Form\Type\LoginFormType;
use AppBundle\Form\Type\ProfileFormType;
use AppBundle\Controller\InitializableController;
use AppBundle\Entity\Role;
use AppBundle\Entity\User;
use Sensio\Bundle\FrameworkExtraBundle\Configuration as
Config;
use Symfony\Component\Form\FormError;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
use
Symfony\Component\HttpKernel\Exception\NotFoundHttpExcepti
on;
use
Symfony\Component\Security\Core\Encoder\UserPasswordEncode
r;
use Symfony\Component\Security\Core\Security;
class SecurityController extends InitializableController
{
/**
* @return RedirectResponse|Response
* @Config\Route("/login", name =
"site_security_login")
*/
public function loginAction()
{
if ($this->authChecker->isGranted(Role::USER))
return $this->redirectToRoute('homepage');
$error = null;
101
if ($this->request->attributes-
>has(Security::AUTHENTICATION_ERROR))
$error = $this->request->attributes-
>get(Security::AUTHENTICATION_ERROR);
else {
$error = $this->session-
>get(Security::AUTHENTICATION_ERROR, null);
$this->session-
>remove(Security::AUTHENTICATION_ERROR);
}
if (!is_null($error)) {
$this->addNotice('error',
'security_login.html.twig', array('notice' =>
'auth_error'));
}
$form = $this->createForm(new LoginFormType(), new
User());
$this->navigation = array('active' => 'login');
$this->forms = array(
'login' => $form->createView(),
'last_username' => $this->session-
>get(Security::LAST_USERNAME, null)
);
return $this-
>render('AppBundle:Security:login.html.twig');
}
/**
* @throws NotFoundHttpException
* @Config\Route("/login-check", name =
"site_security_login_check")
*/
public function loginCheckAction()
{
throw $this->createNotFoundException();
}
/**
* @throws NotFoundHttpException
* @Config\Route("/logout", name =
"site_security_logout")
*/
public function logoutAction()
{
throw $this->createNotFoundException();
}
/**
* @return RedirectResponse|Response
* @Config\Route("/profile", name =
"site_security_profile")
102
*/
public function profileAction()
{
$form = $this->createForm(new ProfileFormType(),
$this->user);
$form->handleRequest($this->request);
if ($form->isSubmitted() && $form->isValid()) {
if (!is_null($form->get('password')-
>getData())) {
/** @var UserPasswordEncoder $encoder */
$encoder = $this-
>get('security.password_encoder');
$this->user->setSalt(User::generateSalt())
->setPassword($encoder-
>encodePassword($this->user, $this->user->getPassword()));
$this->manager->persist($this->user);
$this->manager->flush();
}
$this->addNotice('success',
'security_profile.html.twig',
array('notice' => 'user_changed')
);
return $this->redirectToRoute('homepage');
}
$this->forms['profile'] = $form->createView();
$this->navigation = array('active' => 'homepage');
return $this-
>render('AppBundle:Security:profile.html.twig');
}
}

Смотрите также:

"Автоматизация обработки заявок ООО "Проектно-Строительная Компания"
"Автоматизация процесса аттестации персонала для ООО "Нэт Бай Нэт Холдинг"
"Анализ интернет-активности конкурентов ( на примере конкурентов "Газпром нефть")
"Бухгалтерский учёт и аудит расчётов с подотчётними лицами в организации на примере ООО "ЛОЦ 10""
«Психологическое сопровождение персонала в организации на примере ООО «Крокус»
Cовершенствование деловой оценки персонала в организации (на примере ООО "Даймонд кейтеринг развитие")
IPO - инструмент финансирования деятельности организации. На примере ПАО «Нефтяная компания «Лукойл»
PR как средство продвижения организации (на примере ПАО "Тамбовский завод "Комсомолец им. Н.С. Артемова")
PR-коммуникации в сфере общественного питания (на примере кафе-кондитерской «Cream Cheese»)
SMM как средство повышения эффективности работы учреждений социокультурной сферы (на примере Малого театра)