Skip to content

Commit

Permalink
Merge branch 'Yii' of https://github.com/LimeSurvey/LimeSurvey into Yii
Browse files Browse the repository at this point in the history
  • Loading branch information
jcleeland committed Jul 28, 2012
2 parents f8fac71 + 7167ff7 commit 67c9baf
Show file tree
Hide file tree
Showing 24 changed files with 1,071 additions and 1,020 deletions.
2 changes: 1 addition & 1 deletion application/controllers/OptinController.php
Expand Up @@ -93,7 +93,7 @@ function actionLocal($surveyid, $token, $langcode = '')
//PRINT COMPLETED PAGE
if (!$thissurvey['templatedir'])
{
$thistpl=getTemplatePath($defaulttemplate);
$thistpl=getTemplatePath(Yii::app()->getConfig("defaulttemplate"));
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions application/controllers/OptoutController.php
Expand Up @@ -96,7 +96,7 @@ function actiontokens()
//PRINT COMPLETED PAGE
if (!$thissurvey['templatedir'])
{
$thistpl=getTemplatePath($defaulttemplate);
$thistpl=getTemplatePath(Yii::app()->getConfig("defaulttemplate"));
}
else
{
Expand Down Expand Up @@ -196,7 +196,7 @@ function actionparticipants()
//PRINT COMPLETED PAGE
if (!$thissurvey['templatedir'])
{
$thistpl=getTemplatePath($defaulttemplate);
$thistpl=getTemplatePath(Yii::app()->getConfig("defaulttemplate"));
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/RegisterController.php
Expand Up @@ -29,9 +29,9 @@ function actionAJAXRegisterForm
Yii::app()->loadHelper('database');
Yii::app()->loadHelper('replacements');
$redata = compact(array_keys(get_defined_vars()));
$thistpl = Yii::app()->getConfig("standardtemplaterootdir").'/default';
$surveyid = sanitize_int($surveyid);
$row = Survey::model()->find('sid=:sid',array(':sid' => $surveyid)) or show_error("Can't find survey data");
$thistpl=getTemplatePath(validateTemplateDir($row->template));
$data['sid'] = $surveyid;
$data['startdate'] = $row->startdate;
$data['enddate'] = $row->expires;
Expand Down
6 changes: 3 additions & 3 deletions application/controllers/admin/assessments.php
Expand Up @@ -116,7 +116,7 @@ private function _showAssessments($iSurveyID, $action, $surveyLanguage, Limesurv

private function _collectGroupData($iSurveyID)
{
$aData = array();
$aData = array();
$groups = Groups::model()->findAllByAttributes(array('sid' => $iSurveyID));
foreach ($groups as $group) {
$groupId = $group->attributes['gid'];
Expand Down Expand Up @@ -156,7 +156,7 @@ private function _add($iSurveyID)
if ($first == false) {
$aData['id'] = $assessmentId;
}
$assessment = Assessment::insertRecords($aData);
$assessment = Assessment::model()->insertRecords($aData);
if ($first == true) {
$first = false;
$assessmentId = $assessment->id;
Expand All @@ -177,7 +177,7 @@ private function _update($iSurveyID)
foreach ($languages as $language)
{
$aData = $this->_getAssessmentPostData($iSurveyID, $language);
Assessment::updateAssessment($aid, $language, $aData);
Assessment::model()->updateAssessment($aid, $language, $aData);
}
}
}
Expand Down
184 changes: 92 additions & 92 deletions application/controllers/admin/participantsaction.php

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions application/controllers/admin/surveypermission.php
Expand Up @@ -36,12 +36,12 @@ function index($surveyid)

if(hasSurveyPermission($surveyid,'survey','read'))
{
$aBaseSurveyPermissions=Survey_permissions::getBasePermissions();
$aBaseSurveyPermissions=Survey_permissions::model()->getBasePermissions();

$this->getController()->_js_admin_includes(Yii::app()->baseUrl.'/scripts/jquery/jquery.tablesorter.min.js');
$this->getController()->_js_admin_includes(Yii::app()->baseUrl.'/scripts/admin/surveysecurity.js');

$result2 = Survey_permissions::getUserDetails($surveyid);
$result2 = Survey_permissions::model()->getUserDetails($surveyid);

$surveysecurity ="<div class='header ui-widget-header'>".$clang->gT("Survey permissions")."</div>\n"
. "<table class='surveysecurity'><thead>"
Expand Down Expand Up @@ -219,7 +219,7 @@ function addusergroup($surveyid)
if( (count($result) > 0 && in_array($postusergroupid,getSurveyUserGroupList('simpleugidarray',$surveyid))) ||Yii::app()->session['USER_RIGHT_SUPERADMIN'] == 1)
{
if($postusergroupid > 0){
$result2 = User::getCommonUID($surveyid, $postusergroupid); //Checked
$result2 = User::model()->getCommonUID($surveyid, $postusergroupid); //Checked
if($result2->getRowCount() > 0)
{
foreach ($result2->readAll() as $row2 )
Expand Down Expand Up @@ -302,7 +302,7 @@ function adduser($surveyid)

if($postuserid > 0){

$isrresult = Survey_permissions::insertSomeRecords(array('sid' => $surveyid, 'uid' => $postuserid, 'permission' => 'survey', 'read_p' => 1));
$isrresult = Survey_permissions::model()->insertSomeRecords(array('sid' => $surveyid, 'uid' => $postuserid, 'permission' => 'survey', 'read_p' => 1));

if($isrresult)
{
Expand Down Expand Up @@ -405,7 +405,7 @@ function set($surveyid)
. "</tr></thead>\n";

//content
$aBasePermissions=Survey_permissions::getBasePermissions();
$aBasePermissions=Survey_permissions::model()->getBasePermissions();

$oddcolumn=false;
foreach($aBasePermissions as $sPermissionKey=>$aCRUDPermissions)
Expand Down Expand Up @@ -548,7 +548,7 @@ function surveyright($surveyid)
$iOwnerID=$resrow['owner_id'];
}

$aBaseSurveyPermissions = Survey_permissions::getBasePermissions();
$aBaseSurveyPermissions = Survey_permissions::model()->getBasePermissions();
$aPermissions=array();
foreach ($aBaseSurveyPermissions as $sPermissionKey=>$aCRUDPermissions)
{
Expand All @@ -575,14 +575,14 @@ function surveyright($surveyid)
{
foreach ($oResult as $aRow)
{
Survey_permissions::setPermission($aRow->uid, $surveyid, $aPermissions);
Survey_permissions::model()->setPermission($aRow->uid, $surveyid, $aPermissions);
}
$addsummary .= "<div class=\"successheader\">".$clang->gT("Survey permissions for all users in this group were successfully updated.")."</div>\n";
}
}
else
{
if (Survey_permissions::setPermission($postuserid, $surveyid, $aPermissions))
if (Survey_permissions::model()->setPermission($postuserid, $surveyid, $aPermissions))
{
$addsummary .= "<div class=\"successheader\">".$clang->gT("Survey permissions were successfully updated.")."</div>\n";
}
Expand Down
10 changes: 5 additions & 5 deletions application/controllers/admin/tokens.php
Expand Up @@ -571,7 +571,7 @@ function editToken($iSurveyId)
// {
// $sLang = Yii::app()->request->getPost('language');
// }
Tokens_dynamic::sid($iSurveyId);
Tokens_dynamic::model()->sid($iSurveyId);

echo $from . ',' . $until;
$aData = array(
Expand Down Expand Up @@ -884,7 +884,7 @@ function delete($iSurveyId)
$aTokenIds = explode(',', $iTokenId); //Make the tokenids string into an array

//Delete any survey_links
Survey_links::deleteTokenLink($aTokenIds, $iSurveyId);
Survey_links::model()->deleteTokenLink($aTokenIds, $iSurveyId);

//Then delete the tokens
Tokens_dynamic::model($iSurveyId)->deleteRecords($aTokenIds);
Expand Down Expand Up @@ -1001,7 +1001,7 @@ function addDummies($iSurveyId, $subaction = '')
if($isvalidtoken)
{
$aDataToInsert['token'] = $newtoken;
Tokens_dynamic::insertToken($iSurveyId, $aDataToInsert);
Tokens_dynamic::model()->insertToken($iSurveyId, $aDataToInsert);
$newDummyToken ++;
}

Expand Down Expand Up @@ -2154,7 +2154,7 @@ function kill($iSurveyId)
Survey::model()->updateByPk($iSurveyId, array('attributedescriptions' => "a:0:{}"));

//Remove any survey_links to the CPDB
Survey_links::deleteLinksBySurvey($iSurveyId);
Survey_links::model()->deleteLinksBySurvey($iSurveyId);

$this->_renderWrappedTemplate('token', array('tokenbar', 'message' => array(
'title' => $clang->gT("Delete Tokens Table"),
Expand Down Expand Up @@ -2309,7 +2309,7 @@ function _newtokentable($iSurveyId)
Yii::app()->db->createCommand()->renameTable(Yii::app()->request->getPost('oldtable'), Yii::app()->db->tablePrefix."tokens_".intval($iSurveyId));

//Add any survey_links from the renamed table
Survey_links::rebuildLinksFromTokenTable($iSurveyId);
Survey_links::model()->rebuildLinksFromTokenTable($iSurveyId);

$this->_renderWrappedTemplate('token', array('message' => array(
'title' => $clang->gT("Import old tokens"),
Expand Down
29 changes: 10 additions & 19 deletions application/controllers/survey/index.php
Expand Up @@ -20,7 +20,7 @@ public function run()

function action()
{
global $surveyid, $thistpl, $totalquestions;
global $surveyid, $totalquestions;
global $thissurvey, $thisstep;
global $clienttoken, $tokensexist, $token;
$clang = Yii::app()->lang;
Expand Down Expand Up @@ -160,10 +160,7 @@ function action()
$sDisplayLanguage = Yii::app()->getConfig('defaultlang');
}
$clang = $this->_loadLimesurveyLang($sDisplayLanguage);
if(!isset($defaulttemplate))
{
$defaulttemplate=Yii::app()->getConfig("defaulttemplate");
}

$languagechanger = makeLanguageChanger($sDisplayLanguage);
//Find out if there are any publicly available surveys
$query = "SELECT sid, surveyls_title, publicstatistics, language
Expand Down Expand Up @@ -276,24 +273,23 @@ function action()
"list"=>implode("\n",$list),
);

$thissurvey['templatedir'] = $defaulttemplate;

$data['thissurvey'] = $thissurvey;
//$data['privacy'] = $privacy;
$data['surveylist'] = $surveylist;
$data['surveyid'] = $surveyid;
$data['templatedir'] = getTemplatePath($defaulttemplate);
$data['templateurl'] = getTemplateURL($defaulttemplate)."/";
$data['templatename'] = $defaulttemplate;
$data['templatedir'] = getTemplatePath(Yii::app()->getConfig("defaulttemplate"));
$data['templateurl'] = getTemplateURL(Yii::app()->getConfig("defaulttemplate"))."/";
$data['templatename'] = Yii::app()->getConfig("defaulttemplate");
$data['sitename'] = Yii::app()->getConfig("sitename");
$data['languagechanger'] = $languagechanger;

//A nice exit
sendCacheHeaders();
doHeader();
$this->_printTemplateContent(getTemplatePath($defaulttemplate)."/startpage.pstpl", $data, __LINE__);
$this->_printTemplateContent(getTemplatePath(Yii::app()->getConfig("defaulttemplate"))."/startpage.pstpl", $data, __LINE__);

$this->_printTemplateContent(getTemplatePath($defaulttemplate)."/surveylist.pstpl", $data, __LINE__);
$this->_printTemplateContent(getTemplatePath(Yii::app()->getConfig("defaulttemplate"))."/surveylist.pstpl", $data, __LINE__);

echo '<script type="text/javascript" >
function sendreq(surveyid)
Expand Down Expand Up @@ -338,14 +334,9 @@ function sendreq(surveyid)
}

//SET THE TEMPLATE DIRECTORY
if (!$thissurvey['templatedir'])
{
$thistpl = getTemplatePath($defaulttemplate);
}
else
{
$thistpl = getTemplatePath($thissurvey['templatedir']);
}

$thistpl = getTemplatePath($thissurvey['templatedir']);


$timeadjust = Yii::app()->getConfig("timeadjust");
//MAKE SURE SURVEY HASN'T EXPIRED
Expand Down

0 comments on commit 67c9baf

Please sign in to comment.