<?php
// Show Movie Details
if(isset($_req_data['content_code'])) {
    $show_all_content = false;

    /*$optres['css'][] = "../style.css";
    $optres['js'][] = "../js/jquery-latest.js";*/
    $optres['css'][] = $path . "assets/plugins/prettyphoto/prettyPhoto.css";
    $optres['js'][] = $path . "assets/plugins/prettyphoto/jquery.prettyPhoto.js";

    require_once("../imCinemaAdmin/classes/movie.class.php");
    $mc = $_req_data['content_code'];
    $t = new Movie();
    $t->get_movie_by_code($mc);
    $img_path = "$include_www/imCinemaAdmin/movies/" . $mc . "/";

    ?>
    <div class="im_movie_details">
        <h1><?php echo $t->title . ' (' . $t->year . ')';?></h1>
        <table cellpadding="0" cellspacing="0" border="0" width="100%" class="im_mains">
            <tr>
                <td align="left" valign="top" width="70%">
                    <div class="movie_short">
                        <table cellpadding="0" cellspacing="0" border="0" width="100%">
                            <tr>

                                <td class="mov_desc right_border" align="left" valign="top" width="80%">
                                    <table cellpadding="0" cellspacing="0" border="0" width="100%">
                                        <tr>
                                            <td class="mov_det" align="left" valign="top" nowrap><strong>Release Date</strong>:</td>
                                            <td class="mov_val" align="left" valign="top"><?php echo date("F d, Y", strtotime($t->release_date));?></td>
                                        </tr>
                                        <tr>
                                            <td class="mov_det" align="left" valign="top" nowrap>Genres:</td>
                                            <td class="mov_val" align="left" valign="top"><span class="redish"><?php echo $t->genres;?></span></td>
                                        </tr>
                                        <tr>
                                            <td class="mov_det" align="left" valign="top" nowrap>Runtime:</td>
                                            <td class="mov_val" align="left" valign="top">&nbsp;<?php echo $t->runtime;?> min</td>
                                        </tr>
                                        <tr>
                                            <td class="mov_det" align="left" valign="top" nowrap>Rating:</td>
                                            <td class="mov_val" align="left" valign="top">&nbsp;<strong><span class="redish"><?php echo $t->cy_rating;?></span></strong> <span><?php echo ' - ' . $ratings[$t->cy_rating];?></span></td>
                                        </tr>


                                        <tr>
                                            <td class="mov_det" align="left" valign="top" nowrap>Director:</td>
                                            <td class="mov_val" align="left" valign="top"><?php echo $t->directors;?></td>
                                        </tr>
                                        <tr>
                                            <td class="mov_det" align="left" valign="top" nowrap>Stars:</td>
                                            <td class="mov_val" align="left" valign="top"><?php echo $t->stars;?></td>
                                        </tr>
                                        <tr>
                                            <td class="mov_det" align="left" valign="top" nowrap>Cast:</td>
                                            <td class="mov_val" align="left" valign="top"><?php echo $t->cast;?></td>
                                        </tr>
                                        <?php
                                        if(trim($t->plot) != "") {
                                            ?>
                                            <tr>
                                                <td class="mov_det" align="left" valign="top" nowrap>Plot:</td>
                                                <td class="mov_val" align="left" valign="top">&nbsp;<?php echo $t->plot; ?>
                                                </td>
                                            </tr>
                                            <?php
                                        }
                                        ?>
                                        <?php
                                        if(trim($t->storyline) != "") {
                                            ?>
                                            <tr>
                                                <td class="mov_det" align="left" valign="top" nowrap>Storyline:</td>
                                                <td class="mov_val" align="left" valign="top">&nbsp;<?php echo $t->storyline;?></td>
                                            </tr>
                                            <?php
                                        }
                                        ?>


                                        <tr>
                                            <td class="mov_det" align="left" valign="top" nowrap>Official Websites:</td>
                                            <td class="mov_val" align="left" valign="top">
                                                <?php
                                                $ofs = $t->official_sites;
                                                if($ofs != "") {
                                                    $ofs = unserialize(base64_decode($ofs));
                                                    foreach ($ofs as $i=>$od) {
                                                        echo '<a href="', $od['url'], '" rel="nofollow" target="_blank">', $od['name'] , '</a><br/>';
                                                    }
                                                }
                                                ?>
                                                &nbsp;
                                            </td>
                                        </tr>
                                    </table>

                                </td>
                                <td align="center" valign="top" class="media_col">
                                    <img src="<?php echo $img_path . $t->poster;?>" class="poster_small" rel="<?php echo $mc;?>">
                                    <div class="media_links media_links_big">

                                        <?php
                                        $mi = $t->media_images;
                                        if($mi != "") {
                                            $mi = explode("|", $mi);
                                            $mi_url = $img_path . $mi[0];
                                            echo '<a href="', $mi_url , '" rel="',$t->movie_code,'|',$mi[$i],'" class="media_image media_link">Images</a>';
                                        }

                                        $mt = $t->trailers;
                                        if(trim($mt) != "") {
                                            $text_trailers = "Trailer";
                                            $mt = explode("|", $mt);
                                            if(count($mt) > 1) $text_trailers = "Trailers";
                                            echo '<a href="', $mt[0] , '" rel="',$t->movie_code,'" class="trailers trailer_link">',$text_trailers,'</a>';
                                        }
                                        ?>
                                    </div>
                                </td>

                            </tr>
                        </table>
                    </div>
                </td>
            </tr>
        </table>
    </div>
    <?php

}