Esempio n. 1
0
/**
 * Convert Pipes to PHP array or return the simple selected value
 * @param $checked a String of pipe delaminated oir just String value
 * @return array|string converted String array or just a string
 */
function convertAnswerToValue($checked)
{
    if (isPipeDelaminatedArray($checked)) {
        return convertPipeToArray($checked);
    } else {
        return trim($checked);
    }
}
Esempio n. 2
0
                        <td colspan="3"><!-- Project Type Dropdown Field -->
                            <select class="form-control" name="<?php 
        echo $spotTypeName . $underLine . $requestedProjectListCounter;
        ?>
"
                                    id="<?php 
        echo $spotTypeName . $underLine . $requestedProjectListCounter;
        ?>
">
                                <?php 
        $fmSpotType = $projectRelatedSet->getField('Spot_Type');
        //$request->getField('Spot_Type');
        if (isset($fmSpotType) && strlen($fmSpotType) > 0) {
            buildRequestDropDownListWithValue(convertPipeToArray($spotTypePipeList), $fmSpotType);
        } else {
            buildRequestDropDownList(convertPipeToArray($spotTypePipeList));
        }
        ?>
                            </select>
                        </td>
                        <td><!-- Length Dropdown List Field -->
                            <select id="<?php 
        echo $lengthName . $underLine . $requestedProjectListCounter;
        ?>
"
                                    name="<?php 
        echo $lengthName . $underLine . $requestedProjectListCounter;
        ?>
">
                                <?php 
        $fmLength = $request->getField('Length');
Esempio n. 3
0
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 
}
Esempio n. 4
0
function processDropDown($items, $name, $question, $question_num, $required, $answerItem)
{
    $boxItems = convertPipeToArray($items);
    ?>
    <br>
    <div class="row">
        <div class="col-xs-12 col-lg-12">
            <h6><strong>
                <?php 
    echo $question_num . ". ";
    echo $question . ".";
    ?>
                <?php 
    if ($required) {
        ?>
                    <i class="text-danger"> *(REQUIRED)</i>
                <?php 
    }
    ?>
                </strong></h6>
        </div>
    </div>

    <div class="row">
        <div class="col-xs-12 col-lg-12">
            <select class="form-control" name="<?php 
    echo $name;
    ?>
" id="<?php 
    echo $name;
    ?>
">
                <?php 
    foreach ($boxItems as $item) {
        ?>
                    <?php 
        if ($item == $answerItem) {
            ?>
                        <option name="<?php 
            echo $item;
            ?>
" selected><?php 
            echo $item;
            ?>
</option>
                    <?php 
        } else {
            ?>
                        <option name="<?php 
            echo $item;
            ?>
"><?php 
            echo $item;
            ?>
</option>"
                    <?php 
        }
        ?>
                <?php 
    }
    ?>
            </select>
        </div>
    </div>
<?php 
}
Esempio n. 5
0
/**
 * A single method to setup Session information regardless which authentication method was used.
 * @param $userRecord FileMaker user record handle
 * @param $site_prefix String site URL address
 */
