<?php
session_start();
define('Admin_USER',true);
require_once("../../../php/defines.php");
require_once("../../../php/classes/mainClass.php");
require_once("../../../php/classes/galleryClass.php");

$gallery = new galleryClass();
$info = $gallery->getImageInfo($_POST['Id']);
$albums = $gallery->getAlbums();
$categories = $gallery->getAlbumCategories();


$display = '';

$display .= '<div class="popup_form">';
$display .= '<form class="a-r-form" id="PopUp_Form">';
$display .= '<h1 style="text-align:center;">Change Album<br/><em>"'.$info['Name'].'"</em></h1>';
$display .= '<div id="Result"></div>';
$display .= '<div class="form-group">';
$display .= '<label>Album Category</label>';
$display .= '<select  class="col-md-12" id="Category" name="Category" onchange="updateAlbums();">';
$display .= '<option value="">Choose Album Category</option>';
for($i=0;$i<count($categories);$i++){

    if($categories[$i]['Name'] != ''){

        $display .= '<option value="'.$categories[$i]['Nbr'].'"';
        if($info['Category'] == $categories[$i]['Nbr']){

            $display .= 'selected="selected"';

        }
        $display .= '>'.$categories[$i]['Name'].'</option>';

    }

}
$display .= '</select>';
$display .= '</div>';  
$display .= '<div class="form-group" id="Album-Menu" name="Album-Menu">';
$display .= '<select  class="col-md-12" id="Album" name="Album" onchange="galleryAlbum();">';
$display .= '<option value="">Choose Album</option>';
$display .= '<option value="New">New Album</option>';
for($i=0;$i<count($albums);$i++){

    if($albums[$i]['Name'] != ''){

    $display .= '<option value="'.$albums[$i]['Nbr'].'"';
    if($info['Album'] == $albums[$i]['Nbr']){
        
        $display .= ' selected="selected"';
        
    }
    $display .= '>'.$albums[$i]['Name'].'</option>';

    }

}
$display .= '</select>';
$display .= '</div>'; 
$display .= '<div class="form-group" id="AlbumName" name="AlbumName" style="display:none;">';
$display .= '<label>Album Name</label>';
$display .= '<input type="text" class="col-md-12" id="Album_Name" name="Album_Name">';
$display .= '</div>';
$display .= '<div class="form-group" id="Submit_Paragraph">';
$display .= '<input type="button" value="submit" onclick="imageProcessing(\'Change-Album\',\'PopUp_Form\');">';
$display .= '<input type="hidden" value="'.$_POST['Id'].'" id="ImageId" name="ImageId">';
$display .= '</div>';
$display .= '</form>';

$display .= '</div>';

echo $display;
exit;

?>

