Skip to content

Commit

Permalink
Remove $this->yii and $this->controller usage in surveyaction and labels
Browse files Browse the repository at this point in the history
git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_yii@11793 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
GautamGupta committed Dec 28, 2011
1 parent 59ccdad commit 9cb3b0f
Show file tree
Hide file tree
Showing 2 changed files with 277 additions and 288 deletions.
78 changes: 39 additions & 39 deletions application/controllers/admin/labels.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,16 @@ public function run($sa)
*/
public function importlabelresources()
{
$clang = $this->controller->lang;
$clang = $this->getController()->lang;
$action = returnglobal('action');
$lid = returnglobal('lid');
$this->controller->_getAdminHeader();
$this->getController()->_getAdminHeader();
$this->_labelsetbar();

if ($action == "importlabelresources" && $lid)
{
if (Yii::app()->getConfig('demoMode'))
$this->controller->error($clang->gT("Demo mode only: Uploading files is disabled in this system."));
$this->getController()->error($clang->gT("Demo mode only: Uploading files is disabled in this system."));

Yii::import('application.libraries.admin.Phpzip');

Expand All @@ -82,7 +82,7 @@ public function importlabelresources()
$destdir = $basedestdir . "/$lid/";

if (!is_writeable($basedestdir))
$this->controller->error(sprintf($clang->gT("Incorrect permissions in your %s folder."), $basedestdir));
$this->getController()->error(sprintf($clang->gT("Incorrect permissions in your %s folder."), $basedestdir));

if (!is_dir($destdir))
mkdir($destdir);
Expand All @@ -95,7 +95,7 @@ public function importlabelresources()
$importlabelresourcesoutput .= $clang->gT("Reading file..") . "<br /><br />\n";

if ($z->extract($extractdir, $zipfile) != 'OK')
$this->controller->error($clang->gT("This file is not a valid ZIP file archive. Import failed."));
$this->getController()->error($clang->gT("This file is not a valid ZIP file archive. Import failed."));

// now read tempdir and copy authorized files only
$dh = opendir($extractdir);
Expand Down Expand Up @@ -149,21 +149,21 @@ public function importlabelresources()
rmdir($extractdir);

if (is_null($aErrorFilesInfo) && is_null($aImportedFilesInfo))
$this->controller->error($clang->gT("This ZIP archive contains no valid Resources files. Import failed.") . '<br /><br />' . $clang->gT("Remember that we do not support subdirectories in ZIP archives."));
$this->getController()->error($clang->gT("This ZIP archive contains no valid Resources files. Import failed.") . '<br /><br />' . $clang->gT("Remember that we do not support subdirectories in ZIP archives."));
}
else
$this->controller->error(sprintf($clang->gT("An error occurred uploading your file. This may be caused by incorrect permissions in your %s folder."), $basedestdir));
$this->getController()->error(sprintf($clang->gT("An error occurred uploading your file. This may be caused by incorrect permissions in your %s folder."), $basedestdir));

$this->controller->render('/admin/labels/importlabelresources_view', array(
$this->getController()->render('/admin/labels/importlabelresources_view', array(
'clang' => $clang,
'aErrorFilesInfo' => $aErrorFilesInfo,
'aImportedFilesInfo' => $aImportedFilesInfo,
));
}

$this->controller->_loadEndScripts();
$this->getController()->_loadEndScripts();

$this->controller->_getAdminFooter("http://docs.limesurvey.org", $clang->gT("LimeSurvey online manual"));
$this->getController()->_getAdminFooter("http://docs.limesurvey.org", $clang->gT("LimeSurvey online manual"));
}

/**
Expand Down Expand Up @@ -197,9 +197,9 @@ protected function _tempdir($dir, $prefix='', $mode=0700)
*/
public function import()
{
$clang = $this->controller->lang;
$clang = $this->getController()->lang;
$action = returnglobal('action');
$this->controller->_getAdminHeader();
$this->getController()->_getAdminHeader();
$this->_labelsetbar();

if ($action == 'importlabels')
Expand All @@ -211,7 +211,7 @@ public function import()
$sExtension = !empty($aPathInfo['extension']) ? $aPathInfo['extension'] : '';

if (!@move_uploaded_file($_FILES['the_file']['tmp_name'], $sFullFilepath))
$this->controller->error(sprintf($clang->gT("An error occurred uploading your file. This may be caused by incorrect permissions in your %s folder."), Yii::app()->getConfig('tempdir')));
$this->getController()->error(sprintf($clang->gT("An error occurred uploading your file. This may be caused by incorrect permissions in your %s folder."), Yii::app()->getConfig('tempdir')));

$options['checkforduplicates'] = 'off';
if (isset($_POST['checkforduplicates']))
Expand All @@ -222,18 +222,18 @@ public function import()
elseif (strtolower($sExtension) == 'lsl')
$aImportResults = XMLImportLabelsets($sFullFilepath, $options);
else
$this->controller->error($clang->gT("Uploaded label set file needs to have an .lsl extension."));
$this->getController()->error($clang->gT("Uploaded label set file needs to have an .lsl extension."));

unlink($sFullFilepath);

$this->controller->render('/admin/labels/import_view', array(
$this->getController()->render('/admin/labels/import_view', array(
'aImportResults' => $aImportResults,
'clang' => $clang,
));
}
$this->controller->_loadEndScripts();
$this->getController()->_loadEndScripts();

$this->controller->_getAdminFooter("http://docs.limesurvey.org", $clang->gT("LimeSurvey online manual"));
$this->getController()->_getAdminFooter("http://docs.limesurvey.org", $clang->gT("LimeSurvey online manual"));
}

/**
Expand All @@ -249,9 +249,9 @@ public function index($action, $lid=0)
$lid = sanitize_int($lid);

Yii::app()->loadHelper('surveytranslator');
$clang = $this->controller->lang;
$clang = $this->getController()->lang;

$this->controller->_getAdminHeader();
$this->getController()->_getAdminHeader();
$this->_labelsetbar($lid);

if (Yii::app()->session['USER_RIGHT_SUPERADMIN'] == 1 || Yii::app()->session['USER_RIGHT_MANAGE_LABEL'] == 1)
Expand Down Expand Up @@ -294,12 +294,12 @@ public function index($action, $lid=0)
$data['panecookie'] = $panecookie;
$data['tabitem'] = $tabitem;

$this->controller->render('/admin/labels/editlabel_view', $data);
$this->getController()->render('/admin/labels/editlabel_view', $data);
}

$this->controller->_loadEndScripts();
$this->getController()->_loadEndScripts();

$this->controller->_getAdminFooter("http://docs.limesurvey.org", $this->controller->lang->gT("LimeSurvey online manual"));
$this->getController()->_getAdminFooter("http://docs.limesurvey.org", $this->getController()->lang->gT("LimeSurvey online manual"));
}

/**
Expand All @@ -316,15 +316,15 @@ public function view($lid = 0)
$lid = sanitize_int($lid);

// Gets the current language
$clang = $this->controller->lang;
$clang = $this->getController()->lang;
$action = 'labels';

// Loads admin header
$this->controller->_getAdminHeader();
$this->getController()->_getAdminHeader();

// Includes some javascript files
$this->controller->_js_admin_includes(Yii::app()->baseUrl . '/scripts/admin/labels.js');
$this->controller->_js_admin_includes(Yii::app()->baseUrl . '/scripts/admin/updateset.js');
$this->getController()->_js_admin_includes(Yii::app()->baseUrl . '/scripts/admin/labels.js');
$this->getController()->_js_admin_includes(Yii::app()->baseUrl . '/scripts/admin/updateset.js');

// Checks if user have the sufficient rights to manage the labels
if (Yii::app()->session['USER_RIGHT_SUPERADMIN'] == 1 || Yii::app()->session['USER_RIGHT_MANAGE_LABEL'] == 1)
Expand All @@ -346,7 +346,7 @@ public function view($lid = 0)
$data['row'] = $result->attributes;

// Display a specific labelbar menu
$this->controller->render("/admin/labels/labelbar_view", $data);
$this->getController()->render("/admin/labels/labelbar_view", $data);

$rwlabelset = $result;

Expand Down Expand Up @@ -387,7 +387,7 @@ public function view($lid = 0)
$i++;
}

$this->controller->render('/admin/labels/labelview_view', array(
$this->getController()->render('/admin/labels/labelview_view', array(
'results' => $results,
'lslanguages' => $lslanguages,
'clang' => $clang,
Expand All @@ -399,9 +399,9 @@ public function view($lid = 0)
}
}

$this->controller->_loadEndScripts();
$this->getController()->_loadEndScripts();

$this->controller->_getAdminFooter("http://docs.limesurvey.org", $clang->gT("LimeSurvey online manual"));
$this->getController()->_getAdminFooter("http://docs.limesurvey.org", $clang->gT("LimeSurvey online manual"));
}

/**
Expand Down Expand Up @@ -436,9 +436,9 @@ public function process()
$lid = 0;

if ($lid)
$this->controller->redirect($this->controller->createUrl("admin/labels/sa/view/lid/" . $lid));
$this->getController()->redirect($this->getController()->createUrl("admin/labels/sa/view/lid/" . $lid));
else
$this->controller->redirect($this->controller->createUrl("admin/labels/sa/view"));
$this->getController()->redirect($this->getController()->createUrl("admin/labels/sa/view"));
}
}

Expand All @@ -450,13 +450,13 @@ public function process()
*/
public function exportmulti()
{
$this->controller->_getAdminHeader();
$this->getController()->_getAdminHeader();
$this->_labelsetbar(0);
$this->controller->_js_admin_includes(Yii::app()->baseUrl . 'scripts/admin/labels.js');
$data['clang'] = $this->controller->lang;
$this->getController()->_js_admin_includes(Yii::app()->baseUrl . 'scripts/admin/labels.js');
$data['clang'] = $this->getController()->lang;
$data['labelsets'] = getlabelsets();
$this->controller->render('/admin/labels/exportmulti_view', $data);
$this->controller->_getAdminFooter("http://docs.limesurvey.org", $this->controller->lang->gT("LimeSurvey online manual"));
$this->getController()->render('/admin/labels/exportmulti_view', $data);
$this->getController()->_getAdminFooter("http://docs.limesurvey.org", $this->getController()->lang->gT("LimeSurvey online manual"));
}

/**
Expand All @@ -469,9 +469,9 @@ public function exportmulti()
protected function _labelsetbar($lid = 0)
{
$lid = (int) $lid;
$data['clang'] = $this->controller->lang;
$data['clang'] = $this->getController()->lang;
$data['lid'] = $lid;
$data['labelsets'] = getlabelsets();
$this->controller->render("/admin/labels/labelsetsbar_view",$data);
$this->getController()->render("/admin/labels/labelsetsbar_view",$data);
}
}
Loading

0 comments on commit 9cb3b0f

Please sign in to comment.