Skip to content

Commit

Permalink
Dev Fixed Scrutinizer issues
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Dec 11, 2017
1 parent 117e5e4 commit a5ce5c6
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 44 deletions.
2 changes: 1 addition & 1 deletion application/controllers/admin/assessments.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function index($iSurveyID)
* Renders template(s) wrapped in header and footer
*
* @param string $sAction Current action, the folder to fetch views from
* @param string|array $aViewUrls View url(s)
* @param array $aViewUrls View url(s)
* @param array $aData Data to be passed on. Optional.
*/
protected function _renderWrappedTemplate($sAction = 'assessments', $aViewUrls = array(), $aData = array())
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/htmleditor_pop.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
class htmleditor_pop extends Survey_Common_Action
{

function index()
public function index()
{
Yii::app()->loadHelper('admin/htmleditor');
$aData = array(
Expand Down
3 changes: 2 additions & 1 deletion application/controllers/admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ class Index extends Survey_Common_Action
{

public function run()
{
{
App()->loadHelper('surveytranslator');
$aData = [];
$aData['issuperadmin'] = false;
if (Permission::model()->hasGlobalPermission('superadmin', 'read')) {
$aData['issuperadmin'] = true;
Expand Down
4 changes: 2 additions & 2 deletions application/core/Survey_Common_Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public function renderInternal($_viewFile_, $_data_ = null, $_return_ = false)
*
* @param string $sAction
* @param array $aViewUrls
* @param array $aData
* @param array|string $aData
* @return string
*/
private function renderCentralContents($sAction, $aViewUrls, $aData = [])
Expand Down Expand Up @@ -312,7 +312,7 @@ private function renderCentralContents($sAction, $aViewUrls, $aData = [])
* Comments starting with //// indicate how it should work in the future
*
* @param string $sAction Current action, the folder to fetch views from
* @param array $aViewUrls View url(s)
* @param array|string $aViewUrls View url(s)
* @param array $aData Data to be passed on. Optional.
*/
protected function _renderWrappedTemplate($sAction = '', $aViewUrls = array(), $aData = array())
Expand Down
67 changes: 28 additions & 39 deletions application/helpers/common_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,22 +163,22 @@ function isStandardTemplate($sTemplateName)
/**
* getSurveyList() Queries the database (survey table) for a list of existing surveys
*
* @param boolean $returnarray if set to true an array instead of an HTML option list is given back
* @param boolean $bReturnArray If set to true an array instead of an HTML option list is given back
* @return string|array This string is returned containing <option></option> formatted list of existing surveys
*
*/
function getSurveyList($returnarray = false, $surveyid = false)
function getSurveyList($bReturnArray = false)
{
static $cached = null;
$bCheckIntegrity = false;
$timeadjust = getGlobalSetting('timeadjust');
App()->setLanguage((isset(Yii::app()->session['adminlang']) ? Yii::app()->session['adminlang'] : 'en'));
$surveynames = array();

if (is_null($cached)) {
$surveyidresult = Survey::model()
->permission(Yii::app()->user->getId())
->findAll();
$surveynames = array();
foreach ($surveyidresult as $result) {
if (!empty($result->defaultlanguage)) {
$surveynames[] = array_merge($result->attributes, $result->defaultlanguage->attributes);
Expand All @@ -200,50 +200,39 @@ function getSurveyList($returnarray = false, $surveyid = false)
$surveynames = $cached;
}
$surveyselecter = "";
if ($returnarray === true) {
if ($bReturnArray === true) {
return $surveynames;
}
$activesurveys = '';
$inactivesurveys = '';
$expiredsurveys = '';
if ($surveynames) {
foreach ($surveynames as $sv) {
foreach ($surveynames as $sv) {

$surveylstitle = flattenText($sv['surveyls_title']);
if (strlen($surveylstitle) > 70) {
$surveylstitle = htmlspecialchars(mb_strcut(html_entity_decode($surveylstitle, ENT_QUOTES, 'UTF-8'), 0, 70, 'UTF-8'))."...";
}
$surveylstitle = flattenText($sv['surveyls_title']);
if (strlen($surveylstitle) > 70) {
$surveylstitle = htmlspecialchars(mb_strcut(html_entity_decode($surveylstitle, ENT_QUOTES, 'UTF-8'), 0, 70, 'UTF-8'))."...";
}

if ($sv['active'] != 'Y') {
$inactivesurveys .= "<option ";
if (Yii::app()->user->getId() == $sv['owner_id']) {
$inactivesurveys .= " class='mysurvey emphasis'";
}
if ($sv['sid'] == $surveyid) {
$inactivesurveys .= " selected='selected'"; $svexist = 1;
}
$inactivesurveys .= " value='{$sv['sid']}'>{$surveylstitle}</option>\n";
} elseif ($sv['expires'] != '' && $sv['expires'] < dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", $timeadjust)) {
$expiredsurveys .= "<option ";
if (Yii::app()->user->getId() == $sv['owner_id']) {
$expiredsurveys .= " class='mysurvey emphasis'";
}
if ($sv['sid'] == $surveyid) {
$expiredsurveys .= " selected='selected'"; $svexist = 1;
}
$expiredsurveys .= " value='{$sv['sid']}'>{$surveylstitle}</option>\n";
} else {
$activesurveys .= "<option ";
if (Yii::app()->user->getId() == $sv['owner_id']) {
$activesurveys .= " class='mysurvey emphasis'";
}
if ($sv['sid'] == $surveyid) {
$activesurveys .= " selected='selected'"; $svexist = 1;
}
$activesurveys .= " value='{$sv['sid']}'>{$surveylstitle}</option>\n";
if ($sv['active'] != 'Y') {
$inactivesurveys .= "<option ";
if (Yii::app()->user->getId() == $sv['owner_id']) {
$inactivesurveys .= " class='mysurvey emphasis'";
}
} // End Foreach
}
$inactivesurveys .= " value='{$sv['sid']}'>{$surveylstitle}</option>\n";
} elseif ($sv['expires'] != '' && $sv['expires'] < dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", $timeadjust)) {
$expiredsurveys .= "<option ";
if (Yii::app()->user->getId() == $sv['owner_id']) {
$expiredsurveys .= " class='mysurvey emphasis'";
}
$expiredsurveys .= " value='{$sv['sid']}'>{$surveylstitle}</option>\n";
} else {
$activesurveys .= "<option ";
if (Yii::app()->user->getId() == $sv['owner_id']) {
$activesurveys .= " class='mysurvey emphasis'";
}
$activesurveys .= " value='{$sv['sid']}'>{$surveylstitle}</option>\n";
}
} // End Foreach

//Only show each activesurvey group if there are some
if ($activesurveys != '') {
Expand Down

0 comments on commit a5ce5c6

Please sign in to comment.