Skip to content

Commit

Permalink
Dev : replaced png by font icons
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Oct 21, 2015
1 parent 6419b20 commit 49df2f8
Show file tree
Hide file tree
Showing 67 changed files with 1,794 additions and 3,740 deletions.
41 changes: 19 additions & 22 deletions application/controllers/admin/conditionsaction.php
Expand Up @@ -35,21 +35,21 @@ function index($subaction, $iSurveyID=null, $gid=null, $qid=null)
$aData['title_bar']['title'] = $surveyinfo['surveyls_title']."(".gT("ID").":".$iSurveyID.")";
$aData['questionbar']['closebutton']['url'] = 'admin/questions/sa/view/surveyid/'.$iSurveyID.'/gid/'.$gid.'/qid/'.$qid;
$aData['questionbar']['buttons']['conditions'] = TRUE;

switch($subaction)
{
case 'editconditionsform':
$aData['questionbar']['buttons']['condition']['edit'] = TRUE;
$aData['questionbar']['buttons']['condition']['edit'] = TRUE;
break;

case 'conditions':
$aData['questionbar']['buttons']['condition']['conditions'] = TRUE;
$aData['questionbar']['buttons']['condition']['conditions'] = TRUE;
break;

case 'copyconditionsform':
$aData['questionbar']['buttons']['condition']['copyconditionsform'] = TRUE;
break;

default:
$aData['questionbar']['buttons']['condition']['edit'] = TRUE;
break;
Expand Down Expand Up @@ -521,7 +521,7 @@ function index($subaction, $iSurveyID=null, $gid=null, $qid=null)
}
else
{

$CopyConditionsMessage = CHtml::tag('div', array('class'=>'successheader'),
'('.gT("Condition successfully copied").')'
);
Expand Down Expand Up @@ -1250,16 +1250,12 @@ function index($subaction, $iSurveyID=null, $gid=null, $qid=null)
$subaction == "deletescenario" || $subaction == "delete")
)
{
$img_tag = CHtml::image($imageurl.'/scenario_delete.png', gT("Delete this scenario"), array(
'name'=>'DeleteWholeGroup'
));
$img_tag = '<span class="glyphicon glyphicon-trash"></span>';
$additional_main_content = CHtml::link($img_tag, '#', array(
'onclick' => "if ( confirm('".gT("Are you sure you want to delete all conditions set in this scenario?", "js")."')) { document.getElementById('deletescenario{$scenarionr['scenario']}').submit();}"
));

$img_tag = CHtml::image($imageurl.'/scenario_edit.png', gT("Edit scenario"), array(
'name'=>'DeleteWholeGroup'
));
$img_tag = '<span class="glyphicon glyphicon-pencil"></span>';
$additional_main_content .= CHtml::link($img_tag, '#', array(
'id' => 'editscenariobtn'.$scenarionr['scenario'],
'onclick' => "$('#editscenario{$scenarionr['scenario']}').toggle('slow');"
Expand Down Expand Up @@ -1346,9 +1342,9 @@ function index($subaction, $iSurveyID=null, $gid=null, $qid=null)

$conditionscount=$conditionscount+$conditionscounttoken;

////////////////// BUILD CONDITIONS DISPLAY


////////////////// BUILD CONDITIONS DISPLAY
if ($conditionscount > 0)
{
$aConditionsMerged=Array();
Expand Down Expand Up @@ -1627,8 +1623,8 @@ function index($subaction, $iSurveyID=null, $gid=null, $qid=null)

}
//END DISPLAY CONDITIONS FOR THIS QUESTION
//// NICE COMMENTS : but a subaction copy would be even nicer

//// NICE COMMENTS : but a subaction copy would be even nicer

// BEGIN: DISPLAY THE COPY CONDITIONS FORM
if ($subaction == "copyconditionsform" || $subaction == "copyconditions")
Expand Down Expand Up @@ -1753,8 +1749,9 @@ function index($subaction, $iSurveyID=null, $gid=null, $qid=null)
if ( ( $subaction != "editthiscondition" && isset($scenariocount) && ($scenariocount == 1 || $scenariocount==0)) ||
( $subaction == "editthiscondition" && isset($scenario) && $scenario == 1) )
{
$scenarioAddBtn = "\t<a id='scenarioaddbtn' href='#' onclick=\"$('#scenarioaddbtn').hide();$('#defaultscenariotxt').hide('slow');$('#scenario').show('slow');\">"
."<img src='$imageurl/plus.png' alt='".gT('Add scenario')."' /></a>\n";
$scenarioAddBtn =
"\t<a id='scenarioaddbtn' href='#' onclick=\"$('#scenarioaddbtn').hide();$('#defaultscenariotxt').hide('slow');$('#scenario').show('slow');\">"
."<span class='icon-add'></span></a>\n";
$scenarioTxt = "<span id='defaultscenariotxt'>".gT("Default scenario")."</span>";
$scenarioInputStyle = "style = 'display: none;'";
}
Expand Down Expand Up @@ -2114,7 +2111,7 @@ function index($subaction, $iSurveyID=null, $gid=null, $qid=null)
$this->_renderWrappedTemplate('conditions', $aViewUrls, $aData);

// TMSW Condition->Relevance: Must call LEM->ConvertConditionsToRelevance() whenever Condition is added or updated - what is best location for that action?
}

private function _showSpeaker($hinttext)
Expand All @@ -2140,7 +2137,7 @@ private function _showSpeaker($hinttext)
$reshtml= "<span style='cursor: hand' alt='".$htmlhinttext."' title='".$htmlhinttext."' "
." onclick=\"alert('".gT("Question","js").": $jshinttext')\" />"
." \"$shortstring...\" </span>"
."<img style='cursor: hand' src='$imageurl/speaker.png' align='bottom' alt='$htmlhinttext' title='$htmlhinttext' "
."<span class='fa fa-commenting-o text-success' style='cursor: hand' title='".$htmlhinttext."'></span>"
." onclick=\"alert('".gT("Question","js").": $jshinttext')\" />";
}
else
Expand Down
54 changes: 27 additions & 27 deletions application/controllers/admin/quotas.php
Expand Up @@ -95,13 +95,13 @@ function index($iSurveyId, $quickreport = false)

$aData['sidebar']['state'] = "close";
$surveyinfo = Survey::model()->findByPk($iSurveyID)->surveyinfo;
$aData['title_bar']['title'] = $surveyinfo['surveyls_title']."(".gT("ID").":".$iSurveyID.")";
$aData['title_bar']['title'] = $surveyinfo['surveyls_title']."(".gT("ID").":".$iSurveyID.")";

//$aData['surveybar']['active_survey_properties'] = 'quotas';
$aData['surveybar']['buttons']['view']= TRUE;
$aData['surveybar']['active_survey_properties']['img'] = 'quota.png';
$aData['surveybar']['active_survey_properties']['txt'] = gT("Quotas");
$aData['surveybar']['closebutton']['url'] = 'admin/survey/sa/view/surveyid/'.$iSurveyID;
$aData['surveybar']['active_survey_properties']['img'] = 'quota';
$aData['surveybar']['active_survey_properties']['txt'] = gT("Quotas");
$aData['surveybar']['closebutton']['url'] = 'admin/survey/sa/view/surveyid/'.$iSurveyID;

$totalquotas = 0;
$totalcompleted = 0;
Expand All @@ -116,11 +116,11 @@ function index($iSurveyId, $quickreport = false)
$aResult = Quota::model()->findAll($criteria);

//if there are quotas let's proceed
$aViewUrls['output'] = '';
$aViewUrls['output'] = '';
if (count($aResult) > 0)
{
$aData['output'] = '';

//loop through all quotas
foreach ($aResult as $aQuotaListing)
{
Expand All @@ -142,7 +142,7 @@ function index($iSurveyId, $quickreport = false)
$aData['totalcompleted'] = $totalcompleted;
$aViewUrls['output'] .= $this->getController()->renderPartial("/admin/quotas/viewquotasrow_view", $aData, true);
$aData['output'] .= $this->getController()->renderPartial("/admin/quotas/viewquotasrow_view", $aData, true);

//check how many sub-elements exist for a certain quota
$aResults2 = QuotaMember::model()->findAllByAttributes(array('quota_id' => $aQuotaListing['id']));

Expand All @@ -155,7 +155,7 @@ function index($iSurveyId, $quickreport = false)
$aViewUrls['output'] .= $this->getController()->renderPartial('/admin/quotas/viewquotasrowsub_view', $aData, true);
//$aData['output'] .= $this->getController()->renderPartial('/admin/quotas/viewquotasrowsub_view', $aData, true);
}

}
}
else
Expand All @@ -176,9 +176,9 @@ function index($iSurveyId, $quickreport = false)
}
else
{

//// WHY ???????
header("Content-Disposition: attachment; filename=results-survey" . $iSurveyId . ".csv");
header("Content-type: text/comma-separated-values; charset=UTF-8");
header("Pragma: public");
Expand Down Expand Up @@ -385,11 +385,11 @@ function editquota($iSurveyId)

$aData['sidebar']['state'] = "close";
$surveyinfo = Survey::model()->findByPk($iSurveyId)->surveyinfo;
$aData['title_bar']['title'] = $surveyinfo['surveyls_title']."(".gT("ID").":".$iSurveyId.")";
$aData['title_bar']['title'] = $surveyinfo['surveyls_title']."(".gT("ID").":".$iSurveyId.")";

//$aData['surveybar']['active_survey_properties'] = 'quotas';
$aData['surveybar']['closebutton']['url'] = 'admin/quotas/sa/index/surveyid/'.$iSurveyId;
$aData['surveybar']['savebutton']['form'] = 'frmeditgroup';
$aData['surveybar']['savebutton']['form'] = 'frmeditgroup';

$this->_renderWrappedTemplate('quotas', $aViewUrls, $aData);
}
Expand Down Expand Up @@ -419,7 +419,7 @@ function new_answer($iSurveyId, $sSubAction = 'new_answer')
{
$aData['newanswer_result'] = $result;
$aData['quota_name'] = $quota_name;

$aViewUrls[] = 'newanswer_view';
}
}
Expand Down Expand Up @@ -447,10 +447,10 @@ function new_answer($iSurveyId, $sSubAction = 'new_answer')

