moved filters div in php + small changes in docker version

This commit is contained in:
lenovo
2022-11-11 12:12:50 +01:00
parent 06683fa4dc
commit 692650da3e
6 changed files with 106 additions and 61 deletions

View File

@@ -29,6 +29,7 @@ require_once(dirname(__FILE__) . '/mp_get_events.php');
require_once(dirname(__FILE__) . '/mp_sort_events.php');
require_once(dirname(__FILE__) . '/mp_get_filters.php');
require_once(dirname(__FILE__) . '/mp_address_errors.php');
require_once(dirname(__FILE__) . '/mp_create_div.php');
@@ -93,36 +94,9 @@ function mp_ljdp_map() {
* ADD FILTERS
*/
/*
pays
ville
categorie
*/
// $filters = (object)[];
// $filters->pays = [];
// $filters->ville = [];
// $filters->categorie = [];
//
// mp_console_log("filters:");
// mp_console_log($filters);
$mp_map_div = mp_create_div($filters);
$mp_api_script = '
<div id="ljdp_map_wrapper">
<div id="ljdp_map_filters">
';
// foreach ($pays as $loc) {
// $mp_api_script .= '<p>';
// $mp_api_script .= $loc;
// $mp_api_script .= '</p>';
// }
$mp_api_script .= '
</div>
<div id="ljdp_map"></div>
</div>
';
return $mp_api_script;
return $mp_map_div;
}
add_shortcode('lejourduprof_map', 'mp_ljdp_map');

View File

@@ -0,0 +1,38 @@
<?php
function mp_create_div(&$filters) {
$mp_map_div = '
<div id="ljdp_map_wrapper">
<div id="ljdp_map_filters">
';
foreach ($filters as $key => $filter) {
$mp_map_div .= '
<div class="filter_menu">
<div class="filter_menu_title" tabindex=0>
<p>'.$key.'</p>
</div>
<div class="filter_menu_drop" tabindex=0>
<p>TOUT DESELECTIONNER</p>
';
foreach ($filter as $value) {
$mp_map_div .= '
<p>'.$value->_name.'</p>
';
}
$mp_map_div .= '
</div>
</div>
';
};
$mp_map_div .= '
</div>
<div id="ljdp_map"></div>
</div>
';
return $mp_map_div;
}
?>

View File

@@ -69,7 +69,7 @@ function mp_get_filters($events) {
}
foreach ($filters as $key => $value) {
usort($filters->$key, mp_filter_compare);
usort($filters->$key, 'mp_filter_compare');
}
return $filters;

View File

