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


PHP GetBaseLanguageFromSurveyID函数代码示例

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


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

示例1: getXMLStructure

function getXMLStructure($xml, $qid)
{
    global $dbprefix, $connect;
    // Questions table
    $qquery = "SELECT *\n               FROM {$dbprefix}questions \n               WHERE qid={$qid} and parent_qid=0 order by language, scale_id, question_order";
    BuildXMLFromQuery($xml, $qquery);
    // Questions table - Subquestions
    $qquery = "SELECT *\n               FROM {$dbprefix}questions \n               WHERE parent_qid={$qid} order by language, scale_id, question_order";
    BuildXMLFromQuery($xml, $qquery, 'subquestions');
    // Answers table
    $aquery = "SELECT *\n               FROM {$dbprefix}answers \n               WHERE qid = {$qid} order by language, scale_id, sortorder";
    BuildXMLFromQuery($xml, $aquery);
    // Question attributes
    $surveyid = $connect->GetOne("select sid from {$dbprefix}questions where qid={$qid}");
    $sBaseLanguage = GetBaseLanguageFromSurveyID($surveyid);
    if ($connect->databaseType == 'odbc_mssql' || $connect->databaseType == 'odbtp' || $connect->databaseType == 'mssql_n' || $connect->databaseType == 'mssqlnative') {
        $query = "SELECT qa.qid, qa.attribute, cast(qa.value as varchar(4000)) as value \n          FROM {$dbprefix}question_attributes qa JOIN {$dbprefix}questions  q ON q.qid = qa.qid AND q.sid={$surveyid} and q.qid={$qid} \n          where q.language='{$sBaseLanguage}' group by qa.qid, qa.attribute,  cast(qa.value as varchar(4000))";
    } else {
        $query = "SELECT qa.qid, qa.attribute, qa.value\n          FROM {$dbprefix}question_attributes qa JOIN {$dbprefix}questions  q ON q.qid = qa.qid AND q.sid={$surveyid} and q.qid={$qid}         \n          where q.language='{$sBaseLanguage}' group by qa.qid, qa.attribute, qa.value";
    }
    BuildXMLFromQuery($xml, $query);
    // Default values
    $query = "SELECT *\n              FROM {$dbprefix}defaultvalues \n              WHERE qid={$qid}  order by language, scale_id";
    BuildXMLFromQuery($xml, $query);
}
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:25,代码来源:dumpquestion.php

示例2: upgrade_question_attributes148

function upgrade_question_attributes148()
{
    global $modifyoutput, $dbprefix;
    $sDBPrefix = $dbprefix;
    $sSurveyQuery = "SELECT sid FROM {$sDBPrefix}surveys";
    $oSurveyResult = db_execute_assoc($sSurveyQuery);
    foreach ($oSurveyResult->FetchRow() as $aSurveyRow) {
        $surveyid = $aSurveyRow['sid'];
        $languages = array_merge(array(GetBaseLanguageFromSurveyID($surveyid)), GetAdditionalLanguagesFromSurveyID($surveyid));
        $sAttributeQuery = "select q.qid,attribute,value from {$sDBPrefix}question_attributes qa , {$sDBPrefix}questions q where q.qid=qa.qid and sid={$surveyid}";
        $oAttributeResult = db_execute_assoc($sAttributeQuery);
        $aAllAttributes = questionAttributes(true);
        foreach ($oAttributeResult->FetchRow() as $aAttributeRow) {
            if (isset($aAllAttributes[$aAttributeRow['attribute']]['i18n']) && $aAllAttributes[$aAttributeRow['attribute']]['i18n']) {
                modify_database("delete from {$sDBPrefix}question_attributes where qid={$aAttributeRow['qid']} and attribute='{$aAttributeRow['attribute']}'");
                echo $modifyoutput;
                flush();
                @ob_flush();
                foreach ($languages as $language) {
                    $sAttributeInsertQuery = "insert into {$sDBPrefix}question_attributes (qid,attribute,value,language) VALUES({$aAttributeRow['qid']},'{$aAttributeRow['attribute']}','{$aAttributeRow['value']}','{$language}' )";
                    modify_database("", $sAttributeInsertQuery);
                    echo $modifyoutput;
                    flush();
                    @ob_flush();
                }
            }
        }
    }
}
开发者ID:rkaldung,项目名称:LimeSurvey,代码行数:29,代码来源:upgrade-all.php

示例3: addResponse