$aData['sidebar']['state'] = "close";
$surveyinfo = Survey::model()->findByPk($iSurveyId)->surveyinfo;
$aData['title_bar']['title'] = $surveyinfo['surveyls_title']."(".gT("ID").":".$iSurveyId.")";
$aData['title_bar']['title'] = $surveyinfo['surveyls_title']."(".gT("ID").":".$iSurveyId.")";
$aData['surveybar']['savebutton']['form'] = 'frmeditgroup';
$aData['surveybar']['closebutton']['url'] = 'admin/quotas/sa/index/surveyid/'.$iSurveyId;
$aData['surveybar']['closebutton']['url'] = 'admin/quotas/sa/index/surveyid/'.$iSurveyId;

$this->_renderWrappedTemplate('quotas', $aViewUrls, $aData);
}

Expand All @@ -466,15 +466,15 @@ function newquota($iSurveyId)

$aData['sidebar']['state'] = "close";
$surveyinfo = Survey::model()->findByPk($iSurveyId)->surveyinfo;
$aData['title_bar']['title'] = $surveyinfo['surveyls_title']."(".gT("ID").":".$iSurveyId.")";
$aData['title_bar']['title'] = $surveyinfo['surveyls_title']."(".gT("ID").":".$iSurveyId.")";
$aData['surveybar']['savebutton']['form'] = 'frmeditgroup';
$aData['surveybar']['closebutton']['url'] = 'admin/quotas/sa/index/surveyid/'.$iSurveyId;
$aData['surveybar']['closebutton']['url'] = 'admin/quotas/sa/index/surveyid/'.$iSurveyId;

