• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP getBaseLanguageFromSurveyID函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: index

 public function index()
 {
     $surveyid = intval(App()->request->getQuery('surveyid'));
     $gid = intval(App()->request->getQuery('gid'));
     $qid = intval(App()->request->getQuery('qid'));
     $fieldtype = sanitize_xss_string(App()->request->getQuery('fieldtype'));
     $action = sanitize_xss_string(App()->request->getQuery('action'));
     if (!Yii::app()->session['loginID']) {
         throw new CHttpException(401);
     }
     list($replacementFields, $isInstertAnswerEnabled) = $this->_getReplacementFields($fieldtype, $surveyid);
     if ($isInstertAnswerEnabled === true) {
         //2: Get all other questions that occur before this question that are pre-determined answer types
         $fieldmap = createFieldMap($surveyid, 'full', false, false, getBaseLanguageFromSurveyID($surveyid));
         $surveyInfo = getSurveyInfo($surveyid);
         $surveyformat = $surveyInfo['format'];
         // S, G, A
         //Go through each question until we reach the current one
         //error_log(print_r($qrows,true));
         $questionlist = $this->_getQuestionList($action, $gid, $qid, $fieldmap, $fieldtype, $surveyformat);
         $childQuestions = $this->_getChildQuestions($questionlist);
     }
     $data['countfields'] = count($replacementFields);
     $data['replFields'] = $replacementFields;
     if (isset($childQuestions)) {
         $data['cquestions'] = $childQuestions;
     }
     if (isset($surveyformat)) {
         $data['surveyformat'] = $surveyformat;
     }
     $this->getController()->render('/admin/limeReplacementFields_view', $data);
 }
开发者ID:BertHankes,项目名称:LimeSurvey,代码行数:32,代码来源:limereplacementfields.php


示例2: getFiles

 /**
  * Delete all files related to this repsonse.
  */
 public function getFiles()
 {
     $questions = Question::model()->findAllByAttributes(array('sid' => $this->dynamicId, 'type' => '|', 'language' => getBaseLanguageFromSurveyID($this->dynamicId)));
     $files = array();
     foreach ($questions as $question) {
         $field = "{$question->sid}X{$question->gid}X{$question->qid}";
         $data = json_decode(stripslashes($this->getAttribute($field)), true);
         if (is_array($data)) {
             $files = array_merge($files, $data);
         }
     }
     return $files;
 }
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:16,代码来源:Response.php


示例3: index

 public function index()
 {
     if (isset($_GET['surveyid'])) {
         $surveyid = sanitize_int($_GET['surveyid']);
     }
     if (isset($_GET['gid'])) {
         $gid = sanitize_int($_GET['gid']);
     }
     if (isset($_GET['qid'])) {
         $qid = sanitize_int($_GET['qid']);
     }
     if (isset($_GET['fieldtype'])) {
         $fieldtype = $_GET['fieldtype'];
     }
     if (isset($_GET['action'])) {
         $action = $_GET['action'];
     }
     $clang = Yii::app()->lang;
     if (!Yii::app()->session['loginID']) {
         die("Unauthenticated Access Forbiden");
     }
     list($replacementFields, $isInstertAnswerEnabled) = $this->_getReplacementFields($fieldtype, $surveyid);
     if ($isInstertAnswerEnabled === true) {
         if (empty($surveyid)) {
             safeDie("No SID provided.");
         }
         //2: Get all other questions that occur before this question that are pre-determined answer types
         $fieldmap = createFieldMap($surveyid, 'full', false, false, getBaseLanguageFromSurveyID($surveyid));
         $surveyInfo = getSurveyInfo($surveyid);
         $surveyformat = $surveyInfo['format'];
         // S, G, A
         //Go through each question until we reach the current one
         //error_log(print_r($qrows,true));
         $questionlist = $this->_getQuestionList($action, $gid, $qid, $fieldmap, $fieldtype, $surveyformat);
         $childQuestions = $this->_getChildQuestions($questionlist);
     }
     $data['countfields'] = count($replacementFields);
     $data['replFields'] = $replacementFields;
     $data['clang'] = $clang;
     if (isset($childQuestions)) {
         $data['cquestions'] = $childQuestions;
     }
     if (isset($surveyformat)) {
         $data['surveyformat'] = $surveyformat;
     }
     $this->getController()->render('/admin/limeReplacementFields_view', $data);
 }
开发者ID:pmaonline,项目名称:limesurvey-quickstart,代码行数:47,代码来源:limereplacementfields.php


示例4: activateSurvey

