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


PHP activateSurvey函数代码示例

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


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

示例1: getDBTableUsage

function getDBTableUsage($surveyid)
{
    Yii::app()->loadHelper('admin/activate');
    $arrCols = activateSurvey($surveyid, $surveyid, 'admin.php', true);
    $length = 1;
    foreach ($arrCols['fields'] as $col) {
        switch ($col[0]) {
            case 'C':
                $length = $length + $col[1] * 3 + 1;
                break;
            case 'X':
            case 'B':
                $length = $length + 12;
                break;
            case 'D':
                $length = $length + 3;
                break;
            case 'T':
            case 'TS':
            case 'N':
                $length = $length + 8;
                break;
            case 'L':
                $legth++;
                break;
            case 'I':
            case 'I4':
            case 'F':
                $length = $length + 4;
                break;
            case 'I1':
                $length = $length + 1;
                break;
            case 'I2':
                $length = $length + 2;
                break;
            case 'I8':
                $length = $length + 8;
                break;
        }
    }
    if ($arrCols['dbtype'] == 'mysql' || $arrCols['dbtype'] == 'mysqli') {
        if ($arrCols['dbengine'] == 'myISAM') {
            $hard_limit = 4096;
        } elseif ($arrCols['dbengine'] == "InnoDB") {
            $hard_limit = 1000;
        } else {
            return false;
        }
        $size_limit = 65535;
    } elseif ($arrCols['dbtype'] == 'postgre') {
        $hard_limit = 1600;
        $size_limit = 0;
    } elseif ($arrCols['dbtype'] == 'mssql' || $arrCols['dbtype'] == 'dblib') {
        $hard_limit = 1024;
        $size_limit = 0;
    } else {
        return false;
    }
    $columns_used = count($arrCols['fields']);
    return array('dbtype' => $arrCols['dbtype'], 'column' => array($columns_used, $hard_limit), 'size' => array($length, $size_limit));
}
开发者ID:GuillaumeSmaha,项目名称:LimeSurvey,代码行数:62,代码来源:common_helper.php

示例2: importSurveyFile

function importSurveyFile($sFullFilepath, $bTranslateLinksFields, $sNewSurveyName = NULL, $DestSurveyID = NULL)
{
    $aPathInfo = pathinfo($sFullFilepath);
    if (isset($aPathInfo['extension'])) {
        $sExtension = $aPathInfo['extension'];
    } else {
        $sExtension = "";
    }
    if (isset($sExtension) && strtolower($sExtension) == 'csv') {
        return CSVImportSurvey($sFullFilepath, $DestSurveyID, $bTranslateLinksFields);
    } elseif (isset($sExtension) && strtolower($sExtension) == 'lss') {
        return XMLImportSurvey($sFullFilepath, null, $sNewSurveyName, $DestSurveyID, $bTranslateLinksFields);
    } elseif (isset($sExtension) && strtolower($sExtension) == 'txt') {
        return TSVImportSurvey($sFullFilepath);
    } elseif (isset($sExtension) && strtolower($sExtension) == 'lsa') {
        Yii::import("application.libraries.admin.pclzip.pclzip", true);
        $pclzip = new PclZip(array('p_zipname' => $sFullFilepath));
        $aFiles = $pclzip->listContent();
        if ($pclzip->extract(PCLZIP_OPT_PATH, Yii::app()->getConfig('tempdir') . DIRECTORY_SEPARATOR, PCLZIP_OPT_BY_EREG, '/(lss|lsr|lsi|lst)$/') == 0) {
            unset($pclzip);
        }
        // Step 1 - import the LSS file and activate the survey
        foreach ($aFiles as $aFile) {
            if (pathinfo($aFile['filename'], PATHINFO_EXTENSION) == 'lss') {
                //Import the LSS file
                $aImportResults = XMLImportSurvey(Yii::app()->getConfig('tempdir') . DIRECTORY_SEPARATOR . $aFile['filename'], null, null, null, true);
                // Activate the survey
                Yii::app()->loadHelper("admin/activate");
                $activateoutput = activateSurvey($aImportResults['newsid']);
                unlink(Yii::app()->getConfig('tempdir') . DIRECTORY_SEPARATOR . $aFile['filename']);
                break;
            }
        }
        // Step 2 - import the responses file
        foreach ($aFiles as $aFile) {
            if (pathinfo($aFile['filename'], PATHINFO_EXTENSION) == 'lsr') {
                //Import the LSS file
                $aResponseImportResults = XMLImportResponses(Yii::app()->getConfig('tempdir') . DIRECTORY_SEPARATOR . $aFile['filename'], $aImportResults['newsid'], $aImportResults['FieldReMap']);
                $aImportResults = array_merge($aResponseImportResults, $aImportResults);
                unlink(Yii::app()->getConfig('tempdir') . DIRECTORY_SEPARATOR . $aFile['filename']);
                break;
            }
        }
        // Step 3 - import the tokens file - if exists
        foreach ($aFiles as $aFile) {
            if (pathinfo($aFile['filename'], PATHINFO_EXTENSION) == 'lst') {
                Yii::app()->loadHelper("admin/token");
                if (createTokenTable($aImportResults['newsid'])) {
                    $aTokenCreateResults = array('tokentablecreated' => true);
                }
                $aImportResults = array_merge($aTokenCreateResults, $aImportResults);
                $aTokenImportResults = XMLImportTokens(Yii::app()->getConfig('tempdir') . DIRECTORY_SEPARATOR . $aFile['filename'], $aImportResults['newsid']);
                $aImportResults = array_merge($aTokenImportResults, $aImportResults);
                unlink(Yii::app()->getConfig('tempdir') . DIRECTORY_SEPARATOR . $aFile['filename']);
                break;
            }
        }
        // Step 4 - import the timings file - if exists
        foreach ($aFiles as $aFile) {
            if (pathinfo($aFile['filename'], PATHINFO_EXTENSION) == 'lsi' && tableExists("survey_{$aImportResults['newsid']}_timings")) {
                $aTimingsImportResults = XMLImportTimings(Yii::app()->getConfig('tempdir') . DIRECTORY_SEPARATOR . $aFile['filename'], $aImportResults['newsid'], $aImportResults['FieldReMap']);
                $aImportResults = array_merge($aTimingsImportResults, $aImportResults);
                unlink(Yii::app()->getConfig('tempdir') . DIRECTORY_SEPARATOR . $aFile['filename']);
                break;
            }
        }
        return $aImportResults;
    } else {
        return null;
    }
}
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:71,代码来源:import_helper.php

