Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
Theme-WordPress-Adullact-org
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
9
Issues
9
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Adullact
Theme-WordPress-Adullact-org
Commits
b27ad9ff
Commit
b27ad9ff
authored
Aug 13, 2019
by
Nathan Peraldi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add: event displaying now depending on the date
parent
c43a199d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
25 deletions
+54
-25
periodSelection.php
periodSelection.php
+1
-1
plugins/events-manager/templates/event-single.php
plugins/events-manager/templates/event-single.php
+53
-24
No files found.
periodSelection.php
View file @
b27ad9ff
...
@@ -18,7 +18,7 @@ function actualMonthYear($plus = 0)
...
@@ -18,7 +18,7 @@ function actualMonthYear($plus = 0)
}
}
$month
=
addZero
(
$month
);
$month
=
addZero
(
$month
);
$year
=
addZero
(
$year
);
$year
=
addZero
(
$year
);
return
$month
.
"/01/"
.
$year
;
;
return
$month
.
"/01/"
.
$year
;
}
}
function
addZero
(
$number
)
function
addZero
(
$number
)
...
...
plugins/events-manager/templates/event-single.php
View file @
b27ad9ff
...
@@ -12,13 +12,17 @@
...
@@ -12,13 +12,17 @@
* $args - the args passed onto EM_Events::output()
* $args - the args passed onto EM_Events::output()
*/
*/
//initialisation des variables
$sinscrire
=
"S'inscrire à l'évènement >"
;
$inscriptions_closes
=
"Inscription closes"
;
function
recup_nombre
()
function
recup_nombre
()
{
{
global
$wpdb
;
global
$wpdb
;
$search
=
"ag-adullact-2019"
;
$search
=
"ag-adullact-2019"
;
$post
=
"post_name"
;
$post
=
"post_name"
;
$link
=
$_SERVER
[
"REQUEST_URI"
];
$link
=
$_SERVER
[
"REQUEST_URI"
];
$search
=
explode
(
"/"
,
$link
)[
2
];
$search
=
explode
(
"/"
,
$link
)[
2
];
$query
=
"SELECT count(meta_value) as number FROM wp5304_postmeta WHERE meta_value LIKE '%"
.
$search
.
"%' && meta_value LIKE '%"
.
$post
.
"%'"
;
$query
=
"SELECT count(meta_value) as number FROM wp5304_postmeta WHERE meta_value LIKE '%"
.
$search
.
"%' && meta_value LIKE '%"
.
$post
.
"%'"
;
$result
=
$wpdb
->
get_results
(
$query
);
$result
=
$wpdb
->
get_results
(
$query
);
...
@@ -28,31 +32,56 @@ function recup_nombre()
...
@@ -28,31 +32,56 @@ function recup_nombre()
global
$EM_Event
;
global
$EM_Event
;
/* @var $EM_Event EM_Event */
/* @var $EM_Event EM_Event */
recup_nombr
e
();
$the_event
=
$EM_Event
->
output_singl
e
();
echo
str_replace
(
"Carte non disponible"
,
""
,
$EM_Event
->
output_single
());
?>
//on enlève ce texte inutile de cette manière car aucun moyen de faire autrement !
$the_event
=
str_replace
(
"Carte non disponible"
,
""
,
$the_event
);
<script>
//si "button" détecté, alors on s'occupe du formulaire d'inscription
if
(
strpos
(
$the_event
,
"BUTTON"
)
!==
false
)
{
recup_nombre
();
//on se prépare à comparer la date actuelle avec la date de l'évènement pour ouvrir / fermer les inscriptions.
$timestamp_event
=
strtotime
(
$EM_Event
->
start_date
);
$timestamp_actual
=
time
();
if
(
$timestamp_event
>
$timestamp_actual
)
{
$the_event
=
str_replace
(
"BUTTON"
,
"<button id='adullact-display-mask'>"
.
$sinscrire
.
"</button>"
,
$the_event
);
echo
$the_event
;
?>
<script>
//on effectue les opérations pour afficher / cacher le formulaire d'inscription à l'évènement
function
display_mask
()
{
if
(
the_form
.
style
.
display
===
"
block
"
)
{
the_form
.
style
.
display
=
"
none
"
;
document
.
getElementById
(
"
adullact-display-mask
"
).
style
.
color
=
"
dimgrey
"
;
document
.
getElementById
(
"
adullact-display-mask
"
).
style
.
backgroundColor
=
"
white
"
//on effectue les opérations pour afficher / cacher le formulaire d'inscription à l'évènement
}
else
{
function
display_mask
(){
the_form
.
style
.
display
=
"
block
"
;
if
(
the_form
.
style
.
display
===
"
block
"
){
document
.
getElementById
(
"
adullact-display-mask
"
).
style
.
color
=
"
white
"
;
the_form
.
style
.
display
=
"
none
"
;
document
.
getElementById
(
"
adullact-display-mask
"
).
style
.
backgroundColor
=
"
#3f7ca2
"
document
.
getElementById
(
"
adullact-display-mask
"
).
style
.
color
=
"
dimgrey
"
;
}
document
.
getElementById
(
"
adullact-display-mask
"
).
style
.
backgroundColor
=
"
white
"
}
}
var
results
=
document
.
getElementsByClassName
(
"
wpcf7
"
);
else
{
var
the_form
=
results
[
0
];
the_form
.
style
.
display
=
"
block
"
;
the_form
.
style
.
display
=
"
none
"
;
document
.
getElementById
(
"
adullact-display-mask
"
).
style
.
color
=
"
white
"
;
var
the_button
=
document
.
getElementById
(
"
adullact-display-mask
"
);
document
.
getElementById
(
"
adullact-display-mask
"
).
style
.
backgroundColor
=
"
#3f7ca2
"
the_button
.
addEventListener
(
"
click
"
,
display_mask
);
}
</script>
<?php
}
else
{
$the_event
=
str_replace
(
"BUTTON"
,
"<button id='adullact-display-mask'>"
.
$inscriptions_closes
.
"</button>"
,
$the_event
);
echo
$the_event
;
?>
<script>
var
results
=
document
.
getElementsByClassName
(
"
wpcf7
"
);
var
the_form
=
results
[
0
];
var
the_parent
=
document
.
getElementsByClassName
(
"
entry-content
"
)[
0
];
the_parent
.
removeChild
(
the_form
);
</script>
<?php
}
}
}
else
{
var
results
=
document
.
getElementsByClassName
(
"
wpcf7
"
);
//puisqu'il n'y a pas de formulaire d'inscription, on affiche simplement l'évènement.
var
the_form
=
results
[
0
];
echo
$the_event
;
the_form
.
style
.
display
=
"
none
"
;
}
var
the_button
=
document
.
getElementById
(
"
adullact-display-mask
"
);
\ No newline at end of file
the_button
.
addEventListener
(
"
click
"
,
display_mask
);
</script>
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