/**
* XML-RPC routine to add a response to the survey table
* Returns the id of the inserted survey response
*
* @param array $request Array containing the following elements (in that order):
* - Session key (string)
* - Survey ID (integer)
* - ResponseData (array)
* 
*/
function addResponse($request)
{
    global $connect, $dbprefix;
    if (!is_object($request)) {
        die;
    }
    if ($request->getNumParams() != 3) {
        return new xmlrpcresp(0, 3, 'Missing parameters');
    }
    $sSessionKey = $request->getParam(0)->scalarVal();
    $iSurveyID = (int) $request->getParam(1)->scalarVal();
    $aResponseData = php_xmlrpc_decode($request->getParam(2));
    if (!is_array($aResponseData)) {
        return new xmlrpcresp(0, '14', 'Survey data is not in array form');
    }
    $uid = _doLogin();
    if ($uid) {
        if (bHasSurveyPermission($iSurveyID, 'responses', 'create', $uid)) {
            $surveytable = db_table_name("survey_" . $iSurveyID);
            if (!db_tables_exist($dbprefix . "survey_" . $iSurveyID)) {
                return new xmlrpcresp(0, '12', 'No survey table');
            }
            //set required values if not set
            if (!isset($aResponseData['submitdate'])) {
                $aResponseData['submitdate'] = date("Y-m-d H:i:s");
            }
            if (!isset($aResponseData['datestamp'])) {
                $aResponseData['datestamp'] = date("Y-m-d H:i:s");
            }
            if (!isset($aResponseData['startdate'])) {
                $aResponseData['startdate'] = date("Y-m-d H:i:s");
            }
            if (!isset($aResponseData['startlanguage'])) {
                $aResponseData['startlanguage'] = GetBaseLanguageFromSurveyID($iSurveyID);
            }
            $SQL = "INSERT INTO {$surveytable}\n                                        (" . implode(',', array_keys($aResponseData)) . ")\n                                        VALUES\n                                        (" . implode(',', array_map('db_quoteall', $aResponseData)) . ")";
            $iinsert = $connect->Execute($SQL);
            if ($iinsert) {
                $thisid = $connect->Insert_ID();
                return new xmlrpcresp(new xmlrpcval($thisid, 'int'));
            } else {
                //Failed to insert return error
                return new xmlrpcresp(0, '13', 'Unable to add response');
            }
        } else {
            return new xmlrpcresp(0, '2', 'No permission');
        }
    }
    die;
}
开发者ID:ddrmoscow,项目名称:queXS,代码行数:60,代码来源:remotecontrol.php

示例4: checkGroup

/**
 * checks consistency of groups
 * @global  $dbprefix
 * @global  $connect
 * @global  $clang
 * @return <type>
 */
function checkGroup($postsid)
{
    global $dbprefix, $connect, $clang;
    $baselang = GetBaseLanguageFromSurveyID($postsid);
    $groupquery = "SELECT g.gid,g.group_name,count(q.qid) as count from {$dbprefix}questions as q RIGHT JOIN {$dbprefix}groups as g ON q.gid=g.gid AND g.language=q.language WHERE g.sid={$postsid} AND g.language='{$baselang}' group by g.gid,g.group_name;";
    $groupresult = db_execute_assoc($groupquery) or safe_die($groupquery . "<br />" . $connect->ErrorMsg());
    while ($row = $groupresult->FetchRow()) {
        //TIBO
        if ($row['count'] == 0) {
            $failedgroupcheck[] = array($row['gid'], $row['group_name'], ": " . $clang->gT("This group does not contain any question(s)."));
        }
    }
    if (isset($failedgroupcheck)) {
        return $failedgroupcheck;
    } else {
        return false;
    }
}
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:25,代码来源:activate_functions.php

示例5: generate_statistics