示例3: activate

 /**
  * Function responsible to activate survey.
  *
  * @access public
  * @param int $iSurveyID
  * @return void
  */
 public function activate($iSurveyID)
 {
     if (!Permission::model()->hasSurveyPermission($iSurveyID, 'surveyactivation', 'update')) {
         die;
     }
     $iSurveyID = (int) $iSurveyID;
     $aData = array();
     $aData['aSurveysettings'] = getSurveyInfo($iSurveyID);
     $aData['surveyid'] = $iSurveyID;
     // Die if this is not possible
     if (!isset($aData['aSurveysettings']['active']) || $aData['aSurveysettings']['active'] == 'Y') {
         $this->getController()->error('Survey not active');
     }
     $qtypes = getQuestionTypeList('', 'array');
     Yii::app()->loadHelper("admin/activate");
     if (empty($_POST['ok'])) {
         if (isset($_GET['fixnumbering']) && $_GET['fixnumbering']) {
             fixNumbering($_GET['fixnumbering'], $iSurveyID);
         }
         // Check consistency for groups and questions
         $failedgroupcheck = checkGroup($iSurveyID);
         $failedcheck = checkQuestions($iSurveyID, $iSurveyID, $qtypes);
         $aData['failedcheck'] = $failedcheck;
         $aData['failedgroupcheck'] = $failedgroupcheck;
         $aData['aSurveysettings'] = getSurveyInfo($iSurveyID);
         $this->_renderWrappedTemplate('survey', 'activateSurvey_view', $aData);
     } else {
         $survey = Survey::model()->findByAttributes(array('sid' => $iSurveyID));
         if (!is_null($survey)) {
             $survey->anonymized = Yii::app()->request->getPost('anonymized');
             $survey->datestamp = Yii::app()->request->getPost('datestamp');
             $survey->ipaddr = Yii::app()->request->getPost('ipaddr');
             $survey->refurl = Yii::app()->request->getPost('refurl');
             $survey->savetimings = Yii::app()->request->getPost('savetimings');
             $survey->save();
             Survey::model()->resetCache();
             // Make sure the saved values will be picked up
         }
         $aResult = activateSurvey($iSurveyID);
         if (isset($aResult['error'])) {
             $aViewUrls['output'] = "<br />\n<div class='messagebox ui-corner-all'>\n" . "<div class='header ui-widget-header'>" . gT("Activate Survey") . " ({$iSurveyID})</div>\n";
             if ($aResult['error'] == 'surveytablecreation') {
                 $aViewUrls['output'] .= "<div class='warningheader'>" . gT("Survey table could not be created.") . "</div>\n";
             } else {
                 $aViewUrls['output'] .= "<div class='warningheader'>" . gT("Timings table could not be created.") . "</div>\n";
             }
             $aViewUrls['output'] .= "<p>" . gT("Database error!!") . "\n <font color='red'>" . "</font>\n" . "<pre>" . var_export($aResult['error'], true) . "</pre>\n\n                <a href='" . Yii::app()->getController()->createUrl("admin/survey/sa/view/surveyid/" . $iSurveyID) . "'>" . gT("Main Admin Screen") . "</a>\n</div>";
         } else {
             $aViewUrls['output'] = "<br />\n<div class='messagebox ui-corner-all'>\n" . "<div class='header ui-widget-header'>" . gT("Activate Survey") . " ({$iSurveyID})</div>\n" . "<div class='successheader'>" . gT("Survey has been activated. Results table has been successfully created.") . "</div><br /><br />\n";
             if (isset($aResult['warning'])) {
                 $aViewUrls['output'] .= "<div class='warningheader'>" . gT("The required directory for saving the uploaded files couldn't be created. Please check file premissions on the /upload/surveys directory.") . "</div>";
             }
             if ($survey->allowregister == 'Y') {
                 $aViewUrls['output'] .= gT("This survey allows public registration. A token table must also be created.") . "<br /><br />\n" . "<input type='submit' value='" . gT("Initialise tokens") . "' onclick=\"" . convertGETtoPOST(Yii::app()->getController()->createUrl("admin/tokens/sa/index/surveyid/" . $iSurveyID)) . "\" />\n";
             } else {
                 $aViewUrls['output'] .= gT("This survey is now active, and responses can be recorded.") . "<br /><br />\n" . "<strong>" . gT("Open-access mode") . ":</strong> " . gT("No invitation code is needed to complete the survey.") . "<br />" . gT("You can switch to the closed-access mode by initialising a token table with the button below.") . "<br /><br />\n" . "<input type='submit' value='" . gT("Switch to closed-access mode") . "' onclick=\"" . convertGETtoPOST(Yii::app()->getController()->createUrl("admin/tokens/sa/index/surveyid/" . $iSurveyID)) . "\" />\n" . "<input type='submit' value='" . gT("No, thanks.") . "' onclick=\"" . convertGETtoPOST(Yii::app()->getController()->createUrl("admin/survey/sa/view/surveyid/" . $iSurveyID)) . "\" />\n";
             }
             $aViewUrls['output'] .= "</div><br />&nbsp;\n";
         }
         $this->_renderWrappedTemplate('survey', $aViewUrls, $aData);
     }
 }
