titre du site par defaut
[mw_sourceml] / app / out / default / views / sources / logo_groupe.php
index 87faa7b..3dec41f 100644 (file)
@@ -1,22 +1,77 @@
 <?php
 
+  $groupes = array();
+  $data = $this->data();
+
   if(
-       isset($this->out["groupe"])
-    && $this->out["groupe"]
-    && $this->out["groupe"]["image_uri"]
-    && file_exists($this->out["groupe"]["image_uri"])
-    && ($img_size = $data->img_size($this->out["groupe"]["image_uri"], 200, 130)) !== false
-  ) :
-  $margin_top = floor((150 - $img_size["height"]) / 2);
+        $this->is_running("sources/album/view")
+    ||  $this->is_running("sources/morceau/view")
+    ||  $this->is_running("sources/piste/view")
+  ){
+    if($this->is_running("sources/album/view")) $groupes = $this->out["album"]["groupes"];
+    if($this->is_running("sources/morceau/view")) $groupes = $this->out["morceau"]["groupes"];
+    if($this->is_running("sources/piste/view")) $groupes = $this->out["piste"]["groupes"];
+    foreach($groupes as $id_groupe => $groupe){
+      if(
+            ($groupe["id_groupe_status"] != $data->id_groupe_status_admin())
+        &&  ($groupe["id_groupe_status"] != $data->id_groupe_status_editeur())
+      ) unset($groupes[$id_groupe]);
+    }
+  }
+  elseif($this->is_running("sources")){
+    if(isset($this->out["groupe"])) $groupes = array($this->out["groupe"]["id"] => $this->out["groupe"]);
+  }
+  foreach($groupes as $groupe) :
+    $source_image_url = false;
+    $source_thumb = false;
+    $margin_top = 0;
+    if(
+          isset($groupe["image_uri"])
+      &&  $groupe["image_uri"]
+      &&  file_exists($groupe["image_uri"])
+    ){
+      $source_image_url = $groupe["image_uri"];
+      if($data->mw_thumbs_activated()){
+        $source_thumb = $data->img_thumb(
+          $source_image_url,
+          200,
+          130,
+          $this->path("content")."thumbs",
+          array(255, 255, 255)
+        );
+      }
+      else{
+        if($img_size = $data->img_size($source_image_url, 200, 130)){
+          $margin_top = floor((130 - $img_size["height"]) / 2);
+        }
+      }
+      if($source_image_url && !$source_thumb && !$img_size) $source_image_url = false;
+    }
+    if($source_image_url) :
 
 ?>
+
 <div class="logo_groupe">
-  <a href="<?php echo $this->url("sources/groupe/view", array("id" => $this->out["groupe"]["id"])) ?>">
-  <img src="<?php echo $this->path("web").$this->out["groupe"]["image_uri"]; ?>"
-       width="<?php echo $img_size["width"] ?>"
-       height="<?php echo $img_size["height"] ?>"
-       style="margin-top:<?php echo $margin_top ?>px"
-       alt="" />
+  <a href="<?php echo $this->url("sources/groupe/view", array("id" => $groupe["id"])) ?>">
+    <?php if($source_thumb) : ?>
+    <img src="<?php echo $this->path("content")."thumbs/".$source_thumb["thumb_file"] ?>"
+         width="<?php echo $source_thumb["thumb_width"] ?>"
+         height="<?php echo $source_thumb["thumb_height"] ?>"
+         alt="" />
+    <?php else : ?>
+    <img src="<?php echo $this->path("web").$source_image_url; ?>"
+         width="<?php echo $img_size["width"] ?>"
+         height="<?php echo $img_size["height"] ?>"
+         style="margin-top:<?php echo $margin_top ?>px"
+         alt="" />
+    <?php endif; ?>
+    <span><?php echo $groupe["nom"]; ?></span>
   </a>
 </div>
-<?php endif; ?>
+
+<?php
+
+    endif;
+  endforeach;
+
+?>
\ No newline at end of file