/**
* Generates statistics
*
* @param int $surveyid The survey id
* @param mixed $allfields
* @param mixed $q2show
* @param mixed $usegraph
* @param string $outputType Optional - Can be xls, html or pdf - Defaults to pdf
* @param string $pdfOutput Sets the target for the PDF output: DD=File download , F=Save file to local disk
* @param string $statlangcode Lamguage for statistics
* @param mixed $browse  Show browse buttons
* @return buffer
*/
function generate_statistics($surveyid, $allfields, $q2show='all', $usegraph=0, $outputType='pdf', $pdfOutput='I',$statlangcode=null, $browse = true)
{
    //$allfields ="";
    global $connect, $dbprefix, $clang,
    $rooturl, $rootdir, $homedir, $homeurl, $tempdir, $tempurl, $scriptname, $imagedir,
    $chartfontfile, $chartfontsize, $admintheme, $pdfdefaultfont, $pdffontsize;

    $fieldmap=createFieldMap($surveyid, "full");

    if (is_null($statlangcode))
    {
        $statlang=$clang;
    }
    else
    {
        $statlang = new limesurvey_lang($statlangcode);
    }

    /*
     * this variable is used in the function shortencode() which cuts off a question/answer title
     * after $maxchars and shows the rest as tooltip (in html mode)
     */
    $maxchars = 13;
    //we collect all the html-output within this variable
    $statisticsoutput ='';
    /**
     * $outputType: html || pdf ||
     */
    /**
     * get/set Survey Details
     */

    //no survey ID? -> come and get one
    if (!isset($surveyid)) {$surveyid=returnglobal('sid');}

    //Get an array of codes of all available languages in this survey
    $surveylanguagecodes = GetAdditionalLanguagesFromSurveyID($surveyid);
    $surveylanguagecodes[] = GetBaseLanguageFromSurveyID($surveyid);

    // Set language for questions and answers to base language of this survey
    $language=$statlangcode;

    if ($usegraph==1)
    {
        //for creating graphs we need some more scripts which are included here
        require_once(dirname(__FILE__).'/../classes/pchart/pchart/pChart.class');
        require_once(dirname(__FILE__).'/../classes/pchart/pchart/pData.class');
        require_once(dirname(__FILE__).'/../classes/pchart/pchart/pCache.class');
        $MyCache = new pCache($tempdir.'/');

        //pick the best font file if font setting is 'auto'
        if ($chartfontfile=='auto')
        {
            $chartfontfile='vera.ttf';
            if ( $language=='ar')
            {
                $chartfontfile='KacstOffice.ttf';
            }
            elseif  ($language=='fa' )
            {
                $chartfontfile='KacstFarsi.ttf';
            }

        }
    }

    if($q2show=='all' )
    {
        $summarySql=" SELECT gid, parent_qid, qid, type "
        ." FROM {$dbprefix}questions WHERE parent_qid=0"
        ." AND sid=$surveyid ";

        $summaryRs = db_execute_assoc($summarySql);

        foreach($summaryRs as $field)
        {
            $myField = $surveyid."X".$field['gid']."X".$field['qid'];

            // Multiple choice get special treatment
            if ($field['type'] == "M") {$myField = "M$myField";}
            if ($field['type'] == "P") {$myField = "P$myField";}
            //numerical input will get special treatment (arihtmetic mean, standard derivation, ...)
            if ($field['type'] == "N") {$myField = "N$myField";}

            if ($field['type'] == "|") {$myField = "|$myField";}

            if ($field['type'] == "Q") {$myField = "Q$myField";}
//.........这里部分代码省略.........
开发者ID:nmklong,项目名称:limesurvey-cdio3,代码行数:101,代码来源:statistics_function.php

示例6: ajaxlabelsetpicker

 /**
  * This function prepares the data for labelset
  *
  * @access public
  * @return void
  */
 public function ajaxlabelsetpicker()
 {
     $match = (int) returnglobal('match');
     $surveyid = returnglobal('sid');
     if ($match == 1) {
         $language = GetBaseLanguageFromSurveyID($surveyid);
     } else {
         $language = null;
     }
     $resultdata = getlabelsets($language);
     echo ls_json_encode($resultdata);
 }
开发者ID:ryu1inaba,项目名称:LimeSurvey,代码行数:18,代码来源:question.php

示例7: returnglobal

 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * See COPYRIGHT.php for copyright notices and details.
 *
 * $Id: export_structure_quexml.php 9671 2010-12-21 20:02:24Z c_schmitz $
 */
//Ensure script is not run directly, avoid path disclosure
include_once "login_check.php";
if (!isset($surveyid)) {
    $surveyid = returnglobal('sid');
}
if (isset($surveyprintlang) && !empty($surveyprintlang)) {
    $quexmllang = $surveyprintlang;
} else {
    $quexmllang = GetBaseLanguageFromSurveyID($surveyid);
}
$qlang = new limesurvey_lang($quexmllang);
if (!$surveyid) {
    echo $htmlheader . "<br />\n" . "<table width='350' align='center' style='border: 1px solid #555555' cellpadding='1' cellspacing='0'>\n" . "\t<tr bgcolor='#555555'><td colspan='2' height='4'><font size='1' face='verdana' color='white'><strong>" . _EXPORTSURVEY . "</strong></td></tr>\n" . "\t<tr><td align='center'>\n" . "{$setfont}<br /><strong><font color='red'>" . _ERROR . "</font></strong><br />\n" . _ES_NOSID . "<br />\n" . "<br /><input type='submit' {$btstyle} value='" . _GO_ADMIN . "' onClick=\"window.open('{$scriptname}', '_top')\">\n" . "\t</td></tr>\n" . "</table>\n" . "</body></html>\n";
    exit;
}
function cleanup($string)
{
    return trim(strip_tags(str_ireplace("<br />", "\n", $string)));
}
function create_free($f, $len, $lab = "")
{
    global $dom;
    $free = $dom->create_element("free");
    $format = $dom->create_element("format");
开发者ID:himanshu12k,项目名称:ce-www,代码行数:31,代码来源:export_structure_quexml.php

示例8: sImportMatrix

/**
 *
 * function to import a five scale Matrix question and set 1 to n items
 * @param $sUser
 * @param $sPass
 * @param $iVid
 * @param $qTitle
 * @param $qText
 * @param $qHelp
 * @param $sItems
 * @param $sMod
 * @param $mandatory
 * @return unknown_type
 */
function sImportMatrix($sUser, $sPass, $iVid, $qTitle, $qText, $qHelp, $sItems, $sMod = 'Matrix5', $mandatory = 'N')
{
    /*
     * this var maybe added later to constructor,
     * to determine if a new group should be build for the question
     * or if the question should be added to the last group in survey
     */
    if ($sMod == '') {
        $sMod = 'Matrix5';
    }
    if ($mandatory == '') {
        $mandatory = 'N';
    }
    $newGroup = 0;
    global $connect;
    global $dbprefix;
    //$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
    include "lsrc.config.php";
    $lsrcHelper = new lsrcHelper();
    $lsrcHelper->debugLsrc("wir sind in " . __FUNCTION__ . " Line " . __LINE__ . ", START OK");
    // check for appropriate rights
    if (!$lsrcHelper->checkUser($sUser, $sPass)) {
        throw new SoapFault("Authentication: ", "User or password wrong");
        exit;
    }
    //check for surveyOwner
    if ($lsrcHelper->getSurveyOwner($iVid) != $_SESSION['loginID'] && !$_SESSION['USER_RIGHT_SUPERADMIN'] == '1') {
        throw new SoapFault("Authentication: ", "You have no right to change Surveys from other people");
        exit;
    }
    // Check if the file to import exists
    if (!is_file($queDir . $sMod . ".csv")) {
        throw new SoapFault("Server: ", "Survey Module {$sMod} does not exist");
        exit;
    }
    $lastId = $lsrcHelper->importQuestion($iVid, $sMod, $newGroup);
    if (is_array($lastId)) {
        $lsrcHelper->changeTable("questions", "title", $qTitle, "qid='" . $lastId['qid'] . "'");
        $lsrcHelper->changeTable("questions", "question", $qText, "qid='" . $lastId['qid'] . "'");
        $lsrcHelper->changeTable("questions", "help", $qHelp, "qid='" . $lastId['qid'] . "'");
        if ($mandatory == '') {
            $mandatory = 'N';
        }
        $lsrcHelper->changeTable("questions", "mandatory", $mandatory, "qid='" . $lastId['qid'] . "'");
        $aItems = explode(",", $sItems);
        $n = 0;
        foreach ($aItems as $item) {
            ++$n;
            $lsrcHelper->changeTable("answers", "qid,code,answer,default_value,sortorder,language", "'" . $lastId['qid'] . "', '{$n}','{$item}','N','{$n}','" . GetBaseLanguageFromSurveyID($iVid) . "' ", "", 1);
        }
        return "OK";
    } else {
        throw new SoapFault("Server: ", $lastId);
        exit;
    }
}
开发者ID:himanshu12k,项目名称:ce-www,代码行数:70,代码来源:lsrc.server.php

示例9: codeCheck

$anscount = $result->RecordCount();
$row = $result->FetchRow();
$maxsortorder = $row['question_order'] + 1;
$vasummary .= "<div class='header ui-widget-header'>\n" . $clang->gT("Edit subquestions") . "</div>\n" . "<form id='editsubquestionsform' name='editsubquestionsform' method='post' action='{$scriptname}'onsubmit=\"return codeCheck('code_',{$maxsortorder},'" . $clang->gT("Error: You are trying to use duplicate answer codes.", 'js') . "','" . $clang->gT("Error: 'other' is a reserved keyword.", 'js') . "');\">\n" . "<input type='hidden' name='sid' value='{$surveyid}' />\n" . "<input type='hidden' name='gid' value='{$gid}' />\n" . "<input type='hidden' name='qid' value='{$qid}' />\n" . "<input type='hidden' id='action' name='action' value='updatesubquestions' />\n" . "<input type='hidden' id='sortorder' name='sortorder' value='' />\n" . "<input type='hidden' id='deletedqids' name='deletedqids' value='' />\n";
$vasummary .= "<div class='tab-pane' id='tab-pane-assessments-{$surveyid}'>";
$first = true;
$sortorderids = '';
$codeids = '';
$vasummary .= "<div id='xToolbar'></div>\n";
// the following line decides if the assessment input fields are visible or not
// for some question types the assessment values is set in the label set instead of the answers
$qtypes = getqtypelist('', 'array');
$scalecount = $qtypes[$qtype]['subquestions'];
foreach ($anslangs as $anslang) {
    $vasummary .= "<div class='tab-page' id='tabpage_{$anslang}'>" . "<h2 class='tab'>" . getLanguageNameFromCode($anslang, false);
    if ($anslang == GetBaseLanguageFromSurveyID($surveyid)) {
        $vasummary .= '(' . $clang->gT("Base language") . ')';
    }
    $vasummary .= "</h2>";
    for ($scale_id = 0; $scale_id < $scalecount; $scale_id++) {
        $position = 0;
        if ($scalecount > 1) {
            if ($scale_id == 0) {
                $vasummary .= "<div class='header ui-widget-header'>\n" . $clang->gT("Y-Scale") . "</div>";
            } else {
                $vasummary .= "<div class='header ui-widget-header'>\n" . $clang->gT("X-Scale") . "</div>";
            }
        }
        $query = "SELECT * FROM " . db_table_name('questions') . " WHERE parent_qid='{$qid}' AND language='{$anslang}' AND scale_id={$scale_id} ORDER BY question_order, title";
        $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
        //Checked
开发者ID:ddrmoscow,项目名称:queXS,代码行数:31,代码来源:editsubquestions.php

示例10: giveMeRawDataFromFieldNames

function giveMeRawDataFromFieldNames($surveyid, $gid, $qid, $fieldlimiters = array(), $output = "full")
{
    //Builds output data for question $surveyid$gid$qid, limiting with $fieldlimiters array
    $questionfields = buildQuestionFields($surveyid, $qid);
    $sql = buildSqlFromFieldnamesArray($fieldlimiters);
    $tablename = "survey_" . $surveyid;
    $fieldmap = createFieldMap($surveyid, "full");
    //echo "<pre>"; print_r($answers); echo "</pre>";
    list($questioninfo, $results) = returnQuestionResults($surveyid, $questionfields, $sql);
    //echo "<pre>"; print_r($questioninfo); echo "</pre>";
    if (count($results) < 1) {
        return array();
    }
    foreach ($questioninfo as $qi) {
        $questiontype = $qi['type'];
    }
    //	echo "[$questiontype]<br />";
    if ($output == "full") {
        GetBaseLanguageFromSurveyID($surveyid);
        //echo "<pre>"; print_r($answers); echo "</pre>";
        switch ($questiontype) {
            case "L":
            case "!":
            case "O":
            case "D":
            case "E":
            case "M":
            case "P":
            case "C":
            case "B":
            case "A":
            case "F":
            case "H":
            case "1":
                $answers = getAnswersSingle($surveyid, $gid, $qid);
                break;
            case "Y":
                $answers[] = array("code" => "Y", "answer" => $clang->gT("Yes"));
                $answers[] = array("code" => "N", "answer" => $clang->gT("No"));
                break;
            case "G":
                $answers[] = array("code" => "M", "answer" => $clang->gT("Male"));
                $answers[] = array("code" => "F", "answer" => $clang->gT("Female"));
                break;
        }
        // switch
        $answers[] = array("code" => "", "answer" => $clang->gT("No answer"));
        $answers[] = array("code" => "-oth-", "answer" => $clang->gT("Other"));
        switch ($questiontype) {
            case "A":
                for ($i = 1; $i <= 5; $i++) {
                    $values[] = array("code" => $i, "answer" => $i);
                }
                break;
            case "B":
                for ($i = 1; $i <= 10; $i++) {
                    $values[] = array("code" => $i, "answer" => $i);
                }
                break;
            case "E":
                $values[] = array("code" => "I", "answer" => $clang->gT("Increase"));
                $values[] = array("code" => "S", "answer" => $clang->gT("Same"));
                $values[] = array("code" => "D", "answer" => $clang->gT("Decrease"));
                break;
            case "C":
            case "M":
            case "P":
                $values[] = array("code" => "Y", "answer" => $clang->gT("Yes"));
                $values[] = array("code" => "U", "answer" => $clang->gT("Uncertain"));
                $values[] = array("code" => "N", "answer" => $clang->gT("No"));
                break;
            case "F":
            case "H":
                $thisquestion = getQuestionInfo($qid);
                $values = getLabelSet($thisquestion['lid']);
                break;
        }
        $values[] = array("code" => "", "answer" => $clang->gT("No answer"));
        switch ($questiontype) {
            case "L":
            case "!":
            case "O":
            case "Y":
            case "G":
            case "S":
            case "T":
            case "H":
            case "N":
            case "5":
            case "D":
                //The first key needs to be expanded
                $firstkey = array_keys($results[0]);
                $firstkey = $firstkey[0];
                $questions = arraySearchByKey($firstkey, $fieldmap, "fieldname", 1);
                //echo $firstkey;
                $i = 0;
                foreach ($results as $result) {
                    $results[$i][$firstkey] = array($questions['question'], arraySubstitute($result[$firstkey], $answers));
                    $i++;
                }
//.........这里部分代码省略.........
开发者ID:himanshu12k,项目名称:ce-www,代码行数:101,代码来源:results.php

示例11: makeLanguageChangerSurvey

/**
 * This function creates the language selector for a particular survey
 *
 * @param mixed $sSelectedLanguage The language in which all information is shown
 */
function makeLanguageChangerSurvey($sSelectedLanguage)
{
    $surveyid = Yii::app()->getConfig('surveyID');
    Yii::app()->loadHelper("surveytranslator");
    $slangs = Survey::model()->findByPk($surveyid)->getAdditionalLanguages();
    $slangs[] = GetBaseLanguageFromSurveyID($surveyid);
    $aAllLanguages = getLanguageData();
    $slangs = array_keys(array_intersect_key($aAllLanguages, array_flip($slangs)));
    // Sort languages by their locale name
    if (count($slangs) > 1) {
        $previewgrp = false;
        if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'previewgroup') {
            $previewgrp = true;
        }
        $sHTMLCode = "<select id='languagechanger' name='languagechanger' class='languagechanger' onchange='javascript:window.location=this.value'>\n";
        $sAddToURL = "";
        $sTargetURL = Yii::app()->getController()->createUrl("/survey/index");
        if ($previewgrp) {
            $sAddToURL = "&amp;action=previewgroup&amp;gid={$_REQUEST['gid']}";
        }
        foreach ($slangs as $sLanguage) {
            $sHTMLCode .= "<option value=\"{$sTargetURL}?sid=" . $surveyid . "&amp;lang=" . $sLanguage . "{$sAddToURL}\" ";
            if ($sLanguage == $sSelectedLanguage) {
                $sHTMLCode .= " selected='selected'";
            }
            $sHTMLCode .= ">" . $aAllLanguages[$sLanguage]['nativedescription'] . "</option>\n";
        }
        $sHTMLCode .= "</select>\n";
        return $sHTMLCode;
    } else {
        return false;
    }
}
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:38,代码来源:frontend_helper.php

示例12: ajaxlabelsetpicker

 /**
  * This function prepares the data for labelset
  *
  * @access public
  * @return void
  */
 public function ajaxlabelsetpicker()
 {
     $match = (int) returnglobal('match');
     $surveyid = returnglobal('sid');
     if ($match == 1) {
         $language = GetBaseLanguageFromSurveyID($surveyid);
     } else {
         $language = null;
     }
     $resultdata = getlabelsets($language);
     // Label set title really don't need HTML
     foreach ($resultdata as &$aResult) {
         $aResult = array_map('flattenText', $aResult);
     }
     header('Content-type: application/json');
     echo ls_json_encode($resultdata);
 }
开发者ID:CSCI-462-01-2016,项目名称:LimeSurvey,代码行数:23,代码来源:questions.php

示例13: getQuotaAnswers

function getQuotaAnswers($qid, $surveyid, $quota_id)
{
    global $clang;
    $baselang = GetBaseLanguageFromSurveyID($surveyid);
    $query = "SELECT type, title FROM " . db_table_name('questions') . "q JOIN " . db_table_name('groups') . "g on g.gid=q.gid WHERE qid='{$qid}' AND q.language='{$baselang}' AND g.language='{$baselang}' order by group_order, question_order";
    $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
    $qtype = $result->FetchRow();
    if ($qtype['type'] == 'G') {
        $query = "SELECT * FROM " . db_table_name('quota_members') . " WHERE sid='{$surveyid}' and qid='{$qid}' and quota_id='{$quota_id}'";
        $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
        $answerlist = array('M' => array('Title' => $qtype['title'], 'Display' => $clang->gT("Male"), 'code' => 'M'), 'F' => array('Title' => $qtype['title'], 'Display' => $clang->gT("Female"), 'code' => 'F'));
        if ($result->RecordCount() > 0) {
            while ($quotalist = $result->FetchRow()) {
                $answerlist[$quotalist['code']]['rowexists'] = '1';
            }
        }
    }
    if ($qtype['type'] == 'M') {
        $query = "SELECT * FROM " . db_table_name('quota_members') . " WHERE sid='{$surveyid}' and qid='{$qid}' and quota_id='{$quota_id}'";
        $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
        $query = "SELECT title,question FROM " . db_table_name('questions') . " WHERE parent_qid='{$qid}'";
        $ansresult = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
        $answerlist = array();
        while ($dbanslist = $ansresult->FetchRow()) {
            $tmparrayans = array('Title' => $qtype['title'], 'Display' => substr($dbanslist['question'], 0, 40), 'code' => $dbanslist['title']);
            $answerlist[$dbanslist['title']] = $tmparrayans;
        }
        if ($result->RecordCount() > 0) {
            while ($quotalist = $result->FetchRow()) {
                $answerlist[$quotalist['code']]['rowexists'] = '1';
            }
        }
    }
    if ($qtype['type'] == 'L' || $qtype['type'] == 'O' || $qtype['type'] == '!') {
        $query = "SELECT * FROM " . db_table_name('quota_members') . " WHERE sid='{$surveyid}' and qid='{$qid}' and quota_id='{$quota_id}'";
        $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
        $query = "SELECT code,answer FROM " . db_table_name('answers') . " WHERE qid='{$qid}' and language='{$baselang}'";
        $ansresult = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
        $answerlist = array();
        while ($dbanslist = $ansresult->FetchRow()) {
            $answerlist[$dbanslist['code']] = array('Title' => $qtype['title'], 'Display' => substr($dbanslist['answer'], 0, 40), 'code' => $dbanslist['code']);
        }
        if ($result->RecordCount() > 0) {
            while ($quotalist = $result->FetchRow()) {
                $answerlist[$quotalist['code']]['rowexists'] = '1';
            }
        }
    }
    if ($qtype['type'] == 'A') {
        $query = "SELECT * FROM " . db_table_name('quota_members') . " WHERE sid='{$surveyid}' and qid='{$qid}' and quota_id='{$quota_id}'";
        $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
        $query = "SELECT title,question FROM " . db_table_name('questions') . " WHERE parent_qid='{$qid}'";
        $ansresult = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
        $answerlist = array();
        while ($dbanslist = $ansresult->FetchRow()) {
            for ($x = 1; $x < 6; $x++) {
                $tmparrayans = array('Title' => $qtype['title'], 'Display' => substr($dbanslist['question'], 0, 40) . ' [' . $x . ']', 'code' => $dbanslist['title']);
                $answerlist[$dbanslist['title'] . "-" . $x] = $tmparrayans;
            }
        }
        if ($result->RecordCount() > 0) {
            while ($quotalist = $result->FetchRow()) {
                $answerlist[$quotalist['code']]['rowexists'] = '1';
            }
        }
    }
    if ($qtype['type'] == 'B') {
        $query = "SELECT * FROM " . db_table_name('quota_members') . " WHERE sid='{$surveyid}' and qid='{$qid}' and quota_id='{$quota_id}'";
        $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
        $query = "SELECT code,answer FROM " . db_table_name('answers') . " WHERE qid='{$qid}' and language='{$baselang}'";
        $ansresult = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
        $answerlist = array();
        while ($dbanslist = $ansresult->FetchRow()) {
            for ($x = 1; $x < 11; $x++) {
                $tmparrayans = array('Title' => $qtype['title'], 'Display' => substr($dbanslist['answer'], 0, 40) . ' [' . $x . ']', 'code' => $dbanslist['code']);
                $answerlist[$dbanslist['code'] . "-" . $x] = $tmparrayans;
            }
        }
        if ($result->RecordCount() > 0) {
            while ($quotalist = $result->FetchRow()) {
                $answerlist[$quotalist['code']]['rowexists'] = '1';
            }
        }
    }
    if ($qtype['type'] == 'Y') {
        $query = "SELECT * FROM " . db_table_name('quota_members') . " WHERE sid='{$surveyid}' and qid='{$qid}' and quota_id='{$quota_id}'";
        $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
        $answerlist = array('Y' => array('Title' => $qtype['title'], 'Display' => $clang->gT("Yes"), 'code' => 'Y'), 'N' => array('Title' => $qtype['title'], 'Display' => $clang->gT("No"), 'code' => 'N'));
        if ($result->RecordCount() > 0) {
            while ($quotalist = $result->FetchRow()) {
                $answerlist[$quotalist['code']]['rowexists'] = '1';
            }
        }
    }
    if ($qtype['type'] == 'I') {
        $slangs = GetAdditionalLanguagesFromSurveyID($surveyid);
        array_unshift($slangs, $baselang);
        $query = "SELECT * FROM " . db_table_name('quota_members') . " WHERE sid='{$surveyid}' and qid='{$qid}' and quota_id='{$quota_id}'";
        $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
        while (list($key, $value) = each($slangs)) {
//.........这里部分代码省略.........
开发者ID:ddrmoscow,项目名称:queXS,代码行数:101,代码来源:quota.php

示例14: CSVImportSurvey


//.........这里部分代码省略.........
    $insert = "INSERT INTO {$dbprefix}surveys (".implode(',',array_keys($surveyrowdata)).") VALUES (".implode(',',$values).")"; //handle db prefix
    $iresult = $connect->Execute($insert) or safe_die("<br />".$clang->gT("Import of this survey file failed")."<br />\n[$insert]<br />{$surveyarray[0]}<br /><br />\n" . $connect->ErrorMsg());

    // Now import the survey language settings
    $fieldorders=convertCSVRowToArray($surveylsarray[0],',','"');
    unset($surveylsarray[0]);
    foreach ($surveylsarray as $slsrow) {
        $fieldcontents=convertCSVRowToArray($slsrow,',','"');
        $surveylsrowdata=array_combine($fieldorders,$fieldcontents);
        // convert back the '\'.'n' char from the CSV file to true return char "\n"
        $surveylsrowdata=array_map('convertCsvreturn2return', $surveylsrowdata);
        // Convert the \n return char from welcometext to <br />

        // translate internal links
        $surveylsrowdata['surveyls_title']=translink('survey', $oldsid, $newsid, $surveylsrowdata['surveyls_title']);
        $surveylsrowdata['surveyls_description']=translink('survey', $oldsid, $newsid, $surveylsrowdata['surveyls_description']);
        $surveylsrowdata['surveyls_welcometext']=translink('survey', $oldsid, $newsid, $surveylsrowdata['surveyls_welcometext']);
        $surveylsrowdata['surveyls_urldescription']=translink('survey', $oldsid, $newsid, $surveylsrowdata['surveyls_urldescription']);
        $surveylsrowdata['surveyls_email_invite']=translink('survey', $oldsid, $newsid, $surveylsrowdata['surveyls_email_invite']);
        $surveylsrowdata['surveyls_email_remind']=translink('survey', $oldsid, $newsid, $surveylsrowdata['surveyls_email_remind']);
        $surveylsrowdata['surveyls_email_register']=translink('survey', $oldsid, $newsid, $surveylsrowdata['surveyls_email_register']);
        $surveylsrowdata['surveyls_email_confirm']=translink('survey', $oldsid, $newsid, $surveylsrowdata['surveyls_email_confirm']);
        unset($surveylsrowdata['lastpage']);
        $surveylsrowdata['surveyls_survey_id']=$newsid;
        $newvalues=array_values($surveylsrowdata);
        $newvalues=array_map(array(&$connect, "qstr"),$newvalues); // quote everything accordingly
        $lsainsert = "INSERT INTO {$dbprefix}surveys_languagesettings (".implode(',',array_keys($surveylsrowdata)).") VALUES (".implode(',',$newvalues).")"; //handle db prefix
        $lsiresult=$connect->Execute($lsainsert) or safe_die("<br />".$clang->gT("Import of this survey file failed")."<br />\n[$lsainsert]<br />\n" . $connect->ErrorMsg() );
    }

    // The survey languagesettings are imported now
    $aLanguagesSupported = array();  // this array will keep all the languages supported for the survey

    $sBaseLanguage = GetBaseLanguageFromSurveyID($newsid);
    $aLanguagesSupported[]=$sBaseLanguage;     // adds the base language to the list of supported languages
    $aLanguagesSupported=array_merge($aLanguagesSupported,GetAdditionalLanguagesFromSurveyID($newsid));


    // DO SURVEY_RIGHTS
    GiveAllSurveyPermissions($_SESSION['loginID'],$newsid);
    $importresults['deniedcountls'] =0;


    $qtypes = getqtypelist("" ,"array");
    $results['labels']=0;
    $results['labelsets']=0;
    $results['answers']=0;
    $results['subquestions']=0;

    //Do label sets
    if (isset($labelsetsarray) && $labelsetsarray)
    {
        $csarray=buildLabelSetCheckSumArray();   // build checksums over all existing labelsets
        $count=0;
        foreach ($labelsetsarray as $lsa) {
            $fieldorders  =convertCSVRowToArray($labelsetsarray[0],',','"');
            $fieldcontents=convertCSVRowToArray($lsa,',','"');
            if ($count==0) {$count++; continue;}

            $labelsetrowdata=array_combine($fieldorders,$fieldcontents);

            // Save old labelid
            $oldlid=$labelsetrowdata['lid'];

            unset($labelsetrowdata['lid']);
            $newvalues=array_values($labelsetrowdata);
开发者ID:nmklong,项目名称:limesurvey-cdio3,代码行数:67,代码来源:import_functions.php

示例15: elseif

         }
     }
     $_SESSION['flashmessage'] = $clang->gT("Email templates successfully saved.");
 } elseif ($action == "delsurvey" && bHasSurveyPermission($surveyid, 'survey', 'delete')) {
     $query = "DELETE FROM {$dbprefix}surveys WHERE sid={$surveyid}";
     $result = $connect->Execute($query);
     // Checked
     if ($result) {
         $surveyid = "";
         $surveyselect = getsurveylist();
     } else {
         $databaseoutput .= "<script type=\"text/javascript\">\n<!--\n alert(\"" . $clang->gT("ERROR deleting Survey id", "js") . " ({$surveyid})!\n{$error}\")\n //-->\n</script>\n";
     }
 } elseif ($action == "updatesurveylocalesettings" && bHasSurveyPermission($surveyid, 'surveylocale', 'update')) {
     $languagelist = GetAdditionalLanguagesFromSurveyID($surveyid);
     $languagelist[] = GetBaseLanguageFromSurveyID($surveyid);
     require_once "../classes/inputfilter/class.inputfilter_clean.php";
     $myFilter = new InputFilter('', '', 1, 1, 1);
     foreach ($languagelist as $langname) {
         if ($langname) {
             if ($_POST['url_' . $langname] == 'http://') {
                 $_POST['url_' . $langname] = "";
             }
             // Clean XSS attacks
             if ($filterxsshtml) {
                 $_POST['short_title_' . $langname] = $myFilter->process($_POST['short_title_' . $langname]);
                 $_POST['description_' . $langname] = $myFilter->process($_POST['description_' . $langname]);
                 $_POST['welcome_' . $langname] = $myFilter->process($_POST['welcome_' . $langname]);
                 $_POST['endtext_' . $langname] = $myFilter->process($_POST['endtext_' . $langname]);
                 $_POST['urldescrip_' . $langname] = $myFilter->process($_POST['urldescrip_' . $langname]);
                 $_POST['url_' . $langname] = $myFilter->process($_POST['url_' . $langname]);
开发者ID:ddrmoscow,项目名称:queXS,代码行数:31,代码来源:database.php


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