Skip to content

Commit

Permalink
Merge pull request #3 from yookoala/refactor-breadcrumbs
Browse files Browse the repository at this point in the history
Refactor breadcrumbs
  • Loading branch information
rossdotparker authored Nov 30, 2018
2 parents b385062 + a886844 commit 0cd96de
Show file tree
Hide file tree
Showing 12 changed files with 81 additions and 56 deletions.
31 changes: 29 additions & 2 deletions Alumni/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,29 @@
# module-alumni
The Alumni module allows schools to accept alumni registrations, and then link these to existing user accounts.
# Alumni

Module of [Gibbon][gibbon]. Allows schools to accept alumni registrations, and
then link these to existing user accounts.

[gibbon]: https://gibbonedu.org

## Installation & Support

To install, just copy this folder into `GIBBON_HOME/modules` so that this file
exists: `GIBBON_HOME/modules/Alumni/manifest.php`.

For support visit [https://gibbonedu.org/support](https://gibbonedu.org/support).

## Compatibility

* v0.5.00 only supports Gibbon v17+
* v0.4.00 supports Gibbon v16

## Latest Source Code

This module is developed on [GitHub][repo-url].

[repo-url]: https://github.com/GibbonEdu/module-alumni

## License

This module is licensed to the GPLv3. You may obtain a copy of the license in
this repository [here](LICENSE).
52 changes: 25 additions & 27 deletions Alumni/alumni_manage.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,18 @@
*/

use Gibbon\Forms\Form;
use Gibbon\Services\Format;

//Module includes
include './modules/'.$_SESSION[$guid]['module'].'/moduleFunctions.php';

if (isActionAccessible($guid, $connection2, '/modules/Alumni/alumni_manage.php') == false) {
//Acess denied
echo "<div class='error'>";
echo __($guid, 'You do not have access to this action.');
echo __('You do not have access to this action.');
echo '</div>';
} else {
echo "<div class='trail'>";
echo "<div class='trailHead'><a href='".$_SESSION[$guid]['absoluteURL']."'>".__($guid, 'Home')."</a> > <a href='".$_SESSION[$guid]['absoluteURL'].'/index.php?q=/modules/'.getModuleName($_GET['q']).'/'.getModuleEntry($_GET['q'], $connection2, $guid)."'>".__($guid, getModuleName($_GET['q']))."</a> > </div><div class='trailEnd'>".__($guid, 'Manage Alumni').'</div>';
echo '</div>';
$page->breadcrumbs->add('Manage Alumni');

if (isset($_GET['return'])) {
returnProcess($guid, $_GET['return'], null, null);
Expand All @@ -39,7 +38,7 @@
$graduatingYear = isset($_GET['graduatingYear'])? $_GET['graduatingYear'] : '';

echo '<h3>';
echo __($guid, 'Filter');
echo __('Filter');
echo '</h3>';

$form = Form::create('search', $_SESSION[$guid]['absoluteURL'].'/index.php', 'get');
Expand All @@ -57,7 +56,7 @@
echo $form->getOutput();

echo '<h3>';
echo __($guid, 'View Records');
echo __('View Records');
echo '</h3>';
//Set pagination variable
$page = 1;
Expand Down Expand Up @@ -89,11 +88,11 @@
$sqlPage = $sql.' LIMIT '.$_SESSION[$guid]['pagination'].' OFFSET '.(($page - 1) * $_SESSION[$guid]['pagination']);

echo "<div class='linkTop'>";
echo "<a href='".$_SESSION[$guid]['absoluteURL'].'/index.php?q=/modules/'.$_SESSION[$guid]['module']."/alumni_manage_add.php&graduatingYear=$graduatingYear'>".__($guid, 'Add')."<img style='margin: 0 0 -4px 5px' title='".__($guid, 'Add')."' src='./themes/".$_SESSION[$guid]['gibbonThemeName']."/img/page_new.png'/></a>";
echo "<a href='".$_SESSION[$guid]['absoluteURL'].'/index.php?q=/modules/'.$_SESSION[$guid]['module']."/alumni_manage_add.php&graduatingYear=$graduatingYear'>".__('Add')."<img style='margin: 0 0 -4px 5px' title='".__('Add')."' src='./themes/".$_SESSION[$guid]['gibbonThemeName']."/img/page_new.png'/></a>";
echo '</div>';

if ($result->rowCount() < 1) { echo "<div class='error'>";
echo __($guid, 'There are no records to display.');
echo __('There are no records to display.');
echo '</div>';
} else {
if ($result->rowCount() > $_SESSION[$guid]['pagination']) {
Expand All @@ -103,16 +102,16 @@
echo "<table cellspacing='0' style='width: 100%'>";
echo "<tr class='head'>";
echo '<th>';
echo __($guid, 'Name');
echo __('Name');
echo '</th>';
echo '<th>';
echo __($guid, 'Email');
echo __('Email');
echo '</th>';
echo '<th>';
echo __($guid, 'Graduating Year');
echo __('Graduating Year');
echo '</th>';
echo "<th style='min-width: 70px'>";
echo __($guid, 'Actions');
echo __('Actions');
echo '</th>';
echo '</tr>';

Expand All @@ -135,7 +134,7 @@
//COLOR ROW BY STATUS!
echo "<tr class=$rowNum>";
echo '<td>';
echo formatName($row['title'], $row['firstName'], $row['surname'], 'Parent', false, false).'</b><br/>';
echo Format::name($row['title'], $row['firstName'], $row['surname'], 'Parent', false, false).'</b><br/>';
echo '</td>';
echo '<td>';
echo $row['email'];
Expand All @@ -144,8 +143,8 @@
echo $row['graduatingYear'];
echo '</td>';
echo '<td>';
echo "<a href='".$_SESSION[$guid]['absoluteURL'].'/index.php?q=/modules/'.$_SESSION[$guid]['module'].'/alumni_manage_edit.php&alumniAlumnusID='.$row['alumniAlumnusID']."&graduatingYear=$graduatingYear'><img title='".__($guid, 'Edit')."' src='./themes/".$_SESSION[$guid]['gibbonThemeName']."/img/config.png'/></a> ";
echo "<a class='thickbox' href='".$_SESSION[$guid]['absoluteURL'].'/fullscreen.php?q=/modules/'.$_SESSION[$guid]['module'].'/alumni_manage_delete.php&alumniAlumnusID='.$row['alumniAlumnusID']."&graduatingYear=$graduatingYear&width=650&height=135'><img title='".__($guid, 'Delete')."' src='./themes/".$_SESSION[$guid]['gibbonThemeName']."/img/garbage.png'/></a> ";
echo "<a href='".$_SESSION[$guid]['absoluteURL'].'/index.php?q=/modules/'.$_SESSION[$guid]['module'].'/alumni_manage_edit.php&alumniAlumnusID='.$row['alumniAlumnusID']."&graduatingYear=$graduatingYear'><img title='".__('Edit')."' src='./themes/".$_SESSION[$guid]['gibbonThemeName']."/img/config.png'/></a> ";
echo "<a class='thickbox' href='".$_SESSION[$guid]['absoluteURL'].'/fullscreen.php?q=/modules/'.$_SESSION[$guid]['module'].'/alumni_manage_delete.php&alumniAlumnusID='.$row['alumniAlumnusID']."&graduatingYear=$graduatingYear&width=650&height=135'><img title='".__('Delete')."' src='./themes/".$_SESSION[$guid]['gibbonThemeName']."/img/garbage.png'/></a> ";
echo "<script type='text/javascript'>";
echo '$(document).ready(function(){';
echo "\$(\".comment-$count\").hide();";
Expand All @@ -155,25 +154,25 @@
echo '});';
echo '});';
echo '</script>';
echo "<a title='".__($guid, 'View Details')."' class='show_hide-$count' onclick='false' href='#'><img style='padding-right: 5px' src='".$_SESSION[$guid]['absoluteURL']."/themes/Default/img/page_down.png' alt='".__($guid, 'View Details')."' onclick='return false;' /></a>";
echo "<a title='".__('View Details')."' class='show_hide-$count' onclick='false' href='#'><img style='padding-right: 5px' src='".$_SESSION[$guid]['absoluteURL']."/themes/Default/img/page_down.png' alt='".__('View Details')."' onclick='return false;' /></a>";
echo '</td>';
echo '</tr>';
echo "<tr class='comment-$count' id='comment-$count'>";
echo '<td colspan=4>';
echo '<b>'.__($guid, 'Official Name').': </b>'.$row['officialName'].'<br/>';
echo '<b>'.__($guid, 'Maiden Name').': </b>'.$row['maidenName'].'<br/>';
echo '<b>'.__($guid, 'Gender').': </b>'.$row['gender'].'<br/>';
echo '<b>'.__($guid, 'Username').': </b>'.$row['username'].'<br/>';
echo '<b>'.__($guid, 'Date Of Birth').': </b>';
echo '<b>'.__('Official Name').': </b>'.$row['officialName'].'<br/>';
echo '<b>'.__('Maiden Name').': </b>'.$row['maidenName'].'<br/>';
echo '<b>'.__('Gender').': </b>'.$row['gender'].'<br/>';
echo '<b>'.__('Username').': </b>'.$row['username'].'<br/>';
echo '<b>'.__('Date Of Birth').': </b>';
if ($row['dob'] != '') {
echo dateConvertBack($guid, $row['dob']);
}
echo '<br/>';
echo '<b>'.__($guid, 'Country of Residence').': </b>'.$row['address1Country'].'<br/>';
echo '<b>'.__($guid, 'Profession').': </b>'.$row['profession'].'<br/>';
echo '<b>'.__($guid, 'Employer').': </b>'.$row['employer'].'<br/>';
echo '<b>'.__($guid, 'Job Title').': </b>'.$row['jobTitle'].'<br/>';
echo '<b>'.__($guid, 'Date Joined').': </b>';
echo '<b>'.__('Country of Residence').': </b>'.$row['address1Country'].'<br/>';
echo '<b>'.__('Profession').': </b>'.$row['profession'].'<br/>';
echo '<b>'.__('Employer').': </b>'.$row['employer'].'<br/>';
echo '<b>'.__('Job Title').': </b>'.$row['jobTitle'].'<br/>';
echo '<b>'.__('Date Joined').': </b>';
if ($row['timestamp'] != '') {
echo dateConvertBack($guid, substr($row['timestamp'], 0, 10));
}
Expand All @@ -188,4 +187,3 @@
}
}
}
?>
10 changes: 5 additions & 5 deletions Alumni/alumni_manage_add.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
if (isActionAccessible($guid, $connection2, '/modules/Alumni/alumni_manage_add.php') == false) {
//Acess denied
echo "<div class='error'>";
echo __($guid, 'You do not have access to this action.');
echo __('You do not have access to this action.');
echo '</div>';
} else {
echo "<div class='trail'>";
echo "<div class='trailHead'><a href='".$_SESSION[$guid]['absoluteURL']."'>".__($guid, 'Home')."</a> > <a href='".$_SESSION[$guid]['absoluteURL'].'/index.php?q=/modules/'.getModuleName($_GET['q']).'/'.getModuleEntry($_GET['q'], $connection2, $guid)."'>".__($guid, getModuleName($_GET['q']))."</a> > <a href='".$_SESSION[$guid]['absoluteURL']."/index.php?q=/modules/Alumni/alumni_manage.php'>".__($guid, 'Manage Alumni')."</a> > </div><div class='trailEnd'>".__($guid, 'Add').'</div>';
echo '</div>';
$page->breadcrumbs
->add(__('Manage Alumni'), 'alumni_manage.php')
->add(__('Add'));

$graduatingYear = isset($_GET['graduatingYear'])? $_GET['graduatingYear'] : '';
$alumniAlumnusID = isset($_GET['alumniAlumnusID'])? $_GET['alumniAlumnusID'] : '';
Expand All @@ -45,7 +45,7 @@
}

if ($graduatingYear != '') { echo "<div class='linkTop'>";
echo "<a href='".$_SESSION[$guid]['absoluteURL'].'/index.php?q=/modules/Alumni/alumni_manage.php&graduatingYear='.$graduatingYear."'>".__($guid, 'Back to Search Results').'</a>';
echo "<a href='".$_SESSION[$guid]['absoluteURL'].'/index.php?q=/modules/Alumni/alumni_manage.php&graduatingYear='.$graduatingYear."'>".__('Back to Search Results').'</a>';
echo '</div>';
}

Expand Down
Empty file modified Alumni/alumni_manage_addProcess.php
100755 → 100644
Empty file.
14 changes: 7 additions & 7 deletions Alumni/alumni_manage_delete.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
if (isActionAccessible($guid, $connection2, '/modules/Alumni/alumni_manage_delete.php') == false) {
//Acess denied
echo "<div class='error'>";
echo __($guid, 'You do not have access to this action.');
echo __('You do not have access to this action.');
echo '</div>';
} else {
//Proceed!
echo "<div class='trail'>";
echo "<div class='trailHead'><a href='".$_SESSION[$guid]['absoluteURL']."'>".__($guid, 'Home')."</a> > <a href='".$_SESSION[$guid]['absoluteURL'].'/index.php?q=/modules/'.getModuleName($_GET['q']).'/'.getModuleEntry($_GET['q'], $connection2, $guid)."'>".__($guid, getModuleName($_GET['q']))."</a> > <a href='".$_SESSION[$guid]['absoluteURL']."/index.php?q=/modules/Alumni/alumni_manage.php'>".__($guid, 'Manage Alumni')."</a> > </div><div class='trailEnd'>".__($guid, 'Delete').'</div>';
echo '</div>';
$page->breadcrumbs
->add(__('Manage Alumni'), 'alumni_manage.php')
->add(__('Delete'));

if (isset($_GET['return'])) {
returnProcess($guid, $_GET['return'], null, null);
Expand All @@ -40,7 +40,7 @@
//Check if school year specified
$alumniAlumnusID = $_GET['alumniAlumnusID'];
if ($alumniAlumnusID == '') { echo "<div class='error'>";
echo __($guid, 'You have not specified one or more required parameters.');
echo __('You have not specified one or more required parameters.');
echo '</div>';
} else {
try {
Expand All @@ -54,15 +54,15 @@

if ($result->rowCount() != 1) {
echo "<div class='error'>";
echo __($guid, 'The selected record does not exist, or you do not have access to it.');
echo __('The selected record does not exist, or you do not have access to it.');
echo '</div>';
} else {
//Let's go!
$row = $result->fetch();

if ($_GET['graduatingYear'] != '') {
echo "<div class='linkTop'>";
echo "<a href='".$_SESSION[$guid]['absoluteURL'].'/index.php?q=/modules/Alumni/alumni_manage.php&graduatingYear='.$_GET['graduatingYear']."'>".__($guid, 'Back to Search Results').'</a>';
echo "<a href='".$_SESSION[$guid]['absoluteURL'].'/index.php?q=/modules/Alumni/alumni_manage.php&graduatingYear='.$_GET['graduatingYear']."'>".__('Back to Search Results').'</a>';
echo '</div>';
}

Expand Down
Empty file modified Alumni/alumni_manage_deleteProcess.php
100755 → 100644
Empty file.
14 changes: 7 additions & 7 deletions Alumni/alumni_manage_edit.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
if (isActionAccessible($guid, $connection2, '/modules/Alumni/alumni_manage_edit.php') == false) {
//Acess denied
echo "<div class='error'>";
echo __($guid, 'You do not have access to this action.');
echo __('You do not have access to this action.');
echo '</div>';
} else {
//Proceed!
echo "<div class='trail'>";
echo "<div class='trailHead'><a href='".$_SESSION[$guid]['absoluteURL']."'>".__($guid, 'Home')."</a> > <a href='".$_SESSION[$guid]['absoluteURL'].'/index.php?q=/modules/'.getModuleName($_GET['q']).'/'.getModuleEntry($_GET['q'], $connection2, $guid)."'>".__($guid, getModuleName($_GET['q']))."</a> > <a href='".$_SESSION[$guid]['absoluteURL']."/index.php?q=/modules/Alumni/alumni_manage.php'>".__($guid, 'Manage Alumni')."</a> > </div><div class='trailEnd'>".__($guid, 'Edit').'</div>';
echo '</div>';
$page->breadcrumbs
->add(__('Manage Alumni'), 'alumni_manage.php')
->add(__('Edit'));

if (isset($_GET['return'])) {
returnProcess($guid, $_GET['return'], null, null);
Expand All @@ -43,7 +43,7 @@

if (empty($alumniAlumnusID)) {
echo "<div class='error'>";
echo __($guid, 'You have not specified one or more required parameters.');
echo __('You have not specified one or more required parameters.');
echo '</div>';
} else {
try {
Expand All @@ -57,12 +57,12 @@

if ($result->rowCount() != 1) {
echo "<div class='error'>";
echo __($guid, 'The selected record does not exist, or you do not have access to it.');
echo __('The selected record does not exist, or you do not have access to it.');
echo '</div>';
} else {
if ($graduatingYear != '') {
echo "<div class='linkTop'>";
echo "<a href='".$_SESSION[$guid]['absoluteURL'].'/index.php?q=/modules/Alumni/alumni_manage.php&graduatingYear='.$graduatingYear."'>".__($guid, 'Back to Search Results').'</a>';
echo "<a href='".$_SESSION[$guid]['absoluteURL'].'/index.php?q=/modules/Alumni/alumni_manage.php&graduatingYear='.$graduatingYear."'>".__('Back to Search Results').'</a>';
echo '</div>';
}

Expand Down
Empty file modified Alumni/alumni_manage_editProcess.php
100755 → 100644
Empty file.
Empty file modified Alumni/moduleFunctions.php
100755 → 100644
Empty file.
16 changes: 8 additions & 8 deletions Alumni/publicRegistration.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@
if ($proceed == false) {
//Acess denied
echo "<div class='error'>";
echo __($guid, 'You do not have access to this action.');
echo __('You do not have access to this action.');
echo '</div>';
} else {
//Proceed!
echo "<div class='trail'>";
echo "<div class='trailHead'><a href='".$_SESSION[$guid]['absoluteURL']."'>".__($guid, 'Home')."</a> > </div><div class='trailEnd'>".$_SESSION[$guid]['organisationNameShort'].' '.__($guid, 'Alumni Registration').'</div>';
echo '</div>';
$page->breadcrumbs->add(__('{orgName} Alumni Registration', [
'orgName' => $_SESSION[$guid]['organisationNameShort'] ?? ''
]));

$publicRegistrationMinimumAge = getSettingByScope($connection2, 'User Admin', 'publicRegistrationMinimumAge');

$returns = array();
$returns['error5'] = sprintf(__($guid, 'Your request failed because you do not meet the minimum age for joining this site (%1$s years of age).'), $publicRegistrationMinimumAge);
$returns['success0'] = __($guid, 'Your registration was successfully submitted: a member of our alumni team will be in touch shortly.');
$returns['error5'] = sprintf(__('Your request failed because you do not meet the minimum age for joining this site (%1$s years of age).'), $publicRegistrationMinimumAge);
$returns['success0'] = __('Your registration was successfully submitted: a member of our alumni team will be in touch shortly.');
$editLink = '';
if (isset($_GET['editID'])) {
$editLink = $_SESSION[$guid]['absoluteURL'].'/index.php?q=/modules/User Admin/user_manage_edit.php&gibbonPersonID='.$_GET['editID'].'&search='.$_GET['search'];
Expand All @@ -55,10 +55,10 @@
?>
<p>
<?php
echo sprintf(__($guid, 'This registration form is for former members of the %1$s community who wish to reconnect. Please fill in your details here, and someone from our alumni team will get back to you.'), $_SESSION[$guid]['organisationNameShort']);
echo sprintf(__('This registration form is for former members of the %1$s community who wish to reconnect. Please fill in your details here, and someone from our alumni team will get back to you.'), $_SESSION[$guid]['organisationNameShort']);
$facebookLink = getSettingByScope($connection2, 'Alumni', 'facebookLink');
if ($facebookLink != '') {
echo ' '.sprintf(__($guid, 'Please don\'t forget to take a look at, and like, our alumni %1$sFacebook page%2$s.'), "<a href='".htmlPrep($facebookLink)."' target='_blank'>", '</a>');
echo ' '.sprintf(__('Please don\'t forget to take a look at, and like, our alumni %1$sFacebook page%2$s.'), "<a href='".htmlPrep($facebookLink)."' target='_blank'>", '</a>');
}

$form = Form::create('action', $_SESSION[$guid]['absoluteURL'].'/modules/Alumni/publicRegistrationProcess.php');
Expand Down
Empty file modified Alumni/publicRegistrationProcess.php
100755 → 100644
Empty file.
Empty file modified Alumni/version.php
100755 → 100644
Empty file.

0 comments on commit 0cd96de

Please sign in to comment.