当前位置: 首页>>代码示例>>PHP>>正文


PHP inArray函数代码示例

本文整理汇总了PHP中inArray函数的典型用法代码示例。如果您正苦于以下问题:PHP inArray函数的具体用法?PHP inArray怎么用?PHP inArray使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了inArray函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: showLanguage

 function showLanguage()
 {
     global $survey;
     $allowed = explode("~", $survey->getAllowedLanguages(getSurveyMode()));
     if (sizeof($allowed) == 1) {
         return "";
     }
     $rgid = $this->engine->getRgid();
     $variablenames = $this->getRealVariables(explode("~", $this->engine->getDisplayed()));
     $template = $this->engine->getTemplate();
     $click = "";
     if ($template != "") {
         $group = $this->engine->getGroup($template);
         $click = $this->engine->replaceFills($group->getClickLanguageChange());
     } else {
         $vars = explode("~", $variablenames);
         $var = $this->engine->getVariableDescriptive($vars[0]);
         $click = $this->engine->replaceFills($var->getClickLanguageChange());
     }
     $click = str_replace("'", "", $click);
     $current = getSurveyLanguage();
     $langs = Language::getLanguagesArray();
     foreach ($langs as $key => $lang) {
         if (inArray($lang["value"], $allowed)) {
             $check = '';
             if ($lang["value"] == getSurveyLanguage()) {
                 //              $check = ' <span class="glyphicon glyphicon-ok"></span>';
             } else {
                 $returnStr .= '<button type="button" class="btn btn-sm btn-warning" onclick=\'document.getElementById("r").value="' . setSessionsParamString(array_merge(array(SESSION_PARAM_LASTACTION => $this->engine->getLastSurveyAction(), SESSION_PARAM_SURVEY => $survey->getSuid(), SESSION_PARAM_PRIMKEY => $this->primkey, SESSION_PARAM_RGID => $rgid, SESSION_PARAM_VARIABLES => $variablenames, SESSION_PARAM_GROUP => $template, SESSION_PARAM_MODE => getSurveyMode(), SESSION_PARAM_TEMPLATE => getSurveyTemplate(), SESSION_PARAM_VERSION => getSurveyVersion(), SESSION_PARAM_LANGUAGE => $current, SESSION_PARAM_TIMESTAMP => time(), SESSION_PARAM_SEID => $this->engine->getSeid(), SESSION_PARAM_MAINSEID => $this->engine->getMainSeid()), array(SESSION_PARAM_NEWLANGUAGE => $lang["value"]))) . '"; document.getElementById("navigation").value="' . NAVIGATION_LANGUAGE_CHANGE . '"; ' . $click . ' document.getElementById("form").submit(); \'>' . $lang["name"] . $check . '</button>';
             }
         }
     }
     return $returnStr;
 }
开发者ID:nubissurveying,项目名称:nubis,代码行数:34,代码来源:displayquestion_1.php

示例2: solution

/**
 * Search for Value where $searchNum in $startArray[0 ... Value - 1] == !$searchNum in arr[Value ... count($searchNum) - 1]
 * Detail description in technical assignment
 *
 * @param int $searchNum number what we search for
 * @param array $startArray array where we searching values
 *
 * @return int
 */
function solution($searchNum, array $startArray)
{
    if (in_array($searchNum, $startArray)) {
        $arrLength = count($startArray);
        $start = 0;
        $end = $arrLength;
        $middle = (int) (($start + $end) / 2);
        $middleWatcher = 0;
        $result = inArray($startArray, $searchNum, $middle);
        while ($result['yes'] !== $result['no']) {
            if ($result['yes'] > $result['no']) {
                $end = $middle;
            } else {
                if ($result['yes'] < $result['no']) {
                    $start = $middle;
                }
            }
            $middle = (int) (($start + $end) / 2);
            //If wathcer == middle - that means that value repeating and no sense to do another loop
            if ($middle === $middleWatcher) {
                return -1;
            }
            $middleWatcher = $middle;
            $result = inArray($startArray, $searchNum, $middle);
        }
        return $middle;
    }
    return -1;
}
开发者ID:vetrok,项目名称:junior_tests,代码行数:38,代码来源:array_search.php

