{ $groupes[$v_rst["id"]] = $v_rst;
$groupes[$v_rst["id"]]["id_groupe_status"] = $groupes_status[$v_rst["id"]];
$groupes[$v_rst["id"]]["image_uri"] =
- ( $v_rst["image"] ?
+ ( isset($v_rst["image"]) && $v_rst["image"] ?
$env->path("content")."uploads/".$v_rst["image"]
: ""
);
$author_ids = array();
foreach($groupes as $i => $groupe) $author_ids[$groupe["id"]] = true;
$sgbd = $this->sgbd();
- $_sources = array();
+ $authors = array();
if($rst = $sgbd->open_data("sml_sources_authors")){
- while(($_sources !== false) && $v_rst = $sgbd->fetch_data($rst)){
+ while(($authors !== false) && $v_rst = $sgbd->fetch_data($rst)){
if(isset($v_rst)){
if(
isset($v_rst["id"])
isset($source_access_ids[$v_rst["id_sources_access"]])
&& isset($author_ids[$v_rst["id_author"]])
){
- $_sources[$v_rst["id_source"]] = array(
- "id_source" => $v_rst["id_source"],
- "id_author" => $v_rst["id_author"],
- );
+ if(!isset($authors[$v_rst["id_source"]])){
+ $authors[$v_rst["id_source"]] = array();
+ }
+ $authors[$v_rst["id_source"]][] = $v_rst["id_author"];
}
}
}
- else $_sources = false;
+ else $authors = false;
}
$sgbd->close_data($rst);
}
- else $_sources = false;
- if($_sources === false) return false;
+ else $authors = false;
+ if($authors === false) return false;
if($rst = $sgbd->open_data("sml_sources")){
while(($sources !== false) && $v_rst = $sgbd->fetch_data($rst)){
if(isset($v_rst) && isset($v_rst["id"])){
- if(isset($_sources[$v_rst["id"]])){
+ if(isset($authors[$v_rst["id"]])){
if(!isset($params["id_class"]) || (isset($v_rst["id_class"]) && ($v_rst["id_class"] == $params["id_class"]))){
- if(!isset($sources[$v_rst["id"]])){
- $sources[$v_rst["id"]] = $v_rst;
- $sources[$v_rst["id"]]["authors"] = array();
- }
- $sources[$v_rst["id"]]["authors"][] = $_sources[$v_rst["id"]]["id_author"];
+ $sources[$v_rst["id"]] = $v_rst;
+ $sources[$v_rst["id"]]["authors"] = $authors[$v_rst["id"]];
}
}
}
$sgbd->close_data($rst);
}
else $sources = false;
- if($_sources === false) return false;
+ if($sources === false) return false;
foreach($sources as $id_source => $source){
if($satisfy_all_groupes_access){
if(count($source["authors"]) < count($groupes)){