@@ -37,6 +37,7 @@ function fill_filters(filters_div) {
*/
let content = "";
// use Object.keys to obtain an array of object keys
let keys = Object.keys(filters);
keys.forEach((key) => {

View File

@@ -92,7 +92,7 @@ function mp_init_map() {
draw_clusters(map, markers);
let filters_div = document.getElementById("ljdp_map_filters");
fill_filters(filters_div);
//fill_filters(filters_div);
// add listener to close infowindow at any click on map
map.addListener('click', function() {

View File

@@ -12,6 +12,7 @@ RESET="\e[0m"
# install wordpress with cli : https://make.wordpress.org/cli/handbook/how-to-install/
# commands : https://developer.wordpress.org/cli/commands/
echo -e ${YELLOW}download wordpress :${RESET}
if ! wp core version --path="${WP_VOLUME_DIR}" 2> /dev/null
then
@@ -21,9 +22,59 @@ else
echo -e ${GREEN}already there !${RESET}
fi
# create config file :
echo -e ${YELLOW}config wordpress :${RESET}
if ! wp config path --path="${WP_VOLUME_DIR}" --quiet 2> /dev/null
# # create config file :
# echo -e ${YELLOW}config wordpress :${RESET}
# if ! wp config path --path="${WP_VOLUME_DIR}" --quiet 2> /dev/null
# then
# wp config create \
# --dbhost="${DB_HOST}" \
# --dbname="${DB_NAME}" \
# --dbuser="${DB_USER}" \
# --dbpass="${DB_PSWD}" \
# --path="${WP_VOLUME_DIR}" --allow-root
# else
# echo -e ${GREEN}already configured !${RESET}
# fi
#
# # install wordpress :
# echo -e ${YELLOW}install wordpress :${RESET}
# if ! wp core is-installed --path="${WP_VOLUME_DIR}" 2> /dev/null
# then
# wp core install \
# --url="${WP_URL}" \
# --title="${WP_TITLE}" \
# --admin_user="${WP_ADMIN}" \
# --admin_email="${WP_ADMIN_EMAIL}" \
# --admin_password="${WP_ADMIN_PSWD}" \
# --skip-email \
# --path="${WP_VOLUME_DIR}" --allow-root
# else
# echo -e ${GREEN}already installed !${RESET}
# fi
#
# # create user :
# echo -e ${YELLOW}create wordpress user :${RESET}
# if ! wp user get ${WP_USER} --path="${WP_VOLUME_DIR}" --field=login 2> /dev/null
# then
# wp user create \
# "${WP_USER}" "${WP_USER_EMAIL}" \
# --user_pass="${WP_USER_PSWD}" \
# --path="${WP_VOLUME_DIR}" --allow-root
# else
# echo -e ${GREEN}already created !${RESET}
# fi
#
# # change owner and permissions to wp files
# chown -R www-data:www-data /var/www/*
# chmod 755 -R /var/www/*
#
# # symlinks for folders found in host plugins/
# plugins=$(ls ${WP_VOLUME_PLUGINS})
# for dir in $plugins; do
# ln -s ${WP_VOLUME_PLUGINS}/$dir ${WP_VOLUME_DIR}/wp-content/plugins/$dir
# done
if ! wp core is-installed --path="${WP_VOLUME_DIR}" 2> /dev/null
then
wp config create \
--dbhost="${DB_HOST}" \
@@ -31,14 +82,6 @@ then
--dbuser="${DB_USER}" \
--dbpass="${DB_PSWD}" \
--path="${WP_VOLUME_DIR}" --allow-root
else
echo -e ${GREEN}already configured !${RESET}
fi
# install wordpress :
echo -e ${YELLOW}install wordpress :${RESET}
if ! wp core is-installed --path="${WP_VOLUME_DIR}" 2> /dev/null
then
wp core install \
--url="${WP_URL}" \
--title="${WP_TITLE}" \
@@ -47,31 +90,20 @@ then
--admin_password="${WP_ADMIN_PSWD}" \
--skip-email \
--path="${WP_VOLUME_DIR}" --allow-root
else
echo -e ${GREEN}already installed !${RESET}
fi
# create user :
echo -e ${YELLOW}create wordpress user :${RESET}
if ! wp user get ${WP_USER} --path="${WP_VOLUME_DIR}" --field=login 2> /dev/null
then
wp user create \
"${WP_USER}" "${WP_USER_EMAIL}" \
--user_pass="${WP_USER_PSWD}" \
--path="${WP_VOLUME_DIR}" --allow-root
else
echo -e ${GREEN}already created !${RESET}
chown -R www-data:www-data /var/www/*
chmod 755 -R /var/www/*
plugins=$(ls ${WP_VOLUME_PLUGINS})
for dir in $plugins; do
ln -s ${WP_VOLUME_PLUGINS}/$dir ${WP_VOLUME_DIR}/wp-content/plugins/$dir
done
fi
# change owner and permissions to wp files
chown -R www-data:www-data /var/www/*
chmod 755 -R /var/www/*
# symlinks for folders found in host plugins/
plugins=$(ls ${WP_VOLUME_PLUGINS})
for dir in $plugins; do
ln -s ${WP_VOLUME_PLUGINS}/$dir ${WP_VOLUME_DIR}/wp-content/plugins/$dir
done
exec "${PHP_VERSION}" -FR