开发者ID:nicbon,项目名称:LimeSurvey,代码行数:69,代码来源:surveyadmin.php

示例4: activate_survey

 /**
  * RPC Routine that launches a newly created survey.
  *
  * @access public
  * @param string $sSessionKey Auth credentials
  * @param int $iSurveyID The id of the survey to be activated
  * @return array The result of the activation
  */
 public function activate_survey($sSessionKey, $iSurveyID)
 {
     if ($this->_checkSessionKey($sSessionKey)) {
         $oSurvey = Survey::model()->findByPk($iSurveyID);
         if (is_null($oSurvey)) {
             return array('status' => 'Error: Invalid survey ID');
         }
         if (Permission::model()->hasSurveyPermission($iSurveyID, 'surveyactivation', 'update')) {
             Yii::app()->loadHelper('admin/activate');
             $aActivateResults = activateSurvey($iSurveyID);
             if (isset($aActivateResults['error'])) {
                 return array('status' => 'Error: ' . $aActivateResults['error']);
             } else {
                 return $aActivateResults;
             }
         } else {
             return array('status' => 'No permission');
         }
     } else {
         return array('status' => 'Invalid session key');
     }
 }
开发者ID:kasutori,项目名称:LimeSurvey,代码行数:30,代码来源:remotecontrol_handle.php

