add a member to a department and create his profile

This commit is contained in:
Afonso Baldo 2022-10-06 23:23:56 +01:00
parent d602908466
commit 1be9341272
5 changed files with 331 additions and 16 deletions

65
B-10/index.html Normal file
View File

@ -0,0 +1,65 @@
<?xml version="1.0"?>
<!DOCTYPE html>
<HTML lang="en">
<HEAD>
<META http-equiv="Content-type" content="text/html;charset=UTF-8"/>
<TITLE>B-10 HR Department - Porto Space Team</TITLE>
<LINK rel="stylesheet" href="https://diogo.site/assets/css/main.css" type="text/css"/>
<LINK rel="stylesheet" href="/style.css" type="text/css"/>
<LINK rel="shortcut icon" href="about:blank"/>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@48,400,0,0"/>
<META name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes"/>
</HEAD>
<BODY>
<HEADER>
<DIV id="header-content">
<H1>B-10 HR Department - Porto Space Team</H1>
<NAV>
<UL>
<LI><A href="/">Back</A></LI>
<LI><A href="">Staff</A></LI>
<LI><A href="https://docs.google.com/spreadsheets/d/1ZWNEMillDsazFKvDcpFJw7AXnhd0d832PTYg6xVqTRE/edit?usp=sharing">Availability</A>
</LI>
<LI><A href="https://blog.diogo.site/2022-08-12-rocket">Situation Report</A></LI>
<LI><A href="https://drive.google.com/drive/folders/13IT6hPvnLLfGPnsecII5t-82X5qM5up0">Drive</A></LI>
<LI><A href="https://codeberg.org/portospaceteam">Codeberg</A></LI>
<LI><A href="new-member-orientation.html">New Members</A></LI>
</UL>
</NAV>
</DIV>
</HEADER>
<HR/>
<MAIN>
<SECTION>
<H2>Staff Members </H2>
<a href="/add_member.php?department=B-10" id="AddMember">
<span class="material-symbols-outlined">
add
</span>
<span>Add Member</span>
</a>
<UL id="staffList">
</UL>
</SECTION>
</MAIN>
<HR/>
<FOOTER>
<P><SMALL>This website's source code is <A href="https://codeberg.org/portospaceteam/E-42">hosted here</A>.</SMALL>
</P>
<P><SMALL>Unless stated otherwise, you can assume <A href="https://creativecommons.org/licenses/by-sa/4.0/">Attribution-ShareAlike 4.0 International (CC BY-SA
4.0)</A>.</SMALL></P>
</FOOTER>
</BODY>
</HTML>

View File

@ -0,0 +1,69 @@
<!DOCTYPE html>
<HTML lang="en">
<HEAD>
<META http-equiv="Content-type" content="text/html;charset=UTF-8" />
<TITLE>E-42 SoftEng Dept. - Porto Space Team</TITLE>
<LINK rel="stylesheet" href="https://diogo.site/assets/css/main.css" type="text/css">
<LINK rel="shortcut icon" href="about:blank">
<META name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
</HEAD>
<BODY>
<HEADER>
<DIV id="header-content">
<H1>B-10 HR Department - Porto Space Team</H1>
<NAV>
<UL>
<LI><A href="/B-10/">Staff</A></LI>
<LI><A
href="https://docs.google.com/spreadsheets/d/1ZWNEMillDsazFKvDcpFJw7AXnhd0d832PTYg6xVqTRE/edit?usp=sharing">Availability</A>
</LI>
<LI><A href="https://blog.diogo.site/2022-08-12-rocket">Situation Report</A></LI>
<LI><A
href="https://kanban.undefinedhackers.net/?controller=BoardViewController&action=show&project_id=3">Kanban</A>
[<A
href="https://kanban.undefinedhackers.net/?controller=BoardViewController&action=readonly&token=5462eb4b047a0a8828cafb4d0f09461b970c07c1d31801536558542f723a">P</A>]
</LI>
<LI><A href="https://drive.google.com/drive/u/0/folders/1fVqTATvoZ9vamQRb-SL8uIvnawgUTdEN">Drive</A></LI>
<LI><A href="https://codeberg.org/portospaceteam">Codeberg</A></LI>
<LI><A href="#">New Members</A></LI>
</UL>
</NAV>
</DIV>
</HEADER>
<HR>
<MAIN>
<SECTION>
<H2>Ahoy-hoy!</H2>
<P>Welcome to E-42, and thank you for your interest in joining us!</P>
<P>Please read the general situation report (sitrep) linked in the top menu so you understand the State of The Art
(SoTA) of this department.</P>
<P>We use certain tools and methodologies here, and it's important that you know how they work and be consistent.
</P>
<P>The team is currently 7-members long, where Diogo Peralta Cordeiro is working as Project Manager (Project Owner
and SCRUM Master).</P>
<H3>Tools/Platforms</H3>
<UL>
<LI><B>php-kanban</B> as our <A href="https://en.wikipedia.org/wiki/Scrum">SCRUM</A> board;</LI>
<LI><B>Codeberg</B> as our GIT host, and markdown for periodic reports;</LI>
<LI><B>Google Drive</B> for storing documents. This department will always present more formal final reports in
LaTeX, these are produced by the Project Manager;</LI>
</UL>
</SECTION>
</MAIN>
<HR>
<FOOTER>
<P><SMALL>Unless stated otherwise, you can assume <A
href="https://creativecommons.org/licenses/by-sa/4.0/">Attribution-ShareAlike 4.0 International (CC BY-SA
4.0)</A>.</SMALL></P>
</FOOTER>
</BODY>
</HTML>

