Inheritance: extends DatabaseObject, implements IGeoMapLocation
 /**
  * Creates the list of objects. Sets the parameter $p_hasNextElements to
  * true if this list is limited and elements still exist in the original
  * list (from which this was truncated) after the last element of this
  * list.
  *
  * @param int $p_start
  * @param int $p_limit
  * @param array $p_parameters
  * @param int &$p_count
  * @return array
  */
 protected function CreateList($p_start = 0, $p_limit = 0, array $p_parameters, &$p_count)
 {
     $articleLocationsList = Geo_MapLocation::GetList($this->m_constraints, $this->m_order, $p_start, $p_limit, $p_count);
     $metaLocationsList = array();
     foreach ($articleLocationsList as $location) {
         $metaLocationsList[] = new MetaMapLocation($location);
     }
     return $metaLocationsList;
 }
Example #2
0
 /**
  * Gives the SQL query for article searching via their point inside the box specified by the p_coordinates.
  * The (two) corner lon/lat coordinates should go west to east.
  *
  * @param array $p_coordinates
  *
  * @return string
  */
 public static function GetGeoSearchSQLQuery($p_coordinates)
 {
     $queryStr = '';
     $queryStr_1 = '';
     $queryStr_2 = '';
     $queryStr_end = '';
     $queryStr .= 'SELECT DISTINCT m.fk_article_number AS Number FROM Maps AS m INNER JOIN MapLocations AS ml ON m.id = ml.fk_map_id INNER JOIN ';
     $queryStr .= 'Locations AS l ON ml.fk_location_id = l.id WHERE ';
     $cons_res = Geo_MapLocation::GetGeoSearchSQLCons($p_coordinates, 'rectangle', 'l');
     if ($cons_res['error']) {
         return '';
     }
     $queryStr .= $cons_res['cons'];
     $queryStr_end .= 'AND m.fk_article_number != 0';
     $queryStr .= $queryStr_end;
     return $queryStr;
 }
Example #3
0
 /**
  * @return array of IGeoMapLocation
  */
 public function getLocations()
 {
     $locations = Geo_MapLocation::GetByMap($this);
     return (array) $locations;
 }
/**
 * Campsite set_map function plugin
 *
 * Type:     function
 * Name:     set_map
 * Purpose:
 *
 * @param array
 *     $p_params the map constarints set at the template
 * @param object
 *     $p_smarty The Smarty object
 */