示例3: singleRowTable

 {
     $this->variables = $variables;
     $this->realvariables = $realvariables;
     $this->language = $language;
     $returnStr = $this->singleRowTable();
     return $returnStr;
 }
 function singleRowTable()
 {
     $pt = $this->group->getParentGroup()->getTemplate();
     if ($pt != $this->group->getTemplate()) {
         $returnStr = '<div class="table-responsive">';
     }
     /* add error checks */
     $this->addErrorChecks();
     /* start table */
     $id = $this->group->getTableId();
     if (trim($id) == "") {
         $id = 'table_' . $this->group->getName() . mt_rand(0, 10000);
     }
     if ($pt != $this->group->getTemplate()) {
         $returnStr .= '<table id="' . $id . '" class="table' . $this->striped . $this->bordered . $this->hovered . $this->condensed . ' uscic-table-singlerow">';
         $returnStr .= '<thead></thead><tbody>';
         $returnStr .= "<tr class='uscic-table-row-singlerow'>";
     }
     /* build table */
     $cellwidth = "";
     //'style=" min-width: ' . round(100/(sizeof($this->variables)*2)) . '%; max-width: ' . round(100/sizeof($this->variables)) . '%; width: ' . round(100/sizeof($this->variables)) . '%;"';
     for ($i = 0; $i < sizeof($this->variables); $i++) {
         $variable = $this->variables[$i];
         if (startsWith($variable, ROUTING_IDENTIFY_SUBGROUP)) {
             //$returnStr .= "<td class='uscic-table-row-cell-singlerow' $cellwidth>" . $this->displayobject->showSubGroupQuestions($variable) . "</td>";
             $returnStr .= $this->displayobject->showSubGroupQuestions($variable, $this->group);
             $i = $this->findEndSubGroup($this->variables, $i);
             // skip until the end of the sub group, and continue display from there
         } else {
             $var = $this->engine->getVariableDescriptive($variable);
             /* only display non-inline fields */
             if ($this->engine->isInlineField($variable) == false) {
                 /* question text */
                 $returnStr .= "<td class='uscic-table-row-question-cell-singlerow' {$cellwidth}>" . $this->displayobject->showQuestionText($variable, $var, "uscic-question-table-single-row") . "</td>";
                 $cnt = $this->displaynumbers[strtoupper($variable)];
                 if (!inArray($var->getAnswerType(), array(ANSWER_TYPE_NONE, ANSWER_TYPE_SECTION))) {
                     /* answer input element */
                     $previousdata = $this->engine->getAnswer($variable);
                     $returnStr .= "<td class='uscic-table-row-cell-singlerow' {$cellwidth}>" . $this->displayobject->showAnswer($cnt, $variable, $var, $previousdata) . "</td>";
                 } else {
                     //$returnStr .= "<td></td>";
                 }
             }
开发者ID:nubissurveying,项目名称:nubis,代码行数:50,代码来源:singlerowtable.php

示例4: showNavBar

    public function showNavBar()
    {
        $returnStr = $this->showCalculator();
        //language
        $rgid = $this->engine->getRgid();
        $variablenames = $this->engine->getDisplayed();
        // begin language
        global $survey;
        if (getSurveyLanguageAllowChange() == LANGUAGE_CHANGE_RESPONDENT_ALLOWED) {
            $allowed = explode("~", $survey->getAllowedLanguages(getSurveyMode()));
            if (sizeof($allowed) > 1) {
                $returnStr .= '<li class="dropdown">';
                $returnStr .= '   <a href="#" class="dropdown-toggle" data-toggle="dropdown">Language <b class="caret"></b></a><ul class="dropdown-menu">';
                $langs = Language::getLanguagesArray();
                //getSurveyLanguages($this->engine->survey);
                foreach ($langs as $lang) {
                    if (inArray($lang["value"], $allowed)) {
                        $check = '';
                        if ($lang["value"] == getSurveyLanguage()) {
                            $check = ' <span class="glyphicon glyphicon-ok"></span>';
                        }
                        $returnStr .= '<li><a href=# onclick=\'document.getElementById("r").value="' . setSessionsParamString(array_merge(array(SESSION_PARAM_PRIMKEY => $this->engine->primkey, SESSION_PARAM_RGID => $rgid, SESSION_PARAM_VARIABLES => $variablenames, SESSION_PARAM_LANGUAGE => getSurveyLanguage(), SESSION_PARAM_TIMESTAMP => time(), SESSION_PARAM_SEID => $this->engine->getSeid(), SESSION_PARAM_MAINSEID => $this->engine->getMainSeid()), array(SESSION_PARAM_NEWLANGUAGE => $lang["value"]))) . '"; document.getElementById("navigation").value="' . addslashes(Language::buttonUpdate()) . '"; document.getElementById("form").submit(); \'>' . $lang["name"] . $check . '</a></li>';
                    }
                }
                $returnStr .= '</ul></li>';
            }
            //end language
        }
        $user = new User($_SESSION['URID']);
        $returnStr .= '<li class="dropdown">
              <a href="#" class="dropdown-toggle" data-hover="dropdown" data-toggle="dropdown">' . $user->getName() . ' <b class="caret"></b></a>
                 <ul class="dropdown-menu">
										<li class="dropdown-header">' . $this->engine->primkey . '</li>
                                                                                <li class="dropdown-header">' . $variablenames . '</li>';
        //$returnStr .= '<li><a href=# data-toggle="modal" data-target="#calculator">Calculator</a></li>';
        $returnStr .= '<li><a href="#" data-toggle="modal" data-target="#calculator"><span class="glyphicon glyphicon-th"></span> Calculator</a></li>';
        $returnStr .= '<li><a href="' . setSessionParams(array('page' => 'nurse.backfromsms', 'primkey' => $this->engine->primkey, 'suid' => $this->engine->getSuid())) . '&se=' . addslashes(USCIC_SMS) . '"><span class="glyphicon glyphicon-home"></span> ' . Language::linkBackToSMS() . '</a></li>                   
                    <li class="divider"></li>
                   <li><a href="index.php?rs=1&se=2"><span class="glyphicon glyphicon-log-out"></span> ' . Language::linkLogout() . '</a></li>
                 </ul>
             </li>
            </ul>
';
        $returnStr .= '</div><!--/.nav-collapse --> </div> </div>';
        return $returnStr;
    }
开发者ID:nubissurveying,项目名称:nubis,代码行数:46,代码来源:displayquestionnurse.php

示例5: __construct

	public function __construct( $definedMeaningId ) {
		$dc = wdGetDataSetContext();
		$dbr = wfGetDB( DB_SLAVE );

		global
			$wgDefaultClassMids, $dataSet;

		$queryResult = $dbr->query(
			SelectLatestDistinct(
				array(
					$dataSet->classAttributes->attributeMid,
					$dataSet->classAttributes->attributeType,
					$dataSet->bootstrappedDefinedMeanings->name
				),
				array( $dataSet->classAttributes, $dataSet->bootstrappedDefinedMeanings ),
				array(
					equals( $dataSet->classAttributes->levelMid, $dataSet->bootstrappedDefinedMeanings->definedMeaningId ),
					sqlOr(
						in( $dataSet->classAttributes->classMid,
							selectLatest(
								array( $dataSet->classMemberships->classMid ),
								array( $dataSet->classMemberships ),
								array( equals( $dataSet->classMemberships->classMemberMid, $definedMeaningId ) )
							)
						),
						inArray( $dataSet->classAttributes->classMid, $wgDefaultClassMids )
					)
				)
			)
		);

		$this->classAttributes = array();
		
		while ( $row = $dbr->fetchRow( $queryResult ) ) {
			$classAttribute = new ClassAttribute();
			$classAttribute->attributeId = $row[0];
			$classAttribute->type = $row[1];
			$classAttribute->levelName = $row[2];
			
			$this->classAttributes[] = $classAttribute;
		}
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:42,代码来源:WikiDataAPI.php

示例6: addQuestion

 function addQuestion(&$node, $instruction)
 {
     $rule = trim($instruction->getRule());
     $rgid = trim($instruction->getRgid());
     $excluded = array();
     $rule = excludeText($rule, $excluded);
     // check for .INLINE
     $inline = false;
     if (endsWith($rule, ROUTING_IDENTIFY_INLINE)) {
         $inline = true;
         //echo $rule;
         $pos = strrpos($rule, ROUTING_IDENTIFY_INLINE);
         //echo $pos;
         $rule = substr($rule, 0, $pos);
     }
     //echo $rule;
     // hide module dot notations
     $rule = hideModuleNotations($rule, TEXT_MODULE_DOT);
     //echo $rule;
     $rule = includeText($rule, $excluded);
     $var = $this->survey->getVariableDescriptiveByName(getBasicName($rule));
     if ($var->getVsid() != "") {
         if ($var->isHiddenRouting() == false) {
             if (trim($var->getDescription()) != "") {
                 $this->addToStatements("<div class='uscic-paperversion-question uscic-paperversion-nesting" . $this->nesting . "'><div class='uscic-paperversion-question-name'><b>" . $var->getName() . "</b> (" . $this->prepareText($var->getDescription()) . ")");
             } else {
                 $this->addToStatements("<div class='uscic-paperversion-question uscic-paperversion-nesting" . $this->nesting . "'><div class='uscic-paperversion-question-name'>" . $var->getName() . "");
             }
             $this->addToStatements('</div>');
             if (trim($var->getQuestion()) != "") {
                 $this->addToStatements("<div class='uscic-paperversion-questiontext'>" . $this->prepareText($var->getQuestion()) . "</div>", 15);
             }
             $answertype = $var->getAnswerType();
             if ($answertype == SETTING_FOLLOW_TYPE) {
                 $type = $this->survey->getType($var->getTyd());
                 $answertype = $type->getAnswerType();
             }
             if (inArray($answertype, array(ANSWER_TYPE_ENUMERATED, ANSWER_TYPE_SETOFENUMERATED, ANSWER_TYPE_DROPDOWN, ANSWER_TYPE_MULTIDROPDOWN))) {
                 $this->addToStatements("<div class='uscic-paperversion-question-categories'>" . $this->prepareText(str_replace("\r\n", "<br/>", $var->getOptionsText())) . "</div>");
             } elseif ($answertype == ANSWER_TYPE_STRING || $answertype == ANSWER_TYPE_OPEN) {
                 $this->addToStatements('STRING');
             } elseif ($answertype == ANSWER_TYPE_RANGE) {
                 $this->addToStatements('RANGE ' . $var->getMinimum() . '..' . $var->getMaximum());
             }
             $this->addToStatements("</div>", 6);
         }
     }
 }
开发者ID:nubissurveying,项目名称:nubis,代码行数:48,代码来源:papergenerator.php

示例7: showSearchSysadmin

    function showSearchSysadmin($searchparameters)
    {
        $returnStr = '<a id="closelink" class="close pull-right">&times;</a>';
        $returnStr .= "<script type='text/javascript'>\n                        \$ ('#closelink').click(function(event) {\n                                \$.sidr('close', 'optionssidebar');\n                                \$.get('" . setSessionParams(array("page" => "sysadmin.search.hide")) . "&updatesessionpage=2" . "',{},function(response){});\n                            });\n                        ";
        $returnStr .= "</script>";
        if (trim($searchparameters) == "") {
            $returnStr .= $this->displayWarning(Language::messageSearchNoTerm());
        } else {
            global $db, $survey;
            $query = "select * from " . Config::dbSurvey() . "_settings where suid=" . $_SESSION['SUID'] . " and CONVERT(value using utf8) COLLATE utf8_general_ci like '%" . prepareDatabaseString($searchparameters) . "%' group by objecttype,object order by objecttype, object";
            $res = $db->selectQuery($query);
            $query1 = "select * from " . Config::dbSurvey() . "_routing where suid=" . $_SESSION['SUID'] . " and CONVERT(rule using utf8) COLLATE utf8_general_ci like '%" . prepareDatabaseString($searchparameters) . "%' order by seid asc, rgid asc";
            $res1 = $db->selectQuery($query1);
            if ($res || $res1) {
                if ($db->getNumberOfRows($res) == 0 && $db->getNumberOfRows($res1) == 0) {
                    $returnStr .= $this->displayWarning(Language::labelNoSearched($searchparameters));
                } else {
                    /*
                     * 
                     */
                    $returnStr .= $this->displayCookieScripts();
                    $returnStr .= "<script type='text/javascript'>\n                        \$(document).ready(function(){\n                            \$('#search a').bind('click',function(event){\n                                  event.preventDefault();\n                                  var url=this.href + \"&" . POST_PARAM_AJAX_LOAD . "=" . AJAX_LOAD . "\";\n                                  \$.get(url,{},function(response){ \n                                     \$('#content').html(\$(response).children().first())\n                              })\t\n                           })\n                          });\n                        ";
                    $returnStr .= "</script>";
                    $_SESSION['SEARCH'] = SEARCH_OPEN_YES;
                    $_SESSION['SEARCHTERM'] = $searchparameters;
                    $returnStr .= $this->displaySuccess(Language::labelSearched($searchparameters));
                    $var_results = array();
                    $type_results = array();
                    $survey_results = array();
                    $group_results = array();
                    $section_results = array();
                    // TODO: HOW TO GROUP HERE: VARIABLE YES, SURVEY NO, SHOW NUMBER OF PLACES FOUND IN CASE OF MULTIPLE LOCATIONS? OR SHOW ALL ENTRIES?
                    if ($db->getNumberOfRows($res) > 0) {
                        while ($row = $db->getRow($res)) {
                            /* process */
                            switch ($row["objecttype"]) {
                                case OBJECT_VARIABLEDESCRIPTIVE:
                                    $variable = $survey->getVariableDescriptive($row["object"]);
                                    $tagclass = "";
                                    //'class="btn btn-default"';
                                    if (isset($_COOKIE['uscicvariablecookie'])) {
                                        $cookievalue = $_COOKIE['uscicvariablecookie'];
                                        if (inArray($variable->getSuid() . "~" . $variable->getVsid(), explode("-", $cookievalue))) {
                                            $tagclass = 'class="uscic-cookie-tag-active"';
                                        }
                                    }
                                    $var_results[$row["name"] . $row["object"] . $row["objecttype"]] = "<tr>\n                                            <td><a " . $tagclass . ' onclick="var res = updateCookie(\'uscicvariablecookie\',\'' . $variable->getSuid() . "~" . $variable->getVsid() . '\'); if (res == 1) { $(this).addClass(\'uscic-cookie-tag-active\'); } else { $(this).removeClass(\'uscic-cookie-tag-active\'); } return false;" title="' . Language::linkTagTooltip() . '" href="" role="button"><span class="glyphicon glyphicon-tag"></span></a></td>' . "<td><a class='searchlink' href='" . setSessionParams(array("page" => "sysadmin.survey.editvariable", "suid" => $_SESSION['SUID'], "vsid" => $row["object"])) . "'>" . $variable->getName() . "</a></td>                                                      \n                                                          </tr>";
                                    break;
                                case OBJECT_TYPE:
                                    $type = $survey->getType($row["object"]);
                                    $tagclass = "";
                                    //'class="btn btn-default"';
                                    if (isset($_COOKIE['uscictypeecookie'])) {
                                        $cookievalue = $_COOKIE['uscictypecookie'];
                                        if (inArray($type->getSuid() . "~" . $type->getTyd(), explode("-", $cookievalue))) {
                                            $tagclass = 'class="uscic-cookie-tag-active"';
                                        }
                                    }
                                    $type_results[] = "<tr>\n                                        <td><a " . $tagclass . ' onclick="var res = updateCookie(\'uscictypecookie\',\'' . $type->getSuid() . "~" . $type->getTyd() . '\'); if (res == 1) { $(this).addClass(\'uscic-cookie-tag-active\'); } else { $(this).removeClass(\'uscic-cookie-tag-active\'); } return false;" title="' . Language::linkTagTooltip() . '" href="" role="button"><span class="glyphicon glyphicon-tag"></span></a></td>' . "<td><a class='searchlink' href='" . setSessionParams(array("page" => "sysadmin.survey.edittype", "suid" => $_SESSION['SUID'], "tyd" => $row["object"])) . "'>" . $type->getName() . "</a></td>\n\n                                                          </tr>";
                                    break;
                                case OBJECT_SECTION:
                                    $section = $survey->getSection($row["object"]);
                                    $tagclass = "";
                                    //'class="btn btn-default"';
                                    if (isset($_COOKIE['uscicsectioncookie'])) {
                                        $cookievalue = $_COOKIE['uscicsectioncookie'];
                                        if (inArray($section->getSuid() . "~" . $section->getSeid(), explode("-", $cookievalue))) {
                                            $tagclass = 'class="uscic-cookie-tag-active"';
                                        }
                                    }
                                    $section_results[] = "<tr>\n                                        <td><a " . $tagclass . ' onclick="var res = updateCookie(\'uscicsectioncookie\',\'' . $section->getSuid() . "~" . $section->getSeid() . '\'); if (res == 1) { $(this).addClass(\'uscic-cookie-tag-active\'); } else { $(this).removeClass(\'uscic-cookie-tag-active\'); } return false;" title="' . Language::linkTagTooltip() . '" href="" role="button"><span class="glyphicon glyphicon-tag"></span></a></td>' . "<td><a class='searchlink' href='" . setSessionParams(array("page" => "sysadmin.survey.editsection", "suid" => $_SESSION['SUID'], "seid" => $row["object"])) . "'>" . $section->getName() . "</a></td>\n\n                                                          </tr>";
                                    break;
                                case OBJECT_GROUP:
                                    $group = $survey->getGroup($row["object"]);
                                    $tagclass = "";
                                    //'class="btn btn-default"';
                                    if (isset($_COOKIE['uscicgroupcookie'])) {
                                        $cookievalue = $_COOKIE['uscicgroupcookie'];
                                        if (inArray($group->getSuid() . "~" . $group->getGid(), explode("-", $cookievalue))) {
                                            $tagclass = 'class="uscic-cookie-tag-active"';
                                        }
                                    }
                                    $group_results[] = "<tr>\n                                        <td><a " . $tagclass . ' onclick="var res = updateCookie(\'uscicgroupcookie\',\'' . $group->getSuid() . "~" . $group->getGid() . '\'); if (res == 1) { $(this).addClass(\'uscic-cookie-tag-active\'); } else { $(this).removeClass(\'uscic-cookie-tag-active\'); } return false;" title="' . Language::linkTagTooltip() . '" href="" role="button"><span class="glyphicon glyphicon-tag"></span></a></td>' . "<td><a class='searchlink' href='" . setSessionParams(array("page" => "sysadmin.survey.editgroup", "suid" => $_SESSION['SUID'], "gid" => $row["object"])) . "'>" . $group->getName() . "</a></td>\n\n                                                          </tr>";
                                    break;
                                case OBJECT_SURVEY:
                                    $survey_results[] = "<tr>\n                                                            <td>" . $survey->getName() . "</td>                                                      \n                                                          </tr>";
                                    break;
                            }
                        }
                    }
                    $var_header .= '<div id="collapseVariables" class="panel-collapse collapse">
                                            <div class="panel-body">';
                    if (sizeof($var_results) > 0) {
                        $var_header .= '<table class="table table-striped table-bordered">
                                        <thead>
                                        <th></th><th align=middle>' . Language::labelSearchName() . '</th>' . '</thead>
                                        <tbody data-link="row" class="rowlink">';
                        $var_footer .= "</tbody></table></div></div>";
                    } else {
                        $var_footer .= "</div></div>";
//.........这里部分代码省略.........
开发者ID:nubissurveying,项目名称:nubis,代码行数:101,代码来源:displaysearch.php

示例8: applet_cats


//.........这里部分代码省略.........
 />
                              </td>
                              <td><label for="is_public"><strong><?php 
        echo $_LANG['AD_SHARE'];
        ?>
</strong></label></td>
                          </tr>
                      </table>
                      <div style="padding:5px">
                          <span class="hinttext">
                              <?php 
        echo $_LANG['AD_IF_NOTED'];
        ?>
                          </span>
                      </div>

                      <div style="margin-top:10px;padding:5px;padding-right:0px;" id="grp">
                          <div>
                              <strong><?php 
        echo $_LANG['AD_GROUPS_VIEW'];
        ?>
</strong><br />
                              <span class="hinttext">
                                  <?php 
        echo $_LANG['AD_SELECT_MULTIPLE_CTRL'];
        ?>
                              </span>
                          </div>
                          <div>
                              <?php 
        echo '<select style="width: 99%" name="showfor[]" id="showin" size="6" multiple="multiple" ' . $style . '>';
        if ($inDB->num_rows($result)) {
            while ($item = $inDB->fetch_assoc($result)) {
                echo '<option value="' . $item['id'] . '"';
                if ($do == 'edit') {
                    if (inArray($ord, $item['id'])) {
                        echo 'selected="selected"';
                    }
                }
                echo '>';
                echo $item['title'] . '</option>';
            }
        }
        echo '</select>';
        ?>
                          </div>
                      </div>

                    {/tabs}

                    <?php 
        echo jwTabs(ob_get_clean());
        ?>

                </td>

            </tr>
        </table>
        <p>
            <input name="add_mod" type="submit" id="add_mod" <?php 
        if ($do == 'add') {
            echo 'value="' . $_LANG['AD_SAVE_SECTION'] . '"';
        } else {
            echo 'value="' . $_LANG['AD_SAVE_SECTION'] . '"';
        }
        ?>
 />
            <input name="back" type="button" id="back" value="<?php 
        echo $_LANG['CANCEL'];
        ?>
" onclick="window.history.back();"/>
            <input name="do" type="hidden" id="do" <?php 
        if ($do == 'add') {
            echo 'value="submit"';
        } else {
            echo 'value="update"';
        }
        ?>
 />
            <?php 
        if ($do == 'edit') {
            echo '<input name="id" type="hidden" value="' . $mod['id'] . '" />';
        }
        ?>
        </p>

    </form>
<script type="text/javascript">
function choosePhotoAlbum(){
	id = $('select[name=album_id]').val();
	if(id != 0){
		$('#con_photoalbum').fadeIn();
	} else {
		$('#con_photoalbum').hide();
	}
}
</script>
<?php 
    }
}
开发者ID:r2git,项目名称:icms1,代码行数:101,代码来源:cats.php

示例9: determineModeLanguage

 function determineModeLanguage(&$de)
 {
     $user = new User($_SESSION['URID']);
     $modes = $user->getModes(loadvar('survey'));
     $mods = "";
     if (loadvar(DATA_OUTPUT_MODES) == "") {
         $mods = implode("~", $modes);
     } else {
         $ms = loadvar(DATA_OUTPUT_MODES);
         $ms1 = array();
         foreach ($ms as $m) {
             if (inArray($m, $modes)) {
                 $ms1[] = $m;
             }
         }
         $mods = implode("~", $ms1);
     }
     $de->setProperty(DATA_OUTPUT_MODES, $mods);
     $modes = explode("~", $mods);
     $langs = "";
     if (loadvar(DATA_OUTPUT_LANGUAGES) == "") {
         $langs = array();
         foreach ($modes as $m) {
             $langs = explode("~", $user->getLanguages(loadvar('survey'), $m));
         }
         $langs = implode("~", array_unique($langs));
     } else {
         $ls = loadvar(DATA_OUTPUT_LANGUAGES);
         $ls1 = array();
         foreach ($ls as $l) {
             foreach ($modes as $m) {
                 if (inArray($l, explode("~", $user->getLanguages(loadvar('survey'), $m)))) {
                     $ls1[] = $l;
                     break;
                 }
             }
         }
         $langs = implode("~", array_unique($ls1));
     }
     $de->setProperty(DATA_OUTPUT_LANGUAGES, $langs);
 }
开发者ID:nubissurveying,项目名称:nubis,代码行数:41,代码来源:researcher.php

示例10: applet_menu


//.........这里部分代码省略.........
                             <td><label for="is_public"><strong><?php 
        echo $_LANG['AD_SHARE'];
        ?>
</strong></label></td>
                         </tr>
                     </table>
                     <div style="padding:5px">
                         <span class="hinttext">
                             <?php 
        echo $_LANG['AD_VIEW_IF_CHECK'];
        ?>
                         </span>
                     </div>

                     <div style="margin-top:10px;padding:5px;padding-right:0px;" id="grp">
                         <div>
                             <strong><?php 
        echo $_LANG['AD_GROUPS_VIEW'];
        ?>
</strong><br />
                             <span class="hinttext">
                                  <?php 
        echo $_LANG['AD_SELECT_MULTIPLE_CTRL'];
        ?>
                             </span>
                         </div>
                         <div>
                             <?php 
        echo '<select style="width: 99%" name="allow_group[]" id="allow_group" size="6" multiple="multiple" ' . $style . '>';
        if ($groups) {
            foreach ($groups as $group) {
                echo '<option value="' . $group['id'] . '"';
                if ($do == 'edit') {
                    if (inArray($access_list, $group['id'])) {
                        echo 'selected="selected"';
                    }
                }
                echo '>';
                echo $group['title'] . '</option>';
            }
        }
        echo '</select>';
        ?>
                         </div>
                     </div>
                     </td>
                 </tr>
                 <tr>
                     <td colspan="2" valign="top">
                         <div style="padding:10px;margin:4px;background-color:#EBEBEB;border:solid 1px gray">
                             <?php 
        echo $_LANG['AD_NEW_MENU_NEW_MODULE'];
        ?>
                         </div>
                     </td>
                 </tr>
             </table>
             <div style="margin-top:5px">
                 <input name="save" type="submit" id="save" value="<?php 
        echo $_LANG['AD_MENU_ADD'];
        ?>
" />
                 <input name="back" type="button" id="back" value="<?php 
        echo $_LANG['CANCEL'];
        ?>
" onclick="window.location.href='index.php?view=menu';" />
开发者ID:vicktorwork,项目名称:cms1,代码行数:67,代码来源:menu.php

示例11: showNavBar

    public function showNavBar()
    {
        $returnStr = $this->showCalculator();
        //language
        $rgid = $this->engine->getRgid();
        $variablenames = $this->getRealVariables(explode("~", $this->engine->getDisplayed()));
        $variablenamesfull = $this->engine->getDisplayed();
        $template = $this->engine->getTemplate();
        $click = "";
        if ($template != "") {
            $group = $this->engine->getGroup($template);
            $click = $this->engine->replaceFills($group->getClickLanguageChange());
        } else {
            $vars = explode("~", $variablenames);
            $var = $this->engine->getVariableDescriptive($vars[0]);
            $click = $this->engine->replaceFills($var->getClickLanguageChange());
        }
        $click = str_replace("'", "", $click);
        // begin language
        global $survey;
        if (getSurveyLanguageAllowChange() == LANGUAGE_CHANGE_RESPONDENT_ALLOWED) {
            $allowed = explode("~", $survey->getAllowedLanguages(getSurveyMode()));
            if (sizeof($allowed) > 1) {
                $returnStr .= '<li class="dropdown">';
                $returnStr .= '   <a href="#" class="dropdown-toggle" data-toggle="dropdown">Language <b class="caret"></b></a><ul class="dropdown-menu">';
                $langs = Language::getLanguagesArray();
                //getSurveyLanguages($this->engine->survey);
                foreach ($langs as $lang) {
                    if (inArray($lang["value"], $allowed)) {
                        $check = '';
                        if ($lang["value"] == getSurveyLanguage()) {
                            $check = ' <span class="glyphicon glyphicon-ok"></span>';
                        }
                        $returnStr .= '<li><a href=# onclick=\'document.getElementById("r").value="' . setSessionsParamString(array_merge(array(SESSION_PARAM_SURVEY => $survey->getSuid(), SESSION_PARAM_PRIMKEY => $this->engine->getPrimaryKey(), SESSION_PARAM_RGID => $rgid, SESSION_PARAM_VARIABLES => $variablenames, SESSION_PARAM_GROUP => $template, SESSION_PARAM_MODE => getSurveyMode(), SESSION_PARAM_LANGUAGE => getSurveyLanguage(), SESSION_PARAM_TEMPLATE => getSurveyTemplate(), SESSION_PARAM_TIMESTAMP => time(), SESSION_PARAM_SEID => $this->engine->getSeid(), SESSION_PARAM_MAINSEID => $this->engine->getMainSeid()), array(SESSION_PARAM_NEWLANGUAGE => $lang["value"]))) . '"; document.getElementById("navigation").value="' . addslashes(Language::buttonUpdate()) . '"; ' . $click . ' document.getElementById("form").submit(); \'>' . $lang["name"] . $check . '</a></li>';
                    }
                }
                $returnStr .= '</ul></li>';
            }
            //end language
        }
        $user = new User($_SESSION['URID']);
        $returnStr .= '<li class="dropdown">
              <a href="#" class="dropdown-toggle" data-hover="dropdown" data-toggle="dropdown">' . $user->getName() . ' <b class="caret"></b></a>
                 <ul class="dropdown-menu">
										<li class="dropdown-header">' . $this->engine->primkey . '</li>
                                                                                <li class="dropdown-header">' . $variablenamesfull . '</li>';
        //$returnStr .= '<li><a href=# data-toggle="modal" data-target="#calculator">Calculator</a></li>';
        $returnStr .= '<li><a href="#" data-toggle="modal" data-target="#calculator"><span class="glyphicon glyphicon-th"></span> ' . Language::linkCalculator() . '</a></li>';
        $windowopen = 'window.open(\'tester/' . setSessionParams(array('type' => "2", 'testpage' => 'watch', 'watchurid' => $_SESSION['URID'], 'watchsuid' => $this->engine->getSuid(), 'watchseid' => $this->engine->getSeid(), 'watchmainseid' => $this->engine->getMainSeid(), 'watchrgid' => $rgid, 'watchdisplayed' => $variablenames, 'watchlanguage' => getSurveyLanguage(), 'watchmode' => getSurveyMode(), 'watchversion' => getSurveyVersion(), 'watchprimkey' => $this->engine->getPrimarykey())) . '\', \'popupWindow\', \'width=770,height=650,scrollbars=yes,top=100,left=100\'); return false;';
        $javascript = ' onclick="' . $windowopen . '"';
        $returnStr .= '<li><a style="cursor: pointer;" ' . $javascript . '><span class="glyphicon glyphicon-zoom-in"></span> ' . Language::linkWatch() . '</a></li>';
        $windowopen = 'window.open(\'tester/' . setSessionParams(array('type' => "2", 'testpage' => 'update', 'watchurid' => $_SESSION['URID'], 'watchsuid' => $this->engine->getSuid(), 'watchseid' => $this->engine->getSeid(), 'watchmainseid' => $this->engine->getMainSeid(), 'watchrgid' => $rgid, 'watchdisplayed' => $variablenames, 'watchlanguage' => getSurveyLanguage(), 'watchmode' => getSurveyMode(), 'watchversion' => getSurveyVersion(), 'watchprimkey' => $this->engine->getPrimarykey())) . '\', \'popupWindow\', \'width=1200,height=650,scrollbars=yes,top=100,left=100\'); return false;';
        $javascript = ' onclick="' . $windowopen . '"';
        $returnStr .= '<li><a style="cursor: pointer;" ' . $javascript . '><span class="glyphicon glyphicon-zoom-in"></span> ' . Language::linkUpdate() . '</a></li>';
        $first = $this->engine->isFirstState();
        if ($first == false || $first == true && $this->engine->getForward() == true) {
            if ($this->engine->getForward() == true) {
                $stateid = $this->engine->getStateId() + 1;
            } else {
                $stateid = $this->engine->getStateId();
            }
            $windowopen = 'window.open(\'tester/' . setSessionParams(array('type' => "2", 'testpage' => 'jumpback', 'jumpurid' => $_SESSION['URID'], 'jumpsuid' => $this->engine->getSuid(), 'jumpstateid' => $stateid, 'jumpprimkey' => $this->engine->getPrimaryKey())) . '\', \'popupWindow\', \'width=770,height=300,scrollbars=yes,top=100,left=100\'); return false;';
            $javascript = ' onclick="' . $windowopen . '"';
            $returnStr .= '<li><a style="cursor: pointer;" ' . $javascript . '><span class="glyphicon glyphicon-arrow-left"></span> ' . Language::linkJumpBack() . '</a></li>';
        }
        $returnStr .= '<li><a href="' . setSessionParams(array('page' => 'interviewer.backfromsms', 'primkey' => $this->engine->primkey, 'suid' => $this->engine->getSuid())) . '&se=' . addslashes(USCIC_SMS) . '"><span class="glyphicon glyphicon-home"></span> ' . Language::linkBackToSMS() . '</a></li>                   
                    <li class="divider"></li>
                   <li><a href="index.php?rs=1&se=2"><span class="glyphicon glyphicon-log-out"></span> ' . Language::linkLogout() . '</a></li>
                 </ul>
             </li>
            </ul>
';
        $returnStr .= '</div><!--/.nav-collapse --> </div> </div>';
        return $returnStr;
    }
开发者ID:nubissurveying,项目名称:nubis,代码行数:75,代码来源:displayquestionsms.php

示例12: trim

                 }
             }
             $query = "update " . $this->targettable . "_routing set rule='endgroup' where suid=" . $this->suid . " and trim(rule)='endcombine'";
             $this->db->executeQuery($query);
         }
     }
 }
 function convertTypes()
 {
     $query = "select teid as id, name as name, questiontype as answertype, answer as options from " . $this->sourcetable . "_type where syid=" . $this->syid . " order by teid";
     if ($res = $this->importdb->selectQuery($query)) {
         if ($this->importdb->getNumberOfRows($res) > 0) {
             while ($row = $this->importdb->getRow($res)) {
                 $query = "replace into " . $this->targettable . "_types (suid, tyd, name) values (";
                 $query .= prepareDatabaseString($this->suid) . ",";
                 $query .= prepareDatabaseString($row["id"]) . ",";
                 $query .= "'" . prepareDatabaseString($row["name"]) . "')";
                 $this->db->executeQuery($query);
                 /* add rest as settings */
                 $this->addSetting($row["id"], OBJECT_TYPE, SETTING_ANSWERTYPE, $this->convertAnswerType($row["answertype"], $row["settings"]));
                 $this->addSetting($row["id"], OBJECT_TYPE, SETTING_OPTIONS, $row["options"]);
                 /* add usage in variables */
                 $query = "select * from " . $this->targettable . "_settings where suid=" . $this->suid . " and name='" . SETTING_OPTIONS . "' and objecttype=" . OBJECT_VARIABLEDESCRIPTIVE . " and value='" . $row["name"] . "'";
                 //                    echo $query;
                 $res1 = $this->db->selectQuery($query);
                 if ($res1) {
                     //echo 'found some for ' . $row["tyd"] . "-----" . $query . "<br/>";
                     if ($this->db->getNumberOfRows($res1) > 0) {
                         while ($row1 = $this->db->getRow($res1)) {
                             $q = "update " . $this->targettable . "_variables set tyd=" . $row["id"] . " where suid=" . $this->suid . " and vsid=" . $row1["object"];
                             $this->db->executeQuery($q);
                             // remove options in settings for variable, so it does not override the type's options
                             $q = "delete from " . $this->targettable . "_settings where suid=" . $this->suid . " and object=" . $row1["object"] . " and name='" . SETTING_OPTIONS . "' and objecttype=" . OBJECT_VARIABLEDESCRIPTIVE;
                             $this->db->executeQuery($q);
                         }
                     }
                 }
                 /* add settings */
                 $this->convertSettings($row, OBJECT_TYPE);
                 /* convert translations */
                 $q = "select source, language, cast(translation as char) as translation from " . $this->sourcetable . "_translation where syid=" . $this->syid . " and id=" . $row["id"] . " order by source";
                 if ($r = $this->importdb->selectQuery($q)) {
                     if ($this->importdb->getNumberOfRows($r) > 0) {
                         while ($rowtrans = $this->importdb->getRow($r)) {
                             $language = $rowtrans["language"];
                             $source = $rowtrans["source"];
                             switch ($source) {
                                 case "teid":
                                     $this->addSetting($row["id"], OBJECT_TYPE, SETTING_OPTIONS, $rowtrans["translation"], $language);
                                     break;
                             }
                             if (!inArray($language, $this->languages)) {
                                 $this->languages[] = $language;
                             }
                         }
                     }
                 }
             }
             // update answer types
             $updates = array("update " . $this->targettable . "_settings set value=" . $this->convertAnswerType(3) . " where suid=" . $this->suid . " and objecttype=" . OBJECT_TYPE . " and name='" . SETTING_ANSWERTYPE . "' and value=3", "update " . $this->targettable . "_settings set value=" . $this->convertAnswerType(4) . " where suid=" . $this->suid . " and objecttype=" . OBJECT_TYPE . " and name='" . SETTING_ANSWERTYPE . "' and value=4", "update " . $this->targettable . "_settings set value=" . $this->convertAnswerType(5) . " where suid=" . $this->suid . " and objecttype=" . OBJECT_TYPE . " and name='" . SETTING_ANSWERTYPE . "' and value=5", "update " . $this->targettable . "_settings set value=" . $this->convertAnswerType(6) . " where suid=" . $this->suid . " and objecttype=" . OBJECT_TYPE . " and name='" . SETTING_ANSWERTYPE . "' and value=6");
开发者ID:nubissurveying,项目名称:nubis,代码行数:60,代码来源:importer.php

示例13: foreach

					<?php 
    $groups = cmsUser::getGroups();
    $style = 'disabled="disabled"';
    $public = 'checked="checked"';
    if ($mod['access_list']) {
        $public = '';
        $style = '';
        $access_list = $inCore->yamlToArray($mod['access_list']);
    }
    echo '<select style="width: 260px" name="access_list[]" id="showin" size="6" multiple="multiple" ' . $style . '>';
    if ($groups) {
        foreach ($groups as $group) {
            if (!$group['is_admin']) {
                echo '<option value="' . $group['id'] . '"';
                if ($access_list) {
                    if (inArray($access_list, $group['id'])) {
                        echo 'selected';
                    }
                }
                echo '>';
                echo $group['title'] . '</option>';
            }
        }
    }
    echo '</select>';
    ?>
                    
                    <label><input name="is_access" type="checkbox" id="is_access" onclick="checkAccesList()" value="1" <?php 
    echo $public;
    ?>
 /> <strong>Всем группам</strong></label>
开发者ID:ratmir-by,项目名称:icms-calendar,代码行数:31,代码来源:backend.php

示例14: addErrorMessage

 function addErrorMessage($message, $rgid = "")
 {
     $arr = array();
     $r = $this->currentrgid;
     if ($rgid != "") {
         $r = $rgid;
     }
     if (isset($this->messages[$r])) {
         $arr = $this->messages[$r];
     }
     if (!inArray($message, $arr)) {
         $arr[] = $message;
     }
     $this->messages[$r] = $arr;
 }
开发者ID:nubissurveying,项目名称:nubis,代码行数:15,代码来源:compiler.php

示例15: sizeof

             $qa = "text-justify";
             break;
         case ALIGN_CENTER:
             $qa = "text-center";
             break;
         default:
             break;
     }
     /* calculate cell width */
     $noofcolumns = sizeof($orderedoptions);
     $this->cellwidth = "width=" . round(($this->engine->replaceFills($this->group->getTableWidth()) - $this->engine->replaceFills($this->group->getQuestionColumnWidth())) / $noofcolumns) . "%";
     foreach ($orderedoptions as $option) {
         $returnStr .= "<th class='uscic-table-row-cell-header-enumerated'><div class='" . $qa . "'><span id='vsid_option" . $var->getVsid() . $option["code"] . "' uscic-target='vsid_" . $var->getVsid() . "' uscic-texttype='" . SETTING_QUESTION . "' class='" . $this->displayobject->inlineeditable . "'>" . $this->displayobject->applyFormatting($option, $this->group->getHeaderFormatting()) . "</span></div></th>";
     }
     $returnStr .= "</tr></thead>";
     return $returnStr;
 }
 function showEnumeratedOption($option, $number, $variable, $var, $first, $previousdata)
 {
     $returnStr = "";
     $varname = SESSION_PARAMS_ANSWER . $number;
     $id = $this->engine->getFill($variable, $var, SETTING_ID);
     if (trim($id) == "") {
         $id = $varname;
     }
     /* get id for inline field error checking */
     $ids = array();
     if (trim($option["label"] != "")) {
         $ids[] = $id . '_' . $option["code"];
     }
     if (inArray($var->getAnswerType(), array(ANSWER_TYPE_SETOFENUMERATED, ANSWER_TYPE_MULTIDROPDOWN))) {
         $varname .= "[]";
     }
     if ($var->getIfEmpty() != IF_EMPTY_ALLOW) {
         if (inArray($var->getAnswerType(), array(ANSWER_TYPE_SETOFENUMERATED))) {
             // custom name for set of enumerated question, since we use a hidden field/textbox to track the real answer(s); we just use this custom name for referencing in the error checking
             $this->displayobject->addErrorCheck(SESSION_PARAMS_ANSWER . $number . "_name[]", new ErrorCheck(ERROR_CHECK_REQUIRED, "true"), $this->engine->getFill($variable, $var, SETTING_EMPTY_MESSAGE));
         } else {
             $this->displayobject->addErrorCheck($varname, new ErrorCheck(ERROR_CHECK_REQUIRED, "true"), $this->engine->getFill($variable, $var, SETTING_EMPTY_MESSAGE));
         }
     }
     $inlinejavascript = $this->engine->getFill($variable, $var, SETTING_JAVASCRIPT_WITHIN_ELEMENT);
     $align = $this->group->getHeaderAlignment();
     $qa = "";
     switch ($align) {
         case ALIGN_LEFT:
             $qa = "text-left";
             break;
         case ALIGN_RIGHT:
             $qa = "text-right";
             break;
         case ALIGN_JUSTIFIED:
             $qa = "text-justify";
             break;
         case ALIGN_CENTER:
             $qa = "text-center";
             break;
         default:
             break;
     }
     switch ($var->getAnswerType()) {
         case ANSWER_TYPE_ENUMERATED:
             //enumerated
             if (trim($option["label"]) != "") {
                 $selected = '';
                 if ($option["code"] == $previousdata) {
                     $selected = ' CHECKED';
                 }
                 $returnStr .= '<td id="cell' . $id . '_' . $option["code"] . '" class="uscic-table-row-cell-enumerated" ' . $this->cellwidth . '><div class="' . $qa . '">
                                     <label for="' . $id . '_' . $option["code"] . '" class="uscic-table-enumerated-label">
                                         <div class="form-group uscic-table-row-cell-form-group">
                                             <input class="uscic-radio-table" ' . $this->displayobject->getErrorTextString($varname) . ' ' . $inlinejavascript . ' type=radio id=' . $id . '_' . $option["code"] . ' name=' . $varname . ' value=' . $option["code"] . $selected . '>
                                         </div>
                                      </label>
                                     </div>
                                     <script type="text/javascript">$( document ).ready(function() { 
                                                 $("#cell' . $id . '_' . $option["code"] . '").click(function (e) {
                                                                       $("#' . $id . '_' . $option["code"] . '").prop("checked", true);
                                                                       $("#' . $id . '_' . $option["code"] . '").change();                                                                          
                                                                       });
                                                                      });</script>
                                     </td>
                                     ';
             } else {
                 $returnStr .= '<td class="uscic-table-row-cell-enumerated"></td>';
             }
             /* done */
             break;
         case ANSWER_TYPE_SETOFENUMERATED:
             //set of enumerated
开发者ID:nubissurveying,项目名称:nubis,代码行数:90,代码来源:reverseenumeratedtable.php


注:本文中的inArray函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。