function processCheckBox($rawItems, $question, $questionNum, $required, $answerItem, $name) { global $log; $log->debug("Inside processCheckBox method"); $items = convertPipeToArray($rawItems); $convertedAnswer = $answerItem; ?> <br> <div class="row"> <div class="col-xs-12 col-lg-12"> <h6><strong> <?php echo $questionNum . ". " . $question; ?> <?php if ($required) { ?> <i class="text-danger"> *(REQUIRED)</i> <?php } ?> </strong></h6> </div> </div> <?php foreach ($items as $item) { ?> <div class="checkbox"> <?php if (is_array($convertedAnswer)) { ?> <?php if (isItemContainedInArray($convertedAnswer, $item)) { ?> <h6><input type="checkbox" id="<?php echo $name . "_" . removeSpaces($item); ?> " name="<?php echo $name; ?> " value="<?php echo $item; ?> " checked><?php echo $item; ?> </h6> <?php } else { ?> <!-- end of test is item contained in array --> <h6><input type="checkbox" id="<?php echo $name . "_" . removeSpaces($item); ?> " name="<?php echo $name; ?> " value="<?php echo $item; ?> "><?php echo $item; ?> </h6> <?php } ?> <!-- end of else that item was not array --> <?php } else { ?> <!-- end of if to to test for array --> <?php if (strlen($convertedAnswer) > 0 && $item == $convertedAnswer) { ?> <h6><input type="checkbox" id="<?php echo $name . "_" . removeSpaces($item); ?> " name="<?php echo $name; ?> " value="<?php echo $item; ?> " checked><?php echo $item; ?> </h6> <?php } else { ?> <!-- end of test if single item is contained in list --> <h6><input type="checkbox" id="<?php echo $name . "_" . removeSpaces($item); ?> " name="<?php echo $name; ?> " value="<?php echo $item; ?> "><?php echo $item; ?> </h6> <?php } ?> <?php } ?> </div> <?php } ?> <!-- end of foreach loop on all items --> <?php }
/** * A consolidated method to determine if user has view privilege for a page and has ability to modify/edit/view a given * page element such as <textarea> notes or the <radio> button approval block associated with OnSpot Viewer * @param $session_privilege_set String privilege(s) from FileMaker of one or more privileges to make modifications * @param $section String value of page to access OnSpot or Request (for now) * @param $item String representation of the request to view what page or modify an element like Notes or approval block * @param $override boolean item will return true without regard to the actual privilege set. * @return bool true if permission is granted or false to block/disable/hide element */ function canViewOrEditWithOverride($session_privilege_set, $section, $item, $override) { $accessKeyWord = $section . $item; //if set this return true to override the actual privilege set. This was added in anticipation of a future requirement if ($override) { return true; } if (!isset($session_privilege_set) || empty($session_privilege_set)) { return false; } if (is_array($session_privilege_set)) { if (isItemContainedInArray($session_privilege_set, $accessKeyWord)) { return true; } } else { if ($session_privilege_set == $accessKeyWord) { return true; } } return false; }