CHOOSE THE GAME:";
$no_result = "
NO RESULTS
";
$url = "https://adgaming.ibv.org/en/training-content/search-serious-games/";
$name_button = "New search games";
$no_select = "GO BACK AND CHOOSE ONE OF OPTIONS";
$txt_protected = "Protected: ";
$main_dimension = "Main cognitive dimension";
$secondary_dimension = "Secondary cognitive dimension";
$post_parent = 386;
}else if ($lang == "es"){
$title = "Elige un juego:
"; $no_result = "No se han obtenido resultados
";
$url = "https://adgaming.ibv.org/es/contenido-formativo/buscar-juegos-serios/";
$name_button = "Nueva búsqueda";
$no_select = "Vuelve atrás y elige una opción";
$txt_protected = "Protegido: ";
$main_dimension = "Dimensión cognitiva principal";
$secondary_dimension = "Dimensión cognitiva secundaria";
$post_parent = 421;
}else if ($lang == "ro"){
$title = "Alegeti jocul:
"; $no_result = "Ni zadetkov
";
$url = "https://adgaming.ibv.org/ro/continut-de-formare/cauta-jocuri-serioase/";
$name_button = "Noua cautare de jocuri";
$no_select = "Reveniți și alegeți una dintre opțiuni";
$txt_protected = "Protejat: ";
$main_dimension = "Dimensiune cognitiva principala";
$secondary_dimension = "Dimensiune cognitiva secundara";
$post_parent = 434;
}else if ($lang == "sl"){
$title = "Izberi igro:
"; $no_result = "Brez rezultatov
";
$url = "https://adgaming.ibv.org/sl/vsebina-usposabljanja/hladat-vazne-hry/";
$name_button = "Novo iskanje";
$no_select = "Pojdite nazaj in izberite eno od možnosti";
$txt_protected = "Zaščiteno: ";
$main_dimension = "Glavna kognitivna dimenzija";
$secondary_dimension = "Sekundarna kognitivna dimenzija";
$post_parent = 446;
}else if ($lang == "el"){
$title = "Επιλέξτε το παιχνίδι:
"; $no_result = "Χωρίς αποτέλεσμα
";
$url = " https://adgaming.ibv.org/el/το-περιεχόμενο-της-κατάρτισης/αναζήτηση-σοβαρά-παιχνίδια/";
$name_button = "Νέα αναζήτηση παιχνιδιών";
$no_select = "Πηγαίνετε πίσω και επιλέξτε μία από τις επιλογές";
$txt_protected = "Πρoστατευμένο: ";
$main_dimension = "Βασική νοητική λειτουργία";
$secondary_dimension = "Δευτερεύων νοητική λειτουργία";
$post_parent = 465;
}
if (count($_POST["cognitive-".$lang.""]) > 0 || count($_POST["ict-".$lang.""]) > 0 || count($_POST["players-".$lang.""]) > 0 || count($_POST["type-".$lang.""]) > 0 || count($_SESSION["cognitive-".$lang.""]) > 0 || count($_SESSION["ict-".$lang.""]) > 0 || count($_SESSION["players-".$lang.""]) > 0 || count($_SESSION["type-".$lang.""]) > 0) {
$txt_ict = "";
if (count($_POST["cognitive-".$lang.""]) > 0) {
$_SESSION["cognitive-".$lang.""] = $_POST["cognitive-".$lang.""];
}
if (count($_POST["ict-".$lang.""]) > 0) {
$_SESSION["ict-".$lang.""] = $_POST["ict-".$lang.""];
//Array ( [0] => ICT Game [1] => Physical game )
$txt_ict.= " AND (";
$v_ict = $_POST["ict-".$lang.""];
for($i=0; $i < count($v_ict); $i++)
{
$txt_ict.= " ".$wpdb->postmeta.".meta_value LIKE '%".$v_ict[$i]."%' OR";
}
$txt_ict = substr($txt_ict, 0, -2);
$txt_ict.=")";
}
if (count($_POST["players-".$lang.""]) > 0) {
$_SESSION["players-".$lang.""] = $_POST["players-".$lang.""];
}
if (count($_POST["type-".$lang.""]) > 0) {
$_SESSION["type-".$lang.""] = $_POST["type-".$lang.""];
}
if (isset($_POST["cognitive-".$lang.""])) {
$rows = $wpdb->get_results("SELECT DISTINCT $wpdb->posts.ID, $wpdb->posts.post_title
FROM $wpdb->posts
LEFT JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id)
WHERE $wpdb->posts.post_status = 'publish'
AND $wpdb->postmeta.meta_value LIKE '%".$_SESSION["cognitive-".$lang.""]." Main%'
AND $wpdb->postmeta.meta_key = 'cognitive-".$lang."'
AND $wpdb->posts.post_parent = ".$post_parent."
AND $wpdb->posts.ID IN
(SELECT DISTINCT $wpdb->posts.ID
FROM $wpdb->posts
LEFT JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id)
WHERE $wpdb->posts.post_status = 'publish'
".$txt_ict."
AND $wpdb->postmeta.meta_key = 'ict-".$lang."'
AND $wpdb->posts.post_parent = ".$post_parent."
GROUP BY $wpdb->posts.post_title)
GROUP BY $wpdb->posts.post_title
ORDER BY $wpdb->posts.post_title ASC");
$rows1 = $wpdb->get_results("SELECT DISTINCT $wpdb->posts.ID, $wpdb->posts.post_title
FROM $wpdb->posts
LEFT JOIN $wpdb->postmeta ON($wpdb->posts.ID = $wpdb->postmeta.post_id)
WHERE $wpdb->posts.post_status = 'publish'
AND $wpdb->postmeta.meta_value LIKE '%".$_SESSION["cognitive-".$lang.""]." Secondary%'
AND $wpdb->postmeta.meta_key = 'cognitive-".$lang."'
AND $wpdb->posts.post_parent = ".$post_parent."
AND $wpdb->posts.ID IN
(SELECT DISTINCT $wpdb->posts.ID
FROM $wpdb->posts
LEFT JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id)
WHERE $wpdb->posts.post_status = 'publish'
".$txt_ict."
AND $wpdb->postmeta.meta_key = 'ict-".$lang."'
AND $wpdb->posts.post_parent = ".$post_parent."
GROUP BY $wpdb->posts.post_title)
GROUP BY $wpdb->posts.post_title
ORDER BY $wpdb->posts.post_title ASC");
/*}else if (isset($_POST["ict-".$lang.""])) {
$rows = $wpdb->get_results("SELECT DISTINCT $wpdb->posts.ID, $wpdb->posts.post_title
FROM $wpdb->posts
LEFT JOIN $wpdb->postmeta ON($wpdb->posts.ID = $wpdb->postmeta.post_id)
WHERE $wpdb->posts.post_status = 'publish'
AND $wpdb->postmeta.meta_value LIKE '%".$_SESSION["ict-".$lang.""]."%'
AND $wpdb->postmeta.meta_key = 'ict-".$lang."'
GROUP BY $wpdb->posts.post_title
ORDER BY $wpdb->posts.post_title ASC");*/
}else if (isset($_POST["players-".$lang.""])) {
$rows = $wpdb->get_results("SELECT DISTINCT $wpdb->posts.ID, $wpdb->posts.post_title
FROM $wpdb->posts
LEFT JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id)
WHERE $wpdb->posts.post_status = 'publish'
AND $wpdb->postmeta.meta_value LIKE '%".$_SESSION["players-".$lang.""]."%'
AND $wpdb->postmeta.meta_key = 'players-".$lang."'
AND $wpdb->posts.post_parent = ".$post_parent."
AND $wpdb->posts.ID IN
(SELECT DISTINCT $wpdb->posts.ID
FROM $wpdb->posts
LEFT JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id)
WHERE $wpdb->posts.post_status = 'publish'
".$txt_ict."
AND $wpdb->postmeta.meta_key = 'ict-".$lang."'
AND $wpdb->posts.post_parent = ".$post_parent."
GROUP BY $wpdb->posts.post_title)
GROUP BY $wpdb->posts.post_title
ORDER BY $wpdb->posts.post_title ASC");
}else if (isset($_POST["type-".$lang.""])) {
$rows = $wpdb->get_results("SELECT DISTINCT $wpdb->posts.ID, $wpdb->posts.post_title
FROM $wpdb->posts
LEFT JOIN $wpdb->postmeta ON($wpdb->posts.ID = $wpdb->postmeta.post_id)
WHERE $wpdb->posts.post_status = 'publish'
AND $wpdb->postmeta.meta_value LIKE '%".$_SESSION["type-".$lang.""]."%'
AND $wpdb->postmeta.meta_key = 'type-".$lang."'
AND $wpdb->posts.post_parent = ".$post_parent."
AND $wpdb->posts.ID IN
(SELECT DISTINCT $wpdb->posts.ID
FROM $wpdb->posts
LEFT JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id)
WHERE $wpdb->posts.post_status = 'publish'
".$txt_ict."
AND $wpdb->postmeta.meta_key = 'ict-".$lang."'
AND $wpdb->posts.post_parent = ".$post_parent."
GROUP BY $wpdb->posts.post_title)
GROUP BY $wpdb->posts.post_title
ORDER BY $wpdb->posts.post_title ASC");
}else{
$rows = $wpdb->get_results("SELECT DISTINCT $wpdb->posts.ID, $wpdb->posts.post_title
FROM $wpdb->posts
LEFT JOIN $wpdb->postmeta ON($wpdb->posts.ID = $wpdb->postmeta.post_id)
WHERE $wpdb->posts.post_status = 'publish'
AND $wpdb->posts.post_parent = ".$post_parent."
AND ($wpdb->postmeta.meta_key = 'cognitive-".$lang."' OR $wpdb->postmeta.meta_key = 'ict-".$lang."' OR $wpdb->postmeta.meta_key = 'players-".$lang."' OR $wpdb->postmeta.meta_key = 'type-".$lang."')
GROUP BY $wpdb->posts.post_title
ORDER BY $wpdb->posts.post_title ASC");
}
// loop through the results
if( $rows || $rows1)
{
echo $title;
if (isset($_POST["cognitive-".$lang.""])) {
if (count($rows) > 0) {
echo "";
echo "
".$main_dimension." br>
";
foreach( $rows as $row )
{
// load image src
// - https://www.advancedcustomfields.com/resources/field-types/image/
$src = wp_get_attachment_image_src( get_post_thumbnail_id($row->ID), 'full'); //medium
?>
";
}
if (count($rows1) > 0) {
echo "";
echo "
".$secondary_dimension." br>
";
foreach( $rows1 as $row )
{
// load image src
// - https://www.advancedcustomfields.com/resources/field-types/image/
$src = wp_get_attachment_image_src( get_post_thumbnail_id($row->ID), 'full'); //medium
?>
";
}
echo "";
}else{
foreach( $rows as $row )
{
// load image src
// - https://www.advancedcustomfields.com/resources/field-types/image/
$src = wp_get_attachment_image_src( get_post_thumbnail_id($row->ID), 'full'); //medium
?>
';
?>