$this->_renderWrappedTemplate('quotas', 'newquota_view', $aData);
}

/**
*
*
* @param type $iQuestionId
* @param type $iSurveyId
* @param type $iQuotaId
Expand All @@ -488,8 +488,8 @@ function getQuotaAnswers($iQuestionId, $iSurveyId, $iQuotaId)
$aData = $this->_getData($iSurveyId);
$sBaseLang = $aData['sBaseLang'];
$this->_checkPermissions($iSurveyId, 'read');


$aQuestion = Question::model()->findByPk(array('qid' => $iQuestionId, 'language' => $sBaseLang));
$aQuestionType = $aQuestion['type'];

Expand All @@ -510,16 +510,16 @@ function getQuotaAnswers($iQuestionId, $iSurveyId, $iQuotaId)
'F' => array('Title' => $aQuestion['title'], 'Display' => gT("Female"), 'code' => 'F'));
} elseif ($aQuestionType == 'L' || $aQuestionType == 'O' || $aQuestionType == '!')
{

$aAnsResults = Answer::model()->findAllByAttributes(array('qid' => $iQuestionId, 'language' => $sBaseLang));

$aAnswerList = array();

foreach ($aAnsResults as $aDbAnsList)
foreach ($aAnsResults as $aDbAnsList)
{
$aAnswerList[$aDbAnsList['code']] = array('Title' => $aQuestion['title'], 'Display' => substr($aDbAnsList['answer'], 0, 40), 'code' => $aDbAnsList['code']);
}

} elseif ($aQuestionType == 'A')
{
$aAnsResults = Question::model()->findAllByAttributes(array('parent_qid' => $iQuestionId));
Expand Down Expand Up @@ -568,7 +568,7 @@ function getQuotaAnswers($iQuestionId, $iSurveyId, $iQuotaId)
if (empty($aAnswerList))
{
return array();
}
}
else
{
// Now we mark answers already used in this quota as such
Expand Down
39 changes: 21 additions & 18 deletions application/controllers/admin/responses.php
Expand Up @@ -286,7 +286,7 @@ public function view($iSurveyID, $iId, $sBrowseLang = '')
$aData['sidebar']['state'] = "close";
$aData['menu']['edition'] = true;
$aData['menu']['view'] = true;
$aData['menu']['close'] = true;
$aData['menu']['close'] = true;

$this->_renderWrappedTemplate('',$aViewUrls, $aData);
}
Expand Down Expand Up @@ -349,9 +349,9 @@ function browse($iSurveyId)
App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('adminscripts') . "listresponse.js");

$aData = $this->_getData($iSurveyId);

$aData['menu']['edition'] = false;

extract($aData);
$aViewUrls = array();
$sBrowseLanguage = $aData['language'];
Expand Down Expand Up @@ -562,7 +562,7 @@ function browse($iSurveyId)
'hidden' => (bool)$bHidden,
'title' => $text,
);

}

$column_model_txt = ls_json_encode($column_model);
Expand All @@ -588,7 +588,7 @@ function browse($iSurveyId)

}


/**
* Returns survey responses in json format for a given survey
*
Expand Down Expand Up @@ -711,19 +711,22 @@ public function getResponses_json($iSurveyID)
$dtresult = SurveyDynamic::model($iSurveyID)->findAllAsArray($oCriteria);
$all_rows = array();
foreach ($dtresult as $row) {
$action_html = "<a href='" . Yii::app()->createUrl("admin/responses/view/surveyid/$surveyid/id/{$row['id']}") . "'><img src='" . $sImageURL . "token_viewanswer.png' alt='" . gT('View response details') . "'/></a>";
$action_html = "<a href='" . Yii::app()->createUrl("admin/responses/view/surveyid/$surveyid/id/{$row['id']}") . "'>";
$action_html += "<span class='glyphicon glyphicon-list-alt text-success' title='" . gT('View response details') . "'></span></a>";
if (Permission::model()->hasSurveyPermission($iSurveyID,'responses','update')) {
$action_html .= "<a href='" . Yii::app()->createUrl("admin/dataentry/editdata/subaction/edit/surveyid/{$surveyid}/id/{$row['id']}") . "'><img src='" . $sImageURL . "edit.png' alt='" . gT('Edit this response') . "'/></a>";
$action_html .= "<a href='" . Yii::app()->createUrl("admin/dataentry/editdata/subaction/edit/surveyid/{$surveyid}/id/{$row['id']}") . "'>
<span class='glyphicon glyphicon-pencil text-success' title='" . gT('Edit this response') . "'></span></a>";
}
if (hasFileUploadQuestion($surveyid)) {
if(Response::model($surveyid)->findByPk($row['id'])->getFiles())
$action_html .= CHtml::link(
CHtml::image("{$sImageURL}down.png",gT('Download all files in this response as a zip file'),array("class"=>"downloadfile")),
CHtml::tag('span', array('class'=>'glyphicon glyphicon-download-alt downloadfile'),gT('Download all files in this response as a zip file')),
Yii::app()->createUrl("admin/responses",array("sa"=>"actionDownloadfiles","surveyid"=>$surveyid,"sResponseId"=>$row['id']))
);
}
if (Permission::model()->hasSurveyPermission($iSurveyID,'responses','delete')) {
$action_html .= "<a href='".Yii::app()->createUrl("admin/responses",array("sa"=>"actionDelete","surveyid"=>$surveyid,"sResponseId"=>$row['id']))."' data-delete='".$row['id']."'><img src='" . $sImageURL . "delete.png' alt='" . sprintf(gT('Delete response %s'),$row['id']) . "' class='deleteresponse'/></a>";
$action_html .= "<a href='".Yii::app()->createUrl("admin/responses",array("sa"=>"actionDelete","surveyid"=>$surveyid,"sResponseId"=>$row['id']))."' data-delete='".$row['id']."'>
<span title='" . sprintf(gT('Delete response %s'),$row['id']) . "' class='deleteresponse glyphicon glyphicon-trash text-warning'></span></a>";
}

$aSurveyEntry = array();
Expand Down Expand Up @@ -792,8 +795,8 @@ public function getResponses_json($iSurveyID)
echo json_encode($aSurveyEntries);
Yii::app()->end();
}


/**
* Saves the hidden columns for response browsing in the session
*
Expand All @@ -805,12 +808,12 @@ public function setHiddenColumns($iSurveyId)
{
if(Permission::model()->hasSurveyPermission($iSurveyId,'responses','read'))
{
$aHiddenFields=explode('|',Yii::app()->request->getPost('aHiddenFields'));
$aHiddenFields=explode('|',Yii::app()->request->getPost('aHiddenFields'));
$_SESSION['survey_'.$iSurveyId]['HiddenFields']=$aHiddenFields;
}
}


/**
* Do an actions on response
*
Expand Down Expand Up @@ -895,7 +898,7 @@ public function actionDownloadfile($iSurveyId,$iResponseId,$sFileName)
Yii::app()->setFlashMessage(gT("Sorry, this file was not found."),'error');
$this->getController()->redirect(array("admin/responses","sa"=>"browse","surveyid"=>$surveyid));
}

}

/**
Expand Down Expand Up @@ -1389,9 +1392,9 @@ protected function _renderWrappedTemplate($sAction='', $aViewUrls = array(), $aD
$aData['display']['menu_bars']['browse'] = gT('Browse responses'); // browse is independent of the above

$surveyinfo = Survey::model()->findByPk($iSurveyId)->surveyinfo;
$aData["surveyinfo"] = $surveyinfo;
$aData['title_bar']['title'] = gT('Browse responses').': '.$surveyinfo['surveyls_title'];
$aData["surveyinfo"] = $surveyinfo;
$aData['title_bar']['title'] = gT('Browse responses').': '.$surveyinfo['surveyls_title'];

parent::_renderWrappedTemplate('responses', $aViewUrls, $aData);
}

Expand Down

0 comments on commit 49df2f8

Please sign in to comment.