Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #156 from crimsonstrife/dev
Browse files Browse the repository at this point in the history
Dev to Prod
  • Loading branch information
crimsonstrife authored Mar 21, 2024
2 parents 643d643 + de81147 commit a027284
Show file tree
Hide file tree
Showing 31 changed files with 2,380 additions and 155 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
ready.php
public/content/uploads/
public/content/libs/
.idea/
.phpunit.result.cache
76 changes: 43 additions & 33 deletions admin/editor/actions/school/create.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,21 +179,31 @@

if (($canCreate && $schoolCreated) && $school_id != null && isset($school_id)) {
//if there are files to upload, upload them
if (!empty($school_logo) && $uploaded_file != null) {
if (!empty($school_logo)) {
//debug
error_log('school_logo: ' . $school_logo);
error_log('uploaded_file: ' . print_r($uploaded_file, true));

//check if the school logo is an array
if (is_array($school_logo)) {
if (is_array($school_logo) && $uploaded_file != null) {
//upload the school logo, and get the media id
$media_id = $media->uploadMedia($school_logo, intval($_SESSION['user_id']));

//debug
error_log('media_id: ' . $media_id);

//get the file name
$target_file_logo = $media->getMediaFileName($media_id);

//get the file type
$imageFileType_logo = strtolower(pathinfo($target_file_logo, PATHINFO_EXTENSION));
} else if (!empty($school_logo) && $uploaded_file = null) {
} else if ((!empty($school_logo) && $school_logo != null) && ($uploaded_file = null || $uploaded_file == '')) {
//assume the school logo is an integer
$media_id = $school_logo;

//debug
error_log('media_id: ' . $media_id);

//get the file name
$target_file_logo = $media->getMediaFileName($media_id);

Expand All @@ -220,16 +230,16 @@
}
}
} ?>
<!-- Completion page content -->
<div class="container-fluid px-4">
<h1 class="mt-4"><?php echo htmlspecialchars($school_name); ?></h1>
<div class="row">
<div class="card mb-4">
<!-- show completion message -->
<div class="card-header">
<div class="card-title">
<div>
<?php
<!-- Completion page content -->
<div class="container-fluid px-4">
<h1 class="mt-4"><?php echo htmlspecialchars($school_name); ?></h1>
<div class="row">
<div class="card mb-4">
<!-- show completion message -->
<div class="card-header">
<div class="card-title">
<div>
<?php
if ($action == 'create') {
if ($schoolCreated) {
echo '<i class="fa-solid fa-check"></i>';
Expand All @@ -240,14 +250,14 @@
}
}
?>
</div>
</div>
</div>
<div class="card-body">
<div class="row">
<!-- show completion message -->
<div class="col-md-12">
<?php
</div>
<div class="card-body">
<div class="row">
<!-- show completion message -->
<div class="col-md-12">
<?php
if ($action == 'create') {
if ($schoolCreated) {
echo '<p>The school: ' . htmlspecialchars($school_name) . ' has been created.</p>';
Expand All @@ -257,12 +267,12 @@
}
}
?>
</div>
</div>
<!-- show error messages -->
<div class="row">
<div class="col-md-12">
<?php
</div>
<!-- show error messages -->
<div class="row">
<div class="col-md-12">
<?php
if ($action == 'create') {
if (!$schoolCreated) {
echo '<p>The school: ' . htmlspecialchars($school_name) . ' could not be created due to an error.</p>';
Expand All @@ -274,12 +284,12 @@
if ($schoolLogoSet && (!empty($school_logo) || $school_logo != null || isset($school_logo))) {
echo '<p>The school logo has been set.</p>';
} elseif (!$schoolLogoSet && (!empty($school_logo) || $school_logo != null || isset($school_logo))) {
echo '<p>The school logo could not be set.</p>';
echo '<p>The school logo could not be set or was not changed.</p>';
}
if ($schoolColorSet && (!empty($school_color) || $school_color != null || isset($school_color))) {
echo '<p>The school color has been set.</p>';
} elseif (!$schoolColorSet && (!empty($school_color) || $school_color != null || isset($school_color))) {
echo '<p>The school color could not be set.</p>';
echo '<p>The school color could not be set or was not changed.</p>';
}
}
//if the school name already exists, show the error message
Expand All @@ -288,13 +298,13 @@
}
}
?>
</div>
</div>
<div class="row">
<!-- show back buttons -->
<div class="col-md-12">
<div class="card-buttons">
<?php
</div>
<div class="row">
<!-- show back buttons -->
<div class="col-md-12">
<div class="card-buttons">
<?php
if ($action == 'create') {
if ($schoolCreated) {
echo '<span><a href="' . APP_URL . '/admin/dashboard.php?view=schools&school=list" class="btn btn-primary">Return to School List</a></span>';
Expand All @@ -304,11 +314,11 @@
}
}
?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php } ?>
10 changes: 5 additions & 5 deletions admin/view/single/role_single.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
$role = new Roles();

