Ejemplo n.º 1
0
 public function thirdAction(Request $request)
 {
     $context = ['time' => date('Y-m-d H:i:s'), 'function' => __METHOD__];
     try {
         $user = $this->getUser();
         if (!$user) {
             throw new AuthenticationException('User was not founded');
         }
         $context['user_id'] = $this->getUser()->getId();
         $parameters = ['date_from' => $request->get('date_from'), 'date_to' => $request->get('date_to'), 'school_id' => $request->get('school_id')];
         $class_info = DBFood::getInstance()->getInfoForThirdRep($parameters);
         foreach ($class_info as $class) {
             $parameters['class_id'] = $class['cls_id'];
             $food_info_by_period[] = DBFood::getInstance()->getThirdInfoByPeriod($parameters);
         }
         $conclusion_food_rep_third = DBFood::getInstance()->getConclusionThirdByPeriod($parameters);
         return $this->render('CabinetBundle:Food/rep3:rep3_report.html.twig', ['class_info' => $class_info, 'food_info_by_period' => isset($food_info_by_period) ? $food_info_by_period : [], 'parameters' => $parameters, 'conclusion_food_rep_third' => $conclusion_food_rep_third]);
     } catch (Exception $e) {
         $this->get('logger')->error($e->getMessage(), $context);
         return new Response('Ошибка. Обратитесь к администратору');
     }
 }
Ejemplo n.º 2
0
 public function menuAction(Request $request)
 {
     $context = ['time' => date('Y-m-d H:i:s'), 'function' => __METHOD__];
     try {
         $parameters = ['date' => $request->get('date'), 'inf_eat' => $this->get('session')->get('inf_eat'), 'balance' => $this->get('session')->get('balance'), 'school_id' => $this->get('session')->get('scl_id')];
         $user = $this->getUser();
         if (!$user) {
             throw new AuthenticationException('User was not founded');
         }
         $context['user_id'] = $this->getUser()->getId();
         if (empty($parameters['inf_eat'])) {
             return new Response("<div class='row report-subtitle'>В вашем тарифе отсутсвует данная функциональность</div>");
         }
         if ($parameters['balance'] < 0) {
             return new Response("<div class='row report-subtitle'>На вашем счете недостаточно средств для просмотра данной информации</div>");
         }
         $all_complex_on_date = DBFood::getInstance()->getAllComplexOnDate($parameters);
         foreach ($all_complex_on_date as $idx => $complex) {
             $details_of_complex[$idx] = DBFood::getInstance()->getDetailsOfComplex(array_merge($parameters, ['meal_id' => $complex['MEAL_ID']]));
         }
         $all_groups_of_meal = DBFood::getInstance()->getAllGroupsOfMeals($parameters);
         foreach ($all_groups_of_meal as $idx => $group) {
             $meals_of_group[$idx] = DBFood::getInstance()->getAllMealsOfGroup(array_merge($parameters, ['gmeal_id' => $group['GMEAL_ID']]));
         }
         return $this->render('CabinetBundle:Pupil/menu:mainmenu_report.html.twig', ['all_complex_on_date' => $all_complex_on_date, 'details_of_complex' => isset($details_of_complex) ? $details_of_complex : [], 'all_groups_of_meal' => $all_groups_of_meal, 'meals_of_group' => isset($meals_of_group) ? $meals_of_group : [], 'params' => $parameters]);
     } catch (Exception $e) {
         $this->get('logger')->error($e->getMessage(), $context);
         return new Response('Ошибка. Обратитесь к администратору');
     }
 }
Ejemplo n.º 3
0
 public function pitanieAction(Request $request)
 {
     $context = ['time' => date('Y-m-d H:i:s'), 'function' => __METHOD__];
     try {
         $user = $this->getUser();
         if (!$user) {
             throw new AuthenticationException('User was not founded');
         }
         $context['user_id'] = $this->getUser()->getId();
         $parameters = ['date_from' => $request->get('date_from'), 'date_to' => $request->get('date_to'), 'school_id' => $this->get('session')->get('default_scl_id'), 'class_id' => $request->get('class_id'), 'user_id' => $this->getUser()->getId()];
         $class_info = DBTeacher::getInstance()->getClassInfo($parameters);
         foreach ($class_info as $class) {
             $parameters['class_id'] = $class['cls_id'];
             $food_info_by_period[] = DBFood::getInstance()->getFoodInfoByPeriod($parameters);
         }
         $parameters['class_id'] = $request->get('class_id');
         $conclusion_food_by_period = DBTeacher::getInstance()->getConclusionByPeriod($parameters);
         return $this->render('CabinetBundle:Teacher/pitanie:pitanie_report.html.twig', ['class_info' => $class_info, 'food_info_by_period' => isset($food_info_by_period) ? $food_info_by_period : [], 'conclusion_by_period' => $conclusion_food_by_period, 'teacher_name' => $this->getUser()->getFullName()]);
     } catch (Exception $e) {
         $this->get('logger')->error($e->getMessage(), $context);
         return new Response('Ошибка. Обратитесь к администратору');
     }
 }