Skip to content

Commit

Permalink
Dev Merged branch 2.2: Survey rendering via Twig.
Browse files Browse the repository at this point in the history
  • Loading branch information
SamMousa committed Mar 11, 2013
2 parents 0016016 + 6cbe601 commit 091d59a
Show file tree
Hide file tree
Showing 924 changed files with 134,825 additions and 9,397 deletions.
40 changes: 20 additions & 20 deletions .gitattributes
@@ -1,20 +1,20 @@
# Set default behaviour, in case users don't have core.autocrlf set.
* text=auto

# Declare files that will always have LF line endings on checkout.
*.php text eol=lf
*.css text eol=lf
*.js text eol=lf
*.json text eol=lf
*.pstpl text eol=lf
*.html text eol=lf
*.sql text eol=lf
*.txt text eol=lf
*.lss text eol=lf

# Denote all files that are truly binary and should not be modified.
*.jpg binary
*.png binary
*.gif binary
*.ico binary
*.mo binary
# Set default behaviour, in case users don't have core.autocrlf set.
* text=auto

# Declare files that will always have LF line endings on checkout.
*.php text eol=lf
*.css text eol=lf
*.js text eol=lf
*.json text eol=lf
*.pstpl text eol=lf
*.html text eol=lf
*.sql text eol=lf
*.txt text eol=lf
*.lss text eol=lf

# Denote all files that are truly binary and should not be modified.
*.jpg binary
*.png binary
*.gif binary
*.ico binary
*.mo binary
26 changes: 13 additions & 13 deletions .gitignore
@@ -1,13 +1,13 @@
.project
/upload/surveys/*
/styles/gringegreen/images/Thumbs.db
/upload/templates/*
/tmp/runtime/HTML
/application/controllers/admin/updater.php
/tmp/*.html
/tmp/*.lss
/tmp/*.png
/tmp/*.xls
/assets/*
/upload/.htaccess
/nbproject/*
.project
/upload/surveys/*
/styles/gringegreen/images/Thumbs.db
/upload/templates/*
/tmp/runtime/HTML
/application/controllers/admin/updater.php
/tmp/*.html
/tmp/*.lss
/tmp/*.png
/tmp/*.xls
/assets/*
/upload/.htaccess
/nbproject/*
1 change: 1 addition & 0 deletions application/config/config-defaults.php
Expand Up @@ -743,6 +743,7 @@ function hook_get_auth_webserver_profile($user_name)
// Directories
$config['rootdir'] = getcwd(); // This is the physical disk location for your limesurvey installation. Normally you don't have to touch this setting.
$config['tempdir'] = $config['rootdir'].DIRECTORY_SEPARATOR."tmp"; // The directory path where LimeSurvey can store temporary files
$config['twigdir'] = $config['tempdir'].DIRECTORY_SEPARATOR."twig_cache"; // The directory path where Twig can store compiled template files.
$config['imagedir'] = $config['rootdir'].DIRECTORY_SEPARATOR."images"; // The directory path of the image directory
$config['uploaddir'] = $config['rootdir'].DIRECTORY_SEPARATOR."upload";
$config['standardtemplaterootdir'] = $config['rootdir'].DIRECTORY_SEPARATOR."templates"; // The directory path of the standard templates
Expand Down
186 changes: 93 additions & 93 deletions application/controllers/ConfigController.php
@@ -1,93 +1,93 @@
<?php

class ConfigController extends LSYii_Controller {

public function actionScript()
{
// Retrieve config options that should be available in JS.
$configOptions = array(
// 'DBVersion'
'adminimageurl'
);
$data = array();

foreach ($configOptions as $option) {
$data[$option] = Yii::app()->getConfig($option);
}
$data['baseUrl'] = Yii::app()->getBaseUrl(true);
$data['showScriptName'] = Yii::app()->urlManager->showScriptName;
$data['urlFormat'] = Yii::app()->urlManager->urlFormat;
$data['layoutPath'] = Yii::app()->getLayoutPath();
$data['adminImageUrl'] = Yii::app()->getConfig('adminimageurl');
$data['replacementFields']['path'] = $this->createUrl("admin/limereplacementfields/sa/index/");
$this->layout = false;
$this->render('/config/script', compact('data'));
}

public function actionMap($id)
{
$array = array();
while (count($array) < 1000)
{
$array[] = mt_rand();
}

$reps = 0;
srand(123);
$first = $array;
shuffle($first);

$result = array();
$start = microtime(true);
$correct = 0;
while ($reps < 10000)
{
srand(123);
$array2 = $array;
shuffle($array2);

if ($array2 == $first)
{
$correct++;
}
unset($array2);
$reps++;
}
debug("Correct: $correct");
$end = microtime(true);
$time = $end - $start;
debug("Time: $time seconds");
debug($result);
App()->loadHelper('survey');
$em = new ExpressionManager();
$expr = 'Q1.NAOK - Q2.NAOK';
debug($em->RDP_Evaluate($expr));
debug($em->GetErrors());
debug($em->GetJavaScriptEquivalentOfExpression());
debug($em->GetAllJsVarsUsed());
//debug(createFieldMap($id, true, false, 'en'));
}

public function GetVarAttribute($name, $attr, $default)
{


debug('GetVarAttribute');
debug(func_get_args());
if ($attr == 'jsName')
{
return $attr;
}
elseif ($attr == NULL)
{
return 'null';
}
elseif ($attr == 'varName')
{
return 'hippe shit';
}
return $default;
}


}
<?php

class ConfigController extends LSYii_Controller {

public function actionScript()
{
// Retrieve config options that should be available in JS.
$configOptions = array(
// 'DBVersion'
'adminimageurl'
);
$data = array();

foreach ($configOptions as $option) {
$data[$option] = Yii::app()->getConfig($option);
}
$data['baseUrl'] = Yii::app()->getBaseUrl(true);
$data['showScriptName'] = Yii::app()->urlManager->showScriptName;
$data['urlFormat'] = Yii::app()->urlManager->urlFormat;
$data['layoutPath'] = Yii::app()->getLayoutPath();
$data['adminImageUrl'] = Yii::app()->getConfig('adminimageurl');
$data['replacementFields']['path'] = $this->createUrl("admin/limereplacementfields/sa/index/");
$this->layout = false;
$this->render('/config/script', compact('data'));
}

public function actionMap($id)
{
$array = array();
while (count($array) < 1000)
{
$array[] = mt_rand();
}

$reps = 0;
srand(123);
$first = $array;
shuffle($first);

$result = array();
$start = microtime(true);
$correct = 0;
while ($reps < 10000)
{
srand(123);
$array2 = $array;
shuffle($array2);

if ($array2 == $first)
{
$correct++;
}
unset($array2);
$reps++;
}
debug("Correct: $correct");
$end = microtime(true);
$time = $end - $start;
debug("Time: $time seconds");
debug($result);
App()->loadHelper('survey');
$em = new ExpressionManager();
$expr = 'Q1.NAOK - Q2.NAOK';
debug($em->RDP_Evaluate($expr));
debug($em->GetErrors());
debug($em->GetJavaScriptEquivalentOfExpression());
debug($em->GetAllJsVarsUsed());
//debug(createFieldMap($id, true, false, 'en'));
}

public function GetVarAttribute($name, $attr, $default)
{


debug('GetVarAttribute');
debug(func_get_args());
if ($attr == 'jsName')
{
return $attr;
}
elseif ($attr == NULL)
{
return 'null';
}
elseif ($attr == 'varName')
{
return 'hippe shit';
}
return $default;
}


}

0 comments on commit 091d59a

Please sign in to comment.