示例5: foreach

        $activateoutput .= "<ul>\n";
        if (isset($failedcheck) && $failedcheck) {
            foreach ($failedcheck as $fc) {
                $activateoutput .= "<li> Question qid-{$fc[0]} (\"<a href='{$scriptname}?sid={$surveyid}&amp;gid={$fc['3']}&amp;qid={$fc['0']}'>{$fc[1]}</a>\"){$fc[2]}</li>\n";
            }
        }
        if (isset($failedgroupcheck) && $failedgroupcheck) {
            foreach ($failedgroupcheck as $fg) {
                $activateoutput .= "\t\t\t\t<li> Group gid-{$fg[0]} (\"<a href='{$scriptname}?sid={$surveyid}&amp;gid={$fg['0']}'>{$fg[1]}</a>\"){$fg[2]}</li>\n";
            }
        }
        $activateoutput .= "</ul>\n";
        $activateoutput .= $clang->gT("The survey cannot be activated until these problems have been resolved.") . "\n";
        $activateoutput .= "</div><br />&nbsp;\n";
        return;
    }
    $activateoutput .= "<br />\n<div class='messagebox ui-corner-all'>\n";
    $activateoutput .= "<div class='header ui-widget-header'>" . $clang->gT("Activate Survey") . " ({$surveyid})</div>\n";
    $activateoutput .= "<div class='warningheader'>\n";
    $activateoutput .= $clang->gT("Warning") . "<br />\n";
    $activateoutput .= $clang->gT("READ THIS CAREFULLY BEFORE PROCEEDING") . "\n";
    $activateoutput .= "\t</div>\n";
    $activateoutput .= $clang->gT("You should only activate a survey when you are absolutely certain that your survey setup is finished and will not need changing.") . "<br /><br />\n";
    $activateoutput .= $clang->gT("Once a survey is activated you can no longer:") . "<ul><li>" . $clang->gT("Add or delete groups") . "</li><li>" . $clang->gT("Add or delete questions") . "</li><li>" . $clang->gT("Add or delete subquestions or change their codes") . "</li></ul>\n";
    $activateoutput .= $clang->gT("However you can still:") . "<ul><li>" . $clang->gT("Edit your questions code/title/text and advanced options") . "</li><li>" . $clang->gT("Edit your group names or descriptions") . "</li><li>" . $clang->gT("Add, remove or edit answer options") . "</li><li>" . $clang->gT("Change survey name or description") . "</li></ul>\n";
    $activateoutput .= $clang->gT("Once data has been entered into this survey, if you want to add or remove groups or questions, you will need to deactivate this survey, which will move all data that has already been entered into a separate archived table.") . "<br /><br />\n";
    $activateoutput .= "\t<input type='submit' value=\"" . $clang->gT("Activate Survey") . "\" onclick=\"" . get2post("{$scriptname}?action=activate&amp;ok=Y&amp;sid={$_GET['sid']}") . "\" />\n";
    $activateoutput .= "</div><br />&nbsp;\n";
} else {
    $activateoutput = activateSurvey($postsid, $surveyid);
}
开发者ID:himanshu12k,项目名称:ce-www,代码行数:31,代码来源:activate.php

示例6: activateSurvey

 /**
  * function to activate surveys based on new activate.php 5771 2008-10-13 02:28:40Z jcleeland $
  *
  * @param unknown_type $surveyid
  * @return boolean
  */
 function activateSurvey($surveyid)
 {
     global $dbprefix, $connect, $clang, $databasetype, $databasetabletype;
     $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
     include "lsrc.config.php";
     include '../admin_functions.php';
     include '../activate_functions.php';
     $this->debugLsrc("wir sind in " . __FILE__ . " - " . __FUNCTION__ . " Line " . __LINE__ . ", OK ");
     $returnOutput = activateSurvey($surveyid, $surveyid, 'lsrc');
     $this->debugLsrc("wir sind in " . __FILE__ . " - " . __FUNCTION__ . " Line " . __LINE__ . ", {$returnOutput} ");
     return $returnOutput;
 }
开发者ID:rkaldung,项目名称:LimeSurvey,代码行数:18,代码来源:lsrc.helper.php