//include the role data class
$roleData = new RoleData();
$roleDataClass = new RoleData();

//user class
$user = new User();
Expand Down Expand Up @@ -209,7 +209,7 @@ class="btn btn-primary">Edit Role</a>
foreach ($permissionArray as $permission) { ?>
<tr>
<td><?php echo $permission['name']; ?></td>
<td><?php echo $roleData->getPermissionGrantDate(intval($roleId), intval($permission['id'])); ?>
<td><?php echo $roleDataClass->getPermissionGrantDate(intval($roleId), intval($permission['id'])); ?>
</td>
</tr>
<?php }
Expand All @@ -230,7 +230,7 @@ class="btn btn-primary">Edit Role</a>
<div id="info" class="">
<div class="row">
<div class="col-md-12">
<?php $usersWithRole = $roleData->getUsersWithRole(intval($roleId));
<?php $usersWithRole = $roleDataClass->getUsersWithRole(intval($roleId));
if (!empty($usersWithRole)) { ?>
<p><strong>Users:</strong></p>
<div class="card-body">
Expand All @@ -252,11 +252,11 @@ class="btn btn-primary">Edit Role</a>
<tr>
<td><?php echo $userDetails['username']; ?></td>
<td><?php echo $userDetails['email']; ?></td>
<td><?php echo $roleData->getUserRoleGivenDate(intval($userDetails['id']), intval($roleId)); ?>
<td><?php echo $roleDataClass->getUserRoleGivenDate(intval($userDetails['id']), intval($roleId)); ?>
</td>
<td><?php echo $user->getUserUsername(intval($userHasRole['created_by'])); ?>
</td>
<td><?php echo $roleData->getUserRoleModifiedDate(intval($userDetails['id']), intval($roleId)); ?>
<td><?php echo $roleDataClass->getUserRoleModifiedDate(intval($userDetails['id']), intval($roleId)); ?>
</td>
<td><?php echo $user->getUserUsername(intval($userHasRole['updated_by'])); ?>
</td>
Expand Down
38 changes: 4 additions & 34 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,40 +44,7 @@
"CrimsonStrife\\RYM2\\Interfaces\\": "includes/interfaces/"
},
"classmap": [
"includes/classes/session.inc.php",
"includes/classes/application.inc.php",
"includes/classes/users.inc.php",
"includes/classes/userlogin.inc.php",
"includes/classes/auth.inc.php",
"includes/classes/roles.inc.php",
"includes/classes/permissions.inc.php",
"includes/classes/students.inc.php",
"includes/classes/subjects.inc.php",
"includes/classes/areaofinterest.inc.php",
"includes/classes/jobfield.inc.php",
"includes/classes/job.inc.php",
"includes/classes/grade.inc.php",
"includes/classes/degree.inc.php",
"includes/classes/school.inc.php",
"includes/classes/reports.inc.php",
"includes/classes/events.inc.php",
"includes/classes/studentevent.inc.php",
"includes/classes/studentdata.inc.php",
"includes/classes/studentaddress.inc.php",
"includes/classes/studenteducation.inc.php",
"includes/classes/schedule.inc.php",
"includes/interfaces/login.inc.php",
"includes/interfaces/major.inc.php",
"includes/classes/contact.inc.php",
"includes/classes/activity.inc.php",
"includes/classes/media.inc.php",
"includes/classes/eventmedia.inc.php",
"includes/classes/search.inc.php",
"includes/classes/settings.inc.php",
"includes/classes/topdegreebyschool.report.inc.php",
"includes/classes/topfieldbyschool.report.inc.php",
"includes/classes/jobsbyfield.report.inc.php",
"includes/classes/contactfollowuppercentage.report.inc.php"
"includes"
]
},
"scripts": {
Expand Down Expand Up @@ -142,5 +109,8 @@
"post-install-cmd": [
"@post-update-cmd"
]
},
"require-dev": {
"phpunit/phpunit": "^10.5.12"
}
}
Loading

0 comments on commit a027284

Please sign in to comment.