Issues (42)

_admin/roles.php (1 issue)

Labels
Severity
1
<?php
2
ini_set('display_errors', 1);
3
error_reporting(E_ALL);
4
require_once('class.VolunteerAdminPage.php');
5
$page = new VolunteerAdminPage('Volunteer System Admin');
6
$page->setTemplateName('admin-table-new.html');
7
8
$page->addWellKnownJS(JS_BOOTBOX);
9
$page->addJS('../js/wizard.js');
10
11
$dataTable = DataSetFactory::getDataTableByNames('fvs', 'certifications');
12
$certText = '';
13
$certs = $dataTable->read();
14
if($certs !== false)
15
{
16
    $certCount = count($certs);
0 ignored issues
show
It seems like $certs can also be of type true; however, parameter $var of count() does only seem to accept Countable|array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

16
    $certCount = count(/** @scrutinizer ignore-type */ $certs);
Loading history...
17
    for($i = 0; $i < $certCount; $i++)
18
    {
19
        $cert = $certs[$i];
20
        $certText .= '<label for="requirements.'.$cert['certID'].'" class="col-sm-3 col-form-label">'.$cert['name'].':</label>
21
          <div class="col-sm-2"><input class="form-control" type="checkbox" name="requirements.'.$cert['certID'].'" id="requirements.'.$cert['certID'].'" disabled/></div>';
22
    }
23
}
24
25
$page->content['pageHeader'] = 'Roles: <span id="deptName"></span>';
26
$page->content['table'] = array('id' => 'roles');
27
$page->content['selectors'] = '<div class="col-sm2"><button type="button" class="btn btn-primary" id="newRoleBtn" onclick="showRoleWizard();">New Role</button></div>';
28
if(!isset($_GET['dept']))
29
{
30
    $page->content['selectors'] .= '<div class="col-sm4"><select class="form-control" id="deptFilter"><option value="*"></option></select></div>';
31
}
32
$page->content['body'] = '
33
<div class="modal fade bd-example-modal-lg" id="roleWizard" tabindex="-1" role="dialog" aria-labelledby="roleWizardTitle" aria-hidden="true" data-backdrop="static" data-complete="newRole">
34
  <div class="modal-dialog modal-lg">
35
    <div class="modal-content">
36
      <div class="modal-header">
37
        <h5 class="modal-title" id="roleWizardTitle">New Role</h5>
38
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
39
          <span aria-hidden="true">&times;</span>
40
        </button>
41
      </div>
42
      <div class="modal-body">
43
        <div class="row flex-xl-nowrap">
44
          <div class="col-12 col-md-4 col-xl-3 bd-sidebar">
45
            <ul class="list-group">
46
              <li class="list-group-item active">Basic Info</li>
47
              <li class="list-group-item">Role ID</li>
48
              <li class="list-group-item">Grouping</li>
49
              <li class="list-group-item">Requirements</li>
50
            </ul>
51
          </div>
52
          <div class="col-12 col-md-8 col-xl-8 bd-content">
53
            <div id="roleBasic" class="d-block">
54
              This is some basic information about the role.
55
              <div class="row">
56
                <label for="display_name" class="col-sm-2 col-form-label">Role Name:</label>
57
                <div class="col-sm-10">
58
                  <input class="form-control" type="text" name="display_name" id="display_name" required onChange="roleNameUpdated();"/>
59
                </div>
60
                <div class="w-100"></div>
61
                <label for="description" class="col-sm-2 col-form-label">Description:</label>
62
                <div class="col-sm-10">
63
                  <input class="form-control" type="text" name="description" id="description" required/>
64
                </div>
65
                <div class="w-100"></div>
66
                <label for="down_time" class="col-sm-2 col-form-label">Down Time Between Shifts:</label>
67
                <div class="col-sm-10">
68
                  <input class="form-control" type="number" name="down_time" id="down_time" value="0"/>
69
                </div>
70
              </div>
71
            </div>
72
            <div id="roleID" class="d-none">
73
              This system requires a unique ID per role. One has been autopopulated for you, usually you just need to click next.
74
              <div class="row">
75
                <label for="short_name" class="col-sm-2 col-form-label">Role ID:</label>
76
                <div class="col-sm-10">
77
                  <input class="form-control" type="text" name="short_name" id="short_name" required/>
78
                </div>
79
              </div>
80
            </div>
81
            <div id="roleGroups" class="d-none">
82
              You might want to allow groups such as a theme camp to sign up for a shift. Selecting the "Allow Group" options below will allow this.
83
              You might also want to allow groups to sign up for multiple roles at the same shift time. Select those roles in the list below.
84
              <div class="row">
85
                <label for="groups_allowed" class="col-sm-2 col-form-label">Groups Allowed:</label>
86
                <div class="col-sm-10">
87
                  <input class="form-control" type="checkbox" name="groups_allowed" id="groups_allowed" onChange="groupsAllowedUpdated();"/>
88
                </div>
89
                <div class="w-100"></div>
90
                <div class="col-sm-12">
91
                  <select name="grouped_with" id="grouped_with" multiple="multiple" disabled="true">
92
                  </select>
93
                </div>
94
              </div>
95
            </div>
96
            <div id="roleReqs" class="d-none">
97
              Does this role require special training?
98
              <div class="row">
99
                <label for="publicly_visible" class="col-sm-2 col-form-label">Anyone allowed:</label>
100
              <div class="col-sm-10">
101
                <input class="form-control" type="checkbox" name="publicly_visible" id="publicly_visible" onChange="publiclyVisibleUpdated();" checked/>
102
              </div>
103
              <div class="w-100"></div>'.$certText.'
104
                <div class="w-100"></div>
105
                <label for="onEmailList" class="col-sm-3 col-form-label">On Email List:</label>
106
                <div class="col-sm-2">
107
                  <input class="form-control" type="checkbox" name="onEmailList" id="onEmailList" onChange="onEmailListUpdated();" disabled/>
108
                </div>
109
                <div class="w-100"></div>
110
                <label for="requirements.email_list" class="col-sm-3 col-form-label">Email List:</label>
111
                <div class="col-sm-10">
112
                  <textarea class="form-control" name="requirements.email_list" id="requirements.email_list" disabled></textarea>
113
                </div>
114
              </div>
115
            </div>
116
          </div>
117
        </div>
118
      </div>
119
      <div class="modal-footer">
120
        <button type="button" class="btn btn-secondary mr-auto" data-dismiss="modal">Close</button>
121
        <button type="button" class="btn btn-outline-primary" id="prevStep" disabled onClick="prevWizardStep(this);">Previous</button>
122
        <button type="button" class="btn btn-outline-primary" id="nextStep" onClick="nextWizardStep(this);">Next</button>
123
      </div>
124
    </div>
125
  </div>
126
</div>
127
';
128
129
$page->printPage();
130
/* vim: set tabstop=4 shiftwidth=4 expandtab: */
131