/**
* Function to activate a survey
* @param int $iSurveyID The Survey ID
* @param bool $simulate
* @return string
*/
function activateSurvey($iSurveyID, $simulate = false)
{
    $createsurvey = '';
    $activateoutput = '';
    $createsurveytimings = '';
    $fieldstiming = array();
    $createsurveydirectory = false;
    //Check for any additional fields for this survey and create necessary fields (token and datestamp)
    $prow = Survey::model()->findByAttributes(array('sid' => $iSurveyID));
    //Get list of questions for the base language
    $fieldmap = createFieldMap($iSurveyID, 'full', true, false, getBaseLanguageFromSurveyID($iSurveyID));
    $createsurvey = array();
    foreach ($fieldmap as $j => $arow) {
        switch ($arow['type']) {
            case 'startlanguage':
                $createsurvey[$arow['fieldname']] = "string(20) NOT NULL";
                break;
            case 'id':
                $createsurvey[$arow['fieldname']] = "pk";
                break;
            case "startdate":
            case "datestamp":
                $createsurvey[$arow['fieldname']] = "datetime NOT NULL";
                break;
            case "submitdate":
                $createsurvey[$arow['fieldname']] = "datetime";
                break;
            case "lastpage":
                $createsurvey[$arow['fieldname']] = "integer";
                break;
            case "N":
                //Numerical
            //Numerical
            case "K":
                //Multiple Numerical
                $createsurvey[$arow['fieldname']] = "decimal (30,10)";
                break;
            case "S":
                //SHORT TEXT
                $createsurvey[$arow['fieldname']] = "text";
                break;
            case "L":
                //LIST (RADIO)
            //LIST (RADIO)
            case "!":
                //LIST (DROPDOWN)
            //LIST (DROPDOWN)
            case "M":
                //Multiple choice
            //Multiple choice
            case "P":
                //Multiple choice with comment
            //Multiple choice with comment
            case "O":
                //DROPDOWN LIST WITH COMMENT
                if ($arow['aid'] != 'other' && strpos($arow['aid'], 'comment') === false && strpos($arow['aid'], 'othercomment') === false) {
                    $createsurvey[$arow['fieldname']] = "string(5)";
                } else {
                    $createsurvey[$arow['fieldname']] = "text";
                }
                break;
            case "U":
                //Huge text
            //Huge text
            case "Q":
                //Multiple short text
            //Multiple short text
            case "T":
                //LONG TEXT
            //LONG TEXT
            case ";":
                //Multi Flexi
            //Multi Flexi
            case ":":
                //Multi Flexi
                $createsurvey[$arow['fieldname']] = "text";
                break;
            case "D":
                //DATE
                $createsurvey[$arow['fieldname']] = "datetime";
                break;
            case "5":
                //5 Point Choice
            //5 Point Choice
            case "G":
                //Gender
            //Gender
            case "Y":
                //YesNo
            //YesNo
            case "X":
                //Boilerplate
                $createsurvey[$arow['fieldname']] = "string(1)";
                break;
//.........这里部分代码省略.........
开发者ID:jordan095,项目名称:pemiluweb-iadel,代码行数:101,代码来源:activate_helper.php


示例5: insert


//.........这里部分代码省略.........
                     $aData['save'] = TRUE;
                     $saver['identifier'] = $_POST['save_identifier'];
                     $saver['language'] = $_POST['save_language'];
                     $saver['password'] = $_POST['save_password'];
                     $saver['passwordconfirm'] = $_POST['save_confirmpassword'];
                     $saver['email'] = $_POST['save_email'];
                     if (!returnGlobal('redo')) {
                         $password = md5($saver['password']);
                     } else {
                         $password = $saver['password'];
                     }
                     $errormsg = "";
                     if (!$saver['identifier']) {
                         $errormsg .= $clang->gT("Error") . ": " . $clang->gT("You must supply a name for this saved session.");
                     }
                     if (!$saver['password']) {
                         $errormsg .= $clang->gT("Error") . ": " . $clang->gT("You must supply a password for this saved session.");
                     }
                     if ($saver['password'] != $saver['passwordconfirm']) {
                         $errormsg .= $clang->gT("Error") . ": " . $clang->gT("Your passwords do not match.");
                     }
                     $aData['errormsg'] = $errormsg;
                     if ($errormsg) {
                         foreach ($_POST as $key => $val) {
                             if (substr($key, 0, 4) != "save" && $key != "action" && $key != "sid" && $key != "datestamp" && $key != "ipaddr") {
                                 $hiddenfields .= CHtml::hiddenField($key, $val);
                                 //$aDataentryoutput .= "<input type='hidden' name='$key' value='$val' />\n";
                             }
                         }
                     }
                 }
                 //BUILD THE SQL TO INSERT RESPONSES
                 $baselang = Survey::model()->findByPk($surveyid)->language;
                 $fieldmap = createFieldMap($surveyid, 'full', false, false, getBaseLanguageFromSurveyID($surveyid));
                 $insert_data = array();
                 $_POST['startlanguage'] = $baselang;
                 if ($thissurvey['datestamp'] == "Y") {
                     $_POST['startdate'] = $_POST['datestamp'];
                 }
                 if (isset($_POST['closerecord'])) {
                     if ($thissurvey['datestamp'] == "Y") {
                         $_POST['submitdate'] = dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", Yii::app()->getConfig('timeadjust'));
                     } else {
                         $_POST['submitdate'] = date("Y-m-d H:i:s", mktime(0, 0, 0, 1, 1, 1980));
                     }
                 }
                 foreach ($fieldmap as $irow) {
                     $fieldname = $irow['fieldname'];
                     if (isset($_POST[$fieldname])) {
                         if ($_POST[$fieldname] == "" && ($irow['type'] == 'D' || $irow['type'] == 'N' || $irow['type'] == 'K')) {
                             // can't add '' in Date column
                             // Do nothing
                         } else {
                             if ($irow['type'] == '|') {
                                 if (!strpos($irow['fieldname'], "_filecount")) {
                                     $json = $_POST[$fieldname];
                                     $phparray = json_decode(stripslashes($json));
                                     $filecount = 0;
                                     for ($i = 0; $filecount < count($phparray); $i++) {
                                         if ($_FILES[$fieldname . "_file_" . $i]['error'] != 4) {
                                             $target = Yii::app()->getConfig('uploaddir') . "/surveys/" . $thissurvey['sid'] . "/files/" . randomChars(20);
                                             $size = 0.001 * $_FILES[$fieldname . "_file_" . $i]['size'];
                                             $name = rawurlencode($_FILES[$fieldname . "_file_" . $i]['name']);
                                             if (move_uploaded_file($_FILES[$fieldname . "_file_" . $i]['tmp_name'], $target)) {
                                                 $phparray[$filecount]->filename = basename($target);
                                                 $phparray[$filecount]->name = $name;
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:67,代码来源:dataentry.php


示例6: vvexport

 public function vvexport()
 {
     $iSurveyID = sanitize_int(Yii::app()->request->getParam('surveyid'));
     $subaction = Yii::app()->request->getParam('subaction');
     //Exports all responses to a survey in special "Verified Voting" format.
     $clang = $this->getController()->lang;
     if (!hasSurveyPermission($iSurveyID, 'responses', 'export')) {
         return;
     }
     if ($subaction != "export") {
         $selecthide = "";
         $selectshow = "";
         $selectinc = "";
         if (incompleteAnsFilterState() == "incomplete") {
             $selectinc = "selected='selected'";
         } elseif (incompleteAnsFilterState() == "complete") {
             $selecthide = "selected='selected'";
         } else {
             $selectshow = "selected='selected'";
         }
         $data['selectinc'] = $selectinc;
         $data['selecthide'] = $selecthide;
         $data['selectshow'] = $selectshow;
         $data['surveyid'] = $iSurveyID;
         $data['display']['menu_bars']['browse'] = $clang->gT("Export VV file");
         $this->_renderWrappedTemplate('export', 'vv_view', $data);
     } elseif (isset($iSurveyID) && $iSurveyID) {
         //Export is happening
         $extension = sanitize_paranoid_string(returnGlobal('extension'));
         $fn = "vvexport_{$iSurveyID}." . $extension;
         $this->_addHeaders($fn, "text/comma-separated-values", 0, "cache");
         $s = "\t";
         $fieldmap = createFieldMap($iSurveyID, 'full', false, false, getBaseLanguageFromSurveyID($iSurveyID));
         $surveytable = "{{survey_{$iSurveyID}}}";
         Survey::model()->findByPk($iSurveyID)->language;
         $fieldnames = Yii::app()->db->schema->getTable($surveytable)->getColumnNames();
         //Create the human friendly first line
         $firstline = "";
         $secondline = "";
         foreach ($fieldnames as $field) {
             $fielddata = arraySearchByKey($field, $fieldmap, "fieldname", 1);
             if (count($fielddata) < 1) {
                 $firstline .= $field;
             } else {
                 $firstline .= preg_replace('/\\s+/', ' ', strip_tags($fielddata['question']));
             }
             $firstline .= $s;
             $secondline .= $field . $s;
         }
         $vvoutput = $firstline . "\n";
         $vvoutput .= $secondline . "\n";
         $query = "SELECT * FROM " . Yii::app()->db->quoteTableName($surveytable);
         if (incompleteAnsFilterState() == "incomplete") {
             $query .= " WHERE submitdate IS NULL ";
         } elseif (incompleteAnsFilterState() == "complete") {
             $query .= " WHERE submitdate >= '01/01/1980' ";
         }
         $result = Yii::app()->db->createCommand($query)->query();
         foreach ($result->readAll() as $row) {
             foreach ($fieldnames as $field) {
                 if (is_null($row[$field])) {
                     $value = '{question_not_shown}';
                 } else {
                     $value = trim($row[$field]);
                     // sunscreen for the value. necessary for the beach.
                     // careful about the order of these arrays:
                     // lbrace has to be substituted *first*
                     $value = str_replace(array("{", "\n", "\r", "\t"), array("{lbrace}", "{newline}", "{cr}", "{tab}"), $value);
                 }
                 // one last tweak: excel likes to quote values when it
                 // exports as tab-delimited (esp if value contains a comma,
                 // oddly enough).  So we're going to encode a leading quote,
                 // if it occurs, so that we can tell the difference between
                 // strings that "really are" quoted, and those that excel quotes
                 // for us.
                 $value = preg_replace('/^"/', '{quote}', $value);
                 // yay!  that nasty soab won't hurt us now!
                 if ($field == "submitdate" && !$value) {
                     $value = "NULL";
                 }
                 $sun[] = $value;
             }
             $beach = implode($s, $sun);
             $vvoutput .= $beach;
             unset($sun);
             $vvoutput .= "\n";
         }
         echo $vvoutput;
         exit;
     }
 }
开发者ID:ryu1inaba,项目名称:LimeSurvey,代码行数:91,代码来源:export.php


示例7: reverseTranslateFieldNames

/**
* This function creates the old fieldnames for survey import
*
* @param mixed $iOldSID  The old survey id
* @param mixed $iNewSID  The new survey id
* @param array $aGIDReplacements An array with group ids (oldgid=>newgid)
* @param array $aQIDReplacements An array with question ids (oldqid=>newqid)
*/
function reverseTranslateFieldNames($iOldSID, $iNewSID, $aGIDReplacements, $aQIDReplacements)
{
    $aGIDReplacements = array_flip($aGIDReplacements);
    $aQIDReplacements = array_flip($aQIDReplacements);
    if ($iOldSID == $iNewSID) {
        $forceRefresh = true;
        // otherwise grabs the cached copy and throws undefined index exceptions
    } else {
        $forceRefresh = false;
    }
    $aFieldMap = createFieldMap($iNewSID, 'short', $forceRefresh, false, getBaseLanguageFromSurveyID($iNewSID));
    $aFieldMappings = array();
    foreach ($aFieldMap as $sFieldname => $aFieldinfo) {
        if ($aFieldinfo['qid'] != null) {
            $aFieldMappings[$sFieldname] = $iOldSID . 'X' . $aGIDReplacements[$aFieldinfo['gid']] . 'X' . $aQIDReplacements[$aFieldinfo['qid']] . $aFieldinfo['aid'];
            if ($aFieldinfo['type'] == '1') {
                $aFieldMappings[$sFieldname] = $aFieldMappings[$sFieldname] . '#' . $aFieldinfo['scale_id'];
            }
            // now also add a shortened field mapping which is needed for certain kind of condition mappings
            $aFieldMappings[$iNewSID . 'X' . $aFieldinfo['gid'] . 'X' . $aFieldinfo['qid']] = $iOldSID . 'X' . $aGIDReplacements[$aFieldinfo['gid']] . 'X' . $aQIDReplacements[$aFieldinfo['qid']];
            // Shortened field mapping for timings table
            $aFieldMappings[$iNewSID . 'X' . $aFieldinfo['gid']] = $iOldSID . 'X' . $aGIDReplacements[$aFieldinfo['gid']];
        }
    }
    return array_flip($aFieldMappings);
}
开发者ID:GuillaumeSmaha,项目名称:LimeSurvey,代码行数:34,代码来源:common_helper.php


示例8: export_responses_by_token

 /**
  * RPC Routine to export token response in a survey.
  * Returns the requested file as base64 encoded string
  *
  * @access public
  * @param string $sSessionKey Auth credentials
  * @param int $iSurveyID Id of the Survey
  * @param string $sDocumentType pdf,csv,xls,doc,json
  * @param string $sToken The token for which responses needed
  * @param string $sLanguageCode The language to be used
  * @param string $sCompletionStatus Optional 'complete','incomplete' or 'all' - defaults to 'all'
  * @param string $sHeadingType 'code','full' or 'abbreviated' Optional defaults to 'code'
  * @param string $sResponseType 'short' or 'long' Optional defaults to 'short'
  * @param array $aFields Optional Selected fields
  * @return array|string On success: Requested file as base 64-encoded string. On failure array with error information
  *
  */
 public function export_responses_by_token($sSessionKey, $iSurveyID, $sDocumentType, $sToken, $sLanguageCode = null, $sCompletionStatus = 'all', $sHeadingType = 'code', $sResponseType = 'short', $aFields = null)
 {
     if (!$this->_checkSessionKey($sSessionKey)) {
         return array('status' => 'Invalid session key');
     }
     Yii::app()->loadHelper('admin/exportresults');
     if (!tableExists('{{survey_' . $iSurveyID . '}}')) {
         return array('status' => 'No Data, survey table does not exist.');
     }
     if (!($maxId = SurveyDynamic::model($iSurveyID)->getMaxId())) {
         return array('status' => 'No Data, could not get max id.');
     }
     if (!empty($sLanguageCode) && !in_array($sLanguageCode, Survey::model()->findByPk($iSurveyID)->getAllLanguages())) {
         return array('status' => 'Language code not found for this survey.');
     }
     if (!SurveyDynamic::model($iSurveyID)->findByAttributes(array('token' => $sToken))) {
         return array('status' => 'No Response found for Token');
     }
     if (!Permission::model()->hasSurveyPermission($iSurveyID, 'responses', 'export')) {
         return array('status' => 'No permission');
     }
     if (empty($sLanguageCode)) {
         $sLanguageCode = getBaseLanguageFromSurveyID($iSurveyID);
     }
     if (is_null($aFields)) {
         $aFields = array_keys(createFieldMap($iSurveyID, 'full', true, false, $sLanguageCode));
     }
     if ($sDocumentType == 'xls') {
         // Cut down to the first 255 fields
         $aFields = array_slice($aFields, 0, 255);
     }
     $oFormattingOptions = new FormattingOptions();
     $oFormattingOptions->responseMinRecord = 1;
     $oFormattingOptions->responseMaxRecord = $maxId;
     $oFormattingOptions->selectedColumns = $aFields;
     $oFormattingOptions->responseCompletionState = $sCompletionStatus;
     $oFormattingOptions->headingFormat = $sHeadingType;
     $oFormattingOptions->answerFormat = $sResponseType;
     $oFormattingOptions->output = 'file';
     $oExport = new ExportSurveyResultsService();
     $sTableName = Yii::app()->db->tablePrefix . 'survey_' . $iSurveyID;
     $sTempFile = $oExport->exportSurvey($iSurveyID, $sLanguageCode, $sDocumentType, $oFormattingOptions, "{$sTableName}.token='{$sToken}'");
     return new BigFile($sTempFile, true, 'base64');
 }
开发者ID:kasutori,项目名称:LimeSurvey,代码行数:61,代码来源:remotecontrol_handle.php


示例9: activateSurvey

/**
* Function to activate a survey
* @param int $iSurveyID The Survey ID
* @param bool $simulate
* @return string
*/
function activateSurvey($iSurveyID, $simulate = false)
{
    $createsurvey = '';
    $activateoutput = '';
    $createsurveytimings = '';
    $fieldstiming = array();
    $createsurveydirectory = false;
    //Check for any additional fields for this survey and create necessary fields (token and datestamp)
    $prow = Survey::model()->findByAttributes(array('sid' => $iSurveyID));
    //Get list of questions for the base language
    $fieldmap = createFieldMap($iSurveyID, 'full', true, false, getBaseLanguageFromSurveyID($iSurveyID));
    $createsurvey = array();
    foreach ($fieldmap as $j => $arow) {
        switch ($arow['type']) {
            case 'startlanguage':
                $createsurvey[$arow['fieldname']] = "VARCHAR(20) NOT NULL";
                break;
            case 'id':
                $createsurvey[$arow['fieldname']] = "pk";
                break;
            case "startdate":
            case "datestamp":
                $createsurvey[$arow['fieldname']] = "datetime NOT NULL";
                break;
            case "submitdate":
                $createsurvey[$arow['fieldname']] = "datetime";
                break;
            case "lastpage":
                $createsurvey[$arow['fieldname']] = "integer";
                break;
            case "N":
                //NUMERICAL
                $createsurvey[$arow['fieldname']] = "decimal (30,10)";
                break;
            case "S":
                //SHORT TEXT
                if (Yii::app()->db->driverName == 'mysql' || Yii::app()->db->driverName == 'mysqli') {
                    $createsurvey[$arow['fieldname']] = "text";
                } else {
                    $createsurvey[$arow['fieldname']] = "string";
                }
                break;
            case "L":
                //LIST (RADIO)
            //LIST (RADIO)
            case "!":
                //LIST (DROPDOWN)
            //LIST (DROPDOWN)
            case "M":
                //Multiple choice
            //Multiple choice
            case "P":
                //Multiple choice with comment
            //Multiple choice with comment
            case "O":
                //DROPDOWN LIST WITH COMMENT
                if ($arow['aid'] != 'other' && strpos($arow['aid'], 'comment') === false && strpos($arow['aid'], 'othercomment') === false) {
                    $createsurvey[$arow['fieldname']] = "VARCHAR(5)";
                } else {
                    $createsurvey[$arow['fieldname']] = "text";
                }
                break;
            case "K":
                // Multiple Numerical
                $createsurvey[$arow['fieldname']] = "float";
                break;
            case "U":
                //Huge text
            //Huge text
            case "Q":
                //Multiple short text
            //Multiple short text
            case "T":
                //LONG TEXT
            //LONG TEXT
            case ";":
                //Multi Flexi
            //Multi Flexi
            case ":":
                //Multi Flexi
                $createsurvey[$arow['fieldname']] = "text";
                break;
            case "D":
                //DATE
                $createsurvey[$arow['fieldname']] = "datetime";
                break;
            case "5":
                //5 Point Choice
            //5 Point Choice
            case "G":
                //Gender
            //Gender
            case "Y":
                //YesNo
//.........这里部分代码省略.........
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:101,代码来源:activate_helper.php


示例10: export_responses

 /**
  * RPC Routine to export responses.
  * Returns the requested file as base64 encoded string
  *
  * @access public
  * @param string $sSessionKey Auth credentials 
  * @param int $iSurveyID Id of the Survey
  * @param string $sDocumentType pdf,csv,xls,doc
  * @param string $sLanguageCode The language to be used
  * @param string $sCompletionStatus Optional 'complete','incomplete' or 'all' - defaults to complete
  * @param string $sHeadingType 'code','full' or 'abbreviated' Optional defaults to 'code'
  * @param string $sResponseType 'short' or 'long' Optional defaults to 'short'
  * @param integer $iFromResponseID Optional
  * @param integer $iToResponseID Optional
  * @param array $aFields Optional Selected fields
  * @return array|string On success: Requested file as base 64-encoded string. On failure array with error information
  **/
 public function export_responses($sSessionKey, $iSurveyID, $sDocumentType, $sLanguageCode = null, $sCompletionStatus = 'all', $sHeadingType = 'code', $sResponseType = 'short', $iFromResponseID = null, $iToResponseID = null, $aFields = null)
 {
     if (!$this->_checkSessionKey($sSessionKey)) {
         return array('status' => 'Invalid session key');
     }
     Yii::app()->loadHelper('admin/exportresults');
     if (!hasSurveyPermission($iSurveyID, 'responses', 'export')) {
         return array('status' => 'No permission');
     }
     if (is_null($sLanguageCode)) {
         $sLanguageCode = getBaseLanguageFromSurveyID($iSurveyID);
     }
     if (is_null($aFields)) {
         $aFields = array_keys(createFieldMap($iSurveyID, 'full', true, false, $sLanguageCode));
     }
     if ($sDocumentType == 'xls') {
         // Cut down to the first 255 fields
         $aFields = array_slice($aFields, 0, 255);
     }
     $oFomattingOptions = new FormattingOptions();
     $oFomattingOptions->format = $sDocumentType;
     $oFomattingOptions->responseMinRecord = $iFromResponseID;
     $oFomattingOptions->responseMaxRecord = $iToResponseID;
     $oFomattingOptions->selectedColumns = $aFields;
     $oFomattingOptions->responseCompletionState = $sCompletionStatus;
     $oFomattingOptions->headingFormat = $sHeadingType;
     $oFomattingOptions->answerFormat = $sResponseType;
     $oExport = new ExportSurveyResultsService();
     $sFileData = $oExport->exportSurvey($iSurveyID, $sLanguageCode, $oFomattingOptions, 'return');
     return base64_encode($sFileData);
 }
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:48,代码来源:remotecontrol.php


示例11: SPSSFieldMap

/**
* Creates a fieldmap with all information necessary to output the fields
*
* @param $prefix string prefix for the variable ID
* @return array
*/
function SPSSFieldMap($iSurveyID, $prefix = 'V')
{
    $typeMap = array('5' => array('name' => '5 Point Choice', 'size' => 1, 'SPSStype' => 'F', 'Scale' => 3), 'B' => array('name' => 'Array (10 Point Choice)', 'size' => 1, 'SPSStype' => 'F', 'Scale' => 3), 'A' => array('name' => 'Array (5 Point Choice)', 'size' => 1, 'SPSStype' => 'F', 'Scale' => 3), 'F' => array('name' => 'Array (Flexible Labels)', 'size' => 1, 'SPSStype' => 'F'), '1' => array('name' => 'Array (Flexible Labels) Dual Scale', 'size' => 1, 'SPSStype' => 'F'), 'H' => array('name' => 'Array (Flexible Labels) by Column', 'size' => 1, 'SPSStype' => 'F'), 'E' => array('name' => 'Array (Increase, Same, Decrease)', 'size' => 1, 'SPSStype' => 'F', 'Scale' => 2), 'C' => array('name' => 'Array (Yes/No/Uncertain)', 'size' => 1, 'SPSStype' => 'F'), 'X' => array('name' => 'Boilerplate Question', 'size' => 1, 'SPSStype' => 'A', 'hide' => 1), 'D' => array('name' => 'Date', 'size' => 20, 'SPSStype' => 'DATETIME23.2'), 'G' => array('name' => 'Gender', 'size' => 1, 'SPSStype' => 'F'), 'U' => array('name' => 'Huge Free Text', 'size' => 1, 'SPSStype' => 'A'), 'I' => array('name' => 'Language Switch', 'size' => 1, 'SPSStype' => 'A'), '!' => array('name' => 'List (Dropdown)', 'size' => 1, 'SPSStype' => 'F'), 'W' => array('name' => 'List (Flexible Labels) (Dropdown)', 'size' => 1, 'SPSStype' => 'F'), 'Z' => array('name' => 'List (Flexible Labels) (Radio)', 'size' => 1, 'SPSStype' => 'F'), 'L' => array('name' => 'List (Radio)', 'size' => 1, 'SPSStype' => 'F'), 'O' => array('name' => 'List With Comment', 'size' => 1, 'SPSStype' => 'F'), 'T' => array('name' => 'Long free text', 'size' => 1, 'SPSStype' => 'A'), 'K' => array('name' => 'Multiple Numerical Input', 'size' => 1, 'SPSStype' => 'F'), 'M' => array('name' => 'Multiple choice', 'size' => 1, 'SPSStype' => 'F'), 'P' => array('name' => 'Multiple choice with comments', 'size' => 1, 'SPSStype' => 'F'), 'Q' => array('name' => 'Multiple Short Text', 'size' => 1, 'SPSStype' => 'F'), 'N' => array('name' => 'Numerical Input', 'size' => 3, 'SPSStype' => 'F', 'Scale' => 3), 'R' => array('name' => 'Ranking', 'size' => 1, 'SPSStype' => 'F'), 'S' => array('name' => 'Short free text', 'size' => 1, 'SPSStype' => 'F'), 'Y' => array('name' => 'Yes/No', 'size' => 1, 'SPSStype' => 'F'), ':' => array('name' => 'Multi flexi numbers', 'size' => 1, 'SPSStype' => 'F', 'Scale' => 3), ';' => array('name' => 'Multi flexi text', 'size' => 1, 'SPSStype' => 'A'), '|' => array('name' => 'File upload', 'size' => 1, 'SPSStype' => 'A'), '*' => array('name' => 'Equation', 'size' => 1, 'SPSStype' => 'A'));
    $fieldmap = createFieldMap($iSurveyID, 'full', false, false, getBaseLanguageFromSurveyID($iSurveyID));
    #See if tokens are being used
    $bTokenTableExists = tableExists('tokens_' . $iSurveyID);
    #Lookup the names of the attributes
    $query = "SELECT sid, anonymized, language FROM {{surveys}} WHERE sid={$iSurveyID}";
    $aRow = Yii::app()->db->createCommand($query)->queryRow();
    //Checked
    $surveyprivate = $aRow['anonymized'];
    $language = $aRow['language'];
    $fieldno = 0;
    $fields = array();
    if ($bTokenTableExists && $surveyprivate == 'N' && Permission::model()->hasSurveyPermission($iSurveyID, 'tokens', 'read')) {
        $tokenattributes = getTokenFieldsAndNames($iSurveyID, false);
        foreach ($tokenattributes as $attributefield => $attributedescription) {
            //Drop the token field, since it is in the survey too
            if ($attributefield != 'token') {
                $fieldno++;
                $fields[] = array('id' => "{$prefix}{$fieldno}", 'name' => mb_substr($attributefield, 0, 8), 'qid' => 0, 'code' => '', 'SPSStype' => 'A', 'LStype' => 'Undef', 'VariableLabel' => $attributedescription['description'], 'sql_name' => $attributefield, 'size' => '100', 'title' => $attributefield, 'hide' => 0, 'scale' => '');
            }
        }
    }
    $tempArray = array();
    $fieldnames = Yii::app()->db->schema->getTable("{{survey_{$iSurveyID}}}")->getColumnNames();
    $num_results = count($fieldnames);
    $num_fields = $num_results;
    $diff = 0;
    $noQID = array('id', 'token', 'datestamp', 'submitdate', 'startdate', 'startlanguage', 'ipaddr', 'refurl', 'lastpage');
    # Build array that has to be returned
    for ($i = 0; $i < $num_results; $i++) {
        #Condition for SPSS fields:
        # - Length may not be longer than 8 characters
        # - Name may not begin with a digit
        $fieldname = $fieldnames[$i];
        $fieldtype = '';
        $ftype = '';
        $val_size = 1;
        $hide = 0;
        $export_scale = '';
        $code = '';
        $scale_id = null;
        $aQuestionAttribs = array();
        #Determine field type
        if ($fieldname == 'submitdate' || $fieldname == 'startdate' || $fieldname == 'datestamp') {
            $fieldtype = 'DATETIME23.2';
        } elseif ($fieldname == 'startlanguage') {
            $fieldtype = 'A';
            $val_size = 19;
        } elseif ($fieldname == 'token') {
            $fieldtype = 'A';
            $val_size = 16;
        } elseif ($fieldname == 'id') {
            $fieldtype = 'F';
            $val_size = 7;
            //Arbitrarilty restrict to 9,999,999 (7 digits) responses/survey
        } elseif ($fieldname == 'ipaddr') {
            $fieldtype = 'A';
            $val_size = 15;
        } elseif ($fieldname == 'refurl') {
            $fieldtype = 'A';
            $val_size = 255;
        } elseif ($fieldname == 'lastpage') {
            $fieldtype = 'F';
            $val_size = 7;
            //Arbitrarilty restrict to 9,999,999 (7 digits) pages
        }
        #Get qid (question id)
        if (in_array($fieldname, $noQID) || substr($fieldname, 0, 10) == 'attribute_') {
            $qid = 0;
            $varlabel = $fieldname;
            $ftitle = $fieldname;
        } else {
            //GET FIELD DATA
            if (!isset($fieldmap[$fieldname])) {
                //Field in database but no longer in survey... how is this possible?
                //@TODO: think of a fix.
                $fielddata = array();
                $qid = 0;
                $varlabel = $fieldname;
                $ftitle = $fieldname;
                $fieldtype = "F";
                $val_size = 1;
            } else {
                $fielddata = $fieldmap[$fieldname];
                $qid = $fielddata['qid'];
                $ftype = $fielddata['type'];
                $fsid = $fielddata['sid'];
                $fgid = $fielddata['gid'];
                $code = mb_substr($fielddata['fieldname'], strlen($fsid . "X" . $fgid . "X" . $qid));
                $varlabel = $fielddata['question'];
                if (isset($fielddata['scale'])) {
                    $varlabel = "[{$fielddata['scale']}] " . $varlabel;
//.........这里部分代码省略.........
开发者ID:wrenchpilot,项目名称:LimeSurvey,代码行数:101,代码来源:export_helper.php


示例12: 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
  */
 public function generate_statistics($surveyid, $allfields, $q2show = 'all', $usegraph = 0, $outputType = 'pdf', $pdfOutput = 'I', $sLanguageCode = null, $browse = true)
 {
     $aStatisticsData = array();
     //astatdata generates data for the output page's javascript so it can rebuild graphs on the fly
     //load surveytranslator helper
     Yii::import('application.helpers.surveytranslator_helper', true);
     Yii::import('application.third_party.ar-php.Arabic', true);
     $sOutputHTML = "";
     //This string carries all the actual HTML code to print.
     $sTempDir = Yii::app()->getConfig("tempdir");
     $this->pdf = array();
     //Make sure $this->pdf exists - it will be replaced with an object if a $this->pdf is actually being created
     //pick the best font file if font setting is 'auto'
     if (is_null($sLanguageCode)) {
         $sLanguageCode = getBaseLanguageFromSurveyID($surveyid);
     }
     Yii::app()->setLanguage($sLanguageCode);
     /*
      * 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
     $sOutputHTML = '';
     /**
      * $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 = Survey::model()->findByPk($surveyid)->additionalLanguages;
     $surveylanguagecodes[] = Survey::model()->findByPk($surveyid)->language;
     $fieldmap = createFieldMap($surveyid, "full", false, false, $sLanguageCode);
     // Set language for questions and answers to base language of this survey
     $language = $sLanguageCode;
     if ($q2show == 'all') {
         $summarySql = " SELECT gid, parent_qid, qid, type " . " FROM {{questions}} WHERE parent_qid=0" . " AND sid={$surveyid} ";
         $summaryRs = Yii::app()->db->createCommand($summarySql)->query()->readAll();
         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}";
             }
             // textfields get special treatment
             if ($field['type'] == "S" || $field['type'] == "T" || $field['type'] == "U") {
                 $myField = "T{$myField}";
             }
             //statistics for Date questions are not implemented yet.
             if ($field['type'] == "D") {
                 $myField = "D{$myField}";
             }
             if ($field['type'] == "F" || $field['type'] == "H") {
                 //Get answers. We always use the answer code because the label might be too long elsewise
                 $query = "SELECT code, answer FROM {{answers}} WHERE qid='" . $field['qid'] . "' AND scale_id=0 AND language='{$language}' ORDER BY sortorder, answer";
                 $result = Yii::app()->db->createCommand($query)->query();
                 $counter2 = 0;
                 //check all the answers
                 foreach ($result->readAll() as $row) {
                     $row = array_values($row);
                     $myField = "{$myField}{$row[0]}";
                 }
                 //$myField = "{$surveyid}X{$flt[1]}X{$flt[0]}{$row[0]}[]";
             }
             if ($q2show == 'all') {
                 $summary[] = $myField;
             }
             //$allfields[]=$myField;
         }
//.........这里部分代码省略.........
开发者ID:krsandesh,项目名称:LimeSurvey,代码行数:101,代码来源:statistics_helper.php


示例13: loadSurveyById

 /**
  * Loads a survey from the database that has the given ID.  If no matching
  * survey is found then null is returned.  Note that no results are loaded
  * from this function call, only survey structure/definition.
  *
  * In the future it would be nice to load all languages from the db at
  * once and have the infrastructure be able to return responses based
  * on language codes.
  *
  * @param int $id
  * @return Survey
  */
 public function loadSurveyById($id)
 {
     $survey = new SurveyObj();
     $clang = Yii::app()->lang;
     $intId = sanitize_int($id);
     $survey->id = $intId;
     $survey->info = getSurveyInfo($survey->id);
     $lang = Survey::model()->findByPk($intId)->language;
     $clang = new limesurvey_lang($lang);
     $survey->fieldMap = createFieldMap($intId, 'full', false, false, getBaseLanguageFromSurveyID($intId));
     // Check to see if timings are present and add to fieldmap if needed
     if ($survey->info['savetimings'] == "Y") {
         $survey->fieldMap = $survey->fieldMap + createTimingsFieldMap($intId, 'full', false, false, getBaseLanguageFromSurveyID($intId));
     }
     if (empty($intId)) {
         //The id given to us is not an integer, croak.
         safeDie("An invalid survey ID was encountered: {$sid}");
     }
     //Load groups
     $sQuery = 'SELECT g.* FROM {{groups}} AS g ' . 'WHERE g.sid = ' . $intId . ' ' . 'ORDER BY g.group_order;';
     $recordSet = Yii::app()->db->createCommand($sQuery)->query()->readAll();
     $survey->groups = $recordSet;
     //Load questions
     $sQuery = 'SELECT q.* FROM {{questions}} AS q ' . 'JOIN {{groups}} AS g ON q.gid = g.gid ' . 'WHERE q.sid = ' . $intId . ' AND q.language = \'' . $lang . '\' ' . 'ORDER BY g.group_order, q.question_order;';
     $survey->questions = Yii::app()->db->createCommand($sQuery)->query()->readAll();
     //Load answers
     $sQuery = 'SELECT DISTINCT a.* FROM {{answers}} AS a ' . 'JOIN {{questions}} AS q ON a.qid = q.qid ' . 'WHERE q.sid = ' . $intId . ' AND a.language = \'' . $lang . '\' ' . 'ORDER BY a.qid, a.sortorder;';
     //$survey->answers = Yii::app()->db->createCommand($sQuery)->queryAll();
     $aAnswers = Yii::app()->db->createCommand($sQuery)->queryAll();
     foreach ($aAnswers as $aAnswer) {
         $aAnswer['answer'] = stripTagsFull($aAnswer['answer']);
         $survey->answers[$aAnswer['qid']][$aAnswer['scale_id']][$aAnswer['code']] = $aAnswer;
     }
     //Load tokens
     if (tableExists('{{tokens_' . $intId . '}}')) {
         $sQuery = 'SELECT t.* FROM {{tokens_' . $intId . '}} AS t;';
         $recordSet = Yii::app()->db->createCommand($sQuery)->query()->readAll();
         $survey->tokens = $recordSet;
     } else {
         $survey->tokens = array();
     }
     //Load language settings
     $sQuery = 'SELECT * FROM {{surveys_languagesettings}} WHERE surveyls_survey_id = ' . $intId . ';';
     $recordSet = Yii::app()->db->createCommand($sQuery)->query()->readAll();
     $survey->languageSettings = $recordSet;
     return $survey;
 }
开发者ID:ryu1inaba,项目名称:LimeSurvey,代码行数:59,代码来源:exportresults_helper.php


示例14: vvexport

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP getBaseURL函数代码示例发布时间:2022-05-15
下一篇:
PHP getBaseConversionRateForProduct函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap