Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
resourcebookingajax.php
1<?php
3
9
10Loc::loadMessages(__FILE__);
11
17{
18 public function configureActions()
19 {
20 return [
21 'getFillFormData' => [
22 '-prefilters' => [
23 ActionFilter\Authentication::class,
24 ActionFilter\Csrf::class
25 ],
26 '+postfilters' => [
27 new ActionFilter\Cors()
28 ],
29 ],
30 ];
31 }
32
33 public function getPlannerDataAction()
34 {
35 $request = $this->getRequest();
36
37 return \CCalendarPlanner::prepareData(array(
38 'user_id' => \CCalendar::getCurUserId(),
39 'codes' => $request->getPost('codes'),
40 'resources' => $request->getPost('resources'),
41 'date_from' => \CCalendar::date(\CCalendar::timestamp($request->getPost('from')), false),
42 'date_to' => \CCalendar::date(\CCalendar::timestamp($request->getPost('to')), false),
43 'timezone' => \CCalendar::getUserTimezoneName(\CCalendar::getCurUserId()),
44 'skipEntryList' => $request->getPost('currentEventList')
45 ));
46 }
47
52
57
58 public function getUserSelectorDataAction()
59 {
60 $request = $this->getRequest();
61
62 $selectedUserList = [];
63 if (!empty($request['selectedUserList']) && is_array($request['selectedUserList']))
64 {
65 $selectedUserList = $request['selectedUserList'];
66 }
67
68 return \CCalendar::getSocNetDestination(false, array(), $selectedUserList);
69 }
70
71 public function getFieldParamsAction()
72 {
73 $request = $this->getRequest();
74 return ResourceBooking::getUserFieldByFieldName($request['fieldname'], $request['selectedUsers']);
75 }
76
77 public function getFillFormDataAction()
78 {
79 $request = $this->getRequest();
80 $settingsData = $request['settingsData'];
81
82 if (is_string($settingsData) && $settingsData)
83 {
84 $settingsData = Encoding::convertEncoding($settingsData, SITE_CHARSET, 'UTF-8');
85 $settingsData = Json::decode($settingsData);
86 }
87
89 $settingsData,
90 [
91 'fieldName' => $request['fieldName'],
92 'from' => $request['from'],
93 'to' => $request['to']
94 ]
95 );
96 }
97}
static getUserFieldByFieldName($fieldName='', $selectedUsers=[])
static getFillFormData($data=[], $params=[])
static loadMessages($file)
Definition loc.php:64