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
27bfeffe
Commit
27bfeffe
authored
May 31, 2019
by
Tobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dc
parent
e5e16aaf
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
80 additions
and
0 deletions
+80
-0
Webservice.php
application/controllers/Webservice.php
+17
-0
Validation_app_model.php
application/models/Validation_app_model.php
+1
-0
Webservice_model.php
application/models/Webservice_model.php
+62
-0
No files found.
application/controllers/Webservice.php
View file @
27bfeffe
...
@@ -439,5 +439,22 @@ class Webservice extends CI_Controller {
...
@@ -439,5 +439,22 @@ class Webservice extends CI_Controller {
else
else
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
event_search
()
{
if
(
!
isset
(
$_GET
)
||
!
isset
(
$_GET
[
'query'
])
||
empty
(
$_GET
[
'query'
])){
$this
->
errorResponse
(
'ER18'
,
'Search Key Missing'
);
exit
;
}
$data
=
$_GET
;
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Webservice_model
->
event_search
(
$data
);
if
(
$res
[
'status'
]
!=
0
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
}
}
?>
?>
application/models/Validation_app_model.php
View file @
27bfeffe
...
@@ -34,6 +34,7 @@ class Validation_app_model extends CI_Model {
...
@@ -34,6 +34,7 @@ class Validation_app_model extends CI_Model {
'get_category_list'
=>
array
(
'auth_token'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER17'
,
'message'
=>
'User Id is null or empty'
),
'get_category_list'
=>
array
(
'auth_token'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER17'
,
'message'
=>
'User Id is null or empty'
),
)
)
),
),
'event_search'
=>
array
(),
'get_last_booking'
=>
array
(
'auth_token'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER17'
,
'message'
=>
'User Id is null or empty'
),
'get_last_booking'
=>
array
(
'auth_token'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER17'
,
'message'
=>
'User Id is null or empty'
),
...
...
application/models/Webservice_model.php
View file @
27bfeffe
...
@@ -1423,6 +1423,68 @@ class Webservice_model extends CI_Model {
...
@@ -1423,6 +1423,68 @@ class Webservice_model extends CI_Model {
}
}
return
$res
;
return
$res
;
}
}
function
event_search
(
$data
)
{
$res
=
array
();
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
)
{
$per_page
=
10
;
$str
=
urldecode
(
strtolower
(
$data
[
'query'
]));
$sql
=
"SELECT EVT.event_id
FROM events AS EVT
INNER JOIN venue AS VEN ON (VEN.id=EVT.venue_id AND VEN.status='1')
INNER JOIN event_gallery AS IMG ON
(IMG.event_id=EVT.event_id AND IMG.media_type=0 AND IMG.status='1')
WHERE EVT.status='1' AND
EVT.event_name LIKE '%
$str
%' OR
EVT.event_name_ar LIKE '%
$str
%'"
;
$count
=
$this
->
db
->
query
(
$sql
)
->
num_rows
();
$page
=
(
isset
(
$data
[
'page'
]))
?
$data
[
'page'
]
:
1
;
$page_limit
=
(
$page
-
1
)
*
$per_page
;
if
(
$count
>
0
&&
$count
>
$page_limit
)
{
$lang
=
$this
->
getUserLang
(
$user_id
);
if
(
$lang
==
'en'
)
$event_name
=
'events.event_name AS event_name'
;
else
$event_name
=
'events.event_name_ar AS event_name'
;
$limit
=
$page_limit
.
','
.
$per_page
;
$sql
=
"SELECT EVT.event_id,EVT.event_name,VEN.location,
IMG.media_url AS event_image
FROM events AS EVT
INNER JOIN venue AS VEN ON (VEN.id=EVT.venue_id AND VEN.status='1')
INNER JOIN event_gallery AS IMG ON
(IMG.event_id=EVT.event_id AND IMG.media_type=0 AND IMG.status='1')
WHERE EVT.status='1' AND
EVT.event_name LIKE '%
$str
%' OR
EVT.event_name_ar LIKE '%
$str
%'
ORDER BY EVT.event_id DESC
LIMIT
$limit
"
;
$result
=
$this
->
db
->
query
(
$sql
)
->
result
();
$meta
=
array
(
'total_pages'
=>
ceil
(
$count
/
$per_page
),
'total'
=>
$count
,
'current_page'
=>
$page
,
'per_page'
=>
$per_page
);
$res
=
array
(
'status'
=>
1
,
'data'
=>
array
(
'events'
=>
$result
,
'meta'
=>
$meta
));
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'No Data Found'
,
'code'
=>
'ER18'
);
}
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'User Authentication Failed'
,
'code'
=>
'ER15'
);
}
}
catch
(
Exception
$e
)
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something went South!!'
,
'code'
=>
'ER06'
);
}
return
$res
;
}
}
}
?>
?>
...
...
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