public function timing(Phase $phase, $id)
 {
     $data = array();
     $data = splitString($id);
     $id = $data[0];
     $statusName = $data[2];
     $currentStatus = $data[3];
     $timing = new Timing();
     $affectedRows = $timing->whereId($id)->orderBy('id', 'desc')->first();
     $datetime = currentTimestamp($currentStatus);
     if ($currentStatus == "start") {
         $newStatus = "pause";
     } elseif ($currentStatus == "notStart") {
         $newStatus = "start";
     } elseif ($currentStatus == "pause") {
         $newStatus = "restart";
     } elseif ($currentStatus == "restart") {
         $newStatus = "pause";
     }
     $timing->tracker = $datetime;
     $timing->status = $newStatus;
     $timing->type_id = $affectedRows->type_id;
     $timing->phase_id = $affectedRows->phase_id;
     $timing->project_id = $affectedRows->project_id;
     $timing->save();
     $updatePhase = $this->phase->where('id', $affectedRows->phase_id)->update(array('updated_at' => currentTimestamp($affectedRows->phase_id)));
     return view('phases.show', compact('phase'));
 }
function extractColumnName($column)
{
    // if nameType --> Type of name
    if (strpos($column, 'primary') !== FALSE || strpos($column, 'secondary') !== FALSE) {
        splitString($column, 'Type');
    } else {
        reorderString($column, 'Type', 'Type of ', '');
    }
    reorderString($column, 'Num', 'Number of ', 's');
    removeCamelCase($column);
    // capatilize
    $column = ucfirst($column);
    return $column;
}
Beispiel #3
0
 function addTimings($lastrgid, $laststateid)
 {
     if (Config::logSurveyTimings() == false) {
         return;
     }
     $localdb = null;
     if (Config::useTransactions() == true) {
         global $transdb;
         $localdb = $transdb;
     } else {
         global $db;
         $localdb = $db;
     }
     $vars = splitString("/~/", getFromSessionParams(SESSION_PARAM_VARIABLES));
     $begin = date("Y-m-d H:i:s", getFromSessionParams(SESSION_PARAM_TIMESTAMP));
     $end = time();
     $lang = getSurveyLanguage();
     $mode = getSurveyMode();
     $version = getSurveyVersion();
     $time = time();
     foreach ($vars as $var) {
         $var = $this->prefixVariableName($var);
         $query = "insert into " . Config::dbSurveyData() . '_times (suid, primkey, stateid, rgid, variable, begintime, endtime, timespent, language, mode, version) values (';
         $query .= prepareDatabaseString($this->getSuid()) . ",";
         $query .= "'" . prepareDatabaseString($this->primkey) . "',";
         $query .= "'" . prepareDatabaseString($laststateid) . "',";
         $query .= "'" . prepareDatabaseString($lastrgid) . "',";
         $query .= "'" . prepareDatabaseString($var) . "',";
         $query .= "'" . prepareDatabaseString($begin) . "',";
         $query .= "'" . date("Y-m-d H:i:s", $end) . "',";
         $query .= $time - getFromSessionParams(SESSION_PARAM_TIMESTAMP) . ",";
         $query .= prepareDatabaseString($lang) . ",";
         $query .= prepareDatabaseString($mode) . ",";
         $query .= prepareDatabaseString($version) . ")";
         //echo$query . "<br/>";
         $localdb->executeQuery($query);
     }
 }
Beispiel #4
0
 function addValueLabels()
 {
     $encoding = $this->getProperty(DATA_OUTPUT_ENCODING);
     if ($this->getProperty(DATA_OUTPUT_INCLUDE_VALUE_LABELS) == VALUELABEL_YES) {
         $this->recordbytes = null;
         for ($i = 0; $i < $this->variablenumber; $i++) {
             if (isset($this->valuelabels[$i]) && $this->valuelabels[$i] != "") {
                 $labels = explode("\r\n", trim($this->valuelabels[$i]));
                 $length = 0;
                 for ($j = 0; $j < sizeof($labels); $j++) {
                     $label = $this->getValueLabel($labels[$j]);
                     $length = $length + strlen($this->prepareLabel($label)) + 1;
                 }
                 // write the length of the value labels
                 $this->writeInt($this->recordbytes, $length + 2 * 4 + 2 * (sizeof($labels) * 4));
                 // write the value label name
                 $labelname = $this->getProperty(DATA_OUTPUT_VALUELABEL_PREFIX);
                 $this->writeString($this->recordbytes, $labelname . $i, 33, $encoding);
                 for ($j = 0; $j < 3; $j++) {
                     $this->writeByte($this->recordbytes, 0);
                 }
                 // write the number of value labels
                 $this->writeInt($this->recordbytes, sizeof($labels));
                 // write the value label text length
                 $this->writeInt($this->recordbytes, $length);
                 // write the length of each value label
                 $position = 0;
                 for ($j = 0; $j < sizeof($labels); $j++) {
                     $this->writeInt($this->recordbytes, $position);
                     $label = $this->getValueLabel($labels[$j]);
                     // update position
                     $position = $position + strlen($this->prepareLabel($label)) + 1;
                 }
                 // write the codes of value labels
                 for ($j = 0; $j < sizeof($labels); $j++) {
                     $labelarray = splitString("/ /", $labels[$j]);
                     $val = $labelarray[0];
                     $this->writeInt($this->recordbytes, $val);
                 }
                 // write value labels themselves
                 for ($j = 0; $j < sizeof($labels); $j++) {
                     $label = $this->getValueLabel($labels[$j]);
                     $this->writeString($this->recordbytes, $this->prepareLabel($label), strlen($this->prepareLabel($label)) + 1, $encoding);
                 }
             }
         }
         // write value labels
         fwrite($this->statahandle, $this->recordbytes);
     }
 }
