From fc76f8966686093692090c9aaf2e7a48608e717e Mon Sep 17 00:00:00 2001 From: Ray Clark Date: Sun, 17 Oct 2021 17:44:45 +1100 Subject: [PATCH 1/4] Implemented SettingManager --- Help Desk/helpDesk_settings.php | 43 ++---------- Help Desk/helpDesk_settingsProcess.php | 53 +-------------- Help Desk/moduleFunctions.php | 56 +++++++++++++++ Help Desk/src/Data/Setting.php | 94 ++++++++++++++++++++++++++ Help Desk/src/Data/SettingManager.php | 78 +++++++++++++++++++++ 5 files changed, 234 insertions(+), 90 deletions(-) create mode 100644 Help Desk/src/Data/Setting.php create mode 100644 Help Desk/src/Data/SettingManager.php diff --git a/Help Desk/helpDesk_settings.php b/Help Desk/helpDesk_settings.php index 26387bc..b4bdcca 100644 --- a/Help Desk/helpDesk_settings.php +++ b/Help Desk/helpDesk_settings.php @@ -18,7 +18,8 @@ */ use Gibbon\Domain\System\SettingGateway; -use Gibbon\Forms\Form; + +require_once __DIR__ . '/moduleFunctions.php'; $page->breadcrumbs->add(__('Manage Help Desk Settings')); @@ -27,47 +28,11 @@ $page->addError(__('You do not have access to this action.')); } else { //Proceed! - //I do this to control the order, there is probably another way, until then, too bad! - $settings = [ - 'simpleCategories', - 'issueCategory', - 'issuePriority', - 'issuePriorityName', - 'techNotes' - ]; - - $settingGateway = $container->get(SettingGateway::class); + $settingManager = getSettings($container); - $form = Form::create('helpDeskSettings', $session->get('absoluteURL') . '/modules/' . $session->get('module') . '/helpDesk_settingsProcess.php'); + $form = $settingManager->form($session->get('absoluteURL') . '/modules/' . $session->get('module') . '/helpDesk_settingsProcess.php'); $form->addHiddenValue('address', $session->get('address')); - foreach ($settings as $settingName) { - $setting = $settingGateway->getSettingByScope('Help Desk', $settingName, true); - $row = $form->addRow(); - $row->addLabel($setting['name'], __($setting['nameDisplay']))->description($setting['description']); - switch ($settingName) { - case 'issueCategory': - case 'issuePriority': - $row->addTextArea($setting['name']) - ->setValue($setting['value']); - break; - case 'issuePriorityName': - $row->addTextField($setting['name']) - ->setValue($setting['value']) - ->required(); - break; - case 'simpleCategories': - case 'techNotes': - $row->addCheckbox($setting['name']) - ->checked(intval($setting['value'])); - break; - } - } - - $row = $form->addRow(); - $row->addFooter(); - $row->addSubmit(); - echo $form->getOutput(); } ?> diff --git a/Help Desk/helpDesk_settingsProcess.php b/Help Desk/helpDesk_settingsProcess.php index d373b69..853e546 100644 --- a/Help Desk/helpDesk_settingsProcess.php +++ b/Help Desk/helpDesk_settingsProcess.php @@ -18,7 +18,6 @@ */ use Gibbon\Domain\System\LogGateway; -use Gibbon\Domain\System\SettingGateway; require_once '../../gibbon.php'; @@ -34,60 +33,12 @@ } else { $URL .= '/helpDesk_settings.php'; - //Not a fan, but too bad! - $settings = [ - 'resolvedIssuePrivacy', - 'issuePriorityName', - 'issueCategory', - 'issuePriority', - 'simpleCategories', - 'techNotes', - ]; - - $settingGateway = $container->get(SettingGateway::class); - - $dbFail = false; - - //Is this really better, potentially, but I'm not going to worry about it too much. - foreach ($settings as $setting) { - if (isset($_POST[$setting]) || $setting == 'simpleCategories') { - $value = ''; - switch ($setting) { - case 'issueCategory': - case 'issuePriority': - $value = implode(',', explodeTrim($_POST[$setting])); - break; - case 'resolvedIssuePrivacy': - if (!in_array($_POST[$setting], privacyOptions())) { - $URL .= '&return=error1'; - header("Location: {$URL}"); - exit(); - } - case 'issuePriorityName': - $value = $_POST[$setting]; - if (empty($value)) { - $URL .= '&return=error1'; - header("Location: {$URL}"); - exit(); - } - break; - case 'simpleCategories': - case 'techNotes': - $value = isset($_POST[$setting]) ? '1' : '0'; - break; - } - $dbFail |= !$settingGateway->updateSettingByScope('Help Desk', $setting, $value); - } - } + $settingManager = getSettings($container); + $return = $settingManager->process($_POST); $logGateway = $container->get(LogGateway::class); $logGateway->addLog($session->get('gibbonSchoolYearID'), 'Help Desk', $session->get('gibbonPersonID'), 'Help Desk Settings Edited'); - $return = 'success0'; - if ($dbFail) { - $return = 'warning1'; - } - $URL .= "&return=$return"; header("Location: {$URL}"); exit(); diff --git a/Help Desk/moduleFunctions.php b/Help Desk/moduleFunctions.php index b135b05..7aabdf5 100644 --- a/Help Desk/moduleFunctions.php +++ b/Help Desk/moduleFunctions.php @@ -17,10 +17,66 @@ along with this program. If not, see . */ +use Gibbon\Domain\System\SettingGateway; use Gibbon\Domain\User\RoleGateway; use Gibbon\Domain\DataSet; +use Gibbon\Module\HelpDesk\Data\Setting; +use Gibbon\Module\HelpDesk\Data\SettingManager; use Psr\Container\ContainerInterface; +function getSettings(ContainerInterface $container) { + $settingManager = new SettingManager($container->get(SettingGateway::class), 'Help Desk'); + + $settingManager->addSetting('simpleCategories') + ->setRenderer(function($data, $row) { + $row->addCheckbox($data['name']) + ->checked(intval($data['value'])); + }) + ->setProcessor(function($data) { + return $data !== null ? 1 : 0; + }); + + $settingManager->addSetting('issueCategory') + ->setRenderer(function($data, $row) { + $row->addTextArea($data['name']) + ->setValue($data['value']); + }) + ->setProcessor(function($data) { + return implode(',', explodeTrim($data ?? '')); + }); + + $settingManager->addSetting('issuePriority') + ->setRenderer(function($data, $row) { + $row->addTextArea($data['name']) + ->setValue($data['value']); + }) + ->setProcessor(function($data) { + return implode(',', explodeTrim($data ?? '')); + }); + + $settingManager->addSetting('issuePriorityName') + ->setRenderer(function($data, $row) { + $row->addTextField($data['name']) + ->setValue($data['value']) + ->required(); + }) + ->setProcessor(function($data) { + return empty($data) ? false : $data; + }); + + $settingManager->addSetting('techNotes') + ->setRenderer(function($data, $row) { + $row->addCheckbox($data['name']) + ->checked(intval($data['value'])); + }) + ->setProcessor(function($data) { + return $data !== null ? 1 : 0; + }); + + return $settingManager; +} + + function explodeTrim($commaSeperatedString) { //This could, in theory, be made for effiicent, however, I don't care to do so. return array_filter(array_map('trim', explode(',', $commaSeperatedString))); diff --git a/Help Desk/src/Data/Setting.php b/Help Desk/src/Data/Setting.php new file mode 100644 index 0000000..544ee3b --- /dev/null +++ b/Help Desk/src/Data/Setting.php @@ -0,0 +1,94 @@ +name = $name; + } + + /** + * Get Setting name. + * @return Setting name. + */ + public function getName() { + return $this->name; + } + + /** + * Get row flag. + * @return True if render as row, false if column. + */ + public function isRow() { + return $this->row; + } + + /** + * Set row flag. + * @param boolean $row (optional) Set to True if render as row, False if render as column. + * @return self + */ + public function setRow($row = true) { + $this->row = $row; + + return $this; + } + + /** + * Render setting into form row using gibbonSetting data. + * @param array $data Row data retrieved from gibbonSetting. + * @param object $row Form row object + */ + public function render($data, $row) { + if (!$this->isRow()) { + $row = $row->addColumn(); + } + + $row->addLabel($data['name'], __($data['nameDisplay'])) + ->description($data['description']); + + if (!empty($this->renderCallback) && is_callable($this->renderCallback)) { + call_user_func($this->renderCallback, $data, $row); + } + } + + /** + * Set the renderer for this setting. + * @param callable $callable Renderer callable + * @return self + */ + public function setRenderer(callable $callable) { + $this->renderCallback = $callable; + + return $this; + } + + /** + * Process setting data for entry into database. + * @param object $data Data from POST + * @return String to insert into database, false if error. + */ + public function process($data) { + return !empty($this->processCallback) && is_callable($this->processCallback) ? call_user_func($this->processCallback, $data) : false; + } + + /** + * Set the processor for this setting. + * @param callable $callable Processor callable. + * @return self + */ + public function setProcessor(callable $callable) { + $this->processCallback = $callable; + + return $this; + } +} \ No newline at end of file diff --git a/Help Desk/src/Data/SettingManager.php b/Help Desk/src/Data/SettingManager.php new file mode 100644 index 0000000..70d6ce5 --- /dev/null +++ b/Help Desk/src/Data/SettingManager.php @@ -0,0 +1,78 @@ +settingGateway = $settingGateway; + $this->scope = $scope; + } + + public function form($processPage) { + $form = Form::create('settings', $processPage); + + foreach ($this->settings as $setting) { + $settingData = $this->settingGateway->getSettingByScope($this->scope, $setting->getName(), true); + $row = $form->addRow(); + $setting->render($settingData, $row); + } + + $row = $form->addRow(); + $row->addFooter(); + $row->addSubmit(); + + return $form; + } + + public function process($formData) { + $return = 'success0'; + + foreach ($this->settings as $setting) { + $data = $formData[$setting->getName()] ?? null; + + $data = $setting->process($data); + + if ($data === false) { + $return = 'warning1'; + continue; + } + + if (!$this->settingGateway->updateSettingByScope($this->scope, $setting->getName(), $data)) { + $return = 'warning1'; + } + } + + return $return; + } + + /** + * Add a new Setting. + * @param Setting name. + * @return new Setting object. + */ + public function addSetting($name) { + $setting = new Setting($name); + $this->settings[] = $setting; + return $setting; + } + + /** + * Get Settings. + * @return Array of Settings. + */ + public function getSettings() { + return $this->settings; + } +} \ No newline at end of file From 239cc41a0f02b9b7cd6000413115f37bd7e8b844 Mon Sep 17 00:00:00 2001 From: Ray Clark Date: Sun, 17 Oct 2021 17:45:00 +1100 Subject: [PATCH 2/4] Fixed tech note permission checking --- Help Desk/issues_discussNoteProccess.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Help Desk/issues_discussNoteProccess.php b/Help Desk/issues_discussNoteProccess.php index 497e49b..ddcb019 100644 --- a/Help Desk/issues_discussNoteProccess.php +++ b/Help Desk/issues_discussNoteProccess.php @@ -51,9 +51,11 @@ $technician = $technicianGateway->getTechnicianByPersonID($gibbonPersonID); + $noTech = empty($technicianGateway->getByID($issue['technicianID'])); + if ($technician->isNotEmpty() //Is tech && !($gibbonPersonID == $issue['gibbonPersonID']) //Not owner - && ($issueGateway->isRelated($issueID, $gibbonPersonID) || $techGroupGateway->getPermissionValue($gibbonPersonID, 'fullAccess')) //Has access + && ($noTech || $issueGateway->isRelated($issueID, $gibbonPersonID) || $techGroupGateway->getPermissionValue($gibbonPersonID, 'fullAccess')) //Has access (no tech assigned, or is related, or has full acces) TODO: No Tech Check should probably check that the tech has permission to view unassigned issues. && $settingGateway->getSettingByScope('Help Desk', 'techNotes') //Setting is enabled ) { //Proceed! From 7cde1b283010df3e59151a4c729c95c7dfa54b16 Mon Sep 17 00:00:00 2001 From: Ray Clark Date: Sun, 17 Oct 2021 17:46:55 +1100 Subject: [PATCH 3/4] Incremented version --- Help Desk/CHANGEDB.php | 6 ++++++ Help Desk/CHANGELOG.txt | 5 +++++ Help Desk/manifest.php | 2 +- Help Desk/version.php | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Help Desk/CHANGEDB.php b/Help Desk/CHANGEDB.php index 3147e8c..342e59f 100644 --- a/Help Desk/CHANGEDB.php +++ b/Help Desk/CHANGEDB.php @@ -394,3 +394,9 @@ $sql[$count][0]="2.0.02"; $sql[$count][1]=" "; + +//v2.0.03 +$count++; +$sql[$count][0]="2.0.03"; +$sql[$count][1]=" +"; diff --git a/Help Desk/CHANGELOG.txt b/Help Desk/CHANGELOG.txt index d919f0d..d23fae0 100644 --- a/Help Desk/CHANGELOG.txt +++ b/Help Desk/CHANGELOG.txt @@ -1,5 +1,10 @@ CHANGELOG ========= +v2.0.03 +------- +Implemented Setting Manager +Fixed tech note permission checking. + v2.0.02 ------- Refactored session variables and null coalesce. diff --git a/Help Desk/manifest.php b/Help Desk/manifest.php index 7235a87..2c32ad3 100644 --- a/Help Desk/manifest.php +++ b/Help Desk/manifest.php @@ -23,7 +23,7 @@ $entryURL="issues_view.php"; $type="Additional"; $category="Other"; -$version="2.0.02"; +$version="2.0.03"; $author="Ray Clark, Ashton Power & Adrien Tremblay"; $url="https://github.com/GibbonEdu/module-helpDesk"; diff --git a/Help Desk/version.php b/Help Desk/version.php index 9627141..d221a86 100644 --- a/Help Desk/version.php +++ b/Help Desk/version.php @@ -20,7 +20,7 @@ /** * Sets version information */ -$moduleVersion='2.0.02'; +$moduleVersion='2.0.03'; $coreVersion = '22.0.00'; ?> From de30b5643266876d4da377481fc301a9e2f3b66c Mon Sep 17 00:00:00 2001 From: Ray Clark Date: Sun, 17 Oct 2021 18:17:51 +1100 Subject: [PATCH 4/4] Cleaned up manifest --- Help Desk/manifest.php | 307 +++++++++++++++++++++-------------------- 1 file changed, 156 insertions(+), 151 deletions(-) diff --git a/Help Desk/manifest.php b/Help Desk/manifest.php index f721eb5..28cecf0 100644 --- a/Help Desk/manifest.php +++ b/Help Desk/manifest.php @@ -18,19 +18,17 @@ */ //Basic variables -$name="Help Desk"; -$description="A virtual help desk module for Gibbon."; -$entryURL="issues_view.php"; -$type="Additional"; -$category="Other"; -$version="2.1.00"; -$author="Ray Clark, Ashton Power & Adrien Tremblay"; -$url="https://github.com/GibbonEdu/module-helpDesk"; +$name = 'Help Desk'; +$description = 'A virtual help desk module for Gibbon.'; +$entryURL = 'issues_view.php'; +$type = 'Additional'; +$category = 'Other'; +$version = '2.1.00'; +$author = 'Ray Clark, Ashton Power & Adrien Tremblay'; +$url = 'https://github.com/GibbonEdu/module-helpDesk'; //Module tables & gibbonSettings entries -$tables = 0; - -$moduleTables[$tables++]="CREATE TABLE `helpDeskIssue` ( +$moduleTables[] = "CREATE TABLE `helpDeskIssue` ( `issueID` int(12) unsigned zerofill NOT NULL AUTO_INCREMENT, `technicianID` int(4) unsigned zerofill DEFAULT NULL, `gibbonPersonID` int(10) unsigned zerofill NOT NULL, @@ -47,7 +45,7 @@ PRIMARY KEY (`issueID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;"; -$moduleTables[$tables++]="CREATE TABLE `helpDeskIssueDiscuss` ( +$moduleTables[] = "CREATE TABLE `helpDeskIssueDiscuss` ( `issueDiscussID` int(12) unsigned zerofill NOT NULL AUTO_INCREMENT, `issueID` int(12) unsigned zerofill NOT NULL, `comment` text NOT NULL, @@ -56,7 +54,7 @@ PRIMARY KEY (`issueDiscussID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;"; -$moduleTables[$tables++]="CREATE TABLE `helpDeskIssueNotes` ( +$moduleTables[] = "CREATE TABLE `helpDeskIssueNotes` ( `issueNoteID` int(12) unsigned zerofill NOT NULL AUTO_INCREMENT, `issueID` int(12) unsigned zerofill NOT NULL, `note` text NOT NULL, @@ -66,14 +64,14 @@ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;"; -$moduleTables[$tables++]="CREATE TABLE `helpDeskTechnicians` ( +$moduleTables[] = "CREATE TABLE `helpDeskTechnicians` ( `technicianID` int(4) unsigned zerofill NOT NULL AUTO_INCREMENT, `gibbonPersonID` int(10) unsigned zerofill NOT NULL, `groupID` int(4) unsigned zerofill NOT NULL, PRIMARY KEY (`technicianID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;"; -$moduleTables[$tables++]="CREATE TABLE `helpDeskTechGroups` ( +$moduleTables[] = "CREATE TABLE `helpDeskTechGroups` ( `groupID` int(4) unsigned zerofill NOT NULL AUTO_INCREMENT, `groupName` varchar(55) NOT NULL, `viewIssue` boolean DEFAULT 1, @@ -88,47 +86,47 @@ PRIMARY KEY (`groupID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;"; -$moduleTables[$tables++]="CREATE TABLE `helpDeskDepartments` ( +$moduleTables[] = "CREATE TABLE `helpDeskDepartments` ( `departmentID` int(4) unsigned zerofill NOT NULL AUTO_INCREMENT, `departmentName` varchar(55) NOT NULL, `departmentDesc` varchar(128) NOT NULL, PRIMARY KEY (`departmentID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8"; -$moduleTables[$tables++]="CREATE TABLE `helpDeskDepartmentPermissions` ( +$moduleTables[] = "CREATE TABLE `helpDeskDepartmentPermissions` ( `departmentPermissionsID` int(4) UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT, `departmentID` int(4) UNSIGNED ZEROFILL NOT NULL, `gibbonRoleID` int(3) UNSIGNED ZEROFILL NOT NULL, PRIMARY KEY (`departmentPermissionsID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8"; -$moduleTables[$tables++]="CREATE TABLE `helpDeskGroupDepartment` ( +$moduleTables[] = "CREATE TABLE `helpDeskGroupDepartment` ( `groupDepartmentID` int(4) UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT, `groupID` int(4) UNSIGNED ZEROFILL NOT NULL, `departmentID` int(4) UNSIGNED ZEROFILL NOT NULL, PRIMARY KEY (`groupDepartmentID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8"; -$moduleTables[$tables++]="CREATE TABLE `helpDeskSubcategories` ( +$moduleTables[] = "CREATE TABLE `helpDeskSubcategories` ( `subcategoryID` int(4) unsigned zerofill NOT NULL AUTO_INCREMENT, `departmentID` int(4) unsigned zerofill NOT NULL, `subcategoryName` varchar(55) NOT NULL, PRIMARY KEY (`subcategoryID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8"; -$moduleTables[$tables++] = "CREATE TABLE `helpDeskReplyTemplate` ( +$moduleTables[] = "CREATE TABLE `helpDeskReplyTemplate` ( `helpDeskReplyTemplateID` int(10) unsigned zerofill NOT NULL AUTO_INCREMENT, `name` varchar(30) NOT NULL, `body` text NOT NULL, PRIMARY KEY (`helpDeskReplyTemplateID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;"; -$moduleTables[$tables++]="INSERT INTO `helpDeskTechGroups` (`groupID`, `groupName`, `viewIssue`, `viewIssueStatus`, `assignIssue`, `acceptIssue`, `resolveIssue`, `createIssueForOther`, `fullAccess`, `reassignIssue`, `reincarnateIssue`) +$moduleTables[] = "INSERT INTO `helpDeskTechGroups` (`groupID`, `groupName`, `viewIssue`, `viewIssueStatus`, `assignIssue`, `acceptIssue`, `resolveIssue`, `createIssueForOther`, `fullAccess`, `reassignIssue`, `reincarnateIssue`) VALUES (NULL, 'Head Technician', 1, 'All', 1, 1, 1, 1, 1, 1, 1), (NULL, 'Technician', 1, 'All', 0, 1, 1, 1, 0, 0, 1)"; -$moduleTables[$tables++]="INSERT INTO `gibbonSetting` (`gibbonSettingID`, `scope`, `name`, `nameDisplay`, `description`, `value`) +$moduleTables[] = "INSERT INTO `gibbonSetting` (`gibbonSettingID`, `scope`, `name`, `nameDisplay`, `description`, `value`) VALUES (NULL, 'Help Desk', 'issuePriority', 'Issue Priority', 'Different priority levels for the issues.', ''), (NULL, 'Help Desk', 'issuePriorityName', 'Issue Priority Name', 'Different name for the Issue Priority', 'Priority'), @@ -138,140 +136,147 @@ //Action rows //One array per action -$actionCount = 0; - -$actionRows[$actionCount]["name"]="Create Issue"; //The name of the action (appears to user in the right hand side module menu) -$actionRows[$actionCount]["precedence"]="0"; //If it is a grouped action, the precedence controls which is highest action in group -$actionRows[$actionCount]["category"]="Issues"; //Optional: subgroups for the right hand side module menu -$actionRows[$actionCount]["description"]="Allows the user to submit an issue to be resolved by the help desk staff."; //Text description -$actionRows[$actionCount]["URLList"]="issues_create.php"; -$actionRows[$actionCount]["entryURL"]="issues_create.php"; -$actionRows[$actionCount]["defaultPermissionAdmin"]="Y"; //Default permission for built in role Admin -$actionRows[$actionCount]["defaultPermissionTeacher"]="Y"; //Default permission for built in role Teacher -$actionRows[$actionCount]["defaultPermissionStudent"]="Y"; //Default permission for built in role Student -$actionRows[$actionCount]["defaultPermissionParent"]="N"; //Default permission for built in role Parent -$actionRows[$actionCount]["defaultPermissionSupport"]="Y"; //Default permission for built in role Support -$actionRows[$actionCount]["categoryPermissionStaff"]="Y"; //Should this action be available to user roles in the Staff category? -$actionRows[$actionCount]["categoryPermissionStudent"]="Y"; //Should this action be available to user roles in the Student category? -$actionRows[$actionCount]["categoryPermissionParent"]="Y"; //Should this action be available to user roles in the Parent category? -$actionRows[$actionCount]["categoryPermissionOther"]="Y"; //Should this action be available to user roles in the Other category? +$actionRows[] = [ + 'name' => 'Create Issue', //The name of the action (appears to user in the right hand side module menu) + 'precedence' => '0', //If it is a grouped action, the precedence controls which is highest action in group + 'category' => 'Issues', //Optional: subgroups for the right hand side module menu + 'description' => 'Allows the user to submit an issue to be resolved by the help desk staff.', //Text description + 'URLList' => 'issues_create.php', + 'entryURL' => 'issues_create.php', + 'defaultPermissionAdmin' => 'Y', //Default permission for built in role Admin + 'defaultPermissionTeacher' => 'Y', //Default permission for built in role Teacher + 'defaultPermissionStudent' => 'Y', //Default permission for built in role Student + 'defaultPermissionParent' => 'N', //Default permission for built in role Parent + 'defaultPermissionSupport' => 'Y', //Default permission for built in role Support + 'categoryPermissionStaff' => 'Y', //Should this action be available to user roles in the Staff category? + 'categoryPermissionStudent' => 'Y', //Should this action be available to user roles in the Student category? + 'categoryPermissionParent' => 'Y', //Should this action be available to user roles in the Parent category? + 'categoryPermissionOther' => 'Y', //Should this action be available to user roles in the Other category? +]; -$actionCount++; -$actionRows[$actionCount]["name"]="Issues"; -$actionRows[$actionCount]["precedence"]="0"; -$actionRows[$actionCount]["category"]="Issues"; -$actionRows[$actionCount]["description"]= "Gives the user access to the Issues section."; -$actionRows[$actionCount]["URLList"]="issues_view.php"; -$actionRows[$actionCount]["entryURL"]="issues_view.php"; -$actionRows[$actionCount]["defaultPermissionAdmin"]="Y"; -$actionRows[$actionCount]["defaultPermissionTeacher"]="Y"; -$actionRows[$actionCount]["defaultPermissionStudent"]="Y"; -$actionRows[$actionCount]["defaultPermissionParent"]="N"; -$actionRows[$actionCount]["defaultPermissionSupport"]="Y"; -$actionRows[$actionCount]["categoryPermissionStaff"]="Y"; -$actionRows[$actionCount]["categoryPermissionStudent"]="Y"; -$actionRows[$actionCount]["categoryPermissionParent"]="Y"; -$actionRows[$actionCount]["categoryPermissionOther"]="Y"; +$actionRows[] = [ + 'name' => 'Issues', + 'precedence' => '0', + 'category' => 'Issues', + 'description' => 'Gives the user access to the Issues section.', + 'URLList' => 'issues_view.php', + 'entryURL' => 'issues_view.php', + 'defaultPermissionAdmin' => 'Y', + 'defaultPermissionTeacher' => 'Y', + 'defaultPermissionStudent' => 'Y', + 'defaultPermissionParent' => 'N', + 'defaultPermissionSupport' => 'Y', + 'categoryPermissionStaff' => 'Y', + 'categoryPermissionStudent' => 'Y', + 'categoryPermissionParent' => 'Y', + 'categoryPermissionOther' => 'Y', +]; -$actionCount++; -$actionRows[$actionCount]["name"]="Help Desk Settings"; -$actionRows[$actionCount]["precedence"]="0"; -$actionRows[$actionCount]["category"]="Admin"; -$actionRows[$actionCount]["description"]="Allows the user to edit the settings for the module."; -$actionRows[$actionCount]["URLList"]="helpDesk_settings.php"; -$actionRows[$actionCount]["entryURL"]="helpDesk_settings.php"; -$actionRows[$actionCount]["defaultPermissionAdmin"]="Y"; -$actionRows[$actionCount]["defaultPermissionTeacher"]="N"; -$actionRows[$actionCount]["defaultPermissionStudent"]="N"; -$actionRows[$actionCount]["defaultPermissionParent"]="N"; -$actionRows[$actionCount]["defaultPermissionSupport"]="N"; -$actionRows[$actionCount]["categoryPermissionStaff"]="Y"; -$actionRows[$actionCount]["categoryPermissionStudent"]="N"; -$actionRows[$actionCount]["categoryPermissionParent"]="N"; -$actionRows[$actionCount]["categoryPermissionOther"]="Y"; +$actionRows[] = [ + 'name' => 'Help Desk Settings', + 'precedence' => '0', + 'category' => 'Admin', + 'description' => 'Allows the user to edit the settings for the module.', + 'URLList' => 'helpDesk_settings.php', + 'entryURL' => 'helpDesk_settings.php', + 'defaultPermissionAdmin' => 'Y', + 'defaultPermissionTeacher' => 'N', + 'defaultPermissionStudent' => 'N', + 'defaultPermissionParent' => 'N', + 'defaultPermissionSupport' => 'N', + 'categoryPermissionStaff' => 'Y', + 'categoryPermissionStudent' => 'N', + 'categoryPermissionParent' => 'N', + 'categoryPermissionOther' => 'Y', +]; -$actionCount++; -$actionRows[$actionCount]["name"]="Manage Technicians"; -$actionRows[$actionCount]["precedence"]="0"; -$actionRows[$actionCount]["category"]="Technician"; -$actionRows[$actionCount]["description"]="Allows the user to manage the Technicians."; -$actionRows[$actionCount]["URLList"]="helpDesk_manageTechnicians.php"; -$actionRows[$actionCount]["entryURL"]="helpDesk_manageTechnicians.php"; -$actionRows[$actionCount]["defaultPermissionAdmin"]="Y"; -$actionRows[$actionCount]["defaultPermissionTeacher"]="N"; -$actionRows[$actionCount]["defaultPermissionStudent"]="N"; -$actionRows[$actionCount]["defaultPermissionParent"]="N"; -$actionRows[$actionCount]["defaultPermissionSupport"]="N"; -$actionRows[$actionCount]["categoryPermissionStaff"]="Y"; -$actionRows[$actionCount]["categoryPermissionStudent"]="N"; -$actionRows[$actionCount]["categoryPermissionParent"]="N"; -$actionRows[$actionCount]["categoryPermissionOther"]="Y"; +$actionRows[] = [ + 'name' => 'Manage Technicians', + 'precedence' => '0', + 'category' => 'Technician', + 'description' => 'Allows the user to manage the Technicians.', + 'URLList' => 'helpDesk_manageTechnicians.php', + 'entryURL' => 'helpDesk_manageTechnicians.php', + 'defaultPermissionAdmin' => 'Y', + 'defaultPermissionTeacher' => 'N', + 'defaultPermissionStudent' => 'N', + 'defaultPermissionParent' => 'N', + 'defaultPermissionSupport' => 'N', + 'categoryPermissionStaff' => 'Y', + 'categoryPermissionStudent' => 'N', + 'categoryPermissionParent' => 'N', + 'categoryPermissionOther' => 'Y', +]; -$actionCount++; -$actionRows[$actionCount]["name"]="Manage Technician Groups"; -$actionRows[$actionCount]["precedence"]="0"; -$actionRows[$actionCount]["category"]="Technician"; -$actionRows[$actionCount]["description"]="Allows the user to manage the Technicians Groups."; -$actionRows[$actionCount]["URLList"]="helpDesk_manageTechnicianGroup.php"; -$actionRows[$actionCount]["entryURL"]="helpDesk_manageTechnicianGroup.php"; -$actionRows[$actionCount]["defaultPermissionAdmin"]="Y"; -$actionRows[$actionCount]["defaultPermissionTeacher"]="N"; -$actionRows[$actionCount]["defaultPermissionStudent"]="N"; -$actionRows[$actionCount]["defaultPermissionParent"]="N"; -$actionRows[$actionCount]["defaultPermissionSupport"]="N"; -$actionRows[$actionCount]["categoryPermissionStaff"]="Y"; -$actionRows[$actionCount]["categoryPermissionStudent"]="N"; -$actionRows[$actionCount]["categoryPermissionParent"]="N"; -$actionRows[$actionCount]["categoryPermissionOther"]="Y"; +$actionRows[] = [ + 'name' => 'Manage Technician Groups', + 'precedence' => '0', + 'category' => 'Technician', + 'description' => 'Allows the user to manage the Technicians Groups.', + 'URLList' => 'helpDesk_manageTechnicianGroup.php', + 'entryURL' => 'helpDesk_manageTechnicianGroup.php', + 'defaultPermissionAdmin' => 'Y', + 'defaultPermissionTeacher' => 'N', + 'defaultPermissionStudent' => 'N', + 'defaultPermissionParent' => 'N', + 'defaultPermissionSupport' => 'N', + 'categoryPermissionStaff' => 'Y', + 'categoryPermissionStudent' => 'N', + 'categoryPermissionParent' => 'N', + 'categoryPermissionOther' => 'Y', +]; -$actionCount++; -$actionRows[$actionCount]["name"]="Help Desk Statistics"; -$actionRows[$actionCount]["precedence"]="0"; -$actionRows[$actionCount]["category"]="Admin"; -$actionRows[$actionCount]["description"]="Statistics for the Help Desk."; -$actionRows[$actionCount]["URLList"]="helpDesk_statistics.php"; -$actionRows[$actionCount]["entryURL"]="helpDesk_statistics.php"; -$actionRows[$actionCount]["defaultPermissionAdmin"]="Y"; -$actionRows[$actionCount]["defaultPermissionTeacher"]="N"; -$actionRows[$actionCount]["defaultPermissionStudent"]="N"; -$actionRows[$actionCount]["defaultPermissionParent"]="N"; -$actionRows[$actionCount]["defaultPermissionSupport"]="N"; -$actionRows[$actionCount]["categoryPermissionStaff"]="Y"; -$actionRows[$actionCount]["categoryPermissionStudent"]="N"; -$actionRows[$actionCount]["categoryPermissionParent"]="N"; -$actionRows[$actionCount]["categoryPermissionOther"]="Y"; +$actionRows[] = [ + 'name' => 'Help Desk Statistics', + 'precedence' => '0', + 'category' => 'Admin', + 'description' => 'Statistics for the Help Desk.', + 'URLList' => 'helpDesk_statistics.php', + 'entryURL' => 'helpDesk_statistics.php', + 'defaultPermissionAdmin' => 'Y', + 'defaultPermissionTeacher' => 'N', + 'defaultPermissionStudent' => 'N', + 'defaultPermissionParent' => 'N', + 'defaultPermissionSupport' => 'N', + 'categoryPermissionStaff' => 'Y', + 'categoryPermissionStudent' => 'N', + 'categoryPermissionParent' => 'N', + 'categoryPermissionOther' => 'Y', +]; -$actionCount++; -$actionRows[$actionCount]["name"]="Manage Departments"; -$actionRows[$actionCount]["precedence"]="0"; -$actionRows[$actionCount]["category"]="Technician"; -$actionRows[$actionCount]["description"]="Allows the user to manage the Help Desk Departments."; -$actionRows[$actionCount]["URLList"]="helpDesk_manageDepartments.php"; -$actionRows[$actionCount]["entryURL"]="helpDesk_manageDepartments.php"; -$actionRows[$actionCount]["defaultPermissionAdmin"]="Y"; -$actionRows[$actionCount]["defaultPermissionTeacher"]="N"; -$actionRows[$actionCount]["defaultPermissionStudent"]="N"; -$actionRows[$actionCount]["defaultPermissionParent"]="N"; -$actionRows[$actionCount]["defaultPermissionSupport"]="N"; -$actionRows[$actionCount]["categoryPermissionStaff"]="Y"; -$actionRows[$actionCount]["categoryPermissionStudent"]="N"; -$actionRows[$actionCount]["categoryPermissionParent"]="N"; -$actionRows[$actionCount]["categoryPermissionOther"]="Y"; +$actionRows[] = [ + 'name' => 'Manage Departments', + 'precedence' => '0', + 'category' => 'Technician', + 'description' => 'Allows the user to manage the Help Desk Departments.', + 'URLList' => 'helpDesk_manageDepartments.php', + 'entryURL' => 'helpDesk_manageDepartments.php', + 'defaultPermissionAdmin' => 'Y', + 'defaultPermissionTeacher' => 'N', + 'defaultPermissionStudent' => 'N', + 'defaultPermissionParent' => 'N', + 'defaultPermissionSupport' => 'N', + 'categoryPermissionStaff' => 'Y', + 'categoryPermissionStudent' => 'N', + 'categoryPermissionParent' => 'N', + 'categoryPermissionOther' => 'Y', +]; -$actionRows[$actionCount]["name"] = "Help Desk Reply Templates"; -$actionRows[$actionCount]["precedence"] = "0"; -$actionRows[$actionCount]["category"] = "Settings"; -$actionRows[$actionCount]["description"] = "Manage Help Desk Reply Templates."; -$actionRows[$actionCount]["URLList"] = "helpDesk_manageReplyTemplates.php"; -$actionRows[$actionCount]["entryURL"] = "helpDesk_manageReplyTemplates.php"; -$actionRows[$actionCount]["defaultPermissionAdmin"] = "Y"; -$actionRows[$actionCount]["defaultPermissionTeacher"] = "N"; -$actionRows[$actionCount]["defaultPermissionStudent"] = "N"; -$actionRows[$actionCount]["defaultPermissionParent"] = "N"; -$actionRows[$actionCount]["defaultPermissionSupport"] = "N"; -$actionRows[$actionCount]["categoryPermissionStaff"] = "Y"; -$actionRows[$actionCount]["categoryPermissionStudent"] = "N"; -$actionRows[$actionCount]["categoryPermissionParent"] = "N"; -$actionRows[$actionCount]["categoryPermissionOther"] = "N"; -$actionCount++; +$actionRows[] = [ + 'name' => 'Help Desk Reply Templates', + 'precedence' => '0', + 'category' => 'Settings', + 'description' => 'Manage Help Desk Reply Templates.', + 'URLList' => 'helpDesk_manageReplyTemplates.php', + 'entryURL' => 'helpDesk_manageReplyTemplates.php', + 'defaultPermissionAdmin' => 'Y', + 'defaultPermissionTeacher' => 'N', + 'defaultPermissionStudent' => 'N', + 'defaultPermissionParent' => 'N', + 'defaultPermissionSupport' => 'N', + 'categoryPermissionStaff' => 'Y', + 'categoryPermissionStudent' => 'N', + 'categoryPermissionParent' => 'N', + 'categoryPermissionOther' => 'N', +]; ?>