function setSessionData($userRecord, $site_prefix)
{
    global $log, $onWebPlugin, $companyLogoSmallPropertyName, $imageDir, $appConfigName, $imageSmallFileName, $imageSplashFileName, $companyLogoSplashPropertyName, $root;
    if (!session_id()) {
        session_start();
    }
    $log->debug("setSessionData - Session was started now populate session Array");
    $_SESSION['authenticated'] = true;
    $_SESSION['firstName'] = $userRecord->getField('User_FirstName_ct');
    $_SESSION['lastName'] = $userRecord->getField('User_LastName_ct');
    $accessLevel = $userRecord->getField('User_Privs_t');
    $log->debug("User Privi Set: " . $accessLevel);
    $_SESSION['accessLevel'] = convertPipeToArray($accessLevel);
    $_SESSION['userName'] = $userRecord->getField('User_Name_ct');
    $_SESSION['LAST_ACTIVITY'] = time();
    $pipeInstalledPlugins = $userRecord->getField('z_SYS_LicensedPlugins_ct');
    //Force the Array items to uppercase just in case the character case was mixed at entry
    $_SESSION['installedPlugins'] = array_map("strtoupper", convertPipeToArray($pipeInstalledPlugins));
    //New values to capture from [WEB] Login view to be used when determining which users can view Spots
    // based on account name and we also need to capture PK for the contact ID
    $_SESSION['contact_pk'] = $userRecord->getField('User_Contact__pk_ID_ct');
    //System preference apply if 1 or else value is null
    $_SESSION['system_preference'] = $userRecord->getField('z_PRO_SeparateWorkByPrograming_cn');
    //Accounts associated with user in cr delaminated field
    //$_SESSION['user_accounts'] = array(stripControlChars($userRecord->getField('User_Contact_Programming_Type_Associations_ct')));
    $_SESSION['user_accounts'] = explodedCrString($userRecord->getField('User_Contact_Programming_Type_Associations_ct'));
    foreach ($_SESSION['user_accounts'] as $account) {
        $log->debug("User: "******" has an account: " . $account);
    }
    //Now test for ON-WEB from the PLUGIN array to validate that the user has the License authority to access web
    validatePlugin($_SESSION['userName'], $_SESSION['installedPlugins'], $onWebPlugin);
    //Now the login ands plugin validation is processed now write the tdc-app-config.php and set small logo location
    //Only perform this operation if the tdc-app-conf.php is not present in the directory. If the file exists then
    //it is ass-u-me(d) that the logo name and location 'was' resolved and is available to the presentation layer
    //This is a run once method as once the file is written is should never run unless the file is deleted
    //TODO remove these comments lines after the authentication flow is resolved
    //        if(!file_exists($root .$appConfigName)){
    //            writeFilesDynamically($userRecord, $imageDir, $imageSmallFileName,$companyLogoSmallPropertyName,
    //                $imageSplashFileName,$companyLogoSplashPropertyName, $appConfigName);
    //        }
    if (!empty($_SESSION['forwardingUrl'])) {
        $log->debug("setSessionData - User logged in and is being forwarded to: " . $_SESSION['forwardingUrl']);
        //added this fix to forward user to page they expected to see prior to login. Assigned session item to var
        //then unset session item then forward user
        $forwardingUrl = $_SESSION['forwardingUrl'];
        unset($_SESSION['forwardingUrl']);
        header("location:" . $forwardingUrl);
        exit;
    } else {
        $log->debug("setSessionData - No previous forwarding is defined so go to index page");
        header("location: " . $site_prefix . "index.php");
        exit;
    }
}
Esempio n. 6
0
function processRadioButton($rawRadioItems, $name, $label, $questionNum, $required, $answer)
{
    $radioItems = convertPipeToArray($rawRadioItems);
    ?>

    <div class="row">
        <div class="col-xs-12 col-lg-12">
            <h6><strong>
                <?php 
    echo $questionNum . ". ";
    echo $label;
    ?>
                <?php 
    if ($required) {
        ?>
                    <i class="text-danger"> *(REQUIRED)</i>
                <?php 
    }
    ?>
            </strong></h6>
        </div>
        <div class="col-xs-12 col-lg-12">
            <?php 
    foreach ($radioItems as $item) {
        ?>
                <div class="radio">
                    <h6>
                        <?php 
        if ($item == $answer) {
            ?>
                            <input type="radio" name="<?php 
            echo $name;
            ?>
" value="<?php 
            echo $item;
            ?>
" checked><?php 
            echo $item;
            ?>
                        <?php 
        } else {
            ?>
 <!-- end of if -->
                            <input type="radio" name="<?php 
            echo $name;
            ?>
" value="<?php 
            echo $item;
            ?>
"><?php 
            echo $item;
            ?>
                        <?php 
        }
        ?>
 <!-- end of else to test fro checked value -->
                    </h6>
                </div>
            <?php 
    }
    ?>
 <!-- end of foreach block -->
        </div>
    </div>
<?php 
}
Esempio n. 7
0
    $fullPathField = "z_ONSPOT_Rough_Full_Path_ct";
    $fullVideoLink = $record->getField($fullPathField);
    $ext = getFileExtensionFromURL($fullVideoLink);
    $videoType = getVideoSourceType($ext);
    $log->debug("URL from field Full Path value: " . $fullVideoLink . " video type: " . $videoType);
}
//This will now extract Spot Image full path from FileMaker without injecting path information manually
//----> At this point if viewOnly is true then we want to skip the query for user notes or loading any value lists. <----////
if (!$bypass) {
    //Approval Value List
    //TODO Uncomment field when the field is available -- Workaround to remove usage of getValueListTwoFields
    //    $layout = $fmDB->getLayout($spotViewerLayout);
    //    $approvalvalues = $layout->getValueListTwoFields('Approval_List');
    //TODO get these selections from FM and not using these hard coded values (see TODO above)
    $pipedApprovalList = "Yes|No|Re-do";
    $approvalvalues = convertPipeToArray($pipedApprovalList);
    //Now get the User Notes layout for historical comments
    $sortFieldOne = 'z_RecCreatedDate';
    $sortFieldTwo = "z_RecCreatedTime";
    $note = $fmWorkDB->newFindCommand($userNotesLayout);
    $note->addFindCriterion('_fk_LinkedObject_ID', '==' . $pkId);
    if (!$spotNotesView && $spotNotesEdit) {
        $log->info("Secondary search for user records for user: "******"z_RecCreatedBy", "==" . $_SESSION['userName']);
        $userHasNotes = true;
    }
    $note->addSortRule($sortFieldOne, 1, FILEMAKER_SORT_DESCEND);
    $note->addSortRule($sortFieldTwo, 2, FILEMAKER_SORT_DESCEND);
    $noteRecords = $note->execute();
    $processNotes = false;
    //Check for errors and no records found is not a true error as it is possible that no comments have been made
Esempio n. 8
0
             if (is_array($items)) {
                 echo "<p class='text-muted'>";
                 foreach ($items as $item) {
                     echo $item . "<br>\n";
                 }
                 echo "</p></div>\n";
             } else {
                 echo "<p class='text-muted'>" . $items . "</p></div>\n";
             }
             if ($columnTypeIndex == $projectTypeRecordCount - 1 && $projectTypeRecordCount % $maxTypesPerRow != 0) {
                 echo "<div class='" . $dynamicColumnXsClassText . $columnWidthTotal . " " . $dynamicColumnLgClassText . $columnWidthTotal . "'>&nbsp;</div>\n";
                 //Empty row dynamic column width text
             }
         } else {
             getButtonCode($projectTypeRecords[$columnTypeIndex]->getField('Request_Type'), $projectTypeRecords[$columnTypeIndex]->getField('__pk_ID'));
             $items = convertPipeToArray($projectTypeRecords[$columnTypeIndex]->getField('Examples_List_Pipe_ct'));
             if (is_array($items)) {
                 echo "<p class='text-muted'>";
                 foreach ($items as $item) {
                     echo $item . "<br>\n";
                 }
                 echo "</p></div>\n";
             } else {
                 echo "<p class='text-muted'>" . $items . "</p></div>\n";
             }
         }
     }
 }
 //End for dynamic cell generation for loop
 echo "<div class='col-xs-2 col-lg-2'>&nbsp;</div><!-- Last blank column for Bootstrap 12 column grid system -->\n";
 echo "</div><!-- end of row for this 12 columns -->\n";