Beispiel #5
0
 function checkType($var, $all = false)
 {
     // get answer type
     $t = $var->getAnswerType();
     // general
     if ($_SESSION['VRFILTERMODE_TYPE'] == 0 || $all == true) {
         switch ($t) {
             case ANSWER_TYPE_ENUMERATED:
             case ANSWER_TYPE_DROPDOWN:
             case ANSWER_TYPE_SETOFENUMERATED:
             case ANSWER_TYPE_MULTIDROPDOWN:
                 $text[] = $var->getOptionsText();
                 break;
             case ANSWER_TYPE_CUSTOM:
                 $text[] = $var->getAnswerTypeCustom();
                 break;
         }
     }
     // verification
     if ($_SESSION['VRFILTERMODE_TYPE'] == 1 || $all == true) {
         switch ($t) {
             case ANSWER_TYPE_RANGE:
                 $text[] = $var->getMinimum();
                 $text[] = $var->getMaximum();
                 $text[] = $var->getOtherValues();
                 break;
             case ANSWER_TYPE_SLIDER:
                 $text[] = $var->getMinimum();
                 $text[] = $var->getMaximum();
                 break;
             case ANSWER_TYPE_SETOFENUMERATED:
             case ANSWER_TYPE_MULTIDROPDOWN:
                 $text[] = $var->getMinimumSelected();
                 $text[] = $var->getMaximumSelected();
                 $text[] = $var->getExactSelected();
                 break;
             case ANSWER_TYPE_STRING:
             case ANSWER_TYPE_OPEN:
                 $text[] = $var->getMinimumLength();
                 $text[] = $var->getMaximumLength();
                 $text[] = $var->getMinimumWords();
                 $text[] = $var->getMaximumWords();
                 break;
             case ANSWER_TYPE_CALENDAR:
                 $text[] = $var->getMaximumDatesSelected();
                 break;
         }
         if (inArray($t, array(ANSWER_TYPE_RANGE, ANSWER_TYPE_DOUBLE, ANSWER_TYPE_INTEGER, ANSWER_TYPE_ENUMERATED, ANSWER_TYPE_DROPDOWN, ANSWER_TYPE_DATE, ANSWER_TYPE_DATETIME, ANSWER_TYPE_TIME, ANSWER_TYPE_SLIDER))) {
             $text[] = $var->getComparisonEqualTo();
             $text[] = $var->getComparisonNotEqualTo();
             $text[] = $var->getComparisonGreaterEqualTo();
             $text[] = $var->getComparisonGreater();
             $text[] = $var->getComparisonSmallerEqualTo();
             $text[] = $var->getComparisonSmaller();
         }
     }
     // display
     if ($_SESSION['VRFILTERMODE_TYPE'] == 2 || $all == true) {
         $text[] = $var->getPageHeader();
         $text[] = $var->getPageFooter();
         $text[] = $var->getLabelBackButton();
         $text[] = $var->getLabelNextButton();
         $text[] = $var->getLabelDKButton();
         $text[] = $var->getLabelRFButton();
         $text[] = $var->getLabelNAButton();
         $text[] = $var->getLabelUpdateButton();
         $text[] = $var->getLabelRemarkButton();
         $text[] = $var->getLabelRemarkSaveButton();
         $text[] = $var->getLabelCloseButton();
         switch ($t) {
             case ANSWER_TYPE_ENUMERATED:
             case ANSWER_TYPE_DROPDOWN:
             case ANSWER_TYPE_SETOFENUMERATED:
             case ANSWER_TYPE_MULTIDROPDOWN:
                 $text[] = $var->getEnumeratedCustom();
                 $text[] = $var->getEnumeratedRandomizer();
                 break;
         }
     }
     // assistance
     if ($_SESSION['VRFILTERMODE_TYPE'] == 3 || $all == true) {
         $text[] = $var->getEmptyMessage();
         $text[] = $var->getPreText();
         $text[] = $var->getPostText();
         if (inArray($t, array(ANSWER_TYPE_RANGE, ANSWER_TYPE_DOUBLE, ANSWER_TYPE_INTEGER, ANSWER_TYPE_ENUMERATED, ANSWER_TYPE_DROPDOWN, ANSWER_TYPE_DATE, ANSWER_TYPE_DATETIME, ANSWER_TYPE_TIME, ANSWER_TYPE_SLIDER))) {
             $text[] = $var->getErrorMessageComparisonEqualTo();
             $text[] = $var->getErrorMessageComparisonNotEqualTo();
             $text[] = $var->getErrorMessageComparisonGreaterEqualTo();
             $text[] = $var->getErrorMessageComparisonGreater();
             $text[] = $var->getErrorMessageComparisonSmallerEqualTo();
             $text[] = $var->getErrorMessageComparisonSmaller();
         } else {
             if (inArray($t, array(ANSWER_TYPE_STRING, ANSWER_TYPE_OPEN))) {
                 $text[] = $var->getErrorMessageComparisonEqualToIgnoreCase();
                 $text[] = $var->getErrorMessageComparisonNotEqualToIgnoreCase();
             }
         }
         switch ($t) {
             case ANSWER_TYPE_DOUBLE:
                 $text[] = $var->getErrorMessageDouble();
                 break;
             case ANSWER_TYPE_INTEGER:
                 $text[] = $var->getErrorMessageInteger();
                 break;
             case ANSWER_TYPE_STRING:
                 /* fall through */
             /* fall through */
             case ANSWER_TYPE_OPEN:
                 $text[] = $var->getErrorMessagePattern();
                 $text[] = $var->getErrorMessageMinimumLength();
                 $text[] = $var->getErrorMessageMaximumLength();
                 $text[] = $var->getErrorMessageMinimumWords();
                 $text[] = $var->getErrorMessageMaximumWords();
                 break;
             case ANSWER_TYPE_RANGE:
                 /* fall through */
             /* fall through */
             case ANSWER_TYPE_SLIDER:
                 $text[] = $var->getErrorMessageRange();
                 break;
             case ANSWER_TYPE_SETOFENUMERATED:
                 /* fall through */
             /* fall through */
             case ANSWER_TYPE_MULTIDROPDOWN:
                 $text[] = $var->getErrorMessageSelectMinimum();
                 $text[] = $var->getErrorMessageSelectMaximum();
                 $text[] = $var->getErrorMessageSelectExact();
                 $text[] = $var->getErrorMessageSelectInvalidSubset();
                 $text[] = $var->getErrorMessageSelectInvalidSet();
                 break;
             case ANSWER_TYPE_CALENDAR:
                 $text[] = $var->getErrorMessageMaximumCalendar();
                 break;
         }
     }
     // interactive
     if ($_SESSION['VRFILTERMODE_TYPE'] == 6 || $all == true) {
         $text[] = $var->getInlineStyle();
         $text[] = $var->getPageStyle();
         $text[] = $var->getPageJavascript();
         $text[] = $var->getInlineJavascript();
         $text[] = $var->getScripts();
     }
     // check for references
     $fills = getReferences(implode(" ", $text), INDICATOR_FILL);
     $fills1 = getReferences(implode(" ", $text), INDICATOR_FILL_NOVALUE);
     $fills2 = getReferences(implode(" ", $text), INDICATOR_INLINEFIELD_ANSWER);
     $fills3 = getReferences(implode(" ", $text), INDICATOR_INLINEFIELD_TEXT);
     $fills = array_unique(array_merge($fills, $fills1, $fills2, $fills3));
     $messages = $this->checkReferences($fills);
     // options text format check
     if ($_SESSION['VRFILTERMODE_TYPE'] == 0 || $all == true) {
         if (inArray($t, array(ANSWER_TYPE_ENUMERATED, ANSWER_TYPE_DROPDOWN, ANSWER_TYPE_SETOFENUMERATED, ANSWER_TYPE_MULTIDROPDOWN))) {
             $options = explode("\r\n", $var->getOptionsText());
             foreach ($options as $option) {
                 $t = splitString("/ /", $option, PREG_SPLIT_NO_EMPTY, 2);
                 $code = trim($t[0]);
                 if (!is_numeric($code)) {
                     $messages[] = Language::messageCheckerVariableNumericOptionCodes($option);
                     break;
                 }
                 $labeltext = trim($t[1]);
             }
         }
     }
     // function reference check
     if ($_SESSION['VRFILTERMODE_VARIABLE'] == 6 || $all == true) {
         $functions[] = $var->getOnBack();
         $functions[] = $var->getOnNext();
         $functions[] = $var->getOnDK();
         $functions[] = $var->getOnRF();
         $functions[] = $var->getOnNA();
         $functions[] = $var->getOnUpdate();
         $functions[] = $var->getOnLanguageChange();
         $functions[] = $var->getOnModeChange();
         $functions[] = $var->getOnVersionChange();
         foreach ($functions as $f) {
             if (!inArray(trim($f), array("", SETTING_FOLLOW_GENERIC, SETTING_FOLLOW_TYPE))) {
                 if (function_exists($f) == false) {
                     $messages[] = Language::messageCheckerFunctionNotExists($f);
                 }
             }
         }
     }
     return $messages;
 }
            <input type="submit" value="Submit" />
        </form>

        <?php 
