<?php
require 'header.php';
require 'file.php';
?>
<div class="content">
<?php
if (!isset($_GET['category']) && !isset($_GET['folder'])) {
header('Location: index.php');
die();
}
$category = $_GET['category'];
$folder = $_GET['folder'];
$files = file::getFilesInFolder("projects/".$category."/".$folder);
if (isset($files) === FALSE) {
header('Location: index.php');
die();
}
echo '
<div class="projectView">
';
if (file::readFile($category, $folder) !== FALSE) {
echo '
<div id="info">
<h3>INFORMATION</h3>
';
file::printFolderInfo($category, $folder);
$example = file::getExamples($category, $folder);
if ($example !== FALSE) {
echo '
<h4 style="background-color: none;">Example</h4>
<div id="example">
';
foreach ($example as $e) {
echo '
<img src="'.$e.'" />
';
}
echo '
</div>
';
}
echo '
</div>
';
}
echo '
<div id="code">
<div id="topbar">
<h3>Files</h3>
</div>
';
foreach ($files as $f) {
if (strpos($f, '.') !== false) { // file
if ($f === "info.txt") continue; // removes info.txt from file view
if (strpos($f, "example") !== FALSE) continue; // removes example.png from file view
$getExtension = explode('.', $f, 2)[1];
if ($getExtension === 'jpg' || $getExtension === 'png') { // image
echo '<div class="fileView">';
echo '<input class="showCodeButton" type="button" name="showcode" value="'.$f.'" onclick="showDiv(\''.$f.'\')"/>';
echo '</div>';
$loc = 'projects/'.$category.'/'.$folder.'/'.$f;
echo "<div style='display: none;' class='codeBorder imgBorder' id='".$f."'><pre><img src=".$loc." /></pre></div>";
} else { // text
echo '<div class="fileView">';
echo '<input class="showCodeButton" type="button" name="showcode" value="'.$f.'" onclick="showDiv(\''.$f.'\')"/>';
echo '</div>';
echo "<div style='display: none;' class='codeBorder' id='".$f."'><pre><code>".htmlspecialchars(file::getFileContent("projects/".$category."/".$folder."/".$f))."</code></pre></div>";
}
} else { // directory
echo '<div class="fileView">';
echo '<div id="folder"><a href="'.file::getURL($category.'%'.$folder, $f).'">'.$f.'</a></div>';
echo '</div>';
}
}
echo '
</div>
</div>
';
?>
</div>
<script>
function showDiv(text) {
$(".codeBorder").each(function() {
if ($(this).attr('id') == text) {
if ($(this).css('display') == "none")
$(this).css('display', 'block');
else
$(this).css('display', 'none');
}
});
}
</script>
<?php
require 'footer.php';
?>
css
>
<?php
class file {
public static $URL = 0, $TITLE = 1, $CREATOR = 2, $DESC = 3, $LANG = 4;
public static function getFilesInFolder($path) {
return array_diff(scandir($path), array('.', '..'));
}
public static function getURL($category, $folder) {
$category = str_replace('%', '/', $category);
return 'code.php?category='.$category.'&folder='.$folder;
}
public static function getFileContent($path) {
return file_get_contents($path);
}
public static function readFile($category, $project) { // Title / Creator / Description
$a = array();
$path = "projects/" . $category . "/" . $project . "/info.txt";
//echo $path;
if (file_exists($path)) {
//echo $path;
$f = fopen($path, "r");
$num = 0;
while (!feof($f)) {
$line = fgets($f);
array_push($a, $line);
$num = $num +1;
}
}
if (isset($a[0]))
return $a;
return false;
}
public static function getType($category, $folder, $TYPE) {
if ($TYPE == file::$URL) {
return file::getURL($category, $folder);
} else {
$readFile = file::readFile($category, $folder);
if ($readFile === FALSE) return false;
if ($TYPE == file::$TITLE) {
if (isset($readFile[0])) // Title
return $readFile[0];
} else if ($TYPE == file::$CREATOR) { // Creator
if (isset($readFile[1]))
return $readFile[1];
} else if ($TYPE == file::$DESC) { // Description
if (isset($readFile[2]))
return $readFile[2];
} else if ($TYPE == file::$LANG) { // Programming Language
if (isset($readFile[3]))
return $readFile[3];
}
}
return false;
}
public static function printFolderInfo($category, $folder) {
$files = file::readFile($category, $folder);
if ($files !== FALSE) {
echo '
<table class="table">
<thead>
<th scope="col">Title</th>
<th scope="col">Creator</th>
<th scope="col">Language</th>
<th scope="col">Description</th>
</thead>
<tbody>
';
$URL = file::getType($category, $folder, file::$URL);
$TITLE = file::getType($category, $folder, file::$TITLE);
$CREATOR = file::getType($category, $folder, file::$CREATOR);
$DESC = file::getType($category, $folder, file::$DESC);
$LANG = file::getType($category, $folder, file::$LANG);
echo '
<tr>
<th scope="row">
'.$TITLE.'
</th>
<td>'.$CREATOR.'</td>
<td>'.$LANG.'</td>
<td>'.$DESC.'</td>
</tr>
';
echo '
</tbody>
</table>
';
return true;
}
return false;
}
public static function printInfo($projectName) {
$directories = file::getFilesInFolder("projects/" . $projectName);
echo '
<table class="table">
<thead>
<th scope="col">Title</th>
<th scope="col">Creator</th>
<th scope="col">Language</th>
<th scope="col">Description</th>
</thead>
<tbody>
';
foreach ($directories as $f) {
$URL = file::getType($projectName, $f, file::$URL);
$TITLE = file::getType($projectName, $f, file::$TITLE);
$CREATOR = file::getType($projectName, $f, file::$CREATOR);
$DESC = file::getType($projectName, $f, file::$DESC);
$LANG = file::getType($projectName, $f, file::$LANG);
if ($TITLE !== FALSE) {
//print('<a href="' . $URL . '">' . $TITLE . '</a></br>');
echo '
<tr>
<th scope="row"><a href="'.$URL.'">'.$TITLE.'</th>
<td>'.$CREATOR.'</td>
<td>'.$LANG.'</td>
<td>'.$DESC.'</td>
</tr>
';
} else {
print('<a href="' . $URL . '">' . $f . '</a></br>');
}
}
echo '
</tbody>
</table>
';
}
public static function getExamples($category, $folder) {
$path = "projects/" . $category . "/" . $folder . "/example";
$extension = ".png";
$num = 1;
$a = array();
while(file_exists($path . $num . $extension)) {
array_push($a, $path . $num . $extension);
$num++;
}
if (isset($a[0]))
return $a;
return false;
}
}
</div>
<!-- Footer -->
<footer class="page-footer font-small unique-color-dark" style="background-color: rgb(28, 35, 49);">
<!-- Copyright -->
<div class="footer-copyright text-center py-3" style="color: gray;">© 2021 Copyright:
<a href="#"> scottsportfolio</a>
</div>
<!-- Copyright -->
</footer>
<!-- Footer -->
<script
src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
crossorigin="anonymous"></script>
<script type="text/javascript" src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Portfolio</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src="https://kit.fontawesome.com/d756906828.js" crossorigin="anonymous"></script>
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro&display=swap" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/main.css">
<link rel="stylesheet"
href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.1.0/styles/default.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.1.0/highlight.min.js"></script><script>hljs.initHighlightingOnLoad();</script>
</head>
<body>
<div class="container-fluid col-md-12" style="background-color: #e8e8e8;">
<?php include 'nav.php'; ?>
<?php
require 'header.php';
require 'file.php';
?>
<div class="content">
<div class="mainpage">
<div class="section" id="aboutSection">
<h2>About Me</h2>
<p>
My name is Scott Hernandez and I am a 23 year old software engineering student. Programming has always been a long time hobby of mine, even before school I was interested in programming. In my opinion, there are a lot of people that go to school and learn the skills that are needed but never really have the experience that is needed to be efficient and proficient when it comes to programming. It has always been a long time hobby of mine and now is what I look to excel in when it comes to my career. Being able to ease an individuals life through lines of code is my passion. I am a very fast learner when it comes to things I have to pick up in a short amount of time. I am not just experienced with programming but I've also picked up electrician skills and network infrastructure technician skills in some of the jobs I've had as of recent. When it comes to programming languages, I believe all you really need is to have a good grasp on the syntax of programming languages and the experience that comes with writing thousands of lines of code. I have knowledge and experience with multiple languages. The languages that I have experience with are C++, C#, Java, Javascript, Lua, PHP, and SQL. I also have experience with the subscript languages HTML and CSS as seen on this webpage.
</p>
</br></br>
<p>
These are some of the projects I have worked on over time. In here are included projects I have made on my own, school assignments, and shared projects. These projects include Java, web based languages, C++, and Lua.
</p>
</div>
<!--
<div class="section" id="education">
<h2>Education</h2>
</div>
<div class="section" id="workexperience">
<h2>Work Experience</h2>
</div>
<div class="section" id="achievement">
<h2>Achievement</h2>
</div>
<div class="section" id="conclusion">
<h2>Conclusion</h2>
</div>
-->
<div class="section" id="projectSection">
<h2>Projects</h2>
<div class="section" id="projects">
<h3>Projects Of My Own</h3>
<?php
file::printInfo("selfProjects");
?>
</div>
<div class="section" id="schoolAssignments">
<h3>School Assignments</h3>
<?php
file::printInfo("schoolAssignments");
?>
</div>
<div class="section" id="sharedProjects">
<h3>Shared Projects</h3>
<?php
file::printInfo("sharedProjects");
?>
</div>
</div>
</div>
</div>
<?php
require 'footer.php';
?>
<nav class="navbar navbar-expand-lg navbar-dark" style="background-color: #222831;">
<a class="navbar-brand" href="index.php">Portfolio</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<!--
<div class="collapse navbar-collapse" id="navbarNavDropdown">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="index.php">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="forum.php">Forum</a>
</li>
</ul>
</div>-->
</nav>
<script>
$(document).ready(function() {
$('.nav-link').each(function() {
var p = $(location).attr('pathname').split('/');
var loc = p[p.length-1];
if (loc === $(this).attr('href')) {
$(this).css('color', 'white');
}
});
});
</script>