Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
TimeOutAdmin
Project
Overview
Details
Activity
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
TimeOut
TimeOutAdmin
Commits
0b2007f1
Commit
0b2007f1
authored
Feb 17, 2020
by
Tobin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into 'dev_production'
Master See merge request
!272
parents
4b5e408e
3b29bc59
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
69 deletions
+71
-69
OrganizerServices.php
application/controllers/OrganizerServices.php
+4
-2
Organizer_model.php
application/models/Organizer_model.php
+67
-67
No files found.
application/controllers/OrganizerServices.php
View file @
0b2007f1
...
...
@@ -28,7 +28,9 @@ class OrganizerServices extends CI_Controller {
$this
->
load
->
model
(
'Validation_organizer_model'
);
$method
=
$this
->
router
->
fetch_method
();
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
if
(
$method
==
'addEvent'
||
$method
==
'addCategory'
||
$method
==
'addCity'
||
$method
==
'editOrganizerCityDetails'
||
$method
==
'editOrganizerCategoryDetails'
||
$method
==
"AddVenue"
||
$method
==
'editOrganizerVenueDetails'
)
{
if
(
$method
==
'addEvent'
||
$method
==
'addCategory'
||
$method
==
'addCity'
||
$method
==
'editOrganizerCityDetails'
||
$method
==
'editOrganizerCategoryDetails'
||
$method
==
'editOrganizerVenueDetails'
)
{
$data
=
$_POST
;
}
if
(
isset
(
apache_request_headers
()[
'Auth'
]))
{
...
...
@@ -605,7 +607,7 @@ class OrganizerServices extends CI_Controller {
}
public
function
AddVenue
(){
$data
=
$_POST
;
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
))
;
$res
=
$this
->
Organizer_model
->
AddVenue
(
$data
);
if
(
$res
[
'status'
]
!=
0
){
$this
->
successResponse
(
$res
);
...
...
application/models/Organizer_model.php
View file @
0b2007f1
...
...
@@ -1557,77 +1557,77 @@ class Organizer_model extends CI_Model {
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something Went South'
,
'code'
=>
'ER06'
);
try
{
if
(
isset
(
$data
[
'has_layout'
])
&&
$data
[
'has_layout'
]
==
1
){
$config
=
set_upload_service
(
"assets/uploads/services"
);
$this
->
load
->
library
(
'upload'
);
$config
[
'file_name'
]
=
time
()
.
"_"
.
$_FILES
[
'layout_image'
][
'name'
];
$this
->
upload
->
initialize
(
$config
);
if
(
!
$this
->
upload
->
do_upload
(
'layout_image'
)){
$err
=
1
;
return
array
(
'status'
=>
0
,
'code'
=>
'ER980'
,
'message'
=>
$this
->
upload
->
display_errors
());
exit
;
}
else
{
$upload_data
=
$this
->
upload
->
data
();
$data
[
'layout'
]
=
$config
[
'upload_path'
]
.
"/"
.
$upload_data
[
'file_name'
];
}
$config
=
set_upload_service
(
"assets/uploads/services"
);
$this
->
load
->
library
(
'upload'
);
$config
[
'file_name'
]
=
time
()
.
"_"
.
$_FILES
[
'layout_image'
][
'name'
];
$this
->
upload
->
initialize
(
$config
);
if
(
!
$this
->
upload
->
do_upload
(
'layout_image'
)){
$err
=
1
;
return
array
(
'status'
=>
0
,
'code'
=>
'ER980'
,
'message'
=>
$this
->
upload
->
display_errors
());
exit
;
}
else
{
$upload_data
=
$this
->
upload
->
data
();
$data
[
'layout'
]
=
$config
[
'upload_path'
]
.
"/"
.
$upload_data
[
'file_name'
];
}
$seatLayoutDetails
=
array
();
foreach
(
json_decode
(
$data
[
'seat_color'
])
AS
$index
=>
$value
){
$seatLayoutDetails
[]
=
array
(
'color'
=>
$value
,
'price'
=>
json_decode
(
$data
[
'seat_price'
])[
$index
],
'capacity'
=>
json_decode
(
$data
[
'seat_capacity'
])[
$index
],
'weekend_price'
=>
json_decode
(
$data
[
'seat_price'
])[
$index
]);
}
$seatLayoutDetails
=
array
();
foreach
(
json_decode
(
$data
[
'seat_color'
])
AS
$index
=>
$value
){
$seatLayoutDetails
[]
=
array
(
'color'
=>
$value
,
'price'
=>
json_decode
(
$data
[
'seat_price'
])[
$index
],
'capacity'
=>
json_decode
(
$data
[
'seat_capacity'
])[
$index
],
'weekend_price'
=>
json_decode
(
$data
[
'seat_price'
])[
$index
]);
}
$data
[
'layout_details'
]
=
json_encode
(
$seatLayoutDetails
);
}
else
{
$data
[
'layout'
]
=
$data
[
'layout_details'
]
=
''
;
}
$locData
=
getLocationLatLng
(
$data
[
'location'
]);
if
(
empty
(
$locData
)){
return
array
(
'status'
=>
0
,
'code'
=>
'ER958'
,
'message'
=>
'Provide a valid Location'
);
exit
;
}
if
(
isset
(
$data
[
'locality_name'
])
&&
(
!
empty
(
$data
[
'locality_name'
])
||
count
(
$data
[
'locality_name'
])
>
0
)){
$locArr
=
json_decode
(
json_encode
(
json_decode
(
$data
[
'locality_name'
])),
true
);
$key
=
array_search
(
'EN'
,
array_column
(
$locArr
,
'lang'
));
$status
=
$this
->
db
->
insert
(
'locality'
,
array
(
'locality'
=>
$locArr
[
$key
][
'locality_name'
],
'region_id'
=>
$data
[
'region_id'
]));
$data
[
'locality_id'
]
=
$this
->
db
->
insert_id
();
$insertArr
=
array
();
foreach
(
$locArr
AS
$key
=>
$value
)
{
$insertArr
[]
=
array
(
'language_code'
=>
$value
[
'lang'
],
'locality_id'
=>
$data
[
'locality_id'
],
'locality_name'
=>
$value
[
'locality_name'
]);
$data
[
'layout_details'
]
=
json_encode
(
$seatLayoutDetails
);
}
else
{
$data
[
'layout'
]
=
$data
[
'layout_details'
]
=
''
;
}
$locData
=
getLocationLatLng
(
$data
[
'location'
]);
if
(
empty
(
$locData
)){
return
array
(
'status'
=>
0
,
'code'
=>
'ER958'
,
'message'
=>
'Provide a valid Location'
);
exit
;
}
if
(
isset
(
$data
[
'locality_name'
])
&&
(
!
empty
(
$data
[
'locality_name'
])
||
count
(
$data
[
'locality_name'
])
>
0
)){
$locArr
=
json_decode
(
json_encode
(
$data
[
'locality_name'
]),
true
);
$key
=
array_search
(
'EN'
,
array_column
(
$locArr
,
'lang'
));
$status
=
$this
->
db
->
insert
(
'locality'
,
array
(
'locality'
=>
$locArr
[
$key
][
'locality_name'
],
'region_id'
=>
$data
[
'region_id'
]));
$data
[
'locality_id'
]
=
$this
->
db
->
insert_id
();
$insertArr
=
array
();
foreach
(
$locArr
AS
$key
=>
$value
)
{
$insertArr
[]
=
array
(
'language_code'
=>
$value
[
'lang'
],
'locality_id'
=>
$data
[
'locality_id'
],
'locality_name'
=>
$value
[
'locality_name'
]);
}
if
(
!
empty
(
$insertArr
)){
$this
->
db
->
insert_batch
(
'translator_locality'
,
$insertArr
);
}
}
unset
(
$data
[
'has_layout'
],
$data
[
'seat_capacity'
],
$data
[
'seat_color'
],
$data
[
'locality_type'
],
$data
[
'seat_price'
]);
$status
=
$this
->
db
->
insert
(
'venue'
,
array
(
'layout'
=>
$data
[
'layout'
],
'location'
=>
$data
[
'location'
],
'region_id'
=>
$data
[
'region_id'
],
'host_cat_id'
=>
$data
[
'host_cat_id'
],
'locality_id'
=>
$data
[
'locality_id'
],
'provider_id'
=>
$data
[
'organiser_id'
],
'location_lat'
=>
$locData
[
'lat'
],
'location_lng'
=>
$locData
[
'lng'
],
'layout_details'
=>
$data
[
'layout_details'
]));
if
(
$status
){
$venue_id
=
$this
->
db
->
insert_id
();
$insertArr
=
array
();
foreach
(
json_decode
(
$data
[
'venue_name'
])
AS
$key
=>
$value
)
{
$insertArr
[]
=
array
(
'venue_id'
=>
$venue_id
,
'venue_name'
=>
$value
->
venue_name
,
'language_code'
=>
$value
->
lang
);
}
if
(
!
empty
(
$insertArr
)){
$this
->
db
->
insert_batch
(
'translator_venue'
,
$insertArr
);
}
$res
=
array
(
'status'
=>
1
,
'message'
=>
'success'
);
}
if
(
!
empty
(
$insertArr
)){
$this
->
db
->
insert_batch
(
'translator_locality'
,
$insertArr
);
}
}
unset
(
$data
[
'has_layout'
],
$data
[
'seat_capacity'
],
$data
[
'seat_color'
],
$data
[
'locality_type'
],
$data
[
'seat_price'
]);
$status
=
$this
->
db
->
insert
(
'venue'
,
array
(
'layout'
=>
$data
[
'layout'
],
'location'
=>
$data
[
'location'
],
'region_id'
=>
$data
[
'region_id'
],
'host_cat_id'
=>
$data
[
'host_cat_id'
],
'locality_id'
=>
$data
[
'locality_id'
],
'provider_id'
=>
$data
[
'organiser_id'
],
'location_lat'
=>
$locData
[
'lat'
],
'location_lng'
=>
$locData
[
'lng'
],
'layout_details'
=>
$data
[
'layout_details'
]));
if
(
$status
){
$venue_id
=
$this
->
db
->
insert_id
();
$insertArr
=
array
();
foreach
(
$data
[
'venue_name'
]
AS
$key
=>
$value
)
{
$insertArr
[]
=
array
(
'venue_id'
=>
$venue_id
,
'venue_name'
=>
$value
->
venue_name
,
'language_code'
=>
$value
->
lang
);
}
if
(
!
empty
(
$insertArr
)){
$this
->
db
->
insert_batch
(
'translator_venue'
,
$insertArr
);
}
$res
=
array
(
'status'
=>
1
,
'message'
=>
'success'
);
}
}
catch
(
Exception
$e
){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something Went South'
,
'code'
=>
'ER06'
);
}
...
...
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