/** * Translation helper function for plural forms * @param string $sToTranslate * @param integer $iCount * @param string $sEscapeMode */ function ngT($sTextToTranslate, $iCount, $sEscapeMode = 'html') { return quoteText(Yii::t('', $sTextToTranslate, $iCount), $sEscapeMode); }
if ($bHaveToken) { $aColumns[] = array('header' => 'token', 'name' => 'token', 'type' => 'raw', 'value' => '$data->tokenForGrid'); $aColumns[] = array('header' => gT("First name"), 'name' => 'tokens.firstname', 'id' => 'firstname', 'type' => 'raw', 'value' => '$data->firstNameForGrid', 'filter' => TbHtml::textField('SurveyDynamic[firstname_filter]', $model->firstname_filter)); $aColumns[] = array('header' => gT("Last name"), 'name' => 'tokens.lastname', 'type' => 'raw', 'id' => 'lastname', 'value' => '$data->lastNameForGrid', 'filter' => TbHtml::textField('SurveyDynamic[lastname_filter]', $model->lastname_filter)); $aColumns[] = array('header' => gT("Email"), 'name' => 'tokens.email', 'id' => 'email', 'filter' => TbHtml::textField('SurveyDynamic[email_filter]', $model->email_filter)); } $aColumns[] = array('header' => 'startlanguage', 'name' => 'startlanguage'); // The column model must be built dynamically, since the columns will differ from survey to survey, depending on the questions. // All other columns are based on the questions. // An array to control unicity of $code (EM code) foreach ($model->metaData->columns as $column) { if (!in_array($column->name, $aDefaultColumns)) { $colName = viewHelper::getFieldCode($fieldmap[$column->name], array('LEMcompat' => true)); // This must be unique ...... $base64jsonFieldMap = base64_encode(json_encode($fieldmap[$column->name])); $aColumns[] = array('header' => '<span data-toggle="tooltip" data-placement="bottom" title="' . quoteText(strip_tags($fieldmap[$column->name]['question'])) . '">' . $colName . ' <br/> ' . ellipsize($fieldmap[$column->name]['question'], $model->ellipsize_header_value) . '</span>', 'headerHtmlOptions' => array('style' => 'min-width: 350px;'), 'name' => $column->name, 'type' => 'raw', 'value' => '$data->getExtendedData("' . $column->name . '", "' . $language . '", "' . $base64jsonFieldMap . '")'); } } $this->widget('bootstrap.widgets.TbGridView', array('dataProvider' => $model->search(), 'filter' => $model, 'columns' => $aColumns, 'itemsCssClass' => 'table-striped', 'id' => 'responses-grid', 'ajaxUpdate' => true, 'ajaxType' => 'POST', 'afterAjaxUpdate' => 'bindScrollWrapper', 'template' => "{items}\n<div id='ListPager'><div class=\"col-sm-4\" id=\"massive-action-container\">{$massiveAction}</div><div class=\"col-sm-4 pager-container \">{pager}</div><div class=\"col-sm-4 summary-container\">{summary}</div></div>", 'summaryText' => gT('Displaying {start}-{end} of {count} result(s).') . ' ' . sprintf(gT('%s rows per page'), CHtml::dropDownList('pageSize', $pageSize, Yii::app()->params['pageSizeOptions'], array('class' => 'changePageSize form-control', 'style' => 'display: inline; width: auto'))))); ?> </div> <!-- To update rows per page via ajax --> <script type="text/javascript"> jQuery(function($) { jQuery(document).on("change", '#pageSize', function(){ $.fn.yiiGridView.update('responses-grid',{ data:{ pageSize: $(this).val() }}); }); }); </script> </div>
</div> </div> </div> </div> <!-- container end --> </section> <!-- WELCOME SECTION --> <section id="welcome"> <!-- <div class="container"> --> <!-- <div class="row quote-text"> <h3>"<?php quoteText(); ?> " -<?php quoteAuthor(); ?> </h3> </div> --> <div class="row about_me"> <div class="col-sm-6 col-sm-offset-3"> <h2>About</h2> <img src="<?php aboutPicture(); ?> " alt="Profile Picture Missing" /> </div>
public function getExtendedData($colName, $sLanguage, $base64jsonFieldMap) { $oFieldMap = json_decode(base64_decode($base64jsonFieldMap)); $value = $this->{$colName}; $sFullValue = strip_tags(getExtendedAnswer(self::$sid, $oFieldMap->fieldname, $value, $sLanguage)); if (strlen($sFullValue) > 50) { $sElipsizedValue = ellipsize($sFullValue, $this->ellipsize_question_value); $sValue = '<span data-toggle="tooltip" data-placement="left" title="' . quoteText($sFullValue) . '">' . $sElipsizedValue . '</span>'; } else { $sValue = $sFullValue; } // Upload question if ($oFieldMap->type == '|' && strpos($oFieldMap->fieldname, 'filecount') === false) { $sSurveyEntry = "<table class='table table-condensed upload-question'><tr>"; $aQuestionAttributes = getQuestionAttributeValues($oFieldMap->qid); $aFilesInfo = json_decode_ls($this->{$colName}); for ($iFileIndex = 0; $iFileIndex < $aQuestionAttributes['max_num_of_files']; $iFileIndex++) { $sSurveyEntry .= '<tr>'; if (isset($aFilesInfo[$iFileIndex])) { $sSurveyEntry .= '<td>' . CHtml::link(rawurldecode($aFilesInfo[$iFileIndex]['name']), App()->createUrl("/admin/responses", array("sa" => "actionDownloadfile", "surveyid" => self::$sid, "iResponseId" => $this->id, "sFileName" => $aFilesInfo[$iFileIndex]['name']))) . '</td>'; $sSurveyEntry .= '<td>' . sprintf('%s Mb', round($aFilesInfo[$iFileIndex]['size'] / 1000, 2)) . '</td>'; if ($aQuestionAttributes['show_title']) { if (!isset($aFilesInfo[$iFileIndex]['title'])) { $aFilesInfo[$iFileIndex]['title'] = ''; } $sSurveyEntry .= '<td>' . htmlspecialchars($aFilesInfo[$iFileIndex]['title'], ENT_QUOTES, 'UTF-8') . '</td>'; } if ($aQuestionAttributes['show_comment']) { if (!isset($aFilesInfo[$iFileIndex]['comment'])) { $aFilesInfo[$iFileIndex]['comment'] = ''; } $sSurveyEntry .= '<td>' . htmlspecialchars($aFilesInfo[$iFileIndex]['comment'], ENT_QUOTES, 'UTF-8') . '</td>'; } } $sSurveyEntry .= '</tr>'; } $sSurveyEntry .= '</table>'; $sValue = $sSurveyEntry; } return $sValue; }
/** * Translation helper function for plural forms * @param string $sToTranslate * @param integer $iCount * @param string $sEscapeMode */ function ngT($sTextToTranslateSingular, $sTextToTranslatePlural, $iCount, $sEscapeMode = 'html') { return quoteText(Yii::t('', $sTextToTranslateSingular . '|' . $sTextToTranslatePlural, $iCount), $sEscapeMode); }