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

PHP surveyGetXMLData函数代码示例

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

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



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

示例1: _surveyexport

 private function _surveyexport($action, $iSurveyID)
 {
     if ($action == "exportstructurexml") {
         $fn = "limesurvey_survey_{$iSurveyID}.lss";
         $this->_addHeaders($fn, "text/xml", "Mon, 26 Jul 1997 05:00:00 GMT");
         echo surveyGetXMLData($iSurveyID);
         exit;
     } elseif ($action == "exportstructurequexml") {
         if (isset($surveyprintlang) && !empty($surveyprintlang)) {
             $quexmllang = $surveyprintlang;
         } else {
             $quexmllang = Survey::model()->findByPk($iSurveyID)->language;
         }
         if (!(isset($noheader) && $noheader == TRUE)) {
             $fn = "survey_{$iSurveyID}_{$quexmllang}.xml";
             $this->_addHeaders($fn, "text/xml", "Mon, 26 Jul 1997 05:00:00 GMT");
             echo quexml_export($iSurveyID, $quexmllang);
             exit;
         }
     } elseif ($action == 'exportstructuretsv') {
         $this->_exporttsv($iSurveyID);
     } elseif ($action == "exportarchive") {
         $this->_exportarchive($iSurveyID);
     }
 }
开发者ID:ryu1inaba,项目名称:LimeSurvey,代码行数:25,代码来源:export.php


