Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
blackcat.dev-vt2b.ru
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Акимов Владимир
blackcat.dev-vt2b.ru
Commits
7911a533
Commit
7911a533
authored
Aug 22, 2024
by
Владимир Акимов
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Форма бронирования
parent
15888960
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
936 additions
and
15 deletions
+936
-15
add-bron.php
local/ajax/add-bron.php
+27
-0
bron-popup.php
local/ajax/bron-popup.php
+14
-0
init.php
local/php_interface/init.php
+118
-0
result_modifier.php
...ws/quests/bitrix/news.detail/.default/result_modifier.php
+50
-15
style.css
.../bitrix/news/quests/bitrix/news.detail/.default/style.css
+280
-0
template.php
...trix/news/quests/bitrix/news.detail/.default/template.php
+447
-0
No files found.
local/ajax/add-bron.php
0 → 100644
View file @
7911a533
<?
require_once
(
$_SERVER
[
"DOCUMENT_ROOT"
]
.
"/bitrix/modules/main/include/prolog_before.php"
);
CModule
::
IncludeModule
(
"iblock"
);
if
(
$_POST
[
'NAME'
]){
if
(
closed
(
$_POST
[
'DATE'
],
$_POST
[
'TIME'
],
$_POST
[
'QUEST'
])
>
0
){
echo
"error"
;
}
else
{
$el
=
new
CIBlockElement
;
$PROP
=
[];
$PROP
=
$_POST
;
$arLoad
=
array
(
"MODIFIED_BY"
=>
$USER
->
GetID
(),
// элемент изменен текущим пользователем
"IBLOCK_SECTION_ID"
=>
false
,
// элемент лежит в корне раздела
"IBLOCK_ID"
=>
10
,
"PROPERTY_VALUES"
=>
$PROP
,
"NAME"
=>
$_POST
[
'NAME'
],
"ACTIVE"
=>
"Y"
,
"PREVIEW_TEXT"
=>
$_POST
[
"COMMENT"
]
);
$el
->
Add
(
$arLoad
);
echo
"ok"
;
}
}
?>
local/ajax/bron-popup.php
0 → 100644
View file @
7911a533
<?
require_once
(
$_SERVER
[
"DOCUMENT_ROOT"
]
.
"/bitrix/modules/main/include/prolog_before.php"
);
CModule
::
IncludeModule
(
"iblock"
);
?>
<?
if
(
!
empty
(
$_POST
)){
$res
=
CIBlockElement
::
GetByID
(
$_POST
[
'quest'
]);
if
(
$ar_res
=
$res
->
GetNext
())
$name
=
$ar_res
[
'NAME'
];
echo
json_encode
([
'name'
=>
$name
,
'date'
=>
rusdate
(
$_POST
[
'date'
])]);
}
?>
local/php_interface/init.php
View file @
7911a533
...
...
@@ -55,5 +55,123 @@ function color($genre)
}
return
$color
;
}
// русские даты
function
rusdate
(
$currentDate
)
{
$_monthsList
=
array
(
".01"
=>
"января"
,
".02"
=>
"февраля"
,
".03"
=>
"марта"
,
".04"
=>
"апреля"
,
".05"
=>
"мая"
,
".06"
=>
"июня"
,
".07"
=>
"июля"
,
".08"
=>
"августа"
,
".09"
=>
"сентября"
,
".10"
=>
"октября"
,
".11"
=>
"ноября"
,
".12"
=>
"декабря"
);
$_mD
=
date
(
".m"
,
strtotime
(
$currentDate
));
//для замены
$currentDate
=
str_replace
(
$_mD
,
" "
.
$_monthsList
[
$_mD
]
.
" "
,
$currentDate
);
$year
=
date
(
"Y"
);
$currentDate
=
str_replace
(
"."
.
$year
,
""
,
$currentDate
);
return
$currentDate
;
}
//получение дней недели
function
dayweek
(
$currentDate
)
{
$dayofweek
=
date
(
'w'
,
strtotime
(
$currentDate
));
$days
=
array
(
'Пн'
,
'Вт'
,
'Cр'
,
'Чт'
,
'Пт'
,
'Сб'
,
'Вс'
);
return
$days
[
$dayofweek
];
}
// функция получения что дата и время забронировано
function
closed
(
$date
,
$time
,
$questId
)
{
$locations
=
array
(
4
,
48
,
65
,
76
);
$iblockId
=
10
;
$date
=
date
(
'Y-m-d'
,
strtotime
(
$date
));
$arSelect
=
array
(
"ID"
,
"NAME"
,
"DATE_ACTIVE_FROM"
);
if
(
in_array
(
$questId
,
$locations
)){
$loc
=
0
;
foreach
(
$locations
as
$location
)
{
$arFilter
=
array
(
"IBLOCK_ID"
=>
$iblockId
,
"ACTIVE"
=>
"Y"
,
"PROPERTY_DATE"
=>
$date
,
"PROPERTY_TIME"
=>
$time
,
"PROPERTY_QUEST"
=>
$location
,
);
$res
=
CIBlockElement
::
GetList
(
array
(),
$arFilter
,
false
,
false
,
$arSelect
);
$count
=
$res
->
SelectedRowsCount
();
if
(
$count
>
0
)
{
$loc
=
1
;
break
;
}
}
if
(
in_array
(
$questId
,
$locations
)
&&
$loc
==
1
){
return
1
;
}
}
else
{
$arFilter
=
Array
(
"IBLOCK_ID"
=>
$iblockId
,
"ACTIVE"
=>
"Y"
,
"PROPERTY_DATE"
=>
$date
,
"PROPERTY_TIME"
=>
$time
,
"PROPERTY_QUEST"
=>
$questId
,
);
$res
=
CIBlockElement
::
GetList
(
Array
(),
$arFilter
,
false
,
false
,
$arSelect
);
return
$res
->
SelectedRowsCount
();
}
}
// получение цен в зависимости от времени
function
price
(
$time
,
$questId
){
$arSelect
=
array
(
"ID"
,
"NAME"
,
"IBLOCK_ID"
,
"PROPERTY_*"
);
$ar
=
explode
(
":"
,
$time
);
$hour
=
(
int
)
$ar
[
0
];
$iblockId
=
12
;
$arFilter
=
Array
(
"IBLOCK_ID"
=>
$iblockId
,
"ACTIVE"
=>
"Y"
,
"PROPERTY_QUEST"
=>
$questId
,
);
$res
=
CIBlockElement
::
GetList
(
Array
(),
$arFilter
,
false
,
false
,
$arSelect
);
if
(
$res
->
SelectedRowsCount
()
==
0
)
return
"5000"
;
$k
=
0
;
$array
=
[];
while
(
$ob
=
$res
->
GetNextElement
())
{
$arItem
=
$ob
->
GetFields
();
$arItem
[
'PROPERTIES'
]
=
$ob
->
GetProperties
();
$arr
=
explode
(
":"
,
$arItem
[
'PROPERTIES'
][
'TIME'
][
'VALUE'
]);
$hourMin
=
(
int
)
$arr
[
0
];
$array
[
$k
][
'HOUR'
]
=
$hourMin
;
$array
[
$k
][
'PRICE'
]
=
$arItem
[
'PROPERTIES'
][
'PRICE'
][
'VALUE'
];
$k
++
;
}
if
(
$hour
>=
$array
[
0
][
'HOUR'
]
&&
$hour
<
$array
[
1
][
'HOUR'
]){
return
$array
[
0
][
'PRICE'
];
}
else
return
$array
[
1
][
'PRICE'
];
}
?>
\ No newline at end of file
local/templates/blackcat/components/bitrix/news/quests/bitrix/news.detail/.default/result_modifier.php
View file @
7911a533
<?php
// текстовые блоки
if
(
!
empty
(
$arResult
[
'PROPERTIES'
][
'BLOCKS'
][
'VALUE'
]))
{
$arResult
[
'BLOCKS'
]
=
[];
foreach
(
$arResult
[
'PROPERTIES'
][
'BLOCKS'
][
'VALUE'
]
as
$elementId
)
{
$element
=
\Bitrix\Iblock\Elements\ElementBlocksTable
::
getByPrimary
(
$elementId
,
[
'select'
=>
[
'ID'
,
'NAME'
,
'PREVIEW_TEXT'
,
'PREVIEW_PICTURE'
],
])
->
fetch
();
$arResult
[
'BLOCKS'
][]
=
$element
;
if
(
!
empty
(
$arResult
[
'PROPERTIES'
][
'BLOCKS'
][
'VALUE'
]))
{
$arResult
[
'BLOCKS'
]
=
[];
foreach
(
$arResult
[
'PROPERTIES'
][
'BLOCKS'
][
'VALUE'
]
as
$elementId
)
{
$element
=
\Bitrix\Iblock\Elements\ElementBlocksTable
::
getByPrimary
(
$elementId
,
[
'select'
=>
[
'ID'
,
'NAME'
,
'PREVIEW_TEXT'
,
'PREVIEW_PICTURE'
],
])
->
fetch
();
$arResult
[
'BLOCKS'
][]
=
$element
;
}
}
}
}
// отзывЫ
$iblockId
=
8
;
$iblockId
=
8
;
$arResult
[
'REVIEWS'
]
=
[];
$arSelect
=
Array
(
"ID"
,
"IBLOCK_ID"
,
"NAME"
,
"PREVIEW_TEXT"
,
"PROPERTY_RAITING"
);
//IBLOCK_ID и ID обязательно должны быть
$arFilter
=
Array
(
"IBLOCK_ID"
=>
$iblockId
,
"ACTIVE"
=>
"Y"
,
"PROPERTY_QUEST"
=>
$arResult
[
'ID'
]);
$res
=
CIBlockElement
::
GetList
(
A
rray
(),
$arFilter
,
false
,
false
,
$arSelect
);
while
(
$ob
=
$res
->
GetNextElement
())
{
$arResult
[
'REVIEWS'
]
=
[];
$arSelect
=
array
(
"ID"
,
"IBLOCK_ID"
,
"NAME"
,
"PREVIEW_TEXT"
,
"PROPERTY_RAITING"
);
//IBLOCK_ID и ID обязательно должны быть
$arFilter
=
array
(
"IBLOCK_ID"
=>
$iblockId
,
"ACTIVE"
=>
"Y"
,
"PROPERTY_QUEST"
=>
$arResult
[
'ID'
]);
$res
=
CIBlockElement
::
GetList
(
a
rray
(),
$arFilter
,
false
,
false
,
$arSelect
);
while
(
$ob
=
$res
->
GetNextElement
())
{
$arFields
=
$ob
->
GetFields
();
$arResult
[
'REVIEWS'
][]
=
$arFields
;
}
// чайные комнаты
if
(
!
empty
(
$arResult
[
'PROPERTIES'
][
'TEAS'
][
'VALUE'
]))
{
$arResult
[
'TEAS'
]
=
[];
foreach
(
$arResult
[
'PROPERTIES'
][
'TEAS'
][
'VALUE'
]
as
$elementId
)
{
$element
=
\Bitrix\Iblock\Elements\ElementTeasTable
::
getByPrimary
(
$elementId
,
[
'select'
=>
[
'ID'
,
'NAME'
],
])
->
fetch
();
$arResult
[
'TEAS'
][
$element
[
"ID"
]]
=
$element
;
}
}
// прайсы для списка
$arSelect
=
array
(
"ID"
,
"IBLOCK_ID"
,
"PROPERTY_*"
);
//IBLOCK_ID и ID обязательно должны быть
$arResult
[
'TIMES'
]
=
[];
$iblockId
=
12
;
$arFilter
=
Array
(
"IBLOCK_ID"
=>
$iblockId
,
"ACTIVE"
=>
"Y"
,
"PROPERTY_QUEST"
=>
$arResult
[
'ID'
],
);
$res
=
CIBlockElement
::
GetList
(
array
(
'PRPPERTY_PRICE'
=>
'ASC'
),
$arFilter
,
false
,
false
,
$arSelect
);
while
(
$ob
=
$res
->
GetNextElement
())
{
$arItem
=
$ob
->
GetFields
();
$arItem
[
'PROPERTIES'
]
=
$ob
->
GetProperties
();
$times
=
[];
$times
[
"TIME"
]
=
$arItem
[
'PROPERTIES'
][
'TIME'
][
'VALUE'
];
$times
[
"PRICE"
]
=
$arItem
[
'PROPERTIES'
][
'PRICE'
][
'VALUE'
];
$times
[
"COLOR"
]
=
$arItem
[
'PROPERTIES'
][
'COLOR'
][
'VALUE'
];
$arResult
[
'TIMES'
][]
=
$times
;
}
?>
\ No newline at end of file
local/templates/blackcat/components/bitrix/news/quests/bitrix/news.detail/.default/style.css
0 → 100644
View file @
7911a533
.book
{
color
:
#fff
;
font-size
:
20px
;
background
:
#bd4648
;
padding
:
10px
;
border-radius
:
3px
;
transition
:
transform
0.35s
,
-webkit-transform
0.35s
;
-webkit-transform
:
translate3d
(
0
,
200%
,
0
);
transform
:
translate3d
(
0
,
200%
,
0
);
margin-left
:
30px
;
position
:
relative
;
top
:
-5px
;
}
.quest_contact
{
display
:
inline-block
;
margin-left
:
30px
;
position
:
relative
;
top
:
12px
;
}
.fix_fon
.quest__content
.quest__content__title
.quest__content__title_link
.quest_contact
span
{
font-size
:
22px
;
padding-left
:
16px
;
}
.quest_contact
.fa
{
font-size
:
20px
;
}
.fix_fon
.quest__content
.quest__content__attribute.attr
{
text-align
:
left
;
padding-left
:
30px
;
}
.review-title
{
font-size
:
25px
;
font-weight
:
bold
;
margin-bottom
:
10px
;
}
.review-phone
{
background
:
#000
;
width
:
100%
;
padding
:
0
30px
30px
30px
;
}
.reviews
{
-webkit-column-count
:
4
;
column-count
:
4
;
-webkit-column-gap
:
20px
;
column-gap
:
40px
;
display
:
flex
;
}
.review
{
width
:
100%
;
padding
:
16px
20px
;
position
:
relative
;
background
:
#222
;
border-radius
:
6px
;
margin-bottom
:
20px
;
display
:
inline-block
;
}
.review-name
{
font-size
:
13px
;
fomt-weight
:
bold
;
margin-bottom
:
10px
;
}
.send-review
{
color
:
#fff
;
font-size
:
20px
;
background
:
#222
;
padding
:
10px
;
border-radius
:
3px
;
text-align
:
center
;
display
:
block
;
margin-bottom
:
20px
;
width
:
180px
;
}
.send-review
:hover
{
color
:
#fff
;
}
.stars
{
margin-bottom
:
20px
;
}
.stars
.fa
{
font-size
:
20px
;
}
.stars
.fa-star
:before
{
color
:
#cbad34
;
}
#review-form
,
.modal-title
{
color
:
#000
;
}
.mt-15
{
margin-top
:
15px
;
}
.help-block-name
,
.help-block-comment
{
display
:
none
;
color
:
red
;
}
.form-control.error
{
border
:
1px
solid
red
;
}
.thanks
{
color
:
#000
;
}
.review-more-btn
{
color
:
#fff
;
font-size
:
20px
;
background
:
#222
;
padding
:
10px
;
border-radius
:
3px
;
text-align
:
center
;
display
:
inline-block
;
margin-bottom
:
20px
;
width
:
180px
;
-webkit-column-break-inside
:
avoid
;
/* Chrome, Safari, Opera */
page-break-inside
:
avoid
;
/* Firefox */
break-inside
:
avoid
;
/* IE 10+ */
}
.review-more-btn
:hover
{
color
:
#fff
;
}
.review-more
{
display
:
none
;
-webkit-column-count
:
4
;
column-count
:
4
;
-webkit-column-gap
:
40px
;
column-gap
:
40px
;
}
.review-more
.review
:nth-child
(
2
)
{
display
:
block
;
}
/* бронирование */
.timetable
p
{
font-size
:
16px
;
}
.timetable
p
:last-child
{
margin-bottom
:
20px
;
}
.timetable
{
margin-bottom
:
20px
;
padding-left
:
30px
;
}
.timetable
h2
{
margin-bottom
:
20px
;
}
.tt_v1__row
:not
([
hidden
])
{
display
:
flex
;
}
.tt_v1__date
{
-webkit-font-smoothing
:
antialiased
;
border-top
:
solid
1px
#3b3b3b
;
color
:
#ccc
;
padding-right
:
.6em
;
padding-bottom
:
5px
;
white-space
:
nowrap
;
align-self
:
flex-start
;
margin-right
:
1em
;
min-width
:
125px
;
padding-top
:
1px
;
padding-left
:
.6em
;
}
.tt_v1__cal-date
{
display
:
inline-block
;
min-width
:
7ch
;
}
.tt_v1__DOW
{
color
:
#666
;
}
.tt_v1__DOW--week-end
{
color
:
#e25a5a
;
}
[
data-price
=
"1"
]
{
--color
:
#FFCCCC
;
}
[
data-price
=
"2"
]
{
--color
:
#FF9999
;
}
[
data-price
=
"3"
]
{
--color
:
#FF6666
;
}
[
data-price
=
"4"
]
{
--color
:
#FF3333
;
}
[
data-price
=
"5"
]
{
--color
:
#FF0033
;
}
[
data-price
=
"6"
]
{
--color
:
#CC0033
;
}
.price-legend-1
.label
{
display
:
inline-block
;
background-color
:
var
(
--color
);
font-weight
:
700
;
padding-top
:
.5em
;
margin-right
:
3px
;
}
.time_table_label
{
border
:
0
;
background-color
:
var
(
--color
);
border-radius
:
2px
;
display
:
inline-block
;
font-size
:
14px
;
font-weight
:
400
;
line-height
:
1
;
margin-bottom
:
3px
;
margin-left
:
0
;
margin-right
:
3px
;
margin-top
:
0
;
min-width
:
50px
;
padding
:
5px
;
text-shadow
:
0
1px
1px
rgba
(
0
,
0
,
0
,
.3
);
vertical-align
:
top
;
white-space
:
nowrap
;
color
:
#000
;
}
.time_table_label.closed
{
background-color
:
#393939
;
color
:
#fff
;
}
.bronblock
{
display
:
flex
;
justify-content
:
space-between
;
}
.mt-20
{
margin-top
:
20px
;
}
.mbt-5
{
margin-top
:
5px
;
margin-bottom
:
20px
;
}
.info-block
{
-webkit-font-smoothing
:
antialiased
;
display
:
flex
;
flex-direction
:
row
;
flex-wrap
:
nowrap
;
justify-content
:
space-around
;
margin-left
:
0
;
margin-right
:
0
;
}
.info-block
.column
{
flex-basis
:
33%
;
text-align
:
center
;
line-height
:
1.4em
;
font-size
:
14px
;
}
.info-block
.fa
{
display
:
block
;
margin-left
:
auto
;
margin-right
:
auto
;
font-size
:
25px
;
line-height
:
1.2
;
color
:
#3aa5df
;
}
.help-block-bron
{
color
:
red
;
display
:
none
;
}
.help-block-bron.error
{
display
:
block
;
}
.bron_error
{
color
:
red
;
font-weight
:
bold
;
padding-left
:
30px
;
display
:
none
;
}
.bron_error.active
{
display
:
block
;
}
\ No newline at end of file
local/templates/blackcat/components/bitrix/news/quests/bitrix/news.detail/.default/template.php
0 → 100644
View file @
7911a533
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment