Skip to content

Commit

Permalink
PORT THE FUNCTIONALITY 'QUICK TRANSLATION' TO THE YII PHP FRAMEWORK :…
Browse files Browse the repository at this point in the history
… Done by GCI participant Aaron Schmitz

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_yii@11557 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
sachdeva-shubham committed Dec 1, 2011
1 parent 4e24692 commit a8ab166
Show file tree
Hide file tree
Showing 10 changed files with 220 additions and 211 deletions.
1 change: 1 addition & 0 deletions application/controllers/AdminController.php
Expand Up @@ -127,6 +127,7 @@ public function actions()
'labels' => 'application.controllers.admin.labels',
'templates' => 'application.controllers.admin.templates',
'participants' => 'application.controllers.admin.participantsaction',
'translate' => 'application.controllers.admin.translate',
);
}

Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/htmleditor_pop.php
Expand Up @@ -22,7 +22,7 @@ class htmleditor_pop extends CAction {
function run()
{
$fieldname = $_GET['index'];
foreach($_GET[''] as $key=>$val)
foreach($_GET as $key=>$val)
{
$fieldtext = $key;
$fieldtype = $val;
Expand Down
392 changes: 198 additions & 194 deletions application/controllers/admin/translate.php

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions application/core/Survey_Common_Action.php
Expand Up @@ -594,4 +594,11 @@ function _browsemenubar($surveyid, $title='')

$this->getController()->render("/admin/browse/browsemenubar_view", $data);
}

function _js_admin_includes($include)
{
$js_admin_includes = Yii::app()->getConfig("js_admin_includes");
$js_admin_includes[] = $include;
Yii::app()->setConfig("js_admin_includes", $js_admin_includes);
}
}
6 changes: 2 additions & 4 deletions application/helpers/surveytranslator_helper.php
Expand Up @@ -648,15 +648,13 @@ function aGetDateFormatDataForQid($aQidAttributes, $mThisSurvey)
*/
function aGetDateFormatForSid($surveyid, $languagecode='')
{
$CI =& get_instance();
$CI->load->model('surveys_languagesettings_model');
if (!isset($languagecode) || $languagecode=='')
{
$languagecode=GetBaseLanguageFromSurveyID($surveyid);;
}
$data = $CI->surveys_languagesettings_model->getDateFormat($surveyid,$languagecode);
$data = Survey_languagesettings::model()->getDateFormat($surveyid,$languagecode);
//$query = "SELECT surveyls_dateformat FROM ".db_table_name('surveys').",".db_table_name('surveys_languagesettings')." WHERE sid=$surveyid and surveyls_survey_id=$surveyid and surveyls_language='$languagecode'";
$dateformat = $data->row_array();
$dateformat = $data->readAll();
//$dateformat = $connect->GetOne($query);
if(is_null($dateformat))
{
Expand Down
11 changes: 6 additions & 5 deletions application/models/Surveys_languagesettings.php
Expand Up @@ -65,11 +65,12 @@ function getAllRecords($condition=FALSE)

function getDateFormat($surveyid,$languagecode)
{
$this->db->select('surveyls_dateformat');
$this->db->from('surveys_languagesettings');
$this->db->join('surveys','surveys.sid = surveys_languagesettings.surveyls_survey_id AND surveyls_survey_id = '.$surveyid);
$this->db->where('surveyls_language = \''.$languagecode.'\'');
return $this->db->get();
$query=Yii::app()->db->createCommand();
$query->select('surveyls_dateformat');
$query->from('{{surveys_languagesettings}}');
$query->join('surveys','surveys.sid = surveys_languagesettings.surveyls_survey_id AND surveyls_survey_id = '.$surveyid);
$query->where('surveyls_language = \''.$languagecode.'\'');
return $query->query();
}

function getAllSurveys($hasPermission = FALSE)
Expand Down
2 changes: 0 additions & 2 deletions application/views/admin/translate/translatefields_view.php
@@ -1,7 +1,5 @@
<?php if (strlen(trim((string)$textfrom)) > 0)
{
$all_fields_empty = FALSE;
$evenRow = !($evenRow);
// Display translation fields
echo translate::displayTranslateFields($surveyid, $gid, $qid, $type,
$amTypeOptions, $baselangdesc, $tolangdesc, $textfrom, $textto, $i, $rowfrom, $evenRow);
Expand Down
@@ -1,12 +1,12 @@
<div id="translationloading" style="width: 100%; font-weight: bold; color: #000; text-align: center;"><br /><?php echo $clang->gT("Loading translations");?><br /><br /></div>

<form name='translateform' method='post' action='<?php echo site_url("admin/translate/$surveyid/$tolang");?>' id='translateform' >
<form name='translateform' method='post' action='<?php echo $this->createUrl("admin/translate/surveyid/$surveyid/lang/$tolang");?>' id='translateform' >
<input type='hidden' name='sid' value='<?php echo $surveyid;?>' />
<input type='hidden' name='action' value='translate' />
<input type='hidden' name='actionvalue' value='translateSave' />
<input type='hidden' name='tolang' value='<?php echo $tolang;?>' />
<input type='hidden' name='baselang' value='<?php echo $baselang;?>' />
<input type='hidden' name='checksessionbypost' value='<?php echo $this->session->userdata('checksessionpost');?>' />
<input type='hidden' name='checksessionbypost' value='<?php echo Yii::app()->session['checksessionpost'];?>' />

<script type="text/javascript">
sGoogleApiError = "<?php echo $clang->gT("There was an error using the Google API.");?>";
Expand Down
2 changes: 1 addition & 1 deletion application/views/admin/translate/translateheader_view.php
@@ -1,4 +1,4 @@
<form name='translatemenu' id='translatemenu' action='<?php echo site_url("admin/translate/$surveyid/$tolang");?>' method='get' >
<form name='translatemenu' id='translatemenu' action='<?php echo $this->createUrl("admin/translate/surveyid/$surveyid/lang/$tolang");?>' method='get' >
<?php echo translate::showTranslateAdminmenu($surveyid, $survey_title, $tolang); ?>
</form>

Expand Down
4 changes: 2 additions & 2 deletions application/views/admin/translate/translatetabs_view.php
@@ -1,7 +1,7 @@
<div id='tab-<?php echo $type;?>'>
<?php echo PrepareEditorScript(); ?>
<?php echo PrepareEditorScript(true, $this); ?>

<div class='translate'>
<input type='button' class='auto-trans' value='<?php echo $clang->gT("Auto Translate");?>' id='auto-trans-tab-<?php echo $type;?>' />
<img src='<?php echo $this->config->item("imageurl");?>/ajax-loader.gif' style='display: none' class='ajax-loader' alt='<?php echo $clang->gT("Loading...");?>' />
<img src='<?php echo Yii::app()->getConfig("imageurl");?>/ajax-loader.gif' style='display: none' class='ajax-loader' alt='<?php echo $clang->gT("Loading...");?>' />
<?php echo translate::displayTranslateFieldsHeader($baselangdesc, $tolangdesc); ?>

0 comments on commit a8ab166

Please sign in to comment.