本文整理汇总了PHP中returnGlobal函数的典型用法代码示例。如果您正苦于以下问题:PHP returnGlobal函数的具体用法?PHP returnGlobal怎么用?PHP returnGlobal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了returnGlobal函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _init
/**
* Initialises this controller, does some basic checks and setups
*
* @access protected
* @return void
*/
protected function _init()
{
parent::_init();
App()->getComponent('bootstrap');
$sUpdateLastCheck = getGlobalSetting('updatelastcheck');
$this->_sessioncontrol();
//if (Yii::app()->getConfig('buildnumber') != "" && Yii::app()->getConfig('updatecheckperiod') > 0 && $sUpdateLastCheck < dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", "-" . Yii::app()->getConfig('updatecheckperiod') . " days"))
// updateCheck();
// App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('adminscripts') . "admin_core.js");
//$this->pnl_id = Yii::app()->user->getId();
$this->pnl_id = Yii::app()->session['plid'];
if (!Yii::app()->getConfig("plid")) {
Yii::app()->setConfig("plid", returnGlobal('plid'));
}
//Panel-list ID
if (!Yii::app()->getConfig("action")) {
Yii::app()->setConfig("action", returnGlobal('action'));
}
//Desired action
if (!Yii::app()->getConfig("subaction")) {
Yii::app()->setConfig("subaction", returnGlobal('subaction'));
}
//Desired subaction
if (!Yii::app()->getConfig("editedaction")) {
Yii::app()->setConfig("editedaction", returnGlobal('editedaction'));
}
// for html editor integration
}
示例2: import
/**
* questiongroup::import()
* Function responsible to import a question group.
*
* @access public
* @return void
*/
function import()
{
$action = $_POST['action'];
$iSurveyID = $surveyid = $aData['surveyid'] = (int) $_POST['sid'];
if (!Permission::model()->hasSurveyPermission($surveyid, 'surveycontent', 'import')) {
Yii::app()->user->setFlash('error', gT("Access denied"));
$this->getController()->redirect(array('admin/survey/sa/listquestiongroups/surveyid/' . $surveyid));
}
if ($action == 'importgroup') {
$importgroup = "\n";
$importgroup .= "\n";
$sFullFilepath = Yii::app()->getConfig('tempdir') . DIRECTORY_SEPARATOR . randomChars(20);
$aPathInfo = pathinfo($_FILES['the_file']['name']);
$sExtension = $aPathInfo['extension'];
if ($_FILES['the_file']['error'] == 1 || $_FILES['the_file']['error'] == 2) {
$fatalerror = sprintf(gT("Sorry, this file is too large. Only files up to %01.2f MB are allowed."), getMaximumFileUploadSize() / 1024 / 1024) . '<br>';
} elseif (!@move_uploaded_file($_FILES['the_file']['tmp_name'], $sFullFilepath)) {
$fatalerror = gT("An error occurred uploading your file. This may be caused by incorrect permissions for the application /tmp folder.");
}
// validate that we have a SID
if (!returnGlobal('sid')) {
$fatalerror .= gT("No SID (Survey) has been provided. Cannot import question.");
}
if (isset($fatalerror)) {
@unlink($sFullFilepath);
Yii::app()->user->setFlash('error', $fatalerror);
$this->getController()->redirect(array('admin/questiongroups/sa/importview/surveyid/' . $surveyid));
}
Yii::app()->loadHelper('admin/import');
// IF WE GOT THIS FAR, THEN THE FILE HAS BEEN UPLOADED SUCCESFULLY
if (strtolower($sExtension) == 'lsg') {
$aImportResults = XMLImportGroup($sFullFilepath, $iSurveyID);
} else {
Yii::app()->user->setFlash('error', gT("Unknown file extension"));
$this->getController()->redirect(array('admin/questiongroups/sa/importview/surveyid/' . $surveyid));
}
LimeExpressionManager::SetDirtyFlag();
// so refreshes syntax highlighting
fixLanguageConsistency($iSurveyID);
if (isset($aImportResults['fatalerror'])) {
unlink($sFullFilepath);
Yii::app()->user->setFlash('error', $aImportResults['fatalerror']);
$this->getController()->redirect(array('admin/questiongroups/sa/importview/surveyid/' . $surveyid));
}
unlink($sFullFilepath);
$aData['display'] = $importgroup;
$aData['surveyid'] = $iSurveyID;
$aData['aImportResults'] = $aImportResults;
$aData['sExtension'] = $sExtension;
//$aData['display']['menu_bars']['surveysummary'] = 'importgroup';
$aData['sidemenu']['state'] = false;
$surveyinfo = Survey::model()->findByPk($iSurveyID)->surveyinfo;
$aData['title_bar']['title'] = $surveyinfo['surveyls_title'] . "(" . gT("ID") . ":" . $iSurveyID . ")";
$this->_renderWrappedTemplate('survey/QuestionGroups', 'import_view', $aData);
}
}
示例3: _init
/**
* Initialises this controller, does some basic checks and setups
*
* @access protected
* @return void
*/
protected function _init()
{
parent::_init();
App()->getComponent('bootstrap');
$sUpdateLastCheck = getGlobalSetting('updatelastcheck');
// echo "111111";
$this->_sessioncontrol();
if (Yii::app()->getConfig('buildnumber') != "" && Yii::app()->getConfig('updatecheckperiod') > 0 && $sUpdateLastCheck < dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", "-" . Yii::app()->getConfig('updatecheckperiod') . " days")) {
updateCheck();
}
//unset(Yii::app()->session['FileManagerContext']);
App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('adminscripts') . "admin_core.js");
$this->user_id = Yii::app()->user->getId();
if (!Yii::app()->getConfig("surveyid")) {
Yii::app()->setConfig("surveyid", returnGlobal('sid'));
}
//SurveyID
if (!Yii::app()->getConfig("ugid")) {
Yii::app()->setConfig("ugid", returnGlobal('ugid'));
}
//Usergroup-ID
if (!Yii::app()->getConfig("gid")) {
Yii::app()->setConfig("gid", returnGlobal('gid'));
}
//GroupID
if (!Yii::app()->getConfig("qid")) {
Yii::app()->setConfig("qid", returnGlobal('qid'));
}
//QuestionID
if (!Yii::app()->getConfig("lid")) {
Yii::app()->setConfig("lid", returnGlobal('lid'));
}
//LabelID
if (!Yii::app()->getConfig("code")) {
Yii::app()->setConfig("code", returnGlobal('code'));
}
// ??
if (!Yii::app()->getConfig("action")) {
Yii::app()->setConfig("action", returnGlobal('action'));
}
//Desired action
if (!Yii::app()->getConfig("subaction")) {
Yii::app()->setConfig("subaction", returnGlobal('subaction'));
}
//Desired subaction
if (!Yii::app()->getConfig("editedaction")) {
Yii::app()->setConfig("editedaction", returnGlobal('editedaction'));
}
// for html editor integration
}
示例4: _init
/**
* Initialises this controller, does some basic checks and setups
*
* @access protected
* @return void
*/
protected function _init()
{
parent::_init();
$updatelastcheck = '';
$this->_sessioncontrol();
if (Yii::app()->getConfig('buildnumber') != "" && Yii::app()->getConfig('updatecheckperiod') > 0 && $updatelastcheck < dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", "-" . Yii::app()->getConfig('updatecheckperiod') . " days")) {
updateCheck();
}
//unset(Yii::app()->session['FileManagerContext']);
$this->user_id = Yii::app()->user->getId();
Yii::app()->setConfig('adminimageurl', Yii::app()->getConfig('styleurl') . Yii::app()->getConfig('admintheme') . '/images/');
Yii::app()->setConfig('adminstyleurl', Yii::app()->getConfig('styleurl') . Yii::app()->getConfig('admintheme') . '/');
if (!Yii::app()->getConfig("surveyid")) {
Yii::app()->setConfig("surveyid", returnGlobal('sid'));
}
//SurveyID
if (!Yii::app()->getConfig("ugid")) {
Yii::app()->setConfig("ugid", returnGlobal('ugid'));
}
//Usergroup-ID
if (!Yii::app()->getConfig("gid")) {
Yii::app()->setConfig("gid", returnGlobal('gid'));
}
//GroupID
if (!Yii::app()->getConfig("qid")) {
Yii::app()->setConfig("qid", returnGlobal('qid'));
}
//QuestionID
if (!Yii::app()->getConfig("lid")) {
Yii::app()->setConfig("lid", returnGlobal('lid'));
}
//LabelID
if (!Yii::app()->getConfig("code")) {
Yii::app()->setConfig("code", returnGlobal('code'));
}
// ??
if (!Yii::app()->getConfig("action")) {
Yii::app()->setConfig("action", returnGlobal('action'));
}
//Desired action
if (!Yii::app()->getConfig("subaction")) {
Yii::app()->setConfig("subaction", returnGlobal('subaction'));
}
//Desired subaction
if (!Yii::app()->getConfig("editedaction")) {
Yii::app()->setConfig("editedaction", returnGlobal('editedaction'));
}
// for html editor integration
}
示例5: import
/**
* questiongroup::import()
* Function responsible to import a question group.
*
* @access public
* @return void
*/
function import()
{
$action = $_POST['action'];
$surveyid = $_POST['sid'];
$clang = $this->getController()->lang;
if ($action == 'importgroup') {
$importgroup = "\n";
$importgroup .= "\n";
$sFullFilepath = Yii::app()->getConfig('tempdir') . DIRECTORY_SEPARATOR . randomChars(20);
$aPathInfo = pathinfo($_FILES['the_file']['name']);
$sExtension = $aPathInfo['extension'];
if (!@move_uploaded_file($_FILES['the_file']['tmp_name'], $sFullFilepath)) {
$fatalerror = sprintf($clang->gT("An error occurred uploading your file. This may be caused by incorrect permissions in your %s folder."), $this->config->item('tempdir'));
}
// validate that we have a SID
if (!returnGlobal('sid')) {
$fatalerror .= $clang->gT("No SID (Survey) has been provided. Cannot import question.");
}
if (isset($fatalerror)) {
@unlink($sFullFilepath);
$this->getController()->error($fatalerror);
}
Yii::app()->loadHelper('admin/import');
// IF WE GOT THIS FAR, THEN THE FILE HAS BEEN UPLOADED SUCCESFULLY
if (strtolower($sExtension) == 'csv') {
$aImportResults = CSVImportGroup($sFullFilepath, $surveyid);
} elseif (strtolower($sExtension) == 'lsg') {
$aImportResults = XMLImportGroup($sFullFilepath, $surveyid);
} else {
$this->getController()->error('Unknown file extension');
}
LimeExpressionManager::SetDirtyFlag();
// so refreshes syntax highlighting
fixLanguageConsistency($surveyid);
if (isset($aImportResults['fatalerror'])) {
unlink($sFullFilepath);
$this->getController()->error($aImportResults['fatalerror']);
}
unlink($sFullFilepath);
$aData['display'] = $importgroup;
$aData['surveyid'] = $surveyid;
$aData['aImportResults'] = $aImportResults;
$aData['sExtension'] = $sExtension;
//$aData['display']['menu_bars']['surveysummary'] = 'importgroup';
$this->_renderWrappedTemplate('survey/QuestionGroups', 'import_view', $aData);
// TMSW Condition->Relevance: call LEM->ConvertConditionsToRelevance() after import
}
}
示例6: _init
/**
* Initialises this controller, does some basic checks and setups
*
* @access protected
* @return void
*/
protected function _init()
{
parent::_init();
App()->getComponent('bootstrap');
$this->_sessioncontrol();
define('ADMIN_SCRIPT_PATH', realpath(Yii::app()->basePath . '/../scripts/admin/') . '/');
define('SCRIPT_PATH', realpath(Yii::app()->basePath . '/../scripts/') . '/');
App()->getClientScript()->registerScriptFile(App()->getAssetManager()->publish(ADMIN_SCRIPT_PATH . '/admin_core.js'));
$this->user_id = Yii::app()->user->getId();
if (!Yii::app()->getConfig("surveyid")) {
Yii::app()->setConfig("surveyid", returnGlobal('sid'));
}
//SurveyID
if (!Yii::app()->getConfig("ugid")) {
Yii::app()->setConfig("ugid", returnGlobal('ugid'));
}
//Usergroup-ID
if (!Yii::app()->getConfig("gid")) {
Yii::app()->setConfig("gid", returnGlobal('gid'));
}
//GroupID
if (!Yii::app()->getConfig("qid")) {
Yii::app()->setConfig("qid", returnGlobal('qid'));
}
//QuestionID
if (!Yii::app()->getConfig("lid")) {
Yii::app()->setConfig("lid", returnGlobal('lid'));
}
//LabelID
if (!Yii::app()->getConfig("code")) {
Yii::app()->setConfig("code", returnGlobal('code'));
}
// ??
if (!Yii::app()->getConfig("action")) {
Yii::app()->setConfig("action", returnGlobal('action'));
}
//Desired action
if (!Yii::app()->getConfig("subaction")) {
Yii::app()->setConfig("subaction", returnGlobal('subaction'));
}
//Desired subaction
if (!Yii::app()->getConfig("editedaction")) {
Yii::app()->setConfig("editedaction", returnGlobal('editedaction'));
}
// for html editor integration
global $oTemplate;
$oTemplate = Template::model()->getTemplateConfiguration(Yii::app()->getConfig("defaulttemplate"));
}
示例7: _init
/**
* Initialises this controller, does some basic checks and setups
*
* @access protected
* @return void
*/
protected function _init()
{
parent::_init();
App()->getComponent('bootstrap');
$this->_sessioncontrol();
$this->user_id = Yii::app()->user->getId();
if (!Yii::app()->getConfig("surveyid")) {
Yii::app()->setConfig("surveyid", returnGlobal('sid'));
}
//SurveyID
if (!Yii::app()->getConfig("ugid")) {
Yii::app()->setConfig("ugid", returnGlobal('ugid'));
}
//Usergroup-ID
if (!Yii::app()->getConfig("gid")) {
Yii::app()->setConfig("gid", returnGlobal('gid'));
}
//GroupID
if (!Yii::app()->getConfig("qid")) {
Yii::app()->setConfig("qid", returnGlobal('qid'));
}
//QuestionID
if (!Yii::app()->getConfig("lid")) {
Yii::app()->setConfig("lid", returnGlobal('lid'));
}
//LabelID
if (!Yii::app()->getConfig("code")) {
Yii::app()->setConfig("code", returnGlobal('code'));
}
// ??
if (!Yii::app()->getConfig("action")) {
Yii::app()->setConfig("action", returnGlobal('action'));
}
//Desired action
if (!Yii::app()->getConfig("subaction")) {
Yii::app()->setConfig("subaction", returnGlobal('subaction'));
}
//Desired subaction
if (!Yii::app()->getConfig("editedaction")) {
Yii::app()->setConfig("editedaction", returnGlobal('editedaction'));
}
// for html editor integration
// Variable not used, but keep it here so the object is initialized at the right place.
$oTemplate = Template::model()->getInstance(Yii::app()->getConfig("defaulttemplate"));
$oAdminTheme = AdminTheme::getInstance();
$oAdminTheme->registerScriptFile('ADMIN_SCRIPT_PATH', 'admin_core.js');
}
示例8: _init
/**
* Initialises this controller, does some basic checks and setups
*
* @access protected
* @return void
*/
protected function _init()
{
parent::_init();
App()->getComponent('bootstrap');
$this->_sessioncontrol();
$this->user_id = Yii::app()->user->getId();
if (!Yii::app()->getConfig("surveyid")) {
Yii::app()->setConfig("surveyid", returnGlobal('sid'));
}
//SurveyID
if (!Yii::app()->getConfig("ugid")) {
Yii::app()->setConfig("ugid", returnGlobal('ugid'));
}
//Usergroup-ID
if (!Yii::app()->getConfig("gid")) {
Yii::app()->setConfig("gid", returnGlobal('gid'));
}
//GroupID
if (!Yii::app()->getConfig("qid")) {
Yii::app()->setConfig("qid", returnGlobal('qid'));
}
//QuestionID
if (!Yii::app()->getConfig("lid")) {
Yii::app()->setConfig("lid", returnGlobal('lid'));
}
//LabelID
if (!Yii::app()->getConfig("code")) {
Yii::app()->setConfig("code", returnGlobal('code'));
}
// ??
if (!Yii::app()->getConfig("action")) {
Yii::app()->setConfig("action", returnGlobal('action'));
}
//Desired action
if (!Yii::app()->getConfig("subaction")) {
Yii::app()->setConfig("subaction", returnGlobal('subaction'));
}
//Desired subaction
if (!Yii::app()->getConfig("editedaction")) {
Yii::app()->setConfig("editedaction", returnGlobal('editedaction'));
}
// for html editor integration
// This line is needed for template editor to work
$oAdminTheme = AdminTheme::getInstance();
AdminTheme::staticRegisterScriptFile('ADMIN_SCRIPT_PATH', 'admin_core.js');
AdminTheme::staticRegisterScriptFile('ADMIN_SCRIPT_PATH', 'notifications.js');
}
示例9: _init
/**
* Initialises this controller, does some basic checks and setups
*
* @access protected
* @return void
*/
protected function _init()
{
parent::_init();
App()->getComponent('bootstrap');
$this->_sessioncontrol();
App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('adminscripts') . "admin_core.js");
$this->user_id = Yii::app()->user->getId();
if (!Yii::app()->getConfig("surveyid")) {
Yii::app()->setConfig("surveyid", returnGlobal('sid'));
}
//SurveyID
if (!Yii::app()->getConfig("ugid")) {
Yii::app()->setConfig("ugid", returnGlobal('ugid'));
}
//Usergroup-ID
if (!Yii::app()->getConfig("gid")) {
Yii::app()->setConfig("gid", returnGlobal('gid'));
}
//GroupID
if (!Yii::app()->getConfig("qid")) {
Yii::app()->setConfig("qid", returnGlobal('qid'));
}
//QuestionID
if (!Yii::app()->getConfig("lid")) {
Yii::app()->setConfig("lid", returnGlobal('lid'));
}
//LabelID
if (!Yii::app()->getConfig("code")) {
Yii::app()->setConfig("code", returnGlobal('code'));
}
// ??
if (!Yii::app()->getConfig("action")) {
Yii::app()->setConfig("action", returnGlobal('action'));
}
//Desired action
if (!Yii::app()->getConfig("subaction")) {
Yii::app()->setConfig("subaction", returnGlobal('subaction'));
}
//Desired subaction
if (!Yii::app()->getConfig("editedaction")) {
Yii::app()->setConfig("editedaction", returnGlobal('editedaction'));
}
// for html editor integration
}
示例10: _init
/**
* Initialises this controller, does some basic checks and setups
*
* @access protected
* @return void
*/
protected function _init()
{
parent::_init();
unset(Yii::app()->session['FileManagerContext']);
if (!Yii::app()->getConfig("surveyid")) {
Yii::app()->setConfig("surveyid", returnGlobal('sid'));
}
//SurveyID
if (!Yii::app()->getConfig("ugid")) {
Yii::app()->setConfig("ugid", returnGlobal('ugid'));
}
//Usergroup-ID
if (!Yii::app()->getConfig("gid")) {
Yii::app()->setConfig("gid", returnGlobal('gid'));
}
//GroupID
if (!Yii::app()->getConfig("qid")) {
Yii::app()->setConfig("qid", returnGlobal('qid'));
}
//QuestionID
if (!Yii::app()->getConfig("lid")) {
Yii::app()->setConfig("lid", returnGlobal('lid'));
}
//LabelID
if (!Yii::app()->getConfig("code")) {
Yii::app()->setConfig("code", returnGlobal('code'));
}
// ??
if (!Yii::app()->getConfig("action")) {
Yii::app()->setConfig("action", returnGlobal('action'));
}
//Desired action
if (!Yii::app()->getConfig("subaction")) {
Yii::app()->setConfig("subaction", returnGlobal('subaction'));
}
//Desired subaction
if (!Yii::app()->getConfig("editedaction")) {
Yii::app()->setConfig("editedaction", returnGlobal('editedaction'));
}
// for html editor integration
Yii::app()->clientScript->registerPackage('decimal');
// decimal
}
示例11: array
<?php
echo CHtml::dropDownList('csvcharset', 'auto', $aEncodings, array('size' => '1', 'class' => 'form-control'));
?>
</div>
</div>
<!-- Separator used -->
<div class="form-group">
<label class="col-sm-2 control-label" for='separator'><?php
eT("Separator used:");
?>
</label>
<div class="col-sm-3">
<?php
$aSeparator = array('auto' => gT("(Autodetect)"), 'comma' => gT("Comma"), 'semicolon' => gT("Semicolon"));
echo CHtml::dropDownList('separator', returnGlobal('separator'), $aSeparator, array('size' => '1', 'class' => 'form-control'));
?>
</div>
</div>
<!-- Filter blank email addresses -->
<div class="form-group">
<label class="col-sm-2 control-label" for='filterblankemail'><?php
eT("Filter blank email addresses:");
?>
</label>
<div class="col-sm-10">
<?php
echo CHtml::checkBox('filterblankemail', true);
?>
</div>
示例12: display_first_page
/**
* Shows the welcome page, used in group by group and question by question mode
*/
function display_first_page()
{
global $token, $surveyid, $thissurvey, $navigator;
$totalquestions = $_SESSION['survey_' . $surveyid]['totalquestions'];
$clang = Yii::app()->lang;
// Fill some necessary var for template
$navigator = surveymover();
$sitename = Yii::app()->getConfig('sitename');
$languagechanger = makeLanguageChangerSurvey($clang->langcode);
sendCacheHeaders();
doHeader();
LimeExpressionManager::StartProcessingPage();
LimeExpressionManager::StartProcessingGroup(-1, false, $surveyid);
// start on welcome page
$redata = compact(array_keys(get_defined_vars()));
$sTemplatePath = $_SESSION['survey_' . $surveyid]['templatepath'];
echo templatereplace(file_get_contents($sTemplatePath . "startpage.pstpl"), array(), $redata, 'frontend_helper[2757]');
echo CHtml::form(array("/survey/index"), 'post', array('id' => 'limesurvey', 'name' => 'limesurvey', 'autocomplete' => 'off'));
echo "\n\n<!-- START THE SURVEY -->\n";
echo templatereplace(file_get_contents($sTemplatePath . "welcome.pstpl"), array(), $redata, 'frontend_helper[2762]') . "\n";
if ($thissurvey['anonymized'] == "Y") {
echo templatereplace(file_get_contents($sTemplatePath . "/privacy.pstpl"), array(), $redata, 'frontend_helper[2765]') . "\n";
}
echo templatereplace(file_get_contents($sTemplatePath . "navigator.pstpl"), array(), $redata, 'frontend_helper[2767]');
if ($thissurvey['active'] != "Y") {
echo "<p style='text-align:center' class='error'>" . $clang->gT("This survey is currently not active. You will not be able to save your responses.") . "</p>\n";
}
echo "\n<input type='hidden' name='sid' value='{$surveyid}' id='sid' />\n";
if (isset($token) && !empty($token)) {
echo "\n<input type='hidden' name='token' value='{$token}' id='token' />\n";
}
echo "\n<input type='hidden' name='lastgroupname' value='_WELCOME_SCREEN_' id='lastgroupname' />\n";
//This is to ensure consistency with mandatory checks, and new group test
$loadsecurity = returnGlobal('loadsecurity', true);
if (isset($loadsecurity)) {
echo "\n<input type='hidden' name='loadsecurity' value='{$loadsecurity}' id='loadsecurity' />\n";
}
$_SESSION['survey_' . $surveyid]['LEMpostKey'] = mt_rand();
echo "<input type='hidden' name='LEMpostKey' value='{$_SESSION['survey_' . $surveyid]['LEMpostKey']}' id='LEMpostKey' />\n";
echo "<input type='hidden' name='thisstep' id='thisstep' value='0' />\n";
echo "\n</form>\n";
echo templatereplace(file_get_contents($sTemplatePath . "endpage.pstpl"), array(), $redata, 'frontend_helper[2782]');
echo LimeExpressionManager::GetRelevanceAndTailoringJavaScript();
LimeExpressionManager::FinishProcessingPage();
doFooter();
}
示例13: delete
/**
* Function responsible for deleting a question.
*
* @access public
* @param string $action
* @param int $surveyid
* @param int $gid
* @param int $qid
* @return void
*/
public function delete($surveyid, $gid, $qid)
{
$clang = $this->getController()->lang;
$surveyid = sanitize_int($surveyid);
$gid = sanitize_int($gid);
$qid = sanitize_int($qid);
if (hasSurveyPermission($surveyid, 'surveycontent', 'delete')) {
if (!isset($qid)) {
$qid = returnGlobal('qid');
}
LimeExpressionManager::RevertUpgradeConditionsToRelevance(NULL, $qid);
// Check if any other questions have conditions which rely on this question. Don't delete if there are.
// TMSW Conditions->Relevance: Allow such deletes - can warn about missing relevance separately.
$ccresult = Conditions::model()->findAllByAttributes(array('cqid' => $qid));
$cccount = count($ccresult);
// There are conditions dependent on this question
if ($cccount) {
foreach ($ccresult as $ccr) {
$qidarray[] = $ccr->qid;
}
if (isset($qidarray)) {
$qidlist = implode(", ", $qidarray);
}
$message = $clang->gT("Question could not be deleted. There are conditions for other questions that rely on this question. You cannot delete this question until those conditions are removed.");
$message .= "<br /><a href='" . $this->getController()->createUrl("admin/expressions/sa/survey_logic_file/sid/{$surveyid}") . "' >" . $clang->gT("Look at survey logic files") . "</a>.";
$this->getController()->error($message, $this->getController()->createUrl("admin/survey/sa/view/surveyid/{$surveyid}/gid/{$gid}/qid/{$qid}"));
} else {
$row = Questions::model()->findByAttributes(array('qid' => $qid))->attributes;
$gid = $row['gid'];
// See if there are any conditions/attributes/answers/defaultvalues for this question,
// and delete them now as well
Conditions::model()->deleteAllByAttributes(array('qid' => $qid));
Question_attributes::model()->deleteAllByAttributes(array('qid' => $qid));
Answers::model()->deleteAllByAttributes(array('qid' => $qid));
$criteria = new CDbCriteria();
$criteria->addCondition('qid = :qid1 or parent_qid = :qid2');
$criteria->params[':qid1'] = $qid;
$criteria->params[':qid2'] = $qid;
Questions::model()->deleteAll($criteria);
Defaultvalues::model()->deleteAllByAttributes(array('qid' => $qid));
Quota_members::model()->deleteAllByAttributes(array('qid' => $qid));
Questions::model()->updateQuestionOrder($gid, $surveyid);
$qid = "";
$postqid = "";
$_GET['qid'] = "";
}
Yii::app()->session['flashmessage'] = $clang->gT("Question was successfully deleted.");
$this->getController()->redirect($this->getController()->createUrl('admin/survey/sa/view/surveyid/' . $surveyid . '/gid/' . $gid));
} else {
Yii::app()->session['flashmessage'] = $clang->gT("You are not authorized to delete questions.");
$this->getController()->redirect($this->getController()->createUrl('admin/survey/sa/view/surveyid/' . $surveyid . '/gid/' . $gid));
}
}
示例14: run
/**
* Constructor
*/
public function run($surveyid = 0, $subaction = null)
{
$surveyid = sanitize_int($surveyid);
//TODO: Convert question types to views
$clang = $this->getController()->lang;
$imageurl = Yii::app()->getConfig("imageurl");
$aData = array('clang' => $clang, 'imageurl' => $imageurl);
$aData['sql'] = '';
/*
* We need this later:
* 1 - Array Dual Scale
* 5 - 5 Point Choice
* A - Array (5 Point Choice)
* B - Array (10 Point Choice)
* C - Array (Yes/No/Uncertain)
* D - Date
* E - Array (Increase, Same, Decrease)
* F - Array (Flexible Labels)
* G - Gender
* H - Array (Flexible Labels) by Column
* I - Language Switch
* K - Multiple Numerical Input
* L - List (Radio)
* M - Multiple choice
* N - Numerical Input
* O - List With Comment
* P - Multiple choice with comments
* Q - Multiple Short Text
* R - Ranking
* S - Short Free Text
* T - Long Free Text
* U - Huge Free Text
* X - Boilerplate Question
* Y - Yes/No
* ! - List (Dropdown)
* : - Array (Flexible Labels) multiple drop down
* ; - Array (Flexible Labels) multiple texts
* | - File Upload
Debugging help:
echo '<script language="javascript" type="text/javascript">alert("HI");</script>';
*/
//split up results to extend statistics -> NOT WORKING YET! DO NOT ENABLE THIS!
$showcombinedresults = 0;
/*
* this variable is used in the function shortencode() which cuts off a question/answer title
* after $maxchars and shows the rest as tooltip
*/
$maxchars = 50;
//we collect all the output within this variable
$statisticsoutput = '';
//output for chosing questions to cross query
$cr_statisticsoutput = '';
// This gets all the 'to be shown questions' from the POST and puts these into an array
$summary = returnGlobal('summary');
$statlang = returnGlobal('statlang');
//if $summary isn't an array we create one
if (isset($summary) && !is_array($summary)) {
$summary = explode("+", $summary);
}
//no survey ID? -> come and get one
if (!isset($surveyid)) {
$surveyid = returnGlobal('sid');
}
//still no survey ID -> error
$aData['surveyid'] = $surveyid;
// Set language for questions and answers to base language of this survey
$language = Survey::model()->findByPk($surveyid)->language;
$aData['language'] = $language;
//Call the javascript file
App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('adminscripts') . 'statistics.js');
App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('adminscripts') . 'json-js/json2.min.js');
$aData['display']['menu_bars']['browse'] = $clang->gT("Quick statistics");
//Select public language file
$row = Survey::model()->find('sid = :sid', array(':sid' => $surveyid));
/*
* check if there is a datestamp available for this survey
* yes -> $datestamp="Y"
* no -> $datestamp="N"
*/
$datestamp = $row->datestamp;
// 1: Get list of questions from survey
/*
* We want to have the following data
* a) "questions" -> all table namens, e.g.
* qid
* sid
* gid
* type
* title
* question
* preg
* help
* other
* mandatory
* lid
//.........这里部分代码省略.........
示例15: _initialise
/**
* Function that initialises all data and call other functions to load default view.
*
* @access protected
* @param string $templatename
* @param string $screenname
* @param string $editfile
* @param bool $showsummary
* @return
*/
protected function _initialise($templatename, $screenname, $editfile, $showsummary = true)
{
App()->getClientScript()->reset();
$clang = $this->getController()->lang;
Yii::app()->loadHelper('surveytranslator');
Yii::app()->loadHelper('admin/template');
$files = $this->_initfiles($templatename);
$cssfiles = $this->_initcssfiles();
// Standard Support Files
// These files may be edited or saved
$supportfiles[] = array('name' => 'print_img_radio.png');
$supportfiles[] = array('name' => 'print_img_checkbox.png');
// Standard screens
// Only these may be viewed
$screens[] = array('name' => $clang->gT('Survey List Page'), 'id' => 'surveylist');
$screens[] = array('name' => $clang->gT('Welcome Page'), 'id' => 'welcome');
$screens[] = array('name' => $clang->gT('Question Page'), 'id' => 'question');
$screens[] = array('name' => $clang->gT('Completed Page'), 'id' => 'completed');
$screens[] = array('name' => $clang->gT('Clear All Page'), 'id' => 'clearall');
$screens[] = array('name' => $clang->gT('Register Page'), 'id' => 'register');
$screens[] = array('name' => $clang->gT('Load Page'), 'id' => 'load');
$screens[] = array('name' => $clang->gT('Save Page'), 'id' => 'save');
$screens[] = array('name' => $clang->gT('Print answers page'), 'id' => 'printanswers');
$screens[] = array('name' => $clang->gT('Printable survey page'), 'id' => 'printablesurvey');
// Page display blocks
$SurveyList = array('startpage.pstpl', 'surveylist.pstpl', 'endpage.pstpl');
$Welcome = array('startpage.pstpl', 'welcome.pstpl', 'privacy.pstpl', 'navigator.pstpl', 'endpage.pstpl');
$Question = array('startpage.pstpl', 'survey.pstpl', 'startgroup.pstpl', 'groupdescription.pstpl', 'question.pstpl', 'endgroup.pstpl', 'navigator.pstpl', 'endpage.pstpl');
$CompletedTemplate = array('startpage.pstpl', 'assessment.pstpl', 'completed.pstpl', 'endpage.pstpl');
$Clearall = array('startpage.pstpl', 'clearall.pstpl', 'endpage.pstpl');
$Register = array('startpage.pstpl', 'survey.pstpl', 'register.pstpl', 'endpage.pstpl');
$Save = array('startpage.pstpl', 'save.pstpl', 'endpage.pstpl');
$Load = array('startpage.pstpl', 'load.pstpl', 'endpage.pstpl');
$printtemplate = array('startpage.pstpl', 'printanswers.pstpl', 'endpage.pstpl');
$printablesurveytemplate = array('print_survey.pstpl', 'print_group.pstpl', 'print_question.pstpl');
$file_version = "LimeSurvey template editor " . Yii::app()->getConfig('versionnumber');
Yii::app()->session['s_lang'] = Yii::app()->session['adminlang'];
$templatename = sanitize_dirname($templatename);
$screenname = autoUnescape($screenname);
// Checks if screen name is in the list of allowed screen names
if (multiarray_search($screens, 'id', $screenname) === false) {
$this->getController()->error('Invalid screen name');
}
if (!isset($action)) {
$action = sanitize_paranoid_string(returnGlobal('action'));
}
if (!isset($subaction)) {
$subaction = sanitize_paranoid_string(returnGlobal('subaction'));
}
if (!isset($newname)) {
$newname = sanitize_dirname(returnGlobal('newname'));
}
if (!isset($copydir)) {
$copydir = sanitize_dirname(returnGlobal('copydir'));
}
if (is_file(Yii::app()->getConfig('usertemplaterootdir') . '/' . $templatename . '/question_start.pstpl')) {
$files[] = array('name' => 'question_start.pstpl');
$Question[] = 'question_start.pstpl';
}
$availableeditorlanguages = array('bg', 'cs', 'de', 'dk', 'en', 'eo', 'es', 'fi', 'fr', 'hr', 'it', 'ja', 'mk', 'nl', 'pl', 'pt', 'ru', 'sk', 'zh');
$extension = substr(strrchr($editfile, "."), 1);
if ($extension == 'css' || $extension == 'js') {
$highlighter = $extension;
} else {
$highlighter = 'html';
}
if (in_array(Yii::app()->session['adminlang'], $availableeditorlanguages)) {
$codelanguage = Yii::app()->session['adminlang'];
} else {
$codelanguage = 'en';
}
$templates = getTemplateList();
if (!isset($templates[$templatename])) {
$templatename = Yii::app()->getConfig('defaulttemplate');
}
$normalfiles = array("DUMMYENTRY", ".", "..", "preview.png");
foreach ($files as $fl) {
$normalfiles[] = $fl["name"];
}
foreach ($cssfiles as $fl) {
$normalfiles[] = $fl["name"];
}
// Some global data
$aData['sitename'] = Yii::app()->getConfig('sitename');
$siteadminname = Yii::app()->getConfig('siteadminname');
$siteadminemail = Yii::app()->getConfig('siteadminemail');
// Set this so common.php doesn't throw notices about undefined variables
$thissurvey['active'] = 'N';
// FAKE DATA FOR TEMPLATES
$thissurvey['name'] = $clang->gT("Template Sample");
//.........这里部分代码省略.........