示例#1
0
 /** Obtiene un html en un formato standar para mostrar la produccion
  * 
  * @param type $production (Production) El objeto de production
  * @return type
  */
 static function getVisualHtml(Production $production, $classname = "production", $classimage = "img-rounded")
 {
     $isVideoMain = $production->haveVideoMain();
     $html = "<div class='" . $classname . "'>";
     $html .= "<a ";
     if (Auth::check()) {
         $html .= "onClick='modalProduction(\"" . $production->id . "\");'";
     } else {
         $html .= "href='" . url("production/" . $production->slug) . "'";
     }
     $html .= ">";
     //Si la produccion es una serie incrustar la información de los capitulos
     if (!$isVideoMain) {
         $chapters = Chapter::where(Chapter::ATTR_PRODUCTION_ID, $production->id)->get();
         $json = array();
         foreach ($chapters as $chapter) {
             $json[] = array($chapter->name, url("production/" . $production->slug . "/play/" . urlencode(\App\System\Library\Security\Hash::encrypt($chapter->id))));
         }
         $html .= "<span class='hidden' id='chapters-" . $production->id . "'>" . json_encode($json) . "</span>";
     }
     $html .= "<span class='hidden' id='url-" . $production->id . "'>" . url("production/" . $production->slug) . "</span><img id='img-production-" . $production->id . "' title='" . $production->title . "' class='" . $classimage;
     $html .= $production->state != Production::STATE_ACTIVE ? " production-not-available" : "";
     $html .= "' src='" . Util::convertToSecureUrl($production->image) . "'><div class='over'><span class='glyphicon glyphicon-play-circle'></span>" . $production->title . "</div>" . "</a>" . "</div>";
     return $html;
 }