Диплом: Автоматизация приема заявок на ремонт и модернизацию ПК в ГБПОУ МО "Рошальский техникум"

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам
106
$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)
{
$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');
}
/**
107
* @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()));
}
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;
108
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoder;
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;
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');
109
}
/**
* @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")
*/
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();
}
110
$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');
}
}
<?php
namespace AppBundle\Controller;
use AppBundle\Entity\CrossOver;
use AppBundle\Form\Type\CrossOverAddFormType;
use AppBundle\Form\Type\CrossOverEditFormType;
use AppBundle\Form\Type\CrossOverFilterFormType;
use AppBundle\Form\Type\CrossOverFormType;
use AppBundle\Entity\Role;
use AppBundle\Form\Type\CrossOverShowFormType;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Query;
use Sensio\Bundle\FrameworkExtraBundle\Configuration as Config;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
class CrossOverController extends InitializableController
{
/**
* @return RedirectResponse|Response
* @Config\Route("/crossovers/index/{pagenum}", name = "site_crossover_index",
defaults={ "pagenum": "1"})
*/
public function indexAction($pagenum=1)
{
111
$form=$this->createForm(new CrossOverFilterFormType());
$code = null;
$company=null;
$type=null;
$installTicket=null;
$destructTicket=null;
$stoika=null;
$form->handleRequest($this->request);
$crossoverquery =
$this->getRepository('CrossOver')->createQueryBuilder('co')
->leftJoin('co.unitA','ua')
->leftJoin('ua.equipment', 'ea')
->leftJoin('co.unitB','ub')
->leftJoin('ub.equipment', 'eb')
->orderBy('co.id');
$crossovercountquery =
$this->getRepository('CrossOver')->createQueryBuilder('co')
->select('COUNT(DISTINCT co.id)')
->leftJoin('co.unitA','ua')
->leftJoin('ua.equipment', 'ea')
->leftJoin('co.unitB','ub')
->leftJoin('ub.equipment', 'eb');
if ($form->isSubmitted() && $form->isValid()) {
$code = $form->get('code')->getData();
$company = $form->get('company')->getData();
$type = $form->get('type')->getData();
$installTicket = $form->get('installTicket')->getData();
$destructTicket = $form->get('destructTicket')->getData();
$stoika = $form->get('stoika')->getData();
}
if (!empty($code)) {
$crossoverquery->andWhere('co.code = :code ')->setParameter('code',
(substr($code,strpos($code,'-')+1 )));
$crossovercountquery->andWhere('co.code = :code
')->setParameter('code', (substr($code,strpos($code,'-')+1 )));
112
}
if (!empty($company)) {
$crossoverquery->andWhere('ea.company = :company or eb.company
= :company')->setParameter('company',$company);
$crossovercountquery->andWhere('ea.company = :company or
eb.company = :company')->setParameter('company',$company);;
}
if (!empty($type)) {
$crossoverquery->andWhere('LOWER(co.type) LIKE LOWER(:type)
')->setParameter('type', '%' . trim($type) . '%');
$crossovercountquery->andWhere('LOWER(co.type) LIKE
LOWER(:type) ')->setParameter('type', '%' . trim($type) . '%');
}
if (!empty($installTicket)) {
$crossoverquery->andWhere('co.installTicket = :installTicket
')->setParameter('installTicket',$installTicket);
*/
public function addAction()
{
if ($this->request->isXmlHttpRequest()) {
return $this->handleAjaxRequest();
}
$crossover = new CrossOver();
if (!($this->authChecker->isGranted(Role::ADMIN))) {
$crossover->getInstallUsers()->add($this->user);
$form = $this->createForm(new
CrossOverAddFormType(), $crossover);
}
else {
$form = $this->createForm(new CrossOverFormType(),
$crossover);
}
$form->handleRequest($this->request);
if ($form->isSubmitted() && $form->isValid()) {
$valid = true;
113
if ($valid) {
$curdate=new \DateTime();
/** @var ArrayCollection|CrossOver $lastcross
*/
$lastcross=$this->getRepository('CrossOver')->createQueryBuilder('co')
->orderBy('co.id', 'DESC')
->getQuery()->getResult();
if ($lastcross) {
if
($lastcross[0]->getCreatedAt()->format('y')==$curdate->format('y')) {
$code=$lastcross[0]->getCode()+1;
}
else {
$code=1;
}
}
else {
$code=1;
}
$crossover->setCode($code);
$this->manager->persist($crossover);
$this->manager->flush();
$this->addNotice('success',
'crossover.html.twig',
array('notice' => 'added'));
return
$this->redirectToRoute('site_crossover_index');
}
}
$this->view['crossover']=null;
$this->forms['crossover'] = $form->createView();
$this->navigation = array('active' => 'addcrossover');
114
return
$this->render('AppBundle:CrossOvers:crossover.html.twig');
}
$crossovercountquery->andWhere('co.installTicket = :installTicket
')->setParameter('installTicket',$installTicket);
}
if (!empty($destructTicket)) {
$crossoverquery->andWhere('co.destructTicket = :destructTicket
')->setParameter('destructTicket',$destructTicket);
$crossovercountquery->andWhere('co.destructTicket = :destructTicket
')->setParameter('destructTicket',$destructTicket);
}
if (!empty($stoika)) {
$crossoverquery->andWhere('co.standA LIKE :stand OR co.standB
LIKE :stand ')->setParameter('stand', trim($stoika) . '%');
$crossovercountquery->andWhere('co.standA LIKE :stand OR
co.standB LIKE :stand ')->setParameter('stand', trim($stoika) . '%');
}
$count=$crossovercountquery->getQuery()->getSingleScalarResult();
$pages = floor($count / 20) + ($count % 20 > 0 ? 1 : 0);
if ($pages < 1) $pages = 1;
if ($pagenum > $pages) $pagenum = $pages;
$companies = $crossoverquery->setFirstResult(($pagenum - 1) * 20)
->setMaxResults(20)
->getQuery()->getResult();
$this->view['page']=$pagenum;
$this->view['pages']=$pages;
$this->view['crossovers'] = $companies;
$this->view['form'] = $form->createView();
$this->navigation = array('active' => 'crossovers');
return $this->render('AppBundle:CrossOvers:index.html.twig');
}
/**
* @return RedirectResponse|Response
* @Config\Route("/crossovers/add", name = "site_crossover_add")
115
protected function handleAjaxRequest()
{
$action = $this->request->get('action', null);
if (is_null($action)) return new JsonResponse();
if ($action == 'getequipments') {
$company = $this->request->get('company', null);
if (!(is_null($company))) {
$results=$this->getRepository('Equipment')->createQueryBuilder('e')
->select('e.id as id')
->where('e.company = :company')
->setParameters(array('company'=> $company))
->getQuery()->getResult(Query::HYDRATE_ARRAY);
}
else {
$results=new JsonResponse();
}
}
elseif($action == 'getunits') {
$equipment = $this->request->get('equipment', null);
if (!(is_null($equipment))) {
$results=$this->getRepository('Unit')->createQueryBuilder('u')
->select('u.id as id')
->where('u.equipment = :equipment')
->setParameters(array('equipment'=> $equipment))
->getQuery()->getResult(Query::HYDRATE_ARRAY);
}
else {
$results=new JsonResponse();
}
}
else {
$results=new JsonResponse();
}
return new JsonResponse($results);
}

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

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