function echo_movie($film)
{
    echo "imdb_code : " . $film['imdb_code'] . "\n";
    echo "Name      : " . $film['title'] . "\n";
    echo "Year      : " . $film['year'] . "\n" . "Genre(s)  : ";
    echo show_tab($film['genres']) . "\n" . "Directors : ";
    echo show_tab($film['directors']) . "\n";
    echo "Stock     : " . $film['stock'] . "\n";
    echo "Rate      : " . $film['rate'] . "\n";
    echo "____________\n\n";
}
function echo_movie($film)
{
    echo "imdb_code : " . $film['imdb_code'] . "\n";
    echo "Name      : " . $film['title'] . "\n";
    echo "Year      : " . $film['year'] . "\n" . "Genre(s)  : ";
    echo show_tab($film['genres']) . "\n" . "Directors : ";
    echo show_tab($film['directors']) . "\n";
    // echo "Link      : " . $film['link'] . "\n";
    echo "Stock     : " . $film['stock'] . "\n";
    echo "Rate      : " . $film['rate'] . "\n";
    echo "____________\n\n";
}
function show_renting_students($db)
{
    $collection_students = $db->createCollection("students");
    $cursor_student = $collection_students->find();
    $i = 0;
    foreach ($cursor_student as $student) {
        if (isset($student["rented_movies"][0])) {
            echo "" . $student['login'] . "\n~~~~~~~~~~~~~~~~~~~\n";
            echo "Name    : " . $student['name'] . "\n";
            echo "Email   : " . $student['email'] . "\n";
            echo "Phone   : " . $student['phone'] . "\n";
            echo "Renting : ";
            show_tab(find_movies($student["rented_movies"], $db));
            echo "\n";
            echo "____________\n\n";
            $i++;
        }
    }
    echo "*" . $i . "*\n";
}
function show_rented_movies($db)
{
    $collection_movies = $db->createCollection("movies");
    $cursor_movie = $collection_movies->find();
    $i = 0;
    foreach ($cursor_movie as $film) {
        if (isset($film["renting_students"][0])) {
            echo "imbd_code : " . $film['imdb_code'] . "\n";
            echo "Name      : " . $film['title'] . "\n";
            echo "Year      : " . $film['year'] . "\n" . "Genre(s)  : ";
            echo show_tab($film['genres']) . "\n" . "Directors : ";
            echo show_tab($film['directors']) . "\n";
            echo "Link      : " . $film['link'] . "\n";
            echo "Stock     : " . $film['stock'] . "\n";
            echo "Rate      : " . $film['rate'] . "\nRented by : ";
            echo show_tab(find_students($film["renting_students"], $db)) . "\n";
            echo "____________\n\n";
            $i++;
        }
    }
    echo "*" . $i . "*\n";
}
function show_movies_genre($db, $argv)
{
    $collection = $db->createCollection("movies");
    $cursor = $collection->find();
    $i = 0;
    foreach ($cursor as $film) {
        if (in_array(strtolower($argv[3]), $film["genres"])) {
            echo "imdb_code : " . $film['imdb_code'] . "\n";
            echo "Name      : " . $film['title'] . "\n";
            echo "Year      : " . $film['year'] . "\n" . "Genre(s)  : ";
            echo show_tab($film['genres']) . "\n" . "Directors : ";
            echo show_tab($film['directors']) . "\n";
            echo "Stock     : " . $film['stock'] . "\n";
            echo "Rate      : " . $film['rate'] . "\n";
            echo "____________\n\n";
            $i++;
        }
    }
    if ($i == 0) {
        echo "Sorry, no movie found.\n";
    } else {
        echo "*" . $i . "*\n";
    }
}
Exemple #6
0
function show_stat($db, $argv)
{
    $i = 0;
    if (sizeof($argv) == 2) {
        $collection = $db->createCollection("movies");
        $cursor = $collection->find(array('rented' => array('$gt' => 0)));
        $cursor = $cursor->sort(array("rented" => -1));
        $cursor = $cursor->limit(20);
        foreach ($cursor as $film) {
            echo $film['title'] . "\t";
            echo $film['year'] . "\n";
            echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";
            echo "Rented    : " . $film['rented'] . " times\n";
            echo "Genre      : " . show_tab($film['genre']) . "\n";
            echo "Rate      : " . $film['rate'] . "\n";
            echo "imbd_code : " . $film['imdb_code'] . "\n";
            echo "____________\n\n";
            $i++;
        }
        echo "*" . $i . "*\n";
    } else {
        echo "Invalid number of arguments\n";
    }
}
function show_movies_genre($db, $argv)
{
    $collection = $db->createCollection("movies");
    $cursor = $collection->find();
    $i = 0;
    foreach ($cursor as $film) {
        if (in_array(strtolower($argv[3]), $film["genres"])) {
            echo "imdb_code : " . $film['imdb_code'] . "\n";
            echo "Name      : " . $film['title'] . "\n";
            echo "Year      : " . $film['year'] . "\n" . "Directors : ";
            echo show_tab($film['directors']) . "\n";
            echo "Rate      : " . $film['rate'] . "\n";
            echo "Link      : " . $film['link'] . "\n";
            echo "Stock     : " . $film['stock'] . "\n";
            echo "____________\n\n";
            $i++;
        }
    }
    if ($i == 0) {
        echo "Sorry, there's no movie according to your research.\n";
    } else {
        echo "*" . $i . "*\n";
    }
}
Exemple #8
0
function show_details($document, $db)
{
    echo "Login \t: " . $document["login"] . "\n";
    echo "Name  \t: " . $document["name"] . "\n";
    echo "Age   \t: " . $document["age"] . "\n";
    echo "Email \t: " . $document["email"] . "\n";
    echo "Phone \t: " . $document["phone"] . "\nRenting : ";
    show_tab(find_movies($document["rented_movies"], $db));
    echo "\n";
}
Exemple #9
0
function login_logs_theme()
{
    global $user, $globals, $l, $theme, $softpanel, $error, $logs, $done;
    // For Deleting Login Logs
    if (optGET('delete_all')) {
        if (!empty($error)) {
            echo '0' . current($error);
            return false;
        }
        // Affirm Record Deletion
        if (!empty($done)) {
            echo '1' . $l['rec_deleted'];
            show_tab();
            return true;
        }
    }
    softheader($l['<title>']);
    echo '<center><div class="sai_tit"><img src="' . $theme['a_images'] . 'login_logs.gif" alt="" />&nbsp;' . $l['ftp_head'] . '</div></center>
	<div id="show_log">';
    show_tab();
    echo '</div>
	
		<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
	
		var message_box = function(){
			return{
				show_message: function(title, body , image) {			
					var okbutton = \'<input  style="width:75px" class="sai_graybluebut" type="button" onclick="message_box.close_message();" value="OK" />\';
					if(image == "1"){
						var img = \'<img src="' . $theme['images'] . 'error.gif" />\';
					}else{
						var img = \'<img src="' . $theme['images'] . 'confirm.gif" />\';			
					}					
					if(jQuery(\'.sai_message_box\').html() === null) {
						var message = \'<div class="sai_message_box"><table border="0" cellpadding="8" width="100%" height="100%"><tr ><td rowspan="2" width="40%" > \'+ img + \'</td><td width="60%" class ="msg_tr1">\' +  title + \'</td></tr><tr class ="msg_tr2"><td style="text-align:left">\' + body + \'</td></tr><tr ><td colspan="2" class ="msg_tr3">\' + okbutton + \'</td></tr></table></div>\';
						jQuery(document.body).append( message );								
						jQuery(\'.sai_message_box\').css(\'top\', jQuery($(jQuery.browser.webkit ? "body": "html")).scrollTop() + 150);
						jQuery(\'.sai_message_box\').show(\'slow\');
					}else{
						var message =\' <table border="0" width="100%" cellpadding="8" height="100%"><tr ><td rowspan="2" width="40%">\'+ img +  \'</td><td widt="60%" class ="msg_tr1">\' + title + \'</td></tr><tr class ="msg_tr2"><td style="text-align:left">\' + body + \'</td></tr><tr ><td colspan="2" class ="msg_tr3">\' + okbutton + \'</td></tr></table>\';				
						jQuery(\'.sai_message_box\').css(\'top\', jQuery($(jQuery.browser.webkit ? "body": "html")).scrollTop() + 150);
						jQuery(\'.sai_message_box\').show(\'slow\');
						jQuery(\'.sai_message_box\').html( message );
					}
				},
				delete_message: function(title, body ,did) {			
					var yesbutton = \'<input type="button" style="width:75px" onclick="message_box.yes_close_message(\'+did+\');" value="YES" class="sai_graybluebut"/>\';
					var nobutton = \'<input type="button" style="width:75px" onclick="message_box.no_close_message();" value="NO" class="sai_graybluebut" />\';
					var img = \'<img src="' . $theme['images'] . 'remove_big.gif" />\';
					if(jQuery(\'.sai_message_box\').html() === null) {
						var message = \'<div class="sai_message_box"><table border="0" cellpadding="8" width="100%" height="100%"><tr height="60%" ><td rowspan="2" width="40%" > \'+ img + \'</td><td width="60%" class ="msg_tr1" height="10%">\' +  title + \'</td></tr><tr ><td style="text-align:left" height="60%" cellpading="2" class ="msg_tr2">\' + body + \'</td></tr><tr ><td colspan="2" class ="msg_tr3" >\' + yesbutton + \'&nbsp; &nbsp; \' + nobutton + \'</td></tr></table></div>\';				
						jQuery(document.body).append( message );								
						jQuery(\'.sai_message_box\').css(\'top\', jQuery($(jQuery.browser.webkit ? "body": "html")).scrollTop() + 150);
						jQuery(\'.sai_message_box\').show(\'slow\');
					}else{
						var message = \' <table  border="0" cellpadding="8" width="100%" height="100%"><tr height="60%" ><td rowspan="2" width="40%">\'+ img +  \'</td><td widt="60%" class ="msg_tr1" height="10%">\' + title + \'</td></tr><tr><td style="text-align:left" height="60%" cellpading="2" class ="msg_tr2">\' + body + \'</td></tr><tr ><td colspan="2" class ="msg_tr3" >\' + yesbutton + \'&nbsp; &nbsp; \' + nobutton + \'</td></tr></table>\'
						jQuery(\'.sai_message_box\').css(\'top\', jQuery($(jQuery.browser.webkit ? "body": "html")).scrollTop() + 150);
						jQuery(\'.sai_message_box\').show(\'slow\');
						jQuery(\'.sai_message_box\').html( message );
					}
				},
				close_message: function() {
					jQuery(\'.sai_message_box\').hide(\'fast\');
				},
				yes_close_message: function(did) {
					$(\'#delete_rec\').css("display", "");;
					jQuery(\'.sai_message_box\').hide(\'fast\');		
					$.ajax({				
						type: "POST",				
						url: window.location+"&delete_all=1",								
						// checking for error
						success: function(data){
							$(\'#delete_rec\').css("display", "none");
							var result = data.substring(0,1);
							if(result == "1"){
								var msg = data.substring(1,data.indexOf("<table"));
								var output = data.substring(data.indexOf("<table"));
								message_box.show_message( "Done ",msg,2);														
								$("#display_tab").fadeOut();
							}
							if(result == "0"){	
								$("#createmx").css("display", "none");
								var msg = data.substring(1);
								message_box.show_message( "Error",msg,1);
							}
						},				
						error: function(request,error) {
							message_box.show_message("Error",\'' . $l['connect_error'] . '\',1);					
						}
					});					
				},
				no_close_message: function() {
					jQuery(\'.sai_message_box\').hide(\'fast\');			
				}
			}
		}();		
		
	// ]]></script>
	';
    softfooter();
}