示例2: copy

 /**
  * Function responsible to import/copy a survey based on $action.
  *
  * @access public
  * @return void
  */
 public function copy()
 {
     $importsurvey = "";
     $action = Yii::app()->request->getParam('action');
     $iSurveyID = sanitize_int(Yii::app()->request->getParam('sid'));
     if ($action == "importsurvey" || $action == "copysurvey") {
         // Start the HTML
         if ($action == 'importsurvey') {
             $aData['sHeader'] = gT("Import survey data");
             $aData['sSummaryHeader'] = gT("Survey structure import summary");
             $importingfrom = "http";
             $aPathInfo = pathinfo($_FILES['the_file']['name']);
             if (isset($aPathInfo['extension'])) {
                 $sExtension = $aPathInfo['extension'];
             } else {
                 $sExtension = "";
             }
         } elseif ($action == 'copysurvey') {
             $aData['sHeader'] = gT("Copy survey");
             $aData['sSummaryHeader'] = gT("Survey copy summary");
         }
         // Start traitment and messagebox
         $aData['bFailed'] = false;
         // Put a var for continue
         if ($action == 'importsurvey') {
             $sFullFilepath = Yii::app()->getConfig('tempdir') . DIRECTORY_SEPARATOR . randomChars(20) . '.' . $sExtension;
             if (!@move_uploaded_file($_FILES['the_file']['tmp_name'], $sFullFilepath)) {
                 $aData['sErrorMessage'] = sprintf(gT("An error occurred uploading your file. This may be caused by incorrect permissions in your %s folder."), Yii::app()->getConfig('tempdir'));
                 $aData['bFailed'] = true;
             }
             if (!$aData['bFailed'] && (strtolower($sExtension) != 'csv' && strtolower($sExtension) != 'lss' && strtolower($sExtension) != 'txt' && strtolower($sExtension) != 'lsa')) {
                 $aData['sErrorMessage'] = sprintf(gT("Import failed. You specified an invalid file type '%s'."), $sExtension);
                 $aData['bFailed'] = true;
             }
         } elseif ($action == 'copysurvey') {
             $iSurveyID = sanitize_int(Yii::app()->request->getParam('copysurveylist'));
             $aExcludes = array();
             $sNewSurveyName = Yii::app()->request->getPost('copysurveyname');
             if (Yii::app()->request->getPost('copysurveyexcludequotas') == "on") {
                 $aExcludes['quotas'] = true;
             }
             if (Yii::app()->request->getPost('copysurveyexcludepermissions') == "on") {
                 $aExcludes['permissions'] = true;
             }
             if (Yii::app()->request->getPost('copysurveyexcludeanswers') == "on") {
                 $aExcludes['answers'] = true;
             }
             if (Yii::app()->request->getPost('copysurveyresetconditions') == "on") {
                 $aExcludes['conditions'] = true;
             }
             if (Yii::app()->request->getPost('copysurveyresetstartenddate') == "on") {
                 $aExcludes['dates'] = true;
             }
             if (!$iSurveyID) {
                 $aData['sErrorMessage'] = gT("No survey ID has been provided. Cannot copy survey");
                 $aData['bFailed'] = true;
             } elseif (!Survey::model()->findByPk($iSurveyID)) {
                 $aData['sErrorMessage'] = gT("Invalid survey ID");
                 $aData['bFailed'] = true;
             } elseif (!Permission::model()->hasSurveyPermission($iSurveyID, 'surveycontent', 'export') && !Permission::model()->hasSurveyPermission($iSurveyID, 'surveycontent', 'export')) {
                 $aData['sErrorMessage'] = gT("You don't have sufficient permissions.");
                 $aData['bFailed'] = true;
             } else {
                 Yii::app()->loadHelper('export');
                 $copysurveydata = surveyGetXMLData($iSurveyID, $aExcludes);
             }
         }
         // Now, we have the survey : start importing
         Yii::app()->loadHelper('admin/import');
         if ($action == 'importsurvey' && !$aData['bFailed']) {
             $aImportResults = importSurveyFile($sFullFilepath, isset($_POST['translinksfields']));
             if (is_null($aImportResults) || !empty($aImportResults['error'])) {
                 $aData['sErrorMessage'] = isset($aImportResults['error']) ? $aImportResults['error'] : gt("Unknow error.");
                 $aData['bFailed'] = true;
             }
         } elseif ($action == 'copysurvey' && !$aData['bFailed']) {
             $aImportResults = XMLImportSurvey('', $copysurveydata, $sNewSurveyName, sanitize_int(App()->request->getParam('copysurveyid')), isset($_POST['translinksfields']));
             if (isset($aExcludes['conditions'])) {
                 Question::model()->updateAll(array('relevance' => '1'), 'sid=' . $aImportResults['newsid']);
                 QuestionGroup::model()->updateAll(array('grelevance' => '1'), 'sid=' . $aImportResults['newsid']);
             }
             if (!isset($aExcludes['permissions'])) {
                 Permission::model()->copySurveyPermissions($iSurveyID, $aImportResults['newsid']);
             }
         } else {
             $aData['bFailed'] = true;
         }
         if ($action == 'importsurvey' && isset($sFullFilepath)) {
             unlink($sFullFilepath);
         }
         if (!$aData['bFailed']) {
             $aData['action'] = $action;
             $aData['sLink'] = $this->getController()->createUrl('admin/survey/sa/view/surveyid/' . $aImportResults['newsid']);
             $aData['aImportResults'] = $aImportResults;
//.........这里部分代码省略.........
开发者ID:nicbon,项目名称:LimeSurvey,代码行数:101,代码来源:surveyadmin.php


示例3: _surveyexport

 private function _surveyexport($action, $iSurveyID)
 {
     viewHelper::disableHtmlLogging();
     if ($action == "exportstructurexml") {
         $fn = "limesurvey_survey_{$iSurveyID}.lss";
         $this->_addHeaders($fn, "text/xml", "Mon, 26 Jul 1997 05:00:00 GMT");
         echo surveyGetXMLData($iSurveyID);
         exit;
     } elseif ($action == "exportstructurejson") {
         $fn = "limesurvey_survey_{$iSurveyID}.json";
         $this->_addHeaders($fn, "application/json", "Mon, 26 Jul 1997 05:00:00 GMT");
         $surveyInXmlFormat = surveyGetXMLData($iSurveyID);
         // now convert this xml into json format and then return
         echo _xmlToJson($surveyInXmlFormat);
         exit;
     } elseif ($action == "exportstructurequexml") {
         if (isset($surveyprintlang) && !empty($surveyprintlang)) {
             $quexmllang = $surveyprintlang;
         } else {
             $quexmllang = Survey::model()->findByPk($iSurveyID)->language;
         }
         if (!(isset($noheader) && $noheader == TRUE)) {
             $fn = "survey_{$iSurveyID}_{$quexmllang}.xml";
             $this->_addHeaders($fn, "text/xml", "Mon, 26 Jul 1997 05:00:00 GMT");
             echo quexml_export($iSurveyID, $quexmllang);
             exit;
         }
     } elseif ($action == 'exportstructuretsv') {
         $this->_exporttsv($iSurveyID);
     } elseif ($action == "exportarchive") {
         $this->_exportarchive($iSurveyID);
     }
 }
开发者ID:ambientelivre,项目名称:LimeSurvey,代码行数:33,代码来源:export.php


示例4: duplicate_survey

 /**
  * RPC Routine to duplicate a survey
  *
  * @access public
  * @param string $sSessionKey Auth credentials
  * @param int $iSurveyXML The XML of the survey to import
  * @return int The key of the new survey created
  * */
 public function duplicate_survey($sSessionKey, $iSurveyID)
 {
     // Check sessionkey
     if (!$this->_checkSessionKey($sSessionKey)) {
         return array('status' => 'Invalid session key');
     }
     // import getSurveyList function
     Yii::app()->loadHelper('common');
     // NOTE: for one language surveys only
     $surveys = getSurveyList(TRUE, $iSurveyID);
     // set a defualt name for the new survey
     if (count($surveys) > 0) {
         $new_survey_name = $surveys[0]['surveyls_title'] . ' (copy)';
     } else {
         $new_survey_name = 'New Duplicate Survey';
     }
     // now get the actual name
     foreach ($surveys as $survey) {
         if ($survey['sid'] == $iSurveyID) {
             $new_survey_name = $survey['surveyls_title'] . ' (copy)';
         }
     }
     // you can use this to get the language code if you want
     //$sLanguageCode = getBaseLanguageFromSurveyID($iSurveyID);
     // check to make sure there isn't another survey with the same name
     foreach ($surveys as $survey) {
         if ($survey['surveyls_title'] == $new_survey_name) {
             return array('status' => 'Error: A survey with that name already exists');
         }
     }
     // export functions
     //Yii::app()->loadHelper('admin/exportresults');
     $aExcludes = array();
     // $aExcludes['quotas'] = true;
     // $aExcludes['permissions'] = true;
     // $aExcludes['answers'] = true;
     // $aExcludes['conditions'] = true;
     // $aExcludes['dates'] = true;
     if (!Survey::model()->findByPk($iSurveyID)) {
         return array('status' => 'Error: Invalid survey ID');
     } elseif (!Permission::model()->hasSurveyPermission($iSurveyID, 'surveycontent', 'export')) {
         return array('status' => 'No permissions');
     } else {
         Yii::app()->loadHelper('export');
         $copy_survey_data = surveyGetXMLData($iSurveyID, $aExcludes);
     }
     // Now, we have the survey lets start importing
     Yii::app()->loadHelper('admin/import');
     // XMLImportSurvey(fileName,data,newName,translateInsertansTags,convertInvalidQuestionCodes)
     $result = XMLImportSurvey('', $copy_survey_data, $new_survey_name, NULL, TRUE);
     // (might get used one day)
     // if (isset($aExcludes['conditions'])) {
     //    Question::model()->updateAll(array('relevance'=>'1'),'sid='.$aImportResults['newsid']);
     //    QuestionGroup::model()->updateAll(array('grelevance'=>'1'),'sid='.$aImportResults['newsid']);
     // }
     // if (!isset($aExcludes['permissions'])) {
     //    Permission::model()->copySurveyPermissions($iSurveyID,$aImportResults['newsid']);
     // }
     // the error is set in the XMLImportSurvey function
     if (isset($result['error'])) {
         return FALSE;
     } else {
         return TRUE;
     }
 }
开发者ID:sevenearths,项目名称:limesurvey-api-test,代码行数:73,代码来源:remotecontrol_handle.php


示例5: copy

 /**
  * Function responsible to import/copy a survey based on $action.
  *
  * @access public
  * @return void
  */
 public function copy()
 {
     $importsurvey = "";
     $action = $_POST['action'];
     @($iSurveyID = $_POST['sid']);
     if ($action == "importsurvey" || $action == "copysurvey") {
         if (@$_POST['copysurveytranslinksfields'] == "on" || @$_POST['translinksfields'] == "on") {
             $sTransLinks = true;
         }
         $clang = $this->getController()->lang;
         // Start the HTML
         if ($action == 'importsurvey') {
             $aData['sHeader'] = $clang->gT("Import survey data");
             $aData['sSummaryHeader'] = $clang->gT("Survey structure import summary");
             $importingfrom = "http";
         } elseif ($action == 'copysurvey') {
             $aData['sHeader'] = $clang->gT("Copy survey");
             $aData['sSummaryHeader'] = $clang->gT("Survey copy summary");
         }
         // Start traitment and messagebox
         $aData['bFailed'] = false;
         // Put a var for continue
         if ($action == 'importsurvey') {
             $the_full_file_path = Yii::app()->getConfig('tempdir') . DIRECTORY_SEPARATOR . randomChars(20) . '_' . $_FILES['the_file']['name'];
             if (!@move_uploaded_file($_FILES['the_file']['tmp_name'], $the_full_file_path)) {
                 $aData['sErrorMessage'] = sprintf($clang->gT("An error occurred uploading your file. This may be caused by incorrect permissions in your %s folder."), Yii::app()->getConfig('tempdir'));
                 $aData['bFailed'] = true;
             } else {
                 $sFullFilepath = $the_full_file_path;
                 $aPathInfo = pathinfo($sFullFilepath);
                 if (isset($aPathInfo['extension'])) {
                     $sExtension = $aPathInfo['extension'];
                 } else {
                     $sExtension = "";
                 }
             }
             if (!$aData['bFailed'] && (strtolower($sExtension) != 'csv' && strtolower($sExtension) != 'lss' && strtolower($sExtension) != 'txt' && strtolower($sExtension) != 'lsa')) {
                 $aData['sErrorMessage'] = sprintf($clang->gT("Import failed. You specified an invalid file type '%s'."), $sExtension);
                 $aData['bFailed'] = true;
             }
         } elseif ($action == 'copysurvey') {
             $iSurveyID = sanitize_int($_POST['copysurveylist']);
             $exclude = array();
             if (get_magic_quotes_gpc()) {
                 $sNewSurveyName = stripslashes($_POST['copysurveyname']);
             } else {
                 $sNewSurveyName = Yii::app()->request->getPost('copysurveyname');
             }
             if (Yii::app()->request->getPost('copysurveyexcludequotas') == "on") {
                 $exclude['quotas'] = true;
             }
             if (Yii::app()->request->getPost('copysurveyexcludepermissions') == "on") {
                 $exclude['permissions'] = true;
             }
             if (Yii::app()->request->getPost('copysurveyexcludeanswers') == "on") {
                 $exclude['answers'] = true;
             }
             if (Yii::app()->request->getPost('copysurveyresetconditions') == "on") {
                 $exclude['conditions'] = true;
             }
             if (!$iSurveyID) {
                 $aData['sErrorMessage'] = $clang->gT("No survey ID has been provided. Cannot copy survey");
                 $aData['bFailed'] = true;
             }
             Yii::app()->loadHelper('export');
             $copysurveydata = surveyGetXMLData($iSurveyID, $exclude);
         }
         // Now, we have the survey : start importing
         Yii::app()->loadHelper('admin/import');
         if ($action == 'importsurvey' && !$aData['bFailed']) {
             $aImportResults = importSurveyFile($sFullFilepath, isset($_POST['translinksfields']));
             if (is_null($aImportResults)) {
                 $importerror = true;
             }
         } elseif ($action == 'copysurvey' && (empty($importerror) || !$importerror)) {
             $aImportResults = XMLImportSurvey('', $copysurveydata, $sNewSurveyName);
             if (!isset($exclude['permissions'])) {
                 Survey_permissions::model()->copySurveyPermissions($iSurveyID, $aImportResults['newsid']);
             }
         } else {
             $importerror = true;
         }
         if ($action == 'importsurvey' && isset($sFullFilepath)) {
             unlink($sFullFilepath);
         }
         //            if (isset($aImportResults['error']) && $aImportResults['error']) safeDie($aImportResults['error']);
         if (!$aData['bFailed']) {
             $aData['action'] = $action;
             $aData['sLink'] = $this->getController()->createUrl('admin/survey/view/surveyid/' . $aImportResults['newsid']);
             $aData['aImportResults'] = $aImportResults;
         }
     }
     $this->_renderWrappedTemplate('survey', 'importSurvey_view', $aData);
 }
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:100,代码来源:surveyadmin.php


示例6: copy

 /**
  * Function responsible to import/copy a survey based on $action.
  *
  * @access public
  * @return void
  */
 public function copy()
 {
     $action = Yii::app()->request->getParam('action');
     $iSurveyID = sanitize_int(Yii::app()->request->getParam('sid'));
     if ($action == "importsurvey" || $action == "copysurvey") {
         // Start the HTML
         $sExtension = "";
         if ($action == 'importsurvey') {
             $aData = array();
             $aData['sHeader'] = gT("Import survey data");
             $aData['sSummaryHeader'] = gT("Survey structure import summary");
             $aPathInfo = pathinfo($_FILES['the_file']['name']);
             if (isset($aPathInfo['extension'])) {
                 $sExtension = $aPathInfo['extension'];
             }
         } elseif ($action == 'copysurvey') {
             $aData = array();
             $aData['sHeader'] = gT("Copy survey");
             $aData['sSummaryHeader'] = gT("Survey copy summary");
         }
         // Start traitment and messagebox
         $aData['bFailed'] = false;
         // Put a var for continue
         $sFullFilepath = '';
         if ($action == 'importsurvey') {
             $sFullFilepath = Yii::app()->getConfig('tempdir') . DIRECTORY_SEPARATOR . randomChars(30) . '.' . $sExtension;
             if ($_FILES['the_file']['error'] == 1 || $_FILES['the_file']['error'] == 2) {
                 $aData['sErrorMessage'] = sprintf(gT("Sorry, this file is too large. Only files up to %01.2f MB are allowed."), getMaximumFileUploadSize() / 1024 / 1024) . '<br>';
                 $aData['bFailed'] = true;
             } elseif (!in_array(strtolower($sExtension), array('lss', 'txt', 'tsv', 'lsa'))) {
                 $aData['sErrorMessage'] = sprintf(gT("Import failed. You specified an invalid file type '%s'."), $sExtension);
                 $aData['bFailed'] = true;
             } elseif ($aData['bFailed'] || !@move_uploaded_file($_FILES['the_file']['tmp_name'], $sFullFilepath)) {
                 $aData['sErrorMessage'] = gT("An error occurred uploading your file. This may be caused by incorrect permissions for the application /tmp folder.");
                 $aData['bFailed'] = true;
             }
         } elseif ($action == 'copysurvey') {
             $iSurveyID = sanitize_int(Yii::app()->request->getParam('copysurveylist'));
             $aExcludes = array();
             $sNewSurveyName = Yii::app()->request->getPost('copysurveyname');
             if (Yii::app()->request->getPost('copysurveyexcludequotas') == "1") {
                 $aExcludes['quotas'] = true;
             }
             if (Yii::app()->request->getPost('copysurveyexcludepermissions') == "1") {
                 $aExcludes['permissions'] = true;
             }
             if (Yii::app()->request->getPost('copysurveyexcludeanswers') == "1") {
                 $aExcludes['answers'] = true;
             }
             if (Yii::app()->request->getPost('copysurveyresetconditions') == "1") {
                 $aExcludes['conditions'] = true;
             }
             if (Yii::app()->request->getPost('copysurveyresetstartenddate') == "1") {
                 $aExcludes['dates'] = true;
             }
             if (!$iSurveyID) {
                 $aData['sErrorMessage'] = gT("No survey ID has been provided. Cannot copy survey");
                 $aData['bFailed'] = true;
             } elseif (!Survey::model()->findByPk($iSurveyID)) {
                 $aData['sErrorMessage'] = gT("Invalid survey ID");
                 $aData['bFailed'] = true;
             } elseif (!Permission::model()->hasSurveyPermission($iSurveyID, 'surveycontent', 'export') && !Permission::model()->hasSurveyPermission($iSurveyID, 'surveycontent', 'export')) {
                 $aData['sErrorMessage'] = gT("We are sorry but you don't have permissions to do this.");
                 $aData['bFailed'] = true;
             } else {
                 Yii::app()->loadHelper('export');
                 $copysurveydata = surveyGetXMLData($iSurveyID, $aExcludes);
             }
         }
         // Now, we have the survey : start importing
         Yii::app()->loadHelper('admin/import');
         if ($action == 'importsurvey' && !$aData['bFailed']) {
             $aImportResults = importSurveyFile($sFullFilepath, Yii::app()->request->getPost('translinksfields') == '1');
             if (is_null($aImportResults)) {
                 $aImportResults = array('error' => gT("Unknown error while reading the file, no survey created."));
             }
         } elseif ($action == 'copysurvey' && !$aData['bFailed']) {
             $aImportResults = XMLImportSurvey('', $copysurveydata, $sNewSurveyName, sanitize_int(App()->request->getParam('copysurveyid')), Yii::app()->request->getPost('copysurveytranslinksfields') == '1');
             if (isset($aExcludes['conditions'])) {
                 Question::model()->updateAll(array('relevance' => '1'), 'sid=' . $aImportResults['newsid']);
                 QuestionGroup::model()->updateAll(array('grelevance' => '1'), 'sid=' . $aImportResults['newsid']);
             }
             if (!isset($aExcludes['permissions'])) {
                 Permission::model()->copySurveyPermissions($iSurveyID, $aImportResults['newsid']);
             }
         } else {
             $aData['bFailed'] = true;
         }
         if ($action == 'importsurvey' && isset($sFullFilepath) && file_exists($sFullFilepath)) {
             unlink($sFullFilepath);
         }
         if (!$aData['bFailed']) {
             $aData['aImportResults'] = $aImportResults;
             $aData['action'] = $action;
//.........这里部分代码省略.........
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:101,代码来源:surveyadmin.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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