View File

@ -0,0 +1,112 @@
<?php
// check if department and name exists
if(!isset($_GET['department']) || !isset($_GET['name']))
die('Name or Department is missing');
// check if department is valid
$departmemt = strtoupper($_GET['department']);
if(empty($departmemt) || !preg_match('/^[A-Z]-[0-9]*$/', $departmemt))
die('Invalid department');
// check if name is valid
$name = htmlentities($_GET['name']);
//TODO verificar se nao tem barras
if(empty( $name) || !preg_match('/^[\w\-()]*$/', $name) )
die('Invalid name');
// load html file
$path = __DIR__ . '/../' . $departmemt . '/index.html';
$html = simplexml_load_file($path);
$staff_list = $html->xpath('//UL[@id="staffList"]');
foreach( $staff_list[0] as $member){
if($member->a->__toString() === $name){
die("Member already exists");
}
}
$new_staff = $staff_list[0]->addChild('li');
$new_staff->a =$name;
$new_staff->a['href'] ='members/'.$name;
// update in department members lists
$html->asXml($path);
// create member profile
$member_page = __DIR__ . '\\..\\' . $departmemt.'\\members\\'.$name;
mkdir($member_page.'\\reports', 0777, true);
$page = fopen($member_page.'\\index.html', "w");
$default_page = '<!DOCTYPE html>
<HTML lang="en">
<HEAD>
<META http-equiv="Content-type" content="text/html;charset=UTF-8" />
<TITLE>Staff Details: '.$name.' | '.$departmemt.' - Porto Space Team</TITLE>
<META name="author" content="'.$name.'">
<LINK rel="stylesheet" href="https://diogo.site/assets/css/main.css" type="text/css">
<LINK rel="shortcut icon" href="about:blank">
<META name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
</HEAD>
<BODY>
<HEADER>
<DIV id="header-content">
<H1>'.$departmemt.' - Porto Space Team</H1>
<H2>Staff Details: '.$name.'</H2>
<NAV>
<UL>
<LI><A href="/'.$departmemt.'/">Back</A></LI>
<LI><A href="#">Profile</A></LI>
<LI><A
href="https://codeberg.org/portospaceteam/'.$departmemt.'/src/branch/master/members/'.$name.'/reports">Reports</A>
</LI>
</UL>
</NAV>
</DIV>
</HEADER>
<HR>
<MAIN>
<SECTION>
<H3>Past Responsibilities</H3>
<P>TODO</P>
<H3>Current Responsibilities</H3>
<P>TODO</P>
<H3>Relevant Education background</H3>
<P>TODO</P>
<H3>About</H3>
<P>TODO</P>
</SECTION>
</MAIN>
<HR>
<FOOTER>
<P><SMALL>Unless stated otherwise, you can assume <A
href="https://creativecommons.org/licenses/by-sa/4.0/">Attribution-ShareAlike 4.0 International (CC BY-SA
4.0)</A>.</SMALL></P>
</FOOTER>
</BODY>
</HTML>';
fwrite($page, $default_page);
fclose( $page);
header('Location: /'. $departmemt.'/');
?>

69
add_member.php Normal file
View File