if (isset($_GET['input']) && isset($_GET['choice'])) {
    $input = $_GET['input'];
    $choice = htmlspecialchars($_GET['choice']);
    switch ($choice) {
        case 'palindrome':
            checkPalindrome($input);
            break;
        case 'reverse':
            echo strrev($input);
            break;
        case 'split':
            splitString($input);
            break;
        case 'hash':
            echo hash('md5', $input);
            break;
        case 'shuffle':
            echo str_shuffle($input);
            break;
        default:
            echo 'Invalid choice';
            break;
    }
}
?>

        <?php 
         }
         if ($userFoundInP === true || $openedWrite === "allowAll") {
             saveFile("{$directory}/{$groupName}/{$otherUser}/data.txt", $clientData);
             echo '{"cenInfo":"set"}';
         } else {
             echo '{"cenError":"write access not granted."}';
         }
     } else {
         echo '{"cenError":"user does not exist."}';
     }
 } else {
     if ($action === "updateOther") {
         $otherUser = $_POST['otherUser'];
         if (file_exists("{$directory}/{$groupName}/{$otherUser}/")) {
             $openedWrite = openFile("{$directory}/{$groupName}/{$otherUser}/write.txt", 1000);
             $arrayX = splitString($openedWrite, "@n@");
             $userFoundInP = false;
             for ($x = 0; $x < count($arrayX); $x++) {
                 //look for current user in $otherUser's perms
                 if ($arrayX[$x] === $userName) {
                     $userFoundInP = true;
                 }
             }
             if ($userFoundInP === true || $openedWrite === "allowAll") {
                 $openedData = openFile("{$directory}/{$groupName}/{$otherUser}/data.txt", 500000);
                 if ($openedData === "") {
                     $openedData = array();
                 } else {
                     $openedData = json_decode($openedData);
                 }
                 $clientData = json_decode($clientData);
 function addAssignment(&$node, $instruction)
 {
     $rule = trim($instruction->getRule());
     $rgid = trim($instruction->getRgid());
     // hide text
     $excluded = array();
     $rule = excludeText($rule, $excluded);
     // hide module dot notations
     $rule = hideModuleNotations($rule, TEXT_MODULE_DOT);
     // split left and right hand
     $split = splitString("/:=/", $rule);
     $lefthand = includeText($split[0], $excluded);
     $righthand = includeText($split[1], $excluded);
     $this->addToStatements("<div class='uscic-paperversion-for uscic-paperversion-nesting" . $this->nesting . "'><div class='uscic-paperversion-assignment'>" . includeText($rule, $excluded) . "</div></div>", 7);
 }
 private function setOptions()
 {
     if ($this->options != null) {
         return $this->options;
     }
     $options = explode("\r\n", $this->getOptionsText());
     foreach ($options as $option) {
         if (trim($option) == "") {
             continue;
         }
         $t = splitString("/ /", $option, PREG_SPLIT_NO_EMPTY, 2);
         $code = trim($t[0]);
         if (isset($t[1])) {
             $labeltext = trim($t[1]);
         } else {
             $labeltext = '';
         }
         /* acronym */
         if (startsWith($labeltext, "(")) {
             $remainder = splitString("/(\\(\\w+\\))/", $labeltext, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY, 2);
             if (sizeof($remainder) >= 2) {
                 if (contains($remainder[0], "(")) {
                     $acronym = trim(str_replace(")", "", str_replace("(", "", $remainder[0])));
                     $pos = strpos($labeltext, $remainder[0]);
                     $label = trim(substr($labeltext, $pos + strlen($remainder[0])));
                 } else {
                     $acronym = "";
                     $label = $labeltext;
                 }
             }
         } else {
             $acronym = "";
             $label = $labeltext;
         }
         $this->options[] = array("code" => $code, "label" => $label, "acronym" => $acronym);
         if ($this->maximumoptioncode == "" || $code > $this->maximumoptioncode) {
             //echo 'set it';
             $this->maximumoptioncode = $code;
         }
     }
     //print_r($this->options);
 }
Beispiel #10
0
<form action="addDataUtil.php" method="post" enctype="multipart/form-data">
    <table border=0 width="100%">

        <tr>
            <td>
                <?php 
$resultArray = splitString($appDiagrams, ",");
for ($i = 1; $i <= count($resultArray); $i++) {
    echo "<input title=\"View " . $entityName . " Interface Diagram\" type=\"button\" style=\"background-color: #FFE4C4;border-color: black\"";
    echo " value=\"Interface Diagram " . $i . "\" onclick=\"window.open('OpenImage.php?appName=" . $entityName . "&filePath=" . $resultArray[$i - 1];
    echo "','window','width=800,height=600,scrollbars=1,resizable=1')\"></input>&nbsp";
}
?>
            </td>

        <div id="appPage" style="display:none">  
            <td align="right">
                <label for="file"><font style="color: black;size:10pt">Upload more Diagrams:</font></label>
                <input type="file" name="file" id="file" /> 
            </td>
            <td align="center">
                <input type="hidden" name="actionId" value="<?php 
echo $actionId;
?>
"/>
                <input type="hidden" name="id" value="<?php 
echo $id;
?>
"/>
                <input type="submit"  value="Submit" name="Update" />
            </td>
Beispiel #11
0
function getSurveyTemplate()
{
    /* SURVEY */
    // check for new template
    global $survey, $template;
    /* global template has been set! (via setting below, so no need to repeat) */
    if (isSurveyTemplate($template)) {
        return $template;
    }
    /* get from loadvar (IF ALLOWED) */
    if (getSurveyTemplateAllowChange() != TEMPLATE_CHANGE_NOTALLOWED) {
        $l = loadvarSurvey(POST_PARAM_TEMPLATE);
        if (isSurveyTemplate($l)) {
            $template = $l;
            $_SESSION["PARAMS"][SESSION_PARAM_TEMPLATE] = $l;
            return $template;
        }
        $l = getFromSessionParams(SESSION_PARAM_NEWTEMPLATE);
        if (isSurveyTemplate($l)) {
            $_SESSION["PARAMS"][SESSION_PARAM_TEMPLATE] = $l;
            unset($_SESSION["PARAMS"][SESSION_PARAM_NEWTEMPLATE]);
            $template = $l;
            return $l;
        }
        // check in submitted answers
        $vars = splitString("/~/", getFromSessionParams(SESSION_PARAM_VARIABLES));
        if (inArray(VARIABLE_TEMPLATE, $vars)) {
            $cnt = 1;
            foreach ($vars as $var) {
                if (strtoupper($var) == strtoupper(VARIABLE_TEMPLATE)) {
                    $answer = loadvarSurvey(SESSION_PARAMS_ANSWER . $cnt);
                    if (isSurveyTemplate($answer)) {
                        $template = $answer;
                        return $answer;
                    }
                    break;
                }
            }
        }
    }
    // check for old template from session
    $l = getFromSessionParams(SESSION_PARAM_TEMPLATE);
    if (isSurveyTemplate($l)) {
        $template = $l;
        return $l;
    }
    // default template from survey
    return $survey->getTemplate();
}
Beispiel #12
0
 function addForLoop($function, &$node, $instruction)
 {
     if ($this->checkclass == true) {
         return;
     }
     $rule = trim($instruction->getRule());
     $rgid = trim($instruction->getRgid());
     $rgidafter = $rgid;
     // hide text
     $excluded = array();
     $rule = excludeText($rule, $excluded);
     // hide module dot notations
     $rule = hideModuleNotations($rule, TEXT_MODULE_DOT);
     // strip FOR
     $reversefor = 1;
     if (startsWith($rule, ROUTING_IDENTIFY_FORREVERSE)) {
         $rule = substr($rule, stripos($rule, ROUTING_IDENTIFY_FORREVERSE) + strlen(ROUTING_IDENTIFY_FORREVERSE));
         $reversefor = 2;
     } else {
         $rule = substr($rule, stripos($rule, ROUTING_IDENTIFY_FOR) + strlen(ROUTING_IDENTIFY_FOR));
     }
     /* multi-line for */
     //if ($pos < 0) {
     if (endsWith(strtoupper($rule), ROUTING_IDENTIFY_DO) == false) {
         for ($cnt = $this->cnt + 1; $cnt <= sizeof($this->instructions); $cnt++) {
             if (isset($this->instructions[$cnt])) {
                 $text = trim($this->instructions[$cnt]->getRule());
                 if (startsWith($text, "/*")) {
                     $this->skipComments($cnt, $cnt);
                 } else {
                     if (startsWith($text, "//")) {
                     } else {
                         //$pos = strripos($text, ROUTING_IDENTIFY_DO);
                         $rule .= " " . $text;
                         //if ($pos > -1) {
                         if (endsWith(strtoupper($rule), ROUTING_IDENTIFY_DO) == true) {
                             $this->cnt = $cnt;
                             $rgidafter = $this->instructions[$cnt]->getRgid();
                             break;
                         }
                     }
                 }
             }
         }
     }
     $pos = strripos(strtoupper($rule), ROUTING_IDENTIFY_DO);
     if ($pos < 1) {
         $this->addErrorMessage(Language::errorForLoopMissingDo());
         return;
     }
     // strip do
     $rule = trim(substr($rule, 0, $pos));
     if (!contains(strtoupper($rule), " TO ")) {
         $this->addErrorMessage(Language::errorForLoopMissingTo());
         return;
     }
     if (!contains(strtoupper($rule), ":=")) {
         $this->addErrorMessage(Language::errorForLoopMissingAssignment());
         return;
     }
     // determine min and max
     $bounds = splitString("/ TO /", strtoupper($rule));
     $counterplusstart = splitString("/:=/", $bounds[0]);
     //print_r($excluded);
     $counterfield = includeText($counterplusstart[0], $excluded);
     $minimum = includeText($counterplusstart[1], $excluded);
     $maximum = includeText($bounds[1], $excluded);
     // check for array
     if (!is_numeric($minimum)) {
         $var = $this->survey->getVariableDescriptiveByName(getBasicName($minimum));
         // new VariableDescriptive();
         if ($var->isArray()) {
             if (!contains($minimum, "[")) {
                 $this->addErrorMessage(Language::errorVariableNoArrayIndex(strtolower(getBasicName($minimum))));
             }
         }
     }
     if (!is_numeric($maximum)) {
         $var = $this->survey->getVariableDescriptiveByName(getBasicName($maximum));
         // new VariableDescriptive();
         if ($var->isArray()) {
             if (!contains($maximum, "[")) {
                 $this->addErrorMessage(Language::errorVariableNoArrayIndex(strtolower(getBasicName($maximum))));
             }
         }
     }
     // replace [ and ] with ( and ), so the parser doesn't break
     // (we deal with these cases in the updateVariables function)
     $counterfield = str_replace("[", TEXT_BRACKET_LEFT, $counterfield);
     $counterfield = str_replace("]", TEXT_BRACKET_RIGHT, $counterfield);
     $minimum = str_replace("[", TEXT_BRACKET_LEFT, $minimum);
     $minimum = str_replace("]", TEXT_BRACKET_RIGHT, $minimum);
     $maximum = str_replace("[", TEXT_BRACKET_LEFT, $maximum);
     $maximum = str_replace("]", TEXT_BRACKET_RIGHT, $maximum);
     /* create do function */
     $forfunctionnode = $this->factory->method($function);
     $forfunctionnode->makePrivate();
     $parser = new PHPParser_Parser(new PHPParser_Lexer());
     try {
         $stmts = $parser->parse("<?php " . $minimum . "?>");
         // only one statement (no ; allowed in loop minimum)
         $stmt = $stmts[0];
         $stmt = new PHPParser_Node_Arg($stmt);
         // encapsulate in fake Argument object, since updateVariables looks only at children of entered node
         $this->updateVariables($stmt);
         $args[] = $stmt;
         //echo 'min: ' . $minimum;
         $stmts = $parser->parse("<?php " . $maximum . "?>");
         // only one statement (no ; allowed in loop maximum)
         $stmt = $stmts[0];
         $stmt = new PHPParser_Node_Arg($stmt);
         // encapsulate in fake Argument object, since updateVariables looks only at children of entered node
         $this->updateVariables($stmt);
         $args[] = $stmt;
         //echo 'max: ' . $maximum;
         $stmts = $parser->parse("<?php " . $counterfield . "?>");
         // only one statement (no ; allowed in loop maximum)
         $stmt = $stmts[0];
         $stmt = new PHPParser_Node_Arg($stmt);
         // encapsulate in fake Argument object, since updateVariables looks only at children of entered node
         $this->updateVariables($stmt);
         //print_r($stmt);
         if ($stmt->value instanceof PHPParser_Node_Expr_MethodCall) {
             $args[] = $stmt->value->args[0];
         } else {
             /* not a constant, which happens if the counter field does not exist */
             if ($stmt->value->name instanceof PHPParser_Node_Expr_MethodCall) {
                 $args[] = $stmt->value->name->args[0]->value;
             }
         }
     } catch (PHPParser_Error $e) {
         $this->addErrorMessage(Language::errorForLoopInvalid());
         return;
     }
     $enddo = $this->findEndDo($rgid);
     //if ($enddo == "") {
     //    $this->addErrorMessage(Language::errorForLoopMissingEnddo());
     //    return;
     //}
     // not in group
     $outerlooprgids = implode("~", $this->loops);
     $this->loops[] = $rgid;
     if (sizeof($this->groups) == 0 && $this->fillclass != true) {
         $this->actions[] = $rgid;
         $timesloop = $maximum;
         if (!is_numeric($timesloop)) {
             $timesloop = LOOP_MAXIMUM_IF_UNDEFINED;
         }
         $this->looptimes = $this->looptimes * $timesloop;
         $this->lasttimesloop[] = $timesloop;
         $outerloopcounters = implode("~", $this->loopcounters);
         $this->loopcounters[] = trim($counterfield);
         $this->progressbarloops[] = $rgid;
         // if nested loop, then size is greater than 1
         //echo '<hr>finding next for loop at ' . $rgid;
         if (sizeof($this->loops) > 1) {
             $nextrgid = $this->findNextAfterForLoop($rgidafter, true);
             $enddo = $this->findEndDo($this->loops[sizeof($this->loops) - 2]);
             if ($nextrgid > $enddo) {
                 $nextrgid = $this->loops[sizeof($this->loops) - 2];
             } else {
                 if ($nextrgid == 0) {
                     $nextrgid = $this->loops[sizeof($this->loops) - 2];
                 }
             }
             // in basicengine: should return true if sizeof last loop action is smaller than loopcounter size?
             // i think now if we have a nested loop without any questions, but just assignments that it does not work
         } else {
             $nextrgid = $this->findNextAfterForLoop($rgidafter, false);
         }
         //echo '<br/>found ' . $nextrgid;
         // set last loop action if nested loop and loop action
         $stmts = array();
         if (sizeof($this->loops) > 1) {
             $arr = $this->loopactions[$this->loops[sizeof($this->loops) - 2]];
             if (inArray($rgid, $arr)) {
                 $s[] = new PHPParser_Node_Arg(new PHPParser_Node_Scalar_LNumber($rgid));
                 $s[] = new PHPParser_Node_Arg(new PHPParser_Node_Scalar_LNumber(sizeof($this->loops) - 2));
                 $stmts[] = new PHPParser_Node_Expr_MethodCall(new PHPParser_Node_Expr_Variable(VARIABLE_THIS), new PHPParser_Node_Name(array(FUNCTION_DO_LOOP_LEFTOFF)), $s);
             }
         }
         if (sizeof($this->whiles) > 0) {
             $arr = $this->whileactions[$this->whiles[sizeof($this->whiles) - 1]];
             if (inArray($rgid, $arr)) {
                 $s[] = new PHPParser_Node_Arg(new PHPParser_Node_Scalar_LNumber($rgid));
                 $s[] = new PHPParser_Node_Arg(new PHPParser_Node_Scalar_LNumber(sizeof($this->whiles) - 1));
                 $stmts[] = new PHPParser_Node_Expr_MethodCall(new PHPParser_Node_Expr_Variable(VARIABLE_THIS), new PHPParser_Node_Name(array(FUNCTION_DO_WHILE_LEFTOFF)), $s);
             }
         }
         $args[] = new PHPParser_Node_Arg(new PHPParser_Node_Scalar_String(implode("~", $this->findStatementsInLoop($rgid))));
         $args[] = new PHPParser_Node_Arg(new PHPParser_Node_Scalar_LNumber($rgid));
         $args[] = new PHPParser_Node_Arg(new PHPParser_Node_Scalar_LNumber($nextrgid));
         $args[] = new PHPParser_Node_Arg(new PHPParser_Node_Scalar_String($outerloopcounters));
         $args[] = new PHPParser_Node_Arg(new PHPParser_Node_Scalar_String($outerlooprgids));
         $args[] = new PHPParser_Node_Arg(new PHPParser_Node_Scalar_LNumber($reversefor));
         $stmts[] = new PHPParser_Node_Expr_MethodCall(new PHPParser_Node_Expr_Variable(VARIABLE_THIS), new PHPParser_Node_Name(array(FUNCTION_DO_LOOP)), $args);
         $this->loopnextrgids[] = $args;
         // add dummy entry if outer loop or while
         if (sizeof($this->loops) == 1) {
             global $db;
             $this->screencounter++;
             $query = "replace into " . Config::dbSurvey() . "_screens (suid, seid, rgid, ifrgid, number, section, looptimes, outerlooptimes, outerlooprgids, outerwhilergids, dummy) values(" . prepareDatabaseString($this->suid) . ", " . prepareDatabaseString($this->seid) . ", '" . prepareDatabaseString($rgid) . "', '" . prepareDatabaseString($ifrgid) . "', '" . prepareDatabaseString($this->screencounter) . "', -1, -1, '-1','-1','-1', 1);";
             $db->executeQuery($query);
             //echo $query;
         }
     } else {
         $nextrgid = $this->findNextAfterForLoop($rgid);
         // always go to next
         $args[] = new PHPParser_Node_Arg(new PHPParser_Node_Scalar_String(implode("~", $this->findStatementsInLoop($rgid))));
         $args[] = new PHPParser_Node_Arg(new PHPParser_Node_Scalar_LNumber($rgid));
         $args[] = new PHPParser_Node_Arg(new PHPParser_Node_Scalar_LNumber($nextrgid));
         $args[] = new PHPParser_Node_Arg(new PHPParser_Node_Scalar_LNumber($reversefor));
         //$args[] = new PHPParser_Node_Arg(new PHPParser_Node_Scalar_String("")); // dont think we need this
         $stmts = array();
         // not fill class
         if ($this->fillclass != true) {
             $stmts[] = new PHPParser_Node_Stmt_Return(new PHPParser_Node_Expr_MethodCall(new PHPParser_Node_Expr_Variable(VARIABLE_THIS), new PHPParser_Node_Name(array(FUNCTION_DO_LOOP_GROUP)), $args));
         } else {
             $stmts[] = new PHPParser_Node_Expr_MethodCall(new PHPParser_Node_Expr_Variable(VARIABLE_THIS), new PHPParser_Node_Name(array(FUNCTION_DO_LOOP)), $args);
         }
         $this->loopnextrgids[] = $args;
     }
     $forfunctionnode->addStmts($stmts);
     /* add for loop function */
     $node->addStmt($forfunctionnode);
 }
Beispiel #13
0
 private function setOptions()
 {
     if ($this->options != null) {
         return $this->options;
     }
     $options = explode("\r\n", $this->getOptionsText());
     foreach ($options as $option) {
         if (trim($option) == "") {
             continue;
         }
         $t = splitString("/ /", $option, PREG_SPLIT_NO_EMPTY, 2);
         $code = trim($t[0]);
         $remainder = splitString("/(\\(\\w+\\))/", $t[1], PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
         if (sizeof($remainder) == 2) {
             $acronym = trim(str_replace(")", "", str_replace("(", "", $remainder[0])));
             $label = trim($remainder[1]);
         } else {
             $acronym = "";
             $label = trim($remainder[0]);
         }
         $this->options[] = array("code" => $code, "label" => $label, "acronym" => $acronym);
     }
 }
 public function updateSingleTask(Project $project, $id)
 {
     $data = array();
     $data = splitString($id);
     $id = $data[0];
     $statusName = $data[2];
     $currentStatus = $data[3];
     $task = new Task();
     $affectedRows = $task->whereId($id)->orderBy('id', 'desc')->first();
     //dd($affectedRows->task_dev);
     $datetime = currentTimestamp($currentStatus);
     if ($currentStatus == "start" or $currentStatus == "restart") {
         $newStatus = "pause";
     } elseif ($currentStatus == "notStart" or $currentStatus == "end") {
         $newStatus = "start";
     } elseif ($currentStatus == "pause") {
         $newStatus = "restart";
     }
     if ($statusName == "status_des") {
         $task->task_designs = $datetime;
         $task->status_task_designs = $newStatus;
         $task->task_prod = $affectedRows->task_prod;
         $task->status_task_prod = $affectedRows->status_task_prod;
         $task->task_dev = $affectedRows->task_dev;
         $task->status_task_dev = $affectedRows->status_task_dev;
         $task->project_id = $affectedRows->project_id;
         $task->save();
     }
     if ($statusName == "status_dev") {
         $task->task_designs = $affectedRows->task_designs;
         $task->status_task_designs = $affectedRows->status_task_designs;
         $task->task_prod = $affectedRows->task_prod;
         $task->status_task_prod = $affectedRows->status_task_prod;
         $task->task_dev = $datetime;
         $task->status_task_dev = $newStatus;
         $task->project_id = $affectedRows->project_id;
         $task->save();
     }
     if ($statusName == "status_prod") {
         $task->task_designs = $affectedRows->task_designs;
         $task->status_task_designs = $affectedRows->status_task_designs;
         $task->task_prod = $datetime;
         $task->status_task_prod = $newStatus;
         $task->task_dev = $affectedRows->task_dev;
         $task->status_task_dev = $affectedRows->status_task_dev;
         $task->project_id = $affectedRows->project_id;
         $task->save();
     }
     return view('projects.show', compact('project'));
 }
Beispiel #15
0
 function addForLoop($instruction)
 {
     $rule = trim($instruction->getRule());
     $rgid = trim($instruction->getRgid());
     $rgidafter = $rgid;
     // hide text
     $excluded = array();
     $rule = excludeText($rule, $excluded);
     // hide module dot notations
     $rule = hideModuleNotations($rule, TEXT_MODULE_DOT);
     // strip FOR
     $reversefor = 1;
     if (startsWith($rule, ROUTING_IDENTIFY_FORREVERSE)) {
         $rule = substr($rule, stripos($rule, ROUTING_IDENTIFY_FORREVERSE) + strlen(ROUTING_IDENTIFY_FORREVERSE));
         $reversefor = 2;
     } else {
         $rule = substr($rule, stripos($rule, ROUTING_IDENTIFY_FOR) + strlen(ROUTING_IDENTIFY_FOR));
     }
     /* multi-line for */
     //if ($pos < 0) {
     if (endsWith(strtoupper($rule), ROUTING_IDENTIFY_DO) == false) {
         for ($cnt = $this->cnt + 1; $cnt <= sizeof($this->instructions); $cnt++) {
             if (isset($this->instructions[$cnt])) {
                 $text = trim($this->instructions[$cnt]->getRule());
                 if (startsWith($text, "/*")) {
                     $this->skipComments($cnt, $cnt);
                 } else {
                     if (startsWith($text, "//")) {
                     } else {
                         //$pos = strripos($text, ROUTING_IDENTIFY_DO);
                         $rule .= " " . $text;
                         //if ($pos > -1) {
                         if (endsWith(strtoupper($rule), ROUTING_IDENTIFY_DO) == true) {
                             $this->cnt = $cnt;
                             $rgidafter = $this->instructions[$cnt]->getRgid();
                             break;
                         }
                     }
                 }
             }
         }
     }
     $pos = strripos(strtoupper($rule), ROUTING_IDENTIFY_DO);
     if ($pos < 1) {
         $this->addErrorMessage(Language::errorForLoopMissingDo());
         return;
     }
     // strip do
     $rule = trim(substr($rule, 0, $pos));
     if (!contains(strtoupper($rule), " TO ")) {
         $this->addErrorMessage(Language::errorForLoopMissingTo());
         return;
     }
     if (!contains(strtoupper($rule), ":=")) {
         $this->addErrorMessage(Language::errorForLoopMissingAssignment());
         return;
     }
     // determine min and max
     $bounds = preg_split("/ to /i", $rule);
     $counterplusstart = splitString("/:=/", $bounds[0]);
     //print_r($excluded);
     $counterfield = includeText($counterplusstart[0], $excluded);
     $minimum = includeText($counterplusstart[1], $excluded);
     $maximum = includeText($bounds[1], $excluded);
     // check for array
     if (!is_numeric($minimum)) {
         $var = $this->survey->getVariableDescriptiveByName(getBasicName($minimum));
         // new VariableDescriptive();
         if ($var->isArray()) {
             if (!contains($minimum, "[")) {
                 $this->addErrorMessage(Language::errorVariableNoArrayIndex(strtolower(getBasicName($minimum))));
             }
         }
     }
     if (!is_numeric($maximum)) {
         $var = $this->survey->getVariableDescriptiveByName(getBasicName($maximum));
         // new VariableDescriptive();
         if ($var->isArray()) {
             if (!contains($maximum, "[")) {
                 $this->addErrorMessage(Language::errorVariableNoArrayIndex(strtolower(getBasicName($maximum))));
             }
         }
     }
     // replace [ and ] with ( and ), so the parser doesn't break
     // (we deal with these cases in the updateVariables function)
     $counterfield = str_replace("[", TEXT_BRACKET_LEFT, $counterfield);
     $counterfield = str_replace("]", TEXT_BRACKET_RIGHT, $counterfield);
     $minimum = str_replace("[", TEXT_BRACKET_LEFT, $minimum);
     $minimum = str_replace("]", TEXT_BRACKET_RIGHT, $minimum);
     $maximum = str_replace("[", TEXT_BRACKET_LEFT, $maximum);
     $maximum = str_replace("]", TEXT_BRACKET_RIGHT, $maximum);
     $parser = new PHPParser_Parser(new PHPParser_Lexer());
     try {
         $stmts = $parser->parse("<?php " . $minimum . "?>");
         // only one statement (no ; allowed in loop minimum)
         $stmt = $stmts[0];
         $stmt = new PHPParser_Node_Arg($stmt);
         // encapsulate in fake Argument object, since updateVariables looks only at children of entered node
         $this->updateVariables($stmt);
         $min = $stmt;
         //echo 'min: ' . $minimum;
         $stmts = $parser->parse("<?php " . $maximum . "?>");
         // only one statement (no ; allowed in loop maximum)
         $stmt = $stmts[0];
         $stmt = new PHPParser_Node_Arg($stmt);
         // encapsulate in fake Argument object, since updateVariables looks only at children of entered node
         $this->updateVariables($stmt);
         $max = $stmt;
         //echo 'max: ' . $maximum;
         $stmts = $parser->parse("<?php " . $counterfield . "?>");
         // only one statement (no ; allowed in loop maximum)
         $stmt = $stmts[0];
         $stmt = new PHPParser_Node_Arg($stmt);
         // encapsulate in fake Argument object, since updateVariables looks only at children of entered node
         $this->updateVariables($stmt);
         //print_r($stmt);
         if ($stmt->value instanceof PHPParser_Node_Expr_MethodCall) {
             $counter = $stmt->value->var;
         } else {
             /* not a constant, which happens if the counter field does not exist */
             if ($stmt->value->name instanceof PHPParser_Node_Expr_MethodCall) {
                 $counter = $stmt->value->name->var;
             } else {
                 $counter = new PHPParser_Node_Expr_Variable($counterfield);
             }
         }
     } catch (PHPParser_Error $e) {
         $this->addErrorMessage(Language::errorForLoopInvalid());
         return;
     }
     // create for loop
     $temp = new PHPParser_Node_Expr_MethodCall($counter, FUNCTION_XI_GET_ANSWER, array($min));
     $temp1 = new PHPParser_Node_Expr_MethodCall($counter, FUNCTION_XI_GET_ANSWER, array());
     $temp2 = new PHPParser_Node_Expr_SmallerOrEqual($temp1, $max->value);
     $temp4 = new PHPParser_Node_Expr_Plus($temp1, new PHPParser_Node_Scalar_LNumber(1));
     $temp3 = new PHPParser_Node_Expr_MethodCall($counter, FUNCTION_XI_GET_ANSWER, array($temp4));
     $fillcall = "for (" . $this->printer->prettyPrint(array($temp)) . " " . $this->printer->prettyPrint(array($temp2)) . " " . $this->printer->prettyPrint(array($temp3));
     // clean up
     $fillcall = str_replace(" . (", "", $fillcall);
     $fillcall = str_replace(" . ])", "]", $fillcall);
     $fillcall = str_replace("\n", "", trim(substr($fillcall, 0, strlen($fillcall) - 1))) . ") {\r\n";
     // remove closing "}"
     $this->routing_output[$this->seid][] = $fillcall;
 }
Beispiel #16
0
        <font size=5pt font=arial><u>Result for: <?php 
echo $searchStr;
?>
(Related with Application:  <?php 
echo $appName;
?>
)</u></font>
    </td>
</tr>
</table>

<table width=100% border=0>
    <tr>
        <td>
            <?php 
$outputStr = splitString($fileNames, ",");
for ($i = 1; $i <= count($outputStr); $i++) {
    echo "<input title=\"View " . $appName . " Interface Diagram\" type=\"button\" style=\"background-color: #FFE4C4;border-color: black\"";
    echo " value=\"Interface Diagram " . $i . "\" onclick=\"window.open('OpenImage.php?appName=" . $appName . "&filePath=" . $outputStr[$i - 1];
    echo "','window','width=800,height=600,scrollbars=1,resizable=1')\"></input>&nbsp";
}
?>
        </td>
    </tr>
</table>

<table width=100% border=1 bordercolor=orange>
    <tr>	
        <td  width="33%" align="left"><font style="color: #CD3700;font-family:arial;size:11pt"> <b>Type:</b></font> 
            <font style="color: black;font-family:arial;size:11pt"><?php 
echo $type;