Esempio n. 9
0
$requestDivision = $request->getField($requestDivisionFieldName);
$webShowCodeTitle = "Show_Title_t";
$showTitle = $request->getField($webShowCodeTitle);
//load SpotTypes from FM DB or Session
if (!isset($_SESSION[$spotTypesSessionIndex])) {
    $spotTypeArray = loadSpotTypesSessionData($fmOrderDB, $allProgrammingTypes);
} else {
    $log->debug('Using Session to load Spot Types');
    $spotTypeArray = $_SESSION[$spotTypesSessionIndex];
}
/** Project Type uses UI_Spot_Types_ValueList_ct field a special Pipe Delimited values **/
$spotTypeName = "Spot_Type";
$lengthName = "Length";
$lengthPipeList = $request->getField('UI_ValueList_ProjectLengths_ct');
if (isset($lengthPipeList)) {
    $lengthItems = convertPipeToArray($lengthPipeList);
}
$requestStatusName = 'Request_Status_t';
$log->debug("Begin find tags command");
//I should be able to remove all the code below with the following
//Load Tag Versions from DB or Session
if (!isset($_SESSION[$tagsSessionIndex])) {
    $tagsArray = loadTagsSessionData($fmOrderDB, $allProgrammingTypes);
} else {
    $log->debug("Using Sessiopn to load Tags");
    $tagsArray = $_SESSION[$tagsSessionIndex];
}
//Pull tags set in FM by Deliverable PK ID
$tagsLayout = "[WEB] Project Deliverable Tags";
$tagsFind = $fmOrderDB->newFindCommand($tagsLayout);
$log->debug("Add search criteria Deliverable PKID: " . $deliverablePkId);