示例7: activate

 /**
  * Function responsible to activate survey.
  *
  * @access public
  * @param int $iSurveyID
  * @return void
  */
 public function activate($iSurveyID)
 {
     if (!Permission::model()->hasSurveyPermission($iSurveyID, 'surveyactivation', 'update')) {
         die;
     }
     $iSurveyID = (int) $iSurveyID;
     $aData = array();
     $aData['sidemenu']['state'] = false;
     $aData['aSurveysettings'] = getSurveyInfo($iSurveyID);
     $aData['surveyid'] = $iSurveyID;
     $surveyinfo = Survey::model()->findByPk($iSurveyID)->surveyinfo;
     $aData['title_bar']['title'] = $surveyinfo['surveyls_title'] . "(" . gT("ID") . ":" . $iSurveyID . ")";
     // Die if this is not possible
     if (!isset($aData['aSurveysettings']['active']) || $aData['aSurveysettings']['active'] == 'Y') {
         $this->getController()->error('Survey not active');
     }
     $qtypes = getQuestionTypeList('', 'array');
     Yii::app()->loadHelper("admin/activate");
     if (empty($_POST['ok'])) {
         if (isset($_GET['fixnumbering']) && $_GET['fixnumbering']) {
             fixNumbering($_GET['fixnumbering'], $iSurveyID);
         }
         // Check consistency for groups and questions
         $failedgroupcheck = checkGroup($iSurveyID);
         $failedcheck = checkQuestions($iSurveyID, $iSurveyID, $qtypes);
         $aData['failedcheck'] = $failedcheck;
         $aData['failedgroupcheck'] = $failedgroupcheck;
         $aData['aSurveysettings'] = getSurveyInfo($iSurveyID);
         $this->_renderWrappedTemplate('survey', 'activateSurvey_view', $aData);
     } else {
         $survey = Survey::model()->findByAttributes(array('sid' => $iSurveyID));
         if (!is_null($survey)) {
             $survey->anonymized = Yii::app()->request->getPost('anonymized');
             $survey->datestamp = Yii::app()->request->getPost('datestamp');
             $survey->ipaddr = Yii::app()->request->getPost('ipaddr');
             $survey->refurl = Yii::app()->request->getPost('refurl');
             $survey->savetimings = Yii::app()->request->getPost('savetimings');
             $survey->save();
             Survey::model()->resetCache();
             // Make sure the saved values will be picked up
         }
         $aResult = activateSurvey($iSurveyID);
         if (isset($aResult['error'])) {
             $aViewUrls['output'] = "<br />\n<div class='messagebox ui-corner-all'>\n";
             if ($aResult['error'] == 'surveytablecreation') {
                 $aViewUrls['output'] .= "<div class='alert alert-warning' role='alert'>" . gT("Survey table could not be created.") . "</div>\n";
             } else {
                 $aViewUrls['output'] .= "<div class='alert alert-success' role='alert'>" . gT("Timings table could not be created.") . "</div>\n";
             }
             $aViewUrls['output'] .= "<strong class='text-warning'>" . gT("Database error!!") . "\n " . "\n" . "<pre>" . var_export($aResult['error'], true) . "</pre>\n\n                <a href='" . Yii::app()->getController()->createUrl("admin/survey/sa/view/surveyid/" . $iSurveyID) . "'>" . gT("Main Admin Screen") . "</a>\n</strong><br/>";
         } else {
             $warning = isset($aResult['warning']) ? true : false;
             $allowregister = $survey->allowregister == 'Y' ? true : false;
             $onclickAction = convertGETtoPOST(Yii::app()->getController()->createUrl("admin/tokens/sa/index/surveyid/" . $iSurveyID));
             $closedOnclickAction = convertGETtoPOST(Yii::app()->getController()->createUrl("admin/tokens/sa/index/surveyid/" . $iSurveyID));
             $noOnclickAction = convertGETtoPOST(Yii::app()->getController()->createUrl("admin/survey/sa/view/surveyid/" . $iSurveyID));
             $activationData = array('iSurveyID' => $iSurveyID, 'warning' => $warning, 'allowregister' => $allowregister, 'onclickAction' => $onclickAction, 'closedOnclickAction' => $closedOnclickAction, 'noOnclickAction' => $noOnclickAction);
             $aViewUrls['output'] = $this->getController()->renderPartial('/admin/survey/_activation_feedback', $activationData, true);
         }
         $this->_renderWrappedTemplate('survey', $aViewUrls, $aData);
     }
 }
开发者ID:GuillaumeSmaha,项目名称:LimeSurvey,代码行数:69,代码来源:surveyadmin.php


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