Home - AlineJo/Jupiter GitHub Wiki

	<?php
	session_start();


		 

	include_once("connect.php");
	include_once("user.php");
	User :: checkUserSession();  

	class IndexPage
	{
		
		
		
		static function content()
		{   
			$DB = new Connection();
			$DB = $DB-> connectToDB();
			
					echo <<< P1

	<script src="ajax/ajax.js"></script>

			<link rel="stylesheet" href="css/popUpDiv.css" /> <!-- PopUpDiv -->
			
		<script src="js/popUpDiv.js"></script>



	<button onclick="location.href='logout.php'">logout</button>

	&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;
	<button onclick="location.href='TODO_PROJECT_V1.zip'"> Dawnload Source Files</button>

	&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;
	<button onclick="location.href='add_item.php'"> Add New Item</button>



	P1;
			
			
		$st = $DB->prepare("select * from work_list  where user_name = :uname  order by note_rank ASC");
		$st->bindParam(':uname',$_SESSION["todo_user_name"]);
		$st->execute();
			
			
		if($st->rowCount() >=1)
		{
			
				   echo <<< P1

	<button onclick="showAll()"> Show All Items</button>

	P1;
		while($row = $st->fetch())   {
	 

			if($row["importance"] == "Very Important")
			{
				$color ="Fa0060"; 
			   
			
			}
			
			else if ($row["importance"] == "Important")
			{
				  $color ="F0F"; 
	 
			}
			else if ($row["importance"] == "Urgent")
			{
				  $color ="F00"; 
	 
			}
			 else if ($row["importance"] == "normal")
			{
				  $color ="FBFF9F"; 
	 
			}
			
			else
			{
				$color ="c7c7c7";
			}
			
			
	if($row["for_now"]=="show")
	{
		 
			echo <<< P1



	<div style=" background:#{$color}; padding:2.5%; margin:5%; width : 50%; ">


		<h2 >Importance : {$row["importance"] } 
	 


		
	<button onclick="document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'   "  style=" height:10%;  margin-left:105%;
	   ">
		Delete </button>
		
	 <div id="light" class="white_content">Do you really want to <b>Delete</b> <br>
	 " Note : {$row["title"]} "  <br><br>
	 <b><button name="btnDelete"  onclick="deleteNote('{$row["note_id"]}')"  >YES</button></b>
	<br><br>
	 <b><button onclick="document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'">NO</button></b>
	  </div>
	  <div id="fade" class="black_overlay"></div>
	  


	  
	  
	  
	  
	  
		Deadline : {$row["date_end"]}</h2>
		<hr>
		
	 
		
	   <h1> {$row["category"] } :   {$row["title"]}</h1> 
		<h2>{$row["description"]}</h2>
	<h2>Done before: 
				<span name="area_done" id="{$row["note_id"]}" >
				
			 <input type="hidden" name="current_done_times" id="{$row["note_id"]}_times" value="{$row["done_before"]}" >  
			 
			 <input type="hidden" name="note_id" id="note_id" value="{$row["note_id"]}" >
			 
						{$row["done_before"]} 
						
						
						</span> 

	times!


	</h2>
		
		
		
		<button style="width:25%; "   onclick="hide()"> Hide </button>
		
		<button style="width:25%; margin-left:25%; "  onclick="done('{$row["note_id"]}')" > Done </button>
	   




	</div>
	   
			
	P1;
	}
	 //if($row["for_now"]=="show")
		   
		 
			
			
		} 
		// while($row = $DB->fetch())   
			
		}
		//if($DB->rowCount() >=1)
			
			
		}
		//class content
		
	}
	//class Index

	IndexPage:: content();

	//<html>
	//<header>
	//  		<link rel="stylesheet" href="css/popUpDiv.css" /> <!-- PopUpDiv -->
	//        
	//    <script src="js/popUpDiv.js"></script>
	//<!--functions available inside popUpDiv.js are:
	//
	//1* deleteNote(noteId);
	//
	//-->
	//    </header>
	//
	//</html>



	?>


	<script>


		
	function deleteNote(noteId) {
		document.getElementById('light').style.display='none';
		document.getElementById('fade').style.display='none';

		
		var hr = new XMLHttpRequest();
		
		hr.open("POST","ajax_fast_checking.php",true);
		
		hr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
		
		hr.onreadystatechange =function(){
			
			if(hr.readyState == 4 && hr.status ==200)
			{
				window.location = "index.php";
			}
		}
		
		var v = "deleteNoteId="+noteId;
		
		hr.send(v);
		
	}


	</script>
⚠️ **GitHub.com Fallback** ⚠️