function smarty_function_set_map($p_params, &$p_smarty)
{
    // gets the context variable
    $campsite = $p_smarty->getTemplateVars('gimme');
    $run_article = $campsite->article->defined ? $campsite->article : null;
    $run_language = $campsite->language;
    $run_topic = $campsite->topic->defined ? $campsite->topic : null;
    $parameters = array();
    $running = '_current';
    $of_article = '_article';
    $map_label = '';
    $map_max_points = 0;
    $con_article_types = array();
    $con_authors = array();
    $con_articles = array();
    $con_issues_num = array();
    $con_sections_num = array();
    $con_sections_str = array();
    $con_topics = array();
    $con_match_all_topics = array();
    $con_has_multimedia = array();
    $con_start_date = array();
    $con_end_date = array();
    $con_date = array();
    $con_areas = array();
    $con_match_any_area = array();
    $con_exact_area = array();
    $con_icons = array();
    if (isset($p_params['label'])) {
        $map_label = trim('' . $p_params['label']);
    }
    if (isset($p_params['max_points'])) {
        $map_max_points = trim('' . $p_params['max_points']);
        if (!is_numeric($map_max_points)) {
            $map_max_points = 0;
        }
        $map_max_points = 0 + $map_max_points;
    }
    $campsite->map_dynamic_max_points = $map_max_points;
    if (isset($p_params['article_types'])) {
        foreach (explode(',', $p_params['article_types']) as $one_article_type) {
            $one_article_type = trim('' . $one_article_type);
            if (0 < strlen($one_article_type)) {
                if ($of_article == $one_article_type) {
                    if ($run_article) {
                        $con_article_types[] = $run_article->type_name;
                    }
                } else {
                    $con_article_types[] = $one_article_type;
                }
            }
        }
    }
    if (isset($p_params['authors'])) {
        foreach (explode(',', $p_params['authors']) as $one_author) {
            $one_author = trim('' . $one_author);
            if (0 < strlen($one_author)) {
                if ($of_article == $one_author) {
                    if ($run_article) {
                        $run_authors = $run_article->authors;
                        foreach ($run_authors as $art_author) {
                            $con_authors[] = $art_author->name;
                        }
                    }
                } else {
                    $con_authors[] = $one_author;
                }
            }
        }
    }
    if (isset($p_params['articles'])) {
        foreach (explode(',', '' . $p_params['articles']) as $one_article) {
            $one_article = trim('' . $one_article);
            if (is_numeric($one_article)) {
                $con_articles[] = $one_article;
            }
        }
    }
    if (isset($p_params['issues'])) {
        foreach (explode(',', $p_params['issues']) as $one_issue) {
            $one_issue = trim('' . $one_issue);
            if ($running == $one_issue) {
                if ($run_article) {
                    $run_issue = $run_article->issue;
                    if ($run_issue) {
                        $con_issues_num[] = $run_issue->number;
                    }
                }
            } else {
                if (is_numeric($one_issue)) {
                    $con_issues_num[] = $one_issue;
                }
            }
        }
    }
    if (isset($p_params['sections'])) {
        foreach (explode(',', $p_params['sections']) as $one_section) {
            $one_section = trim('' . $one_section);
            if ($running == $one_section) {
                if ($run_article) {
                    $run_section = $run_article->section;
                    if ($run_section) {
                        $con_sections_num[] = $run_section->number;
                    }
                }
            } elseif (is_numeric($one_section)) {
                $con_sections_num[] = $one_section;
            } elseif (0 < strlen($one_section)) {
                $one_section = trim($one_section);
                $con_sections_str[] = $one_section;
            }
        }
    }
    if (isset($p_params['topics'])) {
        foreach (explode(',', $p_params['topics']) as $one_topic) {
            $one_topic = trim('' . $one_topic);
            if (0 < strlen($one_topic)) {
                if ($of_article == $one_topic) {
                    if ($run_article) {
                        $run_topics = $run_article->topics;
                        foreach ($run_topics as $art_topic) {
                            $con_topics[] = $art_topic . ':' . $run_language->code;
                        }
                    }
                } elseif ($running == $one_topic) {
                    if ($run_topic) {
                        $cur_topic = $run_topic->name;
                        if (!empty($cur_topic)) {
                            $con_topics[] = htmlspecialchars_decode($cur_topic);
                        }
                    }
                } else {
                    $one_topic = trim($one_topic);
                    $con_topics[] = $one_topic;
                }
            }
        }
    }
    $values_known_yes = array('true' => true, 'yes' => true);
    $values_known_no = array('false' => true, 'no' => true);
    if (isset($p_params['match_all_topics'])) {
        $match_all_topics_val = $p_params['match_all_topics'];
        if (is_bool($match_all_topics_val)) {
            $con_match_all_topics[0] = $match_all_topics_val;
        } elseif (is_string($match_all_topics_val)) {
            $match_all_topics_val = trim(strtolower($match_all_topics_val));
            if (array_key_exists($match_all_topics_val, $values_known_yes)) {
                $con_match_all_topics[0] = true;
            }
            if (array_key_exists($match_all_topics_val, $values_known_no)) {
                $con_match_all_topics[0] = false;
            }
        }
    }
    if (isset($p_params['match_any_topic'])) {
        $match_any_topic_val = $p_params['match_any_topic'];
        if (is_bool($match_any_topic_val)) {
            $con_match_all_topics[0] = !$match_any_topic_val;
        } elseif (is_string($match_any_topic_val)) {
            $match_any_topic_val = trim(strtolower($match_any_topic_val));
            if (array_key_exists($match_any_topic_val, $values_known_yes)) {
                $con_match_all_topics[0] = false;
            }
            if (array_key_exists($match_any_topic_val, $values_known_no)) {
                $con_match_all_topics[0] = true;
            }
        }
    }
    if (isset($p_params['has_multimedia'])) {
        $has_multimedia_val = $p_params['has_multimedia'];
        if (is_bool($has_multimedia_val)) {
            if ($has_multimedia_val) {
                $con_has_multimedia[0] = 'any';
            } else {
                $con_has_multimedia = array();
            }
        } elseif (is_string($has_multimedia_val)) {
            $has_multimedia_val = trim(strtolower($has_multimedia_val));
            if (array_key_exists($has_multimedia_val, $values_known_yes)) {
                $con_has_multimedia[0] = 'any';
            }
            if (array_key_exists($has_multimedia_val, $values_known_no)) {
                $con_has_multimedia = array();
            }
            if ('video' == $has_multimedia_val) {
                $con_has_multimedia[0] = 'video';
            }
            if ('image' == $has_multimedia_val) {
                $con_has_multimedia[0] = 'image';
            }
        }
    }
    if (isset($p_params['start_date'])) {
        $start_date_val = trim($p_params['start_date']);
        $start_date_val = str_replace('"', '""', trim($start_date_val));
        if (0 < strlen($start_date_val)) {
            $con_start_date[0] = $start_date_val;
        }
    }
    if (isset($p_params['end_date'])) {
        $end_date_val = trim($p_params['end_date']);
        $end_date_val = str_replace('"', '""', trim($end_date_val));
        if (0 < strlen($end_date_val)) {
            $con_end_date[0] = $end_date_val;
        }
    }
    if (isset($p_params['date'])) {
        $date_val = trim($p_params['date']);
        $date_val = str_replace('"', '""', trim($date_val));
        if (0 < strlen($date_val)) {
            $con_date[0] = $date_val;
        }
    }
    if (isset($p_params['area'])) {
        $area_val = trim($p_params['area']);
        if (0 < strlen($area_val)) {
            aux_parser_set_map_area($area_val, $con_areas);
        }
    }
    if (isset($p_params['areas'])) {
        $area_val = trim($p_params['areas']);
        if (0 < strlen($area_val)) {
            aux_parser_set_map_area($area_val, $con_areas);
        }
    }
    if (isset($p_params['area_match'])) {
        $area_match_val = $p_params['area_match'];
        if (is_string($area_match_val)) {
            $area_match_val = strtolower($area_match_val);
            if ('intersection' == $area_match_val) {
                $con_match_any_area[0] = false;
            }
            if ('union' == $area_match_val) {
                $con_match_any_area[0] = true;
            }
        }
    }
    if (isset($p_params['area_exact'])) {
        $area_exact_val = $p_params['area_exact'];
        if (is_string($area_exact_val)) {
            $area_exact_val = strtolower($area_exact_val);
            if ('false' == $area_exact_val) {
                $con_exact_area[0] = false;
            }
            if ('true' == $area_exact_val) {
                $con_exact_area[0] = true;
            }
        } else {
            if ($area_exact_val) {
                $con_exact_area[0] = true;
            } else {
                $con_exact_area[0] = false;
            }
        }
    }
    if (isset($p_params['icons'])) {
        $icons_val = trim($p_params['icons']);
        foreach (explode(',', $icons_val) as $cur_icon) {
            $cur_icon = str_replace('"', '""', trim($cur_icon));
            if (0 < strlen($cur_icon)) {
                $con_icons[] = $cur_icon;
            }
        }
    }
    // to put the read constraints into parameters list
    foreach ($con_article_types as $one_article_type) {
        $leftOperand = 'article_type';
        $rightOperand = $one_article_type;
        $operator = new Operator('is', 'sql');
        $constraint = new ComparisonOperation($leftOperand, $operator, $rightOperand);
        $parameters[] = $constraint;
    }
    foreach ($con_authors as $one_author) {
        $leftOperand = 'author';
        $rightOperand = $one_author;
        $operator = new Operator('is', 'sql');
        $constraint = new ComparisonOperation($leftOperand, $operator, $rightOperand);
        $parameters[] = $constraint;
    }
    foreach ($con_articles as $one_article) {
        $leftOperand = 'article';
        $rightOperand = $one_article;
        $operator = new Operator('is', 'sql');
        $constraint = new ComparisonOperation($leftOperand, $operator, $rightOperand);
        $parameters[] = $constraint;
    }
    foreach ($con_issues_num as $one_issue) {
        $leftOperand = 'issue';
        $rightOperand = $one_issue;
        $operator = new Operator('is', 'sql');
        $constraint = new ComparisonOperation($leftOperand, $operator, $rightOperand);
        $parameters[] = $constraint;
    }
    foreach ($con_sections_num as $one_section) {
        $leftOperand = 'section';
        $rightOperand = $one_section;
        $operator = new Operator('is', 'sql');
        $constraint = new ComparisonOperation($leftOperand, $operator, $rightOperand);
        $parameters[] = $constraint;
    }
    foreach ($con_sections_str as $one_section) {
        $leftOperand = 'section_name';
        $rightOperand = $one_section;
        $operator = new Operator('is', 'sql');
        $constraint = new ComparisonOperation($leftOperand, $operator, $rightOperand);
        $parameters[] = $constraint;
    }
    foreach ($con_topics as $one_topic) {
        $leftOperand = 'topic_name';
        $rightOperand = $one_topic;
        $operator = new Operator('is', 'sql');
        $constraint = new ComparisonOperation($leftOperand, $operator, $rightOperand);
        $parameters[] = $constraint;
    }
    if (1 == count($con_match_all_topics)) {
        $leftOperand = 'matchalltopics';
        $rightOperand = $con_match_all_topics[0];
        $operator = new Operator('is', 'sql');
        $constraint = new ComparisonOperation($leftOperand, $operator, $rightOperand);
        $parameters[] = $constraint;
    }
    foreach ($con_has_multimedia as $one_multimedia) {
        $leftOperand = 'multimedia';
        $rightOperand = $one_multimedia;
        $operator = new Operator('is', 'php');
        $constraint = new ComparisonOperation($leftOperand, $operator, $rightOperand);
        $parameters[] = $constraint;
    }
    if (0 < count($con_start_date)) {
        $leftOperand = 'date';
        $rightOperand = $con_start_date;
        $operator = new Operator('greater_equal', 'sql');
        $constraint = new ComparisonOperation($leftOperand, $operator, $rightOperand);
        $parameters[] = $constraint;
    }
    if (0 < count($con_end_date)) {
        $leftOperand = 'date';
        $rightOperand = $con_end_date;
        $operator = new Operator('smaller_equal', 'sql');
        $constraint = new ComparisonOperation($leftOperand, $operator, $rightOperand);
        $parameters[] = $constraint;
    }
    if (0 < count($con_date)) {
        $leftOperand = 'date';
        $rightOperand = $con_date;
        $operator = new Operator('is', 'sql');
        $constraint = new ComparisonOperation($leftOperand, $operator, $rightOperand);
        $parameters[] = $constraint;
    }
    foreach ($con_areas as $one_area) {
        $leftOperand = 'area';
        $rightOperand = json_encode($one_area);
        $operator = new Operator('is', 'php');
        $constraint = new ComparisonOperation($leftOperand, $operator, $rightOperand);
        $parameters[] = $constraint;
    }
    if (0 < count($con_match_any_area)) {
        $leftOperand = 'matchanyarea';
        $rightOperand = $con_match_any_area[0];
        $operator = new Operator('is', 'sql');
        $constraint = new ComparisonOperation($leftOperand, $operator, $rightOperand);
        $parameters[] = $constraint;
    }
    if (0 < count($con_exact_area)) {
        $leftOperand = 'exactarea';
        $rightOperand = $con_exact_area[0];
        $operator = new Operator('is', 'sql');
        $constraint = new ComparisonOperation($leftOperand, $operator, $rightOperand);
        $parameters[] = $constraint;
    }
    foreach ($con_icons as $one_icon) {
        $leftOperand = 'icon';
        $rightOperand = $one_icon;
        $operator = new Operator('is', 'sql');
        $constraint = new ComparisonOperation($leftOperand, $operator, $rightOperand);
        $parameters[] = $constraint;
    }
    $run_publicationId = 0;
    if (CampTemplate::singleton()) {
        $Context = CampTemplate::singleton()->context();
        if ($Context->publication) {
            $run_publicationId = $Context->publication->identifier;
        }
    }
    $leftOperand = 'publication';
    $rightOperand = $run_publicationId;
    $operator = new Operator('is', 'sql');
    $constraint = new ComparisonOperation($leftOperand, $operator, $rightOperand);
    $parameters[] = $constraint;
    $campsite->map_dynamic_constraints = $parameters;
    if (!empty($con_areas)) {
        $campsite->map_dynamic_areas = json_encode($con_areas);
    } else {
        $campsite->map_dynamic_areas = null;
    }
    $campsite->map_dynamic_map_label = $map_label;
    $leftOperand = 'as_array';
    $rightOperand = true;
    $operator = new Operator('is', 'php');
    $constraint = new ComparisonOperation($leftOperand, $operator, $rightOperand);
    $parameters[] = $constraint;
    $leftOperand = 'active_only';
    $rightOperand = true;
    $operator = new Operator('is', 'php');
    $constraint = new ComparisonOperation($leftOperand, $operator, $rightOperand);
    $parameters[] = $constraint;
    $leftOperand = 'text_only';
    $rightOperand = false;
    $operator = new Operator('is', 'php');
    $constraint = new ComparisonOperation($leftOperand, $operator, $rightOperand);
    $parameters[] = $constraint;
    $leftOperand = 'language';
    $rightOperand = (int) $run_language->number;
    $operator = new Operator('is', 'php');
    $constraint = new ComparisonOperation($leftOperand, $operator, $rightOperand);
    $parameters[] = $constraint;
    $leftOperand = 'constrained';
    $rightOperand = true;
    $operator = new Operator('is', 'php');
    $constraint = new ComparisonOperation($leftOperand, $operator, $rightOperand);
    $parameters[] = $constraint;
    $poi_count = 0;
    $poi_array = array();
    $poi_objects = Geo_MapLocation::GetListExt($parameters, array(), 0, $map_max_points, $poi_count, false, $poi_array);
    $campsite->map_dynamic_tot_points = $poi_count;
    $map_art_ids = array();
    $art_backlinks = array();
    $meta_art_objs = array();
    $arts_per_pois = array();
    $poi_retrieved_count = count($poi_array);
    for ($poi_idx = 0; $poi_idx < $poi_retrieved_count; $poi_idx++) {
        $poi_arts = array();
        $articleNos = $poi_array[$poi_idx]['art_numbers'];
        if (0 < strlen($articleNos)) {
            foreach (explode(',', $articleNos) as $one_art) {
                $one_art = trim($one_art);
                if (0 == strlen($one_art)) {
                    continue;
                }
                if (!is_numeric($one_art)) {
                    continue;
                }
                $one_art = 0 + $one_art;
                $poi_arts[] = $one_art;
                $map_art_ids[$one_art] = true;
            }
        }
        if (0 == count($poi_arts)) {
            $articleNo = $poi_array[$poi_idx]['art_number'];
            if (is_numeric($articleNo)) {
                $articleNo = 0 + $articleNo;
                if (0 < $articleNo) {
                    $poi_arts[] = $articleNo;
                    $map_art_ids[$articleNo] = true;
                }
            }
        }
        $arts_per_pois[] = $poi_arts;
    }
    foreach ($map_art_ids as $one_art_id => $one_art_aux) {
        $myArticle = new MetaArticle((int) $run_language->number, $one_art_id);
        $meta_art_objs[$one_art_id] = $myArticle;
        $url = CampSite::GetURIInstance();
        $url->publication = $myArticle->publication;
        $url->issue = $myArticle->issue;
        $url->section = $myArticle->section;
        $url->article = $myArticle;
        $articleURI = $url->getURI('article');
        $article_name = $myArticle->name;
        $art_backlinks[$one_art_id] = array('link' => $articleURI, 'label' => $article_name);
    }
    krsort($meta_art_objs);
    for ($poi_idx = 0; $poi_idx < $poi_retrieved_count; $poi_idx++) {
        $curr_back_list = array();
        $curr_art_ids = $arts_per_pois[$poi_idx];
        foreach ($curr_art_ids as $one_art_id) {
            $curr_back_list[] = $art_backlinks[$one_art_id];
        }
        if (0 < count($curr_back_list)) {
            $poi_array[$poi_idx]['backlinks'] = $curr_back_list;
        }
    }
    $campsite->map_dynamic_points_raw = $poi_array;
    $campsite->map_dynamic_points_objects = $poi_objects;
    $campsite->map_dynamic_meta_article_objects = $meta_art_objs;
    $campsite->map_dynamic_id_counter += 1;
}
Example #5
0
 /**
  * Returns map locations list based on the given parameters.
  *
  * @param array $p_parameters
  *    An array of ComparionOperation objects
  * @param array $p_order
  *    An array of columns and directions to order by
  * @param integer $p_start
  *    The record number to start the list
  * @param integer $p_limit
  *    The offset, how many records from $p_start will be retrieved
  * @param integer $p_count
  *    Total count of POIs without p_start/p_limit limitations
  * @param bool $p_skipCache
  *    Whether to skip caching
  * @param array $p_rawData
  *    The variable for returning read points as raw array, used for the JS processing
  *
  * @return array
  */
 public static function GetListExt(array $p_parameters, array $p_order = array(), $p_start = 0, $p_limit = 0, &$p_count, $p_skipCache = false, &$p_rawData = null)
 {
     $p_count = 0;
     if (!is_numeric($p_limit)) {
         $p_limit = 0;
     }
     if (!is_numeric($p_start)) {
         $p_start = 0;
     }
     $ps_saveArray = false;
     if (!is_null($p_rawData)) {
         $ps_saveArray = true;
         $p_rawData = array();
     }
     $list_spec = array('params' => $p_parameters, 'order' => $p_order, 'start' => $p_start, 'limit' => $p_limit, 'skip_cache' => $p_skipCache, 'raw_data' => $p_rawData);
     $list_spec_str = serialize($list_spec);
     if (!$p_skipCache && !empty(self::$s_found_maplocations_list_ext) && isset(self::$s_found_maplocations_list_ext[$list_spec_str])) {
         $list_res_data = self::$s_found_maplocations_list_ext[$list_spec_str];
         $p_count = $list_res_data['count'];
         $list_obj = $list_res_data['list_obj'];
         if ($ps_saveArray) {
             $p_rawData = $list_res_data['list_raw'];
         }
         return $list_obj;
     }
     $ps_mapId = 0;
     $ps_languageId = 0;
     $ps_preview = false;
     // read all the info, mostly cached at the upstream
     $ps_publicationId = 0;
     $mc_mapCons = false;
     $mc_article_types_yes = array();
     $mc_article_types_no = array();
     $mc_authors_yes = array();
     $mc_authors_no = array();
     $mc_users_yes = array();
     $mc_users_no = array();
     $mc_articles_yes = array();
     $mc_articles_no = array();
     $mc_issues = array();
     $mc_sections = array();
     $mc_section_names = array();
     $mc_topics = array();
     $mc_topic_names = array();
     $mc_topics_matchall = false;
     $mc_multimedia = array();
     $mc_areas = array();
     $mc_areas_matchall = false;
     $mc_areas_exact = true;
     $mc_dates = array();
     $mc_icons = array();
     // process params
     foreach ($p_parameters as $param) {
         switch ($param->getLeftOperand()) {
             case 'constrained':
                 $mc_mapCons = true;
             case 'map':
                 if (is_numeric($param->getRightOperand())) {
                     $ps_mapId = $param->getRightOperand();
                 }
                 break;
             case 'language':
                 if (is_numeric($param->getRightOperand())) {
                     $ps_languageId = 0 + $param->getRightOperand();
                 }
                 break;
             case 'active_only':
             case 'preview':
                 $ps_preview = $param->getRightOperand();
                 break;
             case 'publication':
                 $ps_publicationId = (int) $param->getRightOperand();
                 break;
             case 'article_type':
                 $one_arttp_value = $param->getRightOperand();
                 $one_arttp_type = $param->getOperator()->getName();
                 if ('is' == $one_arttp_type) {
                     $mc_article_types_yes[] = $one_arttp_value;
                     $mc_mapCons = true;
                 }
                 if ('not' == $one_arttp_type) {
                     $mc_article_types_no[] = $one_arttp_value;
                     $mc_mapCons = true;
                 }
                 break;
             case 'author':
                 $one_user_value = $param->getRightOperand();
                 $one_user_type = $param->getOperator()->getName();
                 if ('is' == $one_user_type) {
                     $mc_authors_yes[] = $one_user_value;
                     $mc_mapCons = true;
                 }
                 if ('not' == $one_user_type) {
                     $mc_authors_no[] = $one_user_value;
                     $mc_mapCons = true;
                 }
                 break;
             case 'article':
                 $one_article_value = $param->getRightOperand();
                 $one_article_type = $param->getOperator()->getName();
                 if ('is' == $one_article_type) {
                     $mc_articles_yes[] = $one_article_value;
                     $mc_mapCons = true;
                 }
                 if ('not' == $one_article_type) {
                     $mc_articles_no[] = $one_article_value;
                     $mc_mapCons = true;
                 }
                 break;
             case 'issue':
                 $mc_issues[] = $param->getRightOperand();
                 $mc_mapCons = true;
                 break;
             case 'section':
                 $mc_sections[] = $param->getRightOperand();
                 $mc_mapCons = true;
                 break;
             case 'section_name':
                 $mc_section_names[] = $param->getRightOperand();
                 $mc_mapCons = true;
                 break;
             case 'topic':
                 $mc_topics[] = $param->getRightOperand();
                 $mc_mapCons = true;
                 break;
             case 'topic_name':
                 $mc_topic_names[] = $param->getRightOperand();
                 $mc_mapCons = true;
                 break;
             case 'matchalltopics':
                 $mc_topics_matchall = $param->getRightOperand();
                 break;
             case 'matchanytopic':
                 $mc_topics_matchall = !$param->getRightOperand();
                 break;
             case 'multimedia':
                 $mc_multimedia[] = $param->getRightOperand();
                 $mc_mapCons = true;
                 break;
             case 'area':
                 $mc_areas[] = json_decode($param->getRightOperand());
                 $mc_mapCons = true;
                 break;
             case 'matchallareas':
                 $mc_areas_matchall = $param->getRightOperand();
                 break;
             case 'matchanyarea':
                 $mc_areas_matchall = !$param->getRightOperand();
                 break;
             case 'exactarea':
                 $mc_areas_exact = $param->getRightOperand();
                 break;
             case 'date':
                 $mc_dates[$param->getOperator()->getName()] = $param->getRightOperand();
                 $mc_mapCons = true;
                 break;
             case 'icon':
                 $mc_icons[] = $param->getRightOperand();
                 $mc_mapCons = true;
                 break;
             default:
                 break;
         }
     }
     // constrained maps ned to have set publication
     if ($mc_mapCons && !$ps_publicationId) {
         return array();
     }
     if (!$ps_languageId || 0 >= $ps_languageId) {
         $ps_languageId = $Context->language->number;
     }
     if (!$ps_languageId || 0 >= $ps_languageId) {
         return array();
     }
     if (!CampCache::IsEnabled()) {
         $p_skipCache = true;
     }
     $ps_orders = array();
     if (!$p_order || !is_array($p_order) || 0 == count($p_order)) {
         if ($mc_mapCons) {
             $ps_orders = array(array('a.Number' => 'DESC'), array('m.id' => 'DESC'));
         }
     } else {
         $allowed_order_dirs = array('DESC' => true, 'ASC' => true);
         foreach ($p_order as $one_order_column => $one_order_dir) {
             $one_dir = strtoupper($one_order_dir);
             if (!array_key_exists($one_dir, $allowed_order_dirs)) {
                 continue;
             }
             switch (strtolower($one_order_column)) {
                 case 'article':
                     if (!$mc_mapCons) {
                         break;
                     }
                     $ps_orders[] = array('a.Number' => $one_dir);
                     break;
                 case 'map':
                     $ps_orders[] = array('m.id' => $one_dir);
                     break;
                 case 'name':
                     $ps_orders[] = array('c.poi_name' => $one_dir);
                     break;
             }
         }
     }
     if ((0 == $ps_mapId || !$ps_mapId) && !$mc_mapCons) {
         return array();
     }
     $mc_limit = 0 + $p_limit;
     if (0 > $mc_limit) {
         $mc_limit = 0;
     }
     $mc_start = 0 + $p_start;
     if (0 > $mc_start) {
         $mc_start = 0;
     }
     $dataArray = array();
     $objsArray = array();
     $cachedData = null;
     $paramsArray_arr = array();
     $paramsArray_obj = array();
     $cacheList_arr = null;
     $cacheList_obj = null;
     if (!$p_skipCache) {
         $paramsArray_arr['as_array'] = true;
         $paramsArray_arr['map_id'] = $ps_mapId;
         $paramsArray_arr['publication_id'] = $ps_publicationId;
         $paramsArray_arr['language_id'] = $ps_languageId;
         $paramsArray_arr['preview'] = $ps_preview;
         $paramsArray_arr['map_cons'] = $mc_mapCons;
         $paramsArray_arr['article_types_yes'] = $mc_article_types_yes;
         $paramsArray_arr['article_types_no'] = $mc_article_types_no;
         $paramsArray_arr['authors_yes'] = $mc_authors_yes;
         $paramsArray_arr['authors_no'] = $mc_authors_no;
         $paramsArray_arr['articles_yes'] = $mc_articles_yes;
         $paramsArray_arr['articles_no'] = $mc_articles_no;
         $paramsArray_arr['issues'] = $mc_issues;
         $paramsArray_arr['sections'] = $mc_sections;
         $paramsArray_arr['section_names'] = $mc_section_names;
         $paramsArray_arr['topics'] = $mc_topics;
         $paramsArray_arr['topic_names'] = $mc_topic_names;
         $paramsArray_arr['topics_matchall'] = $mc_topics_matchall;
         $paramsArray_arr['multimedia'] = $mc_multimedia;
         $paramsArray_arr['areas'] = $mc_areas;
         $paramsArray_arr['areas_matchall'] = $mc_areas_matchall;
         $paramsArray_arr['areas_exact'] = $mc_areas_exact;
         $paramsArray_arr['dates'] = $mc_dates;
         $paramsArray_arr['icons'] = $mc_icons;
         $paramsArray_arr['orders'] = $ps_orders;
         $paramsArray_arr['limit'] = $mc_limit;
         $paramsArray_arr['start'] = $mc_start;
         $paramsArray_obj = $paramsArray_arr;
         $paramsArray_obj['as_array'] = false;
         $cacheList_arr = new CampCacheList($paramsArray_arr, __METHOD__);
         $cacheList_obj = new CampCacheList($paramsArray_obj, __METHOD__);
         if ($ps_saveArray) {
             $cachedData = $cacheList_arr->fetchFromCache();
             if ($cachedData !== false && is_array($cachedData)) {
                 $p_count = $cachedData['count'];
                 $p_rawData = $cachedData['data'];
             }
         }
         $cachedData = $cacheList_obj->fetchFromCache();
         if ($cachedData !== false && is_array($cachedData)) {
             $p_count = $cachedData['count'];
             return $cachedData['data'];
         }
     }
     global $g_ado_db;
     if (0 < count($mc_authors_yes)) {
         $author_ids_req_names = ArticleAuthor::BuildAuthorIdsQuery($mc_authors_yes);
         $author_ids_req_alias = AuthorAlias::BuildAuthorIdsQuery($mc_authors_yes);
         if ($author_ids_req_names) {
             $rows = $g_ado_db->GetAll($author_ids_req_names);
             if (is_array($rows)) {
                 foreach ($rows as $row) {
                     $mc_users_yes[] = trim(strtolower($row['id']));
                 }
             }
         }
         if ($author_ids_req_alias) {
             $rows = $g_ado_db->GetAll($author_ids_req_alias);
             if (is_array($rows)) {
                 foreach ($rows as $row) {
                     $mc_users_yes[] = trim(strtolower($row['id']));
                 }
             }
         }
         if (0 == count($mc_users_yes)) {
             return array();
         }
     }
     if (0 < count($mc_authors_no)) {
         $author_ids_req_names = ArticleAuthor::BuildAuthorIdsQuery($mc_authors_no);
         $author_ids_req_alias = AuthorAlias::BuildAuthorIdsQuery($mc_authors_no);
         if ($author_ids_req_names) {
             $rows = $g_ado_db->GetAll($author_ids_req_names);
             if (is_array($rows)) {
                 foreach ($rows as $row) {
                     $mc_users_no[] = trim(strtolower($row['id']));
                 }
             }
         }
         if ($author_ids_req_alias) {
             $rows = $g_ado_db->GetAll($author_ids_req_alias);
             if (is_array($rows)) {
                 foreach ($rows as $row) {
                     $mc_users_no[] = trim(strtolower($row['id']));
                 }
             }
         }
     }
     if (0 < count($mc_section_names)) {
         $section_ids_req_names = Section::BuildSectionIdsQuery($mc_section_names, $ps_publicationId);
         if ($section_ids_req_names) {
             $rows = $g_ado_db->GetAll($section_ids_req_names);
             if (is_array($rows)) {
                 foreach ($rows as $row) {
                     $mc_sections[] = trim(strtolower($row['id']));
                 }
             }
         }
         if (0 == count($mc_sections)) {
             return array();
         }
     }
     if (0 < count($mc_topic_names)) {
         $topic_ids_req_names = TopicName::BuildTopicIdsQuery($mc_topic_names);
         if ($topic_ids_req_names) {
             $rows = $g_ado_db->GetAll($topic_ids_req_names);
             if (is_array($rows)) {
                 foreach ($rows as $row) {
                     $mc_topics[] = trim(strtolower($row['id']));
                 }
             }
         }
         if (0 == count($mc_topics)) {
             return array();
         }
     }
     $ps_orders = array();
     if (!$p_order || !is_array($p_order) || 0 == count($p_order)) {
         if ($mc_mapCons) {
             $ps_orders = array(array('a.PublishDate' => 'DESC'), array('a.Number' => 'DESC'), array('m.id' => 'DESC'));
         }
     } else {
         $allowed_order_dirs = array('DESC' => true, 'ASC' => true);
         foreach ($p_order as $one_order_column => $one_order_dir) {
             $one_dir = strtoupper($one_order_dir);
             if (!array_key_exists($one_dir, $allowed_order_dirs)) {
                 continue;
             }
             switch (strtolower($one_order_column)) {
                 case 'publish':
                 case 'published':
                     if (!$mc_mapCons) {
                         break;
                     }
                     $ps_orders[] = array('a.PublishDate' => $one_dir);
                     break;
                 case 'article':
                     if (!$mc_mapCons) {
                         break;
                     }
                     $ps_orders[] = array('a.Number' => $one_dir);
                     break;
                 case 'map':
                     $ps_orders[] = array('m.id' => $one_dir);
                     break;
                 case 'name':
                     $ps_orders[] = array('c.poi_name' => $one_dir);
                     break;
             }
         }
     }
     if ((0 == $ps_mapId || !$ps_mapId) && !$mc_mapCons) {
         return array();
     }
     $queryStr = '';
     $queryStr_start = '';
     $queryStr_start .= 'SELECT DISTINCT ml.id AS ml_id, mll.id as mll_id, ml.fk_location_id AS loc_id, mll.fk_content_id AS con_id, ';
     $queryStr_start .= 'ml.poi_style AS poi_style, ml.rank AS rank, mll.poi_display AS poi_display, ';
     // these few lines below are just for data for list-of-objects array
     $queryStr_start .= 'l.poi_radius AS l_radius, l.IdUser AS l_user, l.time_updated AS l_updated, ';
     if ($mc_mapCons) {
         $queryStr_start .= 'm.id AS m_id, m.IdUser AS m_user, m.fk_article_number AS art_number, GROUP_CONCAT(DISTINCT m.fk_article_number ORDER BY m.fk_article_number DESC) AS art_numbers, ';
     }
     $multimedia_def = "CONCAT(mu.id, \"-\", mlmu.id)";
     if ($mc_mapCons) {
         $multimedia_def = 'mu.id';
     }
     $queryStr_start .= "(SELECT {$multimedia_def} FROM MapLocationMultimedia AS mlmu INNER JOIN Multimedia AS mu ON mlmu.fk_multimedia_id = mu.id WHERE mlmu.fk_maplocation_id = ml.id AND mu.media_type = 'image' ORDER BY mu.id LIMIT 1) AS image_mm, ";
     $queryStr_start .= "(SELECT {$multimedia_def} FROM MapLocationMultimedia AS mlmu INNER JOIN Multimedia AS mu ON mlmu.fk_multimedia_id = mu.id WHERE mlmu.fk_maplocation_id = ml.id AND mu.media_type = 'video' ORDER BY mu.id LIMIT 1) AS video_mm, ";
     $queryStr_start .= 'c.IdUser AS c_user, c.time_updated AS c_updated, ';
     $queryStr_start .= 'AsText(l.poi_location) AS loc, l.poi_type AS poi_type, l.poi_type_style AS poi_type_style, ';
     $queryStr_start .= 'c.poi_name AS poi_name, c.poi_link AS poi_link, c.poi_perex AS poi_perex, ';
     $queryStr_start .= 'c.poi_content_type AS poi_content_type, c.poi_content AS poi_content, c.poi_text AS poi_text ';
     $queryStr .= 'FROM MapLocations AS ml INNER JOIN MapLocationLanguages AS mll ON ml.id = mll.fk_maplocation_id ';
     $queryStr .= 'INNER JOIN Locations AS l ON l.id = ml.fk_location_id ';
     $queryStr .= 'INNER JOIN LocationContents AS c ON c.id = mll.fk_content_id ';
     $query_mcons = '';
     $article_mcons = false;
     $mc_filter_mm = false;
     $mc_filter_image = false;
     $mc_filter_video = false;
     if ($mc_mapCons) {
         $queryStr .= 'INNER JOIN Maps AS m ON m.id = ml.fk_map_id ';
         $queryStr .= 'INNER JOIN Articles AS a ON m.fk_article_number = a.Number ';
         if (0 < count($mc_users_yes) || 0 < count($mc_users_no)) {
             $queryStr .= 'INNER JOIN ArticleAuthors AS aa ON aa.fk_article_number = a.Number ';
         }
         $query_mcons = "a.IdPublication = {$ps_publicationId} AND ";
         $article_mcons = false;
         foreach ($mc_multimedia as $one_multimedia) {
             if ('any' == $one_multimedia) {
                 $mc_filter_mm = true;
             }
             if ('image' == $one_multimedia) {
                 $mc_filter_image = true;
             }
             if ('video' == $one_multimedia) {
                 $mc_filter_video = true;
             }
         }
         if (0 < count($mc_users_yes)) {
             $query_mcons .= 'aa.fk_author_id IN (' . implode(', ', $mc_users_yes) . ') AND ';
             $article_mcons = true;
         }
         if (0 < count($mc_users_no)) {
             $query_mcons .= 'aa.fk_author_id NOT IN (' . implode(', ', $mc_users_no) . ') AND ';
             $article_mcons = true;
         }
         if (0 < count($mc_article_types_yes)) {
             $mc_correct = true;
             foreach ($mc_article_types_yes as $val) {
                 if (false !== stripos($val, '\'')) {
                     $mc_correct = false;
                     break;
                 }
                 if (false !== stripos($val, '"')) {
                     $mc_correct = false;
                     break;
                 }
             }
             if ($mc_correct) {
                 $query_mcons .= 'a.Type IN (\'' . implode('\', \'', $mc_article_types_yes) . '\') AND ';
                 $article_mcons = true;
             }
         }
         if (0 < count($mc_article_types_no)) {
             $mc_correct = true;
             foreach ($mc_article_types_no as $val) {
                 if (false !== stripos($val, '\'')) {
                     $mc_correct = false;
                     break;
                 }
                 if (false !== stripos($val, '"')) {
                     $mc_correct = false;
                     break;
                 }
             }
             if ($mc_correct) {
                 $query_mcons .= 'a.Type NOT IN (\'' . implode('\', \'', $mc_article_types_no) . '\') AND ';
                 $article_mcons = true;
             }
         }
         if (0 < count($mc_articles_yes)) {
             $mc_correct = true;
             foreach ($mc_articles_yes as $val) {
                 if (!is_numeric($val)) {
                     $mc_correct = false;
                 }
             }
             if ($mc_correct) {
                 $query_mcons .= 'a.Number IN (' . implode(', ', $mc_articles_yes) . ') AND ';
                 $article_mcons = true;
             }
         }
         if (0 < count($mc_articles_no)) {
             $mc_correct = true;
             foreach ($mc_articles_no as $val) {
                 if (!is_numeric($val)) {
                     $mc_correct = false;
                 }
             }
             if ($mc_correct) {
                 $query_mcons .= 'a.Number NOT IN (' . implode(', ', $mc_articles_no) . ') AND ';
                 $article_mcons = true;
             }
         }
         if (0 < count($mc_issues)) {
             $mc_correct = true;
             foreach ($mc_issues as $val) {
                 if (!is_numeric($val)) {
                     $mc_correct = false;
                 }
             }
             if ($mc_correct) {
                 $query_mcons .= 'a.NrIssue IN (' . implode(', ', $mc_issues) . ') AND ';
                 $article_mcons = true;
             }
         }
         if (0 < count($mc_sections)) {
             $mc_correct = true;
             foreach ($mc_sections as $val) {
                 if (!is_numeric($val)) {
                     $mc_correct = false;
                 }
             }
             if ($mc_correct) {
                 $query_mcons .= 'a.NrSection IN (' . implode(', ', $mc_sections) . ') AND ';
                 $article_mcons = true;
             }
         }
         foreach ($mc_dates as $one_date_type => $one_date_value_arr) {
             if (0 == count($one_date_value_arr)) {
                 continue;
             }
             $one_date_value = $one_date_value_arr[0];
             $one_date_value = trim($one_date_value);
             $one_date_value = trim($one_date_value, "\"'");
             $one_date_value = str_replace("'", "\"", $one_date_value);
             $one_date_usage = 'CAST(a.PublishDate AS DATE) ';
             $one_date_known = false;
             if ('smaller_equal' == $one_date_type) {
                 $one_date_usage .= '<= ';
                 $one_date_known = true;
             }
             if ('smaller' == $one_date_type) {
                 $one_date_usage .= '< ';
                 $one_date_known = true;
             }
             if ('greater_equal' == $one_date_type) {
                 $one_date_usage .= '>= ';
                 $one_date_known = true;
             }
             if ('greater' == $one_date_type) {
                 $one_date_usage .= '> ';
                 $one_date_known = true;
             }
             if ('is' == $one_date_type) {
                 $one_date_usage .= '= ';
                 $one_date_known = true;
             }
             if ('not' == $one_date_type) {
                 $one_date_usage .= '<> ';
                 $one_date_known = true;
             }
             if (!$one_date_known) {
                 continue;
             }
             $one_date_usage .= "'{$one_date_value}' AND ";
             $query_mcons .= $one_date_usage;
             $article_mcons = true;
         }
         $mc_icons_usage = array();
         foreach ($mc_icons as $one_icon_value) {
             $one_icon_value = str_replace("'", "\"", $one_icon_value);
             if (0 < strlen($one_icon_value)) {
                 $mc_icons_usage[] = $one_icon_value;
             }
         }
         if (0 < count($mc_icons_usage)) {
             $query_mcons .= "ml.poi_style IN ('" . implode("', '", $mc_icons_usage) . "') AND ";
             $article_mcons = true;
         }
         if (0 < count($mc_topics)) {
             $mc_topics_list = array();
             $mc_topics_conn = 'OR';
             if ($mc_topics_matchall) {
                 $mc_topics_conn = 'AND';
             }
             foreach ($mc_topics as $one_topic) {
                 if (!is_numeric($one_topic)) {
                     continue;
                 }
                 $mc_topics_list[] = 'EXISTS (SELECT at.TopicId FROM ArticleTopics AS at WHERE a.Number = at.NrArticle AND at.TopicId IN (' . Topic::BuildAllSubtopicsQuery($one_topic, false) . '))';
             }
             if (0 < count($mc_topics_list)) {
                 $query_mcons .= '(' . implode(" {$mc_topics_conn} ", $mc_topics_list) . ') AND ';
                 $article_mcons = true;
             }
         }
         $mc_areas_list = array();
         $mc_areas_conn = 'OR';
         if ($mc_areas_matchall) {
             $mc_areas_conn = 'AND';
         }
         foreach ($mc_areas as $one_area) {
             if (is_object($one_area)) {
                 $one_area = get_object_vars($one_area);
             }
             $mc_rectangle = $one_area['rectangle'];
             $mc_polygon = $one_area['polygon'];
             if ($mc_rectangle && 2 == count($mc_rectangle)) {
                 $area_cons_res = Geo_MapLocation::GetGeoSearchSQLCons($mc_rectangle, 'rectangle', 'l');
                 if (!$area_cons_res['error']) {
                     $mc_areas_list[] = $area_cons_res['cons'];
                     $article_mcons = true;
                 }
             }
             if ($mc_polygon && 3 <= count($mc_polygon)) {
                 $area_cons_res = Geo_MapLocation::GetGeoSearchSQLCons($mc_polygon, 'polygon', 'l');
                 $area_cons_res_finer = null;
                 if ($mc_areas_exact) {
                     $area_cons_res_finer = Geo_MapLocation::GetGeoSearchPointInPolygon($mc_polygon, 'l');
                 }
                 if (!$area_cons_res['error']) {
                     $one_area_cons = $area_cons_res['cons'];
                     if ($mc_areas_exact && !$area_cons_res_finer['error']) {
                         $one_area_cons = "({$one_area_cons} AND " . $area_cons_res_finer['cons'] . ')';
                     }
                     $mc_areas_list[] = $one_area_cons;
                     $article_mcons = true;
                 }
             }
         }
         if (0 < count($mc_areas_list)) {
             $query_mcons .= '(' . implode(" {$mc_areas_conn} ", $mc_areas_list) . ') AND ';
             $article_mcons = true;
         }
         $mmu_test_join = '%%mmu_test_join%%';
         $mmu_test_spec = '%%mmu_test_spec%%';
         $multimedia_test_common = "EXISTS (SELECT mlmu.id FROM MapLocationMultimedia AS mlmu {$mmu_test_join} WHERE mlmu.fk_maplocation_id = ml.id {$mmu_test_spec}) AND ";
         $multimedia_test_basic = $multimedia_test_common;
         $multimedia_test_basic = str_replace($mmu_test_join, '', $multimedia_test_basic);
         $multimedia_test_basic = str_replace($mmu_test_spec, '', $multimedia_test_basic);
         $multimedia_test_spec = $multimedia_test_common;
         $multimedia_test_spec = str_replace($mmu_test_join, 'INNER JOIN Multimedia AS mu ON mlmu.fk_multimedia_id = mu.id ', $multimedia_test_spec);
         $multimedia_test_image = $multimedia_test_spec;
         $multimedia_test_image = str_replace($mmu_test_spec, "AND mu.media_type = 'image'", $multimedia_test_image);
         $multimedia_test_video = $multimedia_test_spec;
         $multimedia_test_video = str_replace($mmu_test_spec, "AND mu.media_type = 'video'", $multimedia_test_video);
         if ($mc_filter_image) {
             $query_mcons .= $multimedia_test_image;
             $article_mcons = true;
         }
         if ($mc_filter_video) {
             $query_mcons .= $multimedia_test_video;
             $article_mcons = true;
         }
         if ($mc_filter_mm) {
             $query_mcons .= $multimedia_test_basic;
             $article_mcons = true;
         }
         $queryStr .= 'WHERE ';
         if ($article_mcons) {
             $queryStr .= $query_mcons;
         }
         $queryStr .= "a.Published = 'Y' AND a.IdLanguage = {$ps_languageId} ";
     } else {
         $queryStr .= "WHERE ml.fk_map_id = {$ps_mapId} ";
     }
     $queryStr_mid = "";
     $queryStr_mid .= "AND mll.fk_language_id = {$ps_languageId} ";
     if ($ps_preview) {
         $queryStr_mid .= "AND mll.poi_display = 1 ";
     }
     if ($mc_mapCons) {
         $queryStr_mid .= 'GROUP BY ml.fk_location_id, mll.fk_content_id, ml.poi_style, mll.poi_display, image_mm, video_mm ';
     }
     $queryStr .= $queryStr_mid;
     $queryStr = $queryStr_start . $queryStr;
     $queryStr .= 'ORDER BY ';
     foreach ($ps_orders as $one_order) {
         foreach ($one_order as $cur_order_col => $cur_order_dir) {
             $queryStr .= "{$cur_order_col} {$cur_order_dir}, ";
         }
     }
     $queryStr .= 'ml.rank, ml.id, mll.id';
     $rows = $g_ado_db->GetAll($queryStr);
     if (is_array($rows)) {
         $p_count = count($rows);
         if ($mc_limit) {
             $rows = array_slice($rows, $mc_start, $mc_limit);
         }
         if ($mc_start && !$mc_limit) {
             $rows = array_slice($rows, $mc_start);
         }
     }
     $mm_objs = array();
     if (is_array($rows)) {
         foreach ($rows as $row) {
             $tmp_loc = trim(strtolower($row['loc']));
             $loc_matches = array();
             if (!preg_match('/^point\\((?P<latitude>[\\d.-]+)\\s(?P<longitude>[\\d.-]+)\\)$/', $tmp_loc, $loc_matches)) {
                 continue;
             }
             $tmp_latitude = $loc_matches['latitude'];
             $tmp_longitude = $loc_matches['longitude'];
             $tmpPoint = array();
             $tmpPoint['latitude'] = $tmp_latitude;
             $tmpPoint['longitude'] = $tmp_longitude;
             $tmpPoint['loc_id'] = $row['ml_id'];
             $tmpPoint['con_id'] = $row['mll_id'];
             $tmpPoint['style'] = $row['poi_style'];
             $tmpPoint['rank'] = $row['rank'];
             $tmpPoint['display'] = $row['poi_display'];
             $tmpPoint['title'] = $row['poi_name'];
             $tmpPoint['link'] = $row['poi_link'];
             $tmpPoint['perex'] = $row['poi_perex'];
             $tmpPoint['content_type'] = $row['poi_content_type'];
             $tmpPoint['content'] = $row['poi_content'];
             $tmpPoint['text'] = $row['poi_text'];
             $tmpPoint['image_mm'] = 0;
             $tmpPoint['image_src'] = '';
             $tmpPoint['image_width'] = '';
             $tmpPoint['image_height'] = '';
             $tmp_image = null;
             $tmp_video = null;
             if ($row['image_mm']) {
                 $multimedia_spec = $row['image_mm'];
                 $multimedia_link = $multimedia_spec;
                 // the dynamic maps (i.e. with mc_mapCons) have grouping by multimedia,
                 // while article maps have all multimedia separated (and read with concat)
                 if (!$mc_mapCons) {
                     $multimedia_spec_arr = explode('-', $multimedia_spec);
                     if (2 == count($multimedia_spec_arr)) {
                         $multimedia_spec = 0 + $multimedia_spec_arr[0];
                         $multimedia_link = 0 + $multimedia_spec_arr[1];
                     }
                 }
                 $tmpPoint['image_mm'] = $multimedia_link;
                 $tmp_image = new Geo_Multimedia($multimedia_spec);
                 if ($tmp_image) {
                     $tmpPoint['image_src'] = $tmp_image->getSrc();
                     $tmpPoint['image_width'] = $tmp_image->getWidth();
                     $tmpPoint['image_height'] = $tmp_image->getHeight();
                 }
             }
             $tmpPoint['video_mm'] = 0;
             $tmpPoint['video_id'] = '';
             $tmpPoint['video_type'] = '';
             $tmpPoint['video_width'] = '';
             $tmpPoint['video_height'] = '';
             if ($row['video_mm']) {
                 $multimedia_spec = $row['video_mm'];
                 $multimedia_link = $multimedia_spec;
                 // the dynamic maps (i.e. with mc_mapCons) have grouping by multimedia,
                 // while article maps have all multimedia separated (and read with concat)
                 if (!$mc_mapCons) {
                     $multimedia_spec_arr = explode('-', $multimedia_spec);
                     if (2 == count($multimedia_spec_arr)) {
                         $multimedia_spec = 0 + $multimedia_spec_arr[0];
                         $multimedia_link = 0 + $multimedia_spec_arr[1];
                     }
                 }
                 $tmpPoint['video_mm'] = $multimedia_link;
                 $tmp_video = new Geo_Multimedia($multimedia_spec);
                 if ($tmp_video) {
                     $tmpPoint['video_id'] = $tmp_video->getSrc();
                     $tmpPoint['video_type'] = $tmp_video->getSpec();
                     $tmpPoint['video_width'] = $tmp_video->getWidth();
                     $tmpPoint['video_height'] = $tmp_video->getHeight();
                 }
             }
             if ($tmp_image || $tmp_video) {
                 $mm_objs[$row['ml_id']] = array('image' => $tmp_image, 'video' => $tmp_video);
             }
             // for the list-of-objects array
             $tmpPoint['map_id'] = $ps_mapId;
             $tmpPoint['art_number'] = 0;
             $tmpPoint['art_numbers'] = '';
             if ($mc_mapCons) {
                 $tmpPoint['map_id'] = $row['m_id'];
                 $tmpPoint['art_number'] = $row['art_number'];
                 $tmpPoint['art_numbers'] = $row['art_numbers'];
             }
             $tmpPoint['geo_id'] = $row['loc_id'];
             $tmpPoint['geo_type'] = $row['poi_type'];
             $tmpPoint['geo_style'] = $row['poi_type_style'];
             $tmpPoint['geo_radius'] = $row['l_radius'];
             $tmpPoint['geo_user'] = $row['l_user'];
             $tmpPoint['geo_updated'] = $row['l_updated'];
             $tmpPoint['txt_id'] = $row['con_id'];
             $tmpPoint['txt_user'] = $row['c_user'];
             $tmpPoint['txt_updated'] = $row['c_updated'];
             $dataArray[] = $tmpPoint;
         }
     }
     if (0 == count($dataArray)) {
         return array();
     }
     $dataArray_tmp = $dataArray;
     $objsArray = array();
     $dataArray = array();
     foreach ($dataArray_tmp as $one_poi) {
         $one_poi_source = array('id' => $one_poi['loc_id'], 'fk_map_id' => $one_poi['map_id'], 'fk_location_id' => $one_poi['geo_id'], 'poi_style' => $one_poi['style'], 'rank' => $one_poi['rank']);
         $one_poi_obj = new self($one_poi_source, true);
         $one_geo_source = array('poi_location' => null, 'poi_type' => $one_poi['geo_type'], 'poi_type_style' => $one_poi['geo_style'], 'poi_center' => null, 'poi_radius' => $one_poi['geo_radius'], 'IdUser' => $one_poi['geo_user'], 'time_updated' => $one_poi['geo_updated'], 'latitude' => $one_poi['latitude'], 'longitude' => $one_poi['longitude']);
         $one_poi_obj->location = new Geo_Location($one_geo_source, true);
         $one_lan_source = array('id' => $one_poi['con_id'], 'fk_maplocation_id' => $one_poi['loc_id'], 'fk_language_id' => $ps_languageId, 'fk_content_id' => $one_poi['txt_id'], 'poi_display' => $one_poi['display']);
         $one_poi_obj->setLanguage($ps_languageId, new Geo_MapLocationLanguage(NULL, 0, $one_lan_source, true));
         $one_txt_source = array('id' => $one_poi['txt_id'], 'poi_name' => $one_poi['title'], 'poi_link' => $one_poi['link'], 'poi_perex' => $one_poi['perex'], 'poi_content_type' => $one_poi['content_type'], 'poi_content' => $one_poi['content'], 'poi_text' => $one_poi['text'], 'IdUser' => $one_poi['txt_user'], 'time_updated' => $one_poi['txt_updated']);
         $one_poi_obj->setContent($ps_languageId, new Geo_MapLocationContent(NULL, NULL, $one_txt_source, true));
         if (array_key_exists($one_poi['loc_id'], $mm_objs)) {
             $poi_mm = $mm_objs[$one_poi['loc_id']];
             $one_poi_obj->multimedia = array();
             foreach ($poi_mm as $one_mm) {
                 if ($one_mm) {
                     $one_poi_obj->multimedia[] = $one_mm;
                 }
             }
         }
         $objsArray[] = $one_poi_obj;
         if (!$p_skipCache || $ps_saveArray) {
             $dataArray[] = $one_poi;
         }
     }
     if (!$p_skipCache && CampCache::IsEnabled()) {
         $cacheList_arr->storeInCache(array('count' => $p_count, 'data' => $dataArray));
         $cacheList_obj->storeInCache(array('count' => $p_count, 'data' => $objsArray));
     }
     if (empty(self::$s_found_maplocations_list_ext)) {
         self::$s_found_maplocations_list_ext = array();
     }
     self::$s_found_maplocations_list_ext[$list_spec_str] = array('count' => $p_count, 'list_raw' => $dataArray, 'list_obj' => $objsArray);
     if ($ps_saveArray) {
         $p_rawData = $dataArray;
     }
     return $objsArray;
 }