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

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам
116
/**
* @param CrossOver $crossover
* @return RedirectResponse|Response
* @Config\Route("/crossovers/{crossover}/edit", name = "site_crossover_edit")
* @Config\ParamConverter("crossover", options = {"mapping": {"crossover":
"id"}})
*/
public function editAction(CrossOver $crossover)
{
if (!($this->authChecker->isGranted(Role::ADMIN))) {
if ($crossover->getDestructDate()) {
$form = $this->createForm(new CrossOverShowFormType(),
$crossover);
}
else {
$crossover->getDestructUsers()->add($this->user);
$form = $this->createForm(new CrossOverEditFormType(),
$crossover);
}
}
else {
$form = $this->createForm(new CrossOverFormType(), $crossover);
}
$form->handleRequest($this->request);
if ($form->isSubmitted() && $form->isValid()) {
$valid = true;
if ($valid) {
$this->manager->persist($crossover);
$this->manager->flush();
$this->addNotice('success','crossover.html.twig',
array('notice' => 'changed', 'code' => $crossover->getCode()));
return $this->redirectToRoute('site_crossover_index');
}
}
$this->forms['crossover'] = $form->createView();
117
$this->view['crossover'] = $crossover;
$this->navigation = array('active' => 'crossvers');
return $this->render('AppBundle:CrossOvers:crossover.html.twig');
}
/**
* @param CrossOver $crossover
* @return Response
* @Config\Route("/crossovers/{crossover}/remove", name =
"site_crossover_remove")
* @Config\ParamConverter("crossover", options = {"mapping": {"crossover":
"id"}})
*/
public function removeAction(CrossOver $crossover)
{
$this->manager->remove($crossover);
$this->manager->flush();
$this->addNotice('error','crossover.html.twig',
array('notice' => 'removed', 'code' => $crossover->getCode()));
return $this->redirectToRoute('site_crossover_index');
}
}
<?php
namespace AppBundle\Controller;
use AppBundle\Entity\Equipment;
use AppBundle\Form\Type\EquipmentFilterFormType;
use AppBundle\Form\Type\EquipmentFormType;
use AppBundle\Entity\Role;
use Doctrine\ORM\Query;
use Sensio\Bundle\FrameworkExtraBundle\Configuration as Config;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
class EquipmentController extends InitializableController
{
/**
* @return RedirectResponse|Response
118
* @Config\Route("/equipment/index/{pagenum}", name = "site_equipment_index",
defaults={ "pagenum": "1"})
*/
public function indexAction($pagenum=1)
{
if (!($this->authChecker->isGranted(Role::ADMIN))) {
return $this->redirectToRoute('homepage');
}
else {
$form=$this->createForm(new EquipmentFilterFormType());
$caption = null;
$form->handleRequest($this->request);
$query = $this->getRepository('Equipment')->createQueryBuilder('e')
->orderBy('e.id', 'DESC');
$countquery =
$this->getRepository('Equipment')->createQueryBuilder('e')
->select('COUNT(DISTINCT e.id)');
if ($form->isSubmitted() && $form->isValid()) {
$caption = $form->get('caption')->getData();
}
if (!empty($caption)) {
$query->andWhere('LOWER(c.caption) LIKE
LOWER(:caption) ')->setParameter('caption', '%' . trim($caption) . '%');
$countquery->andWhere('LOWER(c.caption) LIKE
LOWER(:caption) ')->setParameter('caption', '%' . trim($caption) . '%');
}
$count=$countquery->getQuery()->getSingleScalarResult();
$pages = floor($count / 20) + ($count % 20 > 0 ? 1 : 0);
if ($pages < 1) $pages = 1;
if ($pagenum > $pages) $pagenum = $pages;
$equipments = $query->setFirstResult(($pagenum - 1) * 20)
->setMaxResults(20)
->getQuery()->getResult();
$this->view['page']=$pagenum;
$this->view['pages']=$pages;
119
$this->view['equipments'] = $equipments;
$this->view['form'] = $form->createView();
$this->navigation = array('active' => 'equipments');
return $this->render('AppBundle:Equipments:index.html.twig');
}
}
/**
* @return RedirectResponse|Response
* @Config\Route("/equipment/add", name = "site_equipment_add")
*/
public function addAction()
{
if (!($this->authChecker->isGranted(Role::ADMIN))) {
return $this->redirectToRoute('homepage');
}
else {
$equipment = new Equipment();
$form = $this->createForm(new EquipmentFormType(), $equipment);
$form->handleRequest($this->request);
if ($this->request->isMethod('POST')) {
if ($form->isSubmitted() && $form->isValid()) {
$valid = true;
if ($valid) {
$this->manager->persist($equipment);
$this->manager->flush();
foreach ($equipment->getUnits() as $unit) {
$unit->setEquipment($equipment);
$this->manager->persist($unit);
$this->manager->flush();
}
$this->addNotice('success','equipment.html.twig',
array('notice' => 'added', 'place' =>
$equipment->getPlace()));
120
return
$this->redirectToRoute('site_equipment_index');
}
}
}
$this->view['equipment']=null;
$this->forms['equipment'] = $form->createView();
$this->navigation = array('active' => 'equipments');
return $this->render('AppBundle:Equipments:equipment.html.twig');
}
}
/**
* @param Equipment $equipment
* @return RedirectResponse|Response
* @Config\Route("/equipment/{equipment}/edit", name = "site_equipment_edit")
* @Config\ParamConverter("equipment", options = {"mapping": {"equipment":
"id"}})
*/
public function editAction(Equipment $equipment)
{
if (!($this->authChecker->isGranted(Role::ADMIN))) {
return $this->redirectToRoute('homepage');
}
else {
$form = $this->createForm(new EquipmentFormType(), $equipment);
$form->handleRequest($this->request);
if ($form->isSubmitted() && $form->isValid()) {
$valid = true;
if ($valid) {
$units = $equipment->getUnits();
foreach($units as $unit) {
$unit->setEquipment($equipment);
$this->manager->persist($unit);
$this->manager->flush();
}
121
$this->manager->persist($equipment);
$this->manager->flush();
$this->addNotice('success','equipment.html.twig',
array('notice' => 'changed', 'place' =>
$equipment->getPlace()));
return $this->redirectToRoute('site_equipment_index');
}
}
$this->forms['equipment'] = $form->createView();
$this->view['equipment'] = $equipment;
$this->navigation = array('active' => 'equipments');
return $this->render('AppBundle:Equipments:equipment.html.twig');
}
}
/**
* @param Equipment $equipment
* @return Response
* @Config\Route("/equipment/{equipment}/remove", name =
"site_equipment_remove")
* @Config\ParamConverter("equipment", options = {"mapping": {"equipment":
"id"}})
*/
public function removeAction(Equipment $equipment)
{
$this->manager->remove($equipment);
$this->manager->flush();
$this->addNotice('error','equipment.html.twig',
array('notice' => 'removed', 'place' => $equipment->getPlace()));
return $this->redirectToRoute('site_equipment_index');
}
}
<?php
namespace AppBundle\Controller;
use AppBundle\Entity\Vendor;
use AppBundle\Entity\Role;
122
use AppBundle\Form\Type\VendorFilterFormType;
use AppBundle\Form\Type\VendorFormType;
use Sensio\Bundle\FrameworkExtraBundle\Configuration as Config;
use Symfony\Component\Form\FormError;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
class VendorController extends InitializableController
{
/**
* @return RedirectResponse|Response
* @Config\Route("/vendor/index/{pagenum}", name = "site_vendor_index",
defaults={ "pagenum": "1"})
*/
public function indexAction($pagenum=1)
{
if (!($this->authChecker->isGranted(Role::ADMIN))) {
return $this->redirectToRoute('homepage');
}
else {
$form=$this->createForm(new VendorFilterFormType());
$caption = null;
$form->handleRequest($this->request);
$query = $this->getRepository('Vendor')->createQueryBuilder('v')
->orderBy('v.caption', 'DESC');
$countquery =
$this->getRepository('Vendor')->createQueryBuilder('v')
->select('COUNT(DISTINCT v.id)');
if ($form->isSubmitted() && $form->isValid()) {
$caption = $form->get('caption')->getData();
}
if (!empty($caption)) {
$query->andWhere('LOWER(v.caption) LIKE
LOWER(:caption) ')->setParameter('caption', '%' . trim($caption) . '%');
$countquery->andWhere('LOWER(v.caption) LIKE
LOWER(:caption) ')->setParameter('caption', '%' . trim($caption) . '%');
123
}
$count=$countquery->getQuery()->getSingleScalarResult();
$pages = floor($count / 20) + ($count % 20 > 0 ? 1 : 0);
if ($pages < 1) $pages = 1;
if ($pagenum > $pages) $pagenum = $pages;
$vendors = $query->setFirstResult(($pagenum - 1) * 20)
->setMaxResults(20)
->getQuery()->getResult();
$this->view['page']=$pagenum;
$this->view['pages']=$pages;
$this->view['vendors'] = $vendors;
$this->view['form'] = $form->createView();
$this->navigation = array('active' => 'vendors');
return $this->render('AppBundle:Vendors:index.html.twig');
}
}
/**
* @return RedirectResponse|Response
* @Config\Route("/vendor/add", name = "site_vendor_add")
*/
public function addAction()
{
if (!($this->authChecker->isGranted(Role::ADMIN))) {
return $this->redirectToRoute('homepage');
}
else {
$vendor = new Vendor();
$form = $this->createForm(new VendorFormType(), $vendor);
$form->handleRequest($this->request);
if ($form->isSubmitted() && $form->isValid()) {
$valid = true;
$sames =
$this->getRepository('Vendor')->createQueryBuilder('v')
->select('COUNT(v.id) AS id')
->where('v.caption = :caption')
124
->setParameters(array('caption' => $vendor->getCaption()))
->getQuery()->getSingleScalarResult();
if ($sames > 0) {
$form->get('caption')->addError(new
FormError('Вендор с таким названием уже имеется в базе'));
$valid = false;
}
if ($valid) {
$this->manager->persist($vendor);
$this->manager->flush();
$this->addNotice('success','vendor.html.twig',
array('notice' => 'added', 'caption' =>
$vendor->getCaption()));
return $this->redirectToRoute('site_vendor_index');
}
}
$this->view['vendor']=null;
$this->forms['vendor'] = $form->createView();
$this->navigation = array('active' => 'vendors');
return $this->render('AppBundle:Vendors:vendor.html.twig');
}
}
/**
* @param Vendor $vendor
* @return RedirectResponse|Response
* @Config\Route("/vendor/{vendor}/edit", name = "site_vendor_edit")
* @Config\ParamConverter("vendor", options = {"mapping": {"vendor": "id"}})
*/
public function editAction(Vendor $vendor)
{
if (!($this->authChecker->isGranted(Role::ADMIN))) {
return $this->redirectToRoute('homepage');
}
else {
$form = $this->createForm(new VendorFormType(), $vendor);
125
$form->handleRequest($this->request);
if ($form->isSubmitted() && $form->isValid()) {
$valid = true;
$sames =
$this->getRepository('Vendor')->createQueryBuilder('v')
->select('COUNT(v.id) AS id')
->where('v.caption = :caption')
->setParameters(array('caption' => $vendor->getCaption()))
->getQuery()->getSingleScalarResult();
if ($sames > 0) {
$form->get('caption')->addError(new
FormError('Компания с таким названием уже имеется в базе'));
$valid = false;
}
if ($valid) {
$this->manager->persist($vendor);
$this->manager->flush();
$this->addNotice('success','vendor.html.twig',
array('notice' => 'changed', 'caption' =>
$vendor->getCaption()));
return $this->redirectToRoute('site_vendor_index');
}
}
$this->forms['vendor'] = $form->createView();
$this->view['vendor'] = $vendor;
$this->navigation = array('active' => 'vendor');
return $this->render('AppBundle:Vendors:vendor.html.twig');
}
}
/**
* @param Vendor $vendor
* @return Response
* @Config\Route("/vendor/{vendor}/remove", name = "site_vendor_remove")
* @Config\ParamConverter("vendor", options = {"mapping": {"vendor": "id"}})
*/

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

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