@ -0,0 +1,69 @@
<?php
if(!isset($_GET['department'])){
header('Location: /');
die;
}
// check if department is valid
$departmemt = htmlentities(strtoupper($_GET['department']));
if(empty($departmemt) || !preg_match('/^[A-Z]-[0-9]*$/', $departmemt)){
header('Location: /' );
die();
}
?>
<!DOCTYPE html>
<HTML lang="en">
<HEAD>
<META http-equiv="Content-type" content="text/html;charset=UTF-8"/>
<TITLE>Add New Member - Porto Space Team</TITLE>
<LINK rel="stylesheet" href="https://diogo.site/assets/css/main.css" type="text/css"/>
<LINK rel="stylesheet" href="/style.css" type="text/css"/>
<LINK rel="shortcut icon" href="about:blank"/>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@48,400,0,0"/>
<META name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes"/>
</HEAD>
<BODY>
<HEADER>
<DIV id="header-content">
<H1><? echo($departmemt);?> - Porto Space Team</H1>
<NAV>
<UL>
<LI><A href="/">Back</A></LI>
</UL>
</NAV>
</DIV>
</HEADER>
<HR/>
<MAIN>
<H2>Add New Member </H2>
<form action="/action/action_add_member.php" method="GET">
<label for="name">Member Name </label>
<input id="name" type="text" name = "name"/>
<input type="hidden" name ="department" value = "<? echo($departmemt)?>">
<br>
<input type="submit" value ="Add Member"/>
</form>
</MAIN>
<HR/>
<FOOTER>
<P><SMALL>This website's source code is <A href="https://codeberg.org/portospaceteam/E-42">hosted here</A>.</SMALL>
</P>
<P><SMALL>Unless stated otherwise, you can assume <A href="https://creativecommons.org/licenses/by-sa/4.0/">Attribution-ShareAlike 4.0 International (CC BY-SA
4.0)</A>.</SMALL></P>
</FOOTER>
</BODY>
</HTML>

View File

@ -46,13 +46,13 @@
<article id = "Business"> <article id = "Business">
<h3>Business</h3> <h3>Business</h3>
<ul> <ul>
<li><a href="B-10/"> B-10: HR Department </a></li> <li><a href="/B-10/"> B-10: HR Department </a></li>
<li><a href="B-20/"> B-20: Sponsor Department</a></li> <li><a href="/B-20/"> B-20: Sponsor Department</a></li>
<li><a href="B-30/"> B-30: Logistics & Events Department</a></li> <li><a href="/B-30/"> B-30: Logistics & Events Department</a></li>
<li><a href="B-40/"> B-40: Marketing Department</a></li> <li><a href="/B-40/"> B-40: Marketing Department</a></li>
<li><a href="B-50/"> B-50: Financial Department</a></li> <li><a href="/B-50/"> B-50: Financial Department</a></li>
<li><a href="B-60/"> B-60: Legal Department</a></li> <li><a href="/B-60/"> B-60: Legal Department</a></li>
<li><a href="B-70/"> B-70: Consulting Department</a></li> <li><a href="/B-70/"> B-70: Consulting Department</a></li>
</ul> </ul>
</article> </article>
@ -61,10 +61,10 @@
<h3>Project Management</h3> <h3>Project Management</h3>
<ul> <ul>
<li><a href="M-10/"> M-10: Project Management Planning & Implementation </a></li> <li><a href="/M-10/"> M-10: Project Management Planning & Implementation </a></li>
<li><a href="M-20/"> M-20: Information Management Department </a></li> <li><a href="/M-20/"> M-20: Information Management Department </a></li>
<li><a href="M-30/"> M-30: Costs Department </a></li> <li><a href="/M-30/"> M-30: Costs Department </a></li>
<li><a href="M-40/"> M-40: Risk Management Department </a></li> <li><a href="/M-40/"> M-40: Risk Management Department </a></li>
</ul> </ul>
</article> </article>
@ -72,11 +72,11 @@
<article id = "QSS"> <article id = "QSS">
<h3>Quality, Safety and Sustainability</h3> <h3>Quality, Safety and Sustainability</h3>
<ul> <ul>
<li><a href="Q-10/"> Q-10: Quality Department </a></li> <li><a href="/Q-10/"> Q-10: Quality Department </a></li>
<li><a href="Q-20/"> Q-20: Safety Department </a></li> <li><a href="/Q-20/"> Q-20: Safety Department </a></li>
<li><a href="Q-30/"> Q-30: Materials & Manufact. Department </a></li> <li><a href="/Q-30/"> Q-30: Materials & Manufact. Department </a></li>
<li><a href="Q-40/"> Q-40: Certification Department </a></li> <li><a href="/Q-40/"> Q-40: Certification Department </a></li>
<li><a href="Q-50/"> Q-50: Sustainability Department </a></li> <li><a href="/Q-50/"> Q-50: Sustainability Department </a></li>
</ul> </ul>
</article> </article>