本文整理汇总了PHP中ngT函数的典型用法代码示例。如果您正苦于以下问题:PHP ngT函数的具体用法?PHP ngT怎么用?PHP ngT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ngT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: printf
<div class='header ui-widget-header'>
<strong><?php printf(ngT("Select which fields to import as attributes with your participant.","Select which fields to import as attributes with your %s participants.",$linecount), $linecount); ?></strong>
</div>
<div class="draggable-container">
<div id="csvattribute" class="attribute-column">
<div class="heading"><?php eT("CSV field names "); ?></div>
<div class='instructions'><?php eT("The following additional fields were found in your CSV file."); ?></div>
<div class="csvatt droppable">
<?php
foreach ($firstline as $key => $value)
{
echo "<div id='cs_" . $value . "' data-name='" . $value . "' class=\"csv-attribute attribute-item draggable\">" . $value . "</div>";
}
?>
</div>
</div>
<div id="newcreated" class="attribute-column">
<div class="heading"><?php eT("Attributes to be created") ?></div>
<div class='instructions'><?php eT("Drop a CSV field into this area to create a new participant attribute and import your data into it."); ?></div>
<div class="newcreate droppable" style ="height: 40px">
</div>
</div>
<div id="centralattribute" class="attribute-column">
<div class="heading"><?php eT("Existing attribute"); ?></div>
<div class='instructions'><?php eT("Drop a CSV field into an existing participant attribute listed below to import your data into it."); ?></div>
<div class="centralatt">
<?php
foreach ($attributes as $key => $value)
{
echo "<div class=\"mappable-attribute-wrapper droppable\"><div id='c_" . $value['attribute_id'] . "' data-name='c_" . $key . "' class=\"mappable-attribute attribute-item\">" . $value['attribute_name'] . "</div></div>";
}
示例2: printf
<div class='header ui-widget-header'>
<strong><?php
printf(ngT("Select which fields to import as attributes with your participant.|Select which fields to import as attributes with your %s participants.", $linecount), $linecount);
?>
</strong>
</div>
<div class="draggable-container">
<div id="csvattribute" class="attribute-column">
<div class="heading"><?php
eT("CSV field names ");
?>
</div>
<div class='instructions'><?php
eT("The following additional fields were found in your CSV file.");
?>
</div>
<div class="csvatt droppable">
<?php
foreach ($firstline as $key => $value) {
echo "<div id='cs_" . $value . "' data-name='" . $value . "' class=\"csv-attribute attribute-item draggable\">" . $value . "</div>";
}
?>
</div>
</div>
<div id="newcreated" class="attribute-column">
<div class="heading"><?php
eT("Attributes to be created");
?>
</div>
<div class='instructions'><?php
eT("Drop a CSV field into this area to create a new participant attribute and import your data into it.");
示例3: ngT
private function ngT($sTextToTranslate, $number, $escapemode = 'html')
{
return ngT($sTextToTranslate, $number, $escapemode);
}
示例4: eT
eT("Edit your personal preferences");
?>
' /></a>
</strong>
<?php
}
?>
</div>
<?php
if ($showupdate) {
?>
<div class='menubar-title-right'><a href='<?php
echo $this->createUrl("admin/globalsettings");
?>
'><?php
echo sprintf(ngT('Update available: %s|Updates available: %s', count($aUpdateVersions)), $sUpdateText);
?>
</a></div>
<?php
}
?>
</div>
<div class='menubar-main'>
<div class='menubar-left'>
<a href="<?php
echo $this->createUrl("/admin/survey/sa/index");
?>
">
<img src='<?php
echo $sImageURL;
?>
示例5: browse
function browse($iSurveyID)
{
$aData = $this->_getData($iSurveyID);
extract($aData);
$aViewUrls = array();
$oBrowseLanguage = new Limesurvey_lang($aData['language']);
$tokenRequest = Yii::app()->request->getParam('token', null);
//Delete Individual answer using inrow delete buttons/links - checked
if (Yii::app()->request->getPost('deleteanswer') && Yii::app()->request->getPost('deleteanswer') != '' && Yii::app()->request->getPost('deleteanswer') != 'marked') {
if (Permission::model()->hasSurveyPermission($iSurveyID, 'responses', 'delete')) {
$iResponseID = (int) Yii::app()->request->getPost('deleteanswer');
// sanitize the value
Response::model($iSurveyID)->findByPk($iResponseID)->delete(true);
// delete timings if savetimings is set
if ($aData['surveyinfo']['savetimings'] == "Y") {
SurveyTimingDynamic::model($iSurveyID)->deleteByPk($iResponseID);
}
Yii::app()->session['flashmessage'] = sprintf(gT("Response ID %s was successfully deleted."), $iResponseID);
} else {
Yii::app()->session['flashmessage'] = gT("Access denied!", 'js');
}
}
// Marked responses -> deal with the whole batch of marked responses
if (Yii::app()->request->getPost('markedresponses') && count(Yii::app()->request->getPost('markedresponses')) > 0) {
// Delete the marked responses - checked
if (Yii::app()->request->getPost('deleteanswer') && Yii::app()->request->getPost('deleteanswer') === 'marked') {
if (Permission::model()->hasSurveyPermission($iSurveyID, 'responses', 'delete')) {
foreach (Response::model($iSurveyID)->findAllByPk(Yii::app()->request->getPost('markedresponses')) as $response) {
$response->deleteFiles();
// delete timings if savetimings is set
/**
* @todo Move this to the Response model.
*/
if ($aData['surveyinfo']['savetimings'] == "Y") {
SurveyTimingDynamic::model($iSurveyID)->deleteByPk($iResponseID);
}
}
Response::model($iSurveyID)->deleteByPk(Yii::app()->request->getPost('markedresponses'));
Yii::app()->session['flashmessage'] = sprintf(ngT("%s response was successfully deleted.", "%s responses were successfully deleted.", count(Yii::app()->request->getPost('markedresponses'))), count(Yii::app()->request->getPost('markedresponses')), 'js');
} else {
Yii::app()->session['flashmessage'] = $clang->gT("Access denied!", 'js');
}
} elseif (Yii::app()->request->getPost('downloadfile') && Yii::app()->request->getPost('downloadfile') === 'marked') {
if (Permission::model()->hasSurveyPermission($iSurveyID, 'responses', 'read')) {
// Now, zip all the files in the filelist
$zipfilename = "Responses_for_survey_{$iSurveyID}.zip";
$this->_zipFiles($iSurveyID, Yii::app()->request->getPost('markedresponses'), $zipfilename);
}
}
} elseif (Yii::app()->request->getPost('downloadfile') && Yii::app()->request->getPost('downloadfile') != '' && Yii::app()->request->getPost('downloadfile') !== true) {
if (Permission::model()->hasSurveyPermission($iSurveyID, 'responses', 'read')) {
// Now, zip all the files in the filelist
$zipfilename = "Files_for_responses_" . Yii::app()->request->getPost('downloadfile') . ".zip";
$this->_zipFiles($iSurveyID, Yii::app()->request->getPost('downloadfile'), $zipfilename);
}
} elseif (Yii::app()->request->getParam('downloadindividualfile') != '') {
if (Permission::model()->hasSurveyPermission($iSurveyID, 'responses', 'read')) {
$iId = (int) Yii::app()->request->getParam('id');
$downloadindividualfile = Yii::app()->request->getParam('downloadindividualfile');
$fieldname = Yii::app()->request->getParam('fieldname');
$oRow = SurveyDynamic::model($iSurveyID)->findByAttributes(array('id' => $iId));
$phparray = json_decode_ls($oRow->{$fieldname});
for ($i = 0; $i < count($phparray); $i++) {
if (rawurldecode($phparray[$i]['name']) == rawurldecode($downloadindividualfile)) {
$file = Yii::app()->getConfig('uploaddir') . "/surveys/" . $iSurveyID . "/files/" . $phparray[$i]['filename'];
if (file_exists($file)) {
@ob_clean();
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . rawurldecode($phparray[$i]['name']) . '"');
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
readfile($file);
exit;
} else {
Yii::app()->session['flashmessage'] = gT("The requested file does not exist on the server.");
}
break;
}
}
}
}
/**
* fnames is used as informational array
* it containts
* $fnames[] = array(<dbfieldname>, <some strange title>, <questiontext>, <group_id>, <questiontype>);
*/
if (Permission::model()->hasSurveyPermission($iSurveyID, 'responses', 'read')) {
if (Yii::app()->request->getPost('sql')) {
$aViewUrls[] = 'browseallfiltered_view';
}
//add token to top of list if survey is not private
if ($aData['surveyinfo']['anonymized'] == "N" && tableExists('tokens_' . $iSurveyID)) {
if (Permission::model()->hasSurveyPermission($iSurveyID, 'tokens', 'read')) {
$fnames[] = array("token", $clang->gT("Token ID"), 'code' => 'token');
$fnames[] = array("firstname", $clang->gT("First name"), 'code' => 'firstname');
// or token:firstname ?
//.........这里部分代码省略.........
示例6: do_file_upload
function do_file_upload($ia)
{
global $thissurvey;
$checkconditionFunction = "checkconditions";
$aQuestionAttributes = QuestionAttribute::model()->getQuestionAttributes($ia[0]);
// Fetch question attributes
$_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['fieldname'] = $ia[1];
$scriptloc = Yii::app()->getController()->createUrl('uploader/index');
$bPreview = Yii::app()->request->getParam('action') == "previewgroup" || Yii::app()->request->getParam('action') == "previewquestion" || $thissurvey['active'] != "Y";
if ($bPreview) {
$_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['preview'] = 1;
$questgrppreview = 1;
// Preview is launched from Question or group level
} elseif ($thissurvey['active'] != "Y") {
$_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['preview'] = 1;
$questgrppreview = 0;
} else {
$_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['preview'] = 0;
$questgrppreview = 0;
}
$answer = "<script type='text/javascript'>\n function upload_{$ia['1']}() {\n var uploadurl = '{$scriptloc}?sid=" . Yii::app()->getConfig('surveyID') . "&fieldname={$ia[1]}&qid={$ia[0]}';\n uploadurl += '&preview={$questgrppreview}&show_title={$aQuestionAttributes['show_title']}';\n uploadurl += '&show_comment={$aQuestionAttributes['show_comment']}';\n uploadurl += '&minfiles=' + LEMval('{$aQuestionAttributes['min_num_of_files']}');\n uploadurl += '&maxfiles=' + LEMval('{$aQuestionAttributes['max_num_of_files']}');\n \$('#upload_{$ia['1']}').attr('href',uploadurl);\n }\n var uploadLang = {\n title: '" . gT('Upload your files', 'js') . "',\n returnTxt: '" . gT('Return to survey', 'js') . "',\n headTitle: '" . gT('Title', 'js') . "',\n headComment: '" . gT('Comment', 'js') . "',\n headFileName: '" . gT('File name', 'js') . "',\n deleteFile : '" . gT('Delete') . "',\n editFile : '" . gT('Edit') . "'\n };\n var imageurl = '" . Yii::app()->getConfig('imageurl') . "';\n var uploadurl = '" . $scriptloc . "';\n </script>\n";
Yii::app()->getClientScript()->registerScriptFile(Yii::app()->getConfig('generalscripts') . "modaldialog.js");
Yii::app()->getClientScript()->registerCssFile(Yii::app()->getConfig('publicstyleurl') . "uploader-files.css");
// Modal dialog
//$answer .= $uploadbutton;
$filecountvalue = '0';
if (array_key_exists($ia[1] . "_filecount", $_SESSION['survey_' . Yii::app()->getConfig('surveyID')])) {
$tempval = $_SESSION['survey_' . Yii::app()->getConfig('surveyID')][$ia[1] . "_filecount"];
if (is_numeric($tempval)) {
$filecountvalue = $tempval;
}
}
$value = htmlspecialchars($_SESSION['survey_' . Yii::app()->getConfig('surveyID')][$ia[1]], ENT_QUOTES, 'utf-8');
$fileuploadDatas = array('fileid' => $ia[1], 'value' => $value, 'filecountvalue' => $filecountvalue);
$answer .= doRender('/survey/questions/file_upload/answer', $fileuploadDatas, true);
$answer .= '<script type="text/javascript">
var surveyid = ' . Yii::app()->getConfig('surveyID') . ';
$(document).ready(function(){
var fieldname = "' . $ia[1] . '";
var filecount = $("#"+fieldname+"_filecount").val();
var json = $("#"+fieldname).val();
var show_title = "' . $aQuestionAttributes["show_title"] . '";
var show_comment = "' . $aQuestionAttributes["show_comment"] . '";
displayUploadedFiles(json, filecount, fieldname, show_title, show_comment);
});
</script>';
$answer .= '<script type="text/javascript">
$(".basic_' . $ia[1] . '").change(function() {
var i;
var jsonstring = "[";
for (i = 1, filecount = 0; i <= LEMval("' . $aQuestionAttributes['max_num_of_files'] . '"); i++)
{
if ($("#' . $ia[1] . '_"+i).val() == "")
continue;
filecount++;
if (i != 1)
jsonstring += ", ";
if ($("#answer' . $ia[1] . '_"+i).val() != "")
jsonstring += "{ ';
if (isset($_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['show_title'])) {
$answer .= '\\"title\\":\\""+$("#' . $ia[1] . '_title_"+i).val()+"\\",';
} else {
$answer .= '\\"title\\":\\"\\",';
}
if (isset($_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['show_comment'])) {
$answer .= '\\"comment\\":\\""+$("#' . $ia[1] . '_comment_"+i).val()+"\\",';
} else {
$answer .= '\\"comment\\":\\"\\",';
}
$answer .= '\\"size\\":\\"\\",\\"name\\":\\"\\",\\"ext\\":\\"\\"}";
}
jsonstring += "]";
$("#' . $ia[1] . '").val(jsonstring);
$("#' . $ia[1] . '_filecount").val(filecount);
});
</script>';
$uploadurl = $scriptloc . "?sid=" . Yii::app()->getConfig('surveyID') . "&fieldname=" . $ia[1] . "&qid=" . $ia[0];
$uploadurl .= "&preview=" . $questgrppreview . "&show_title=" . $aQuestionAttributes['show_title'];
$uploadurl .= "&show_comment=" . $aQuestionAttributes['show_comment'];
$uploadurl .= "&minfiles=" . $aQuestionAttributes['min_num_of_files'];
// TODO: Regression here? Should use LEMval(minfiles) like above
$uploadurl .= "&maxfiles=" . $aQuestionAttributes['max_num_of_files'];
// Same here.
$answer .= '
<!-- Trigger the modal with a button -->
<!-- <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>-->
<!-- Modal -->
<div id="file-upload-modal-' . $ia[1] . '" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content" style="vertical-align: middle;">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">' . ngT("Upload file|Upload files", $aQuestionAttributes['max_num_of_files']) . '</h4>
//.........这里部分代码省略.........
示例7: eT
<p>
<input type="submit" class="btn btn-default" value="<?php eT('Save'); ?>" />
<input type='hidden' name='action' value='tokens' />
<input type='hidden' name='subaction' value='updatetokenattributedescriptions' />
</p>
</form>
</div>
</div>
<?php endif; ?>
<h3><?php eT("Add or delete token attributes"); ?></h3>
<div class="row">
<div class="col-lg-12 content-right">
<p><?php echo sprintf(ngT('There is %s user attribute field in this token table.","There are %s user attribute fields in this token table.', $nrofattributes), $nrofattributes); ?></p>
<?php echo CHtml::form(array("admin/tokens/sa/updatetokenattributes/surveyid/{$surveyid}"), 'post',array('id'=>'addattribute')); ?>
<p>
<label for="addnumber"><?php eT('Number of attribute fields to add:'); ?></label>
<div class='col-sm-1'>
<input class='form-control' type="text" id="addnumber" name="addnumber" size="3" maxlength="3" value="1" />
</div>
</p>
<p>
<?php echo CHtml::submitButton(gT('Add fields','unescaped'), array('class'=>'btn btn-default')); ?>
<?php echo CHtml::hiddenField('action','tokens'); ?>
<?php echo CHtml::hiddenField('subaction','updatetokenattributes'); ?>
<?php echo CHtml::hiddenField('sid',$surveyid); ?>
</p>
<?php echo CHtml::endForm() ?>
<?php if( count($tokenfieldlist)) { ?>
示例8: eT
<li class="divider"></li>
<!-- Logout -->
<li>
<a href="<?php echo $this->createUrl("admin/authentication/sa/logout"); ?>">
<?php eT("Logout");?>
</a>
</li>
</ul>
</li>
<!-- active surveys -->
<?php if ($activesurveyscount > 0): ?>
<li>
<a href="<?php echo $this->createUrl('admin/survey/sa/listsurveys/active/Y');?>">
<?php printf(ngT("%s active survey","%s active surveys",$activesurveyscount),$activesurveyscount); ?>
</a>
</li>
<?php endif;?>
<?php if($showupdate): ?>
<li class="">
<a href="#notifications">
<?php if($showupdate): ?>
<span class=" label update-small-notification <?php if(Yii::app()->session['notificationstate']=='1' || Yii::app()->session['unstable_update'] ){echo 'hidden';};?>" >1</span>
<?php endif;?>
<i class="nav-icon fa fa-bullhorn"></i>
</a>
<!-- NOTIFICATIONS -->
<?php if($showupdate): ?>
示例9: eT
</div>
</div>
<?php
}
?>
<h3><?php
eT("Add or delete token attributes");
?>
</h3>
<div class="row">
<div class="col-lg-12 content-right">
<p><?php
echo sprintf(ngT('There is %s user attribute field in this token table.|There are %s user attribute fields in this token table.', $nrofattributes), $nrofattributes);
?>
</p>
<?php
echo CHtml::form(array("admin/tokens/sa/updatetokenattributes/surveyid/{$surveyid}"), 'post', array('id' => 'addattribute'));
?>
<p>
<label for="addnumber"><?php
eT('Number of attribute fields to add:');
?>
</label>
<div class='col-sm-1'>
<input class='form-control' type="text" id="addnumber" name="addnumber" size="3" maxlength="3" value="1" />
</div>
</p>
<p>
示例10: tokenify
/**
* Generate tokens
*/
public function tokenify($iSurveyId)
{
$iSurveyId = sanitize_int($iSurveyId);
if (!Permission::model()->hasSurveyPermission($iSurveyId, 'tokens', 'update')) {
Yii::app()->session['flashmessage'] = gT("You do not have permission to access this page.");
$this->getController()->redirect(array("/admin/survey/sa/view/surveyid/{$iSurveyId}"));
}
// CHECK TO SEE IF A TOKEN TABLE EXISTS FOR THIS SURVEY
$bTokenExists = tableExists('{{tokens_' . $iSurveyId . '}}');
if (!$bTokenExists) {
self::_newtokentable($iSurveyId);
}
$aData['thissurvey'] = getSurveyInfo($iSurveyId);
$aData['surveyid'] = $iSurveyId;
$surveyinfo = Survey::model()->findByPk($iSurveyId)->surveyinfo;
$aData['sidemenu']['state'] = false;
$aData["surveyinfo"] = $surveyinfo;
$aData['title_bar']['title'] = $surveyinfo['surveyls_title'] . "(" . gT("ID") . ":" . $iSurveyId . ")";
$aData['sidemenu']["token_menu"] = TRUE;
if (!Yii::app()->request->getParam('ok')) {
$aData['sidemenu']['state'] = false;
$this->_renderWrappedTemplate('token', array('message' => array('title' => gT("Create tokens"), 'message' => gT("Clicking 'Yes' will generate tokens for all those in this token list that have not been issued one. Continue?") . "<br /><br />\n" . "<input class='btn btn-default btn-lg' type='submit' value='" . gT("Yes") . "' onclick=\"" . convertGETtoPOST($this->getController()->createUrl("admin/tokens/sa/tokenify/surveyid/{$iSurveyId}", array('ok' => 'Y'))) . "\" />\n" . "<input class='btn btn-default btn-lg' type='submit' value='" . gT("No") . "' onclick=\"window.open('" . $this->getController()->createUrl("admin/tokens/sa/index/surveyid/{$iSurveyId}") . "', '_top')\" />\n" . "<br />\n")), $aData);
} else {
//get token length from survey settings
$newtoken = Token::model($iSurveyId)->generateTokens($iSurveyId);
$newtokencount = $newtoken['0'];
$neededtokencount = $newtoken['1'];
if ($neededtokencount > $newtokencount) {
$aData['success'] = false;
$message = ngT('Only {n} token has been created.|Only {n} tokens have been created.', $newtokencount) . ngT('Need {n} token.|Need {n} tokens.', $neededtokencount);
$message .= '<p><a href="' . App()->createUrl('admin/tokens/sa/index/surveyid/' . $iSurveyId) . '" title="" class="btn btn-default btn-lg">' . gT("Ok") . '</a></p>';
} else {
$aData['success'] = true;
$message = ngT('{n} token has been created.|{n} tokens have been created.', $newtokencount);
$message .= '<p><a href="' . App()->createUrl('admin/tokens/sa/index/surveyid/' . $iSurveyId) . '" title="" class="btn btn-default btn-lg">' . gT("Ok") . '</a></p>';
}
$this->_renderWrappedTemplate('token', array('message' => array('title' => gT("Create tokens"), 'message' => $message)), $aData);
}
}
示例11: tokenify
/**
* Generate tokens
*/
function tokenify($iSurveyId)
{
$iSurveyId = sanitize_int($iSurveyId);
if (!Permission::model()->hasSurveyPermission($iSurveyId, 'tokens', 'update')) {
Yii::app()->session['flashmessage'] = gT("You do not have sufficient rights to access this page.");
$this->getController()->redirect(array("/admin/survey/sa/view/surveyid/{$iSurveyId}"));
}
// CHECK TO SEE IF A TOKEN TABLE EXISTS FOR THIS SURVEY
$bTokenExists = tableExists('{{tokens_' . $iSurveyId . '}}');
if (!$bTokenExists) {
self::_newtokentable($iSurveyId);
}
$aData['thissurvey'] = getSurveyInfo($iSurveyId);
$aData['surveyid'] = $iSurveyId;
if (!Yii::app()->request->getParam('ok')) {
$this->_renderWrappedTemplate('token', array('tokenbar', 'message' => array('title' => gT("Create tokens"), 'message' => gT("Clicking 'Yes' will generate tokens for all those in this token list that have not been issued one. Continue?") . "<br /><br />\n" . "<input type='submit' value='" . gT("Yes") . "' onclick=\"" . convertGETtoPOST($this->getController()->createUrl("admin/tokens/sa/tokenify/surveyid/{$iSurveyId}", array('ok' => 'Y'))) . "\" />\n" . "<input type='submit' value='" . gT("No") . "' onclick=\"window.open('" . $this->getController()->createUrl("admin/tokens/sa/index/surveyid/{$iSurveyId}") . "', '_top')\" />\n" . "<br />\n")), $aData);
} else {
//get token length from survey settings
$newtoken = Token::model($iSurveyId)->generateTokens($iSurveyId);
$newtokencount = $newtoken['0'];
$neededtokencount = $newtoken['1'];
if ($neededtokencount > $newtokencount) {
$aData['success'] = false;
$message = sprintf(ngT('Only %s token has been created.|Only %s tokens have been created.', $newtokencount), $newtokencount) . sprintf(ngT('Need %s token.|Need %s tokens.', $neededtokencount), $neededtokencount);
} else {
$aData['success'] = true;
$message = sprintf(ngT('%s token has been created.|%s tokens have been created.', $newtokencount), $newtokencount);
}
$this->_renderWrappedTemplate('token', array('tokenbar', 'message' => array('title' => gT("Create tokens"), 'message' => $message)), $aData);
}
}
示例12: RDP_RunFunction
/**
* Run a registered function
* Some PHP functions require specific data types - those can be cast here.
* @param <type> $funcNameToken
* @param <type> $params
* @return boolean
*/
private function RDP_RunFunction($funcNameToken, $params)
{
$name = $funcNameToken[0];
if (!$this->RDP_isValidFunction($name)) {
return false;
}
$func = $this->RDP_ValidFunctions[$name];
$funcName = $func[0];
$numArgs = count($params);
$result = 1;
// default value for $this->RDP_onlyparse
if (function_exists($funcName)) {
$numArgsAllowed = array_slice($func, 5);
// get array of allowable argument counts from end of $func
$argsPassed = is_array($params) ? count($params) : 0;
// for unlimited # parameters (any value less than 0).
try {
if ($numArgsAllowed[0] < 0) {
$minArgs = abs($numArgsAllowed[0] + 1);
// so if value is -2, means that requires at least one argument
if ($argsPassed < $minArgs) {
$this->RDP_AddError(sprintf(ngT("Function must have at least %s argument", "Function must have at least %s arguments", $minArgs), $minArgs), $funcNameToken);
return false;
}
if (!$this->RDP_onlyparse) {
switch ($funcName) {
case 'sprintf':
// PHP doesn't let you pass array of parameters to function, so must use call_user_func_array
$result = call_user_func_array('sprintf', $params);
break;
default:
$result = $funcName($params);
break;
}
}
// Call function with the params passed
} elseif (in_array($argsPassed, $numArgsAllowed)) {
switch ($argsPassed) {
case 0:
if (!$this->RDP_onlyparse) {
$result = $funcName();
}
break;
case 1:
if (!$this->RDP_onlyparse) {
switch ($funcName) {
case 'acos':
case 'asin':
case 'atan':
case 'cos':
case 'exp':
case 'is_nan':
case 'sin':
case 'sqrt':
case 'tan':
if (is_numeric($params[0])) {
$result = $funcName(floatval($params[0]));
} else {
$result = NAN;
}
break;
default:
$result = $funcName($params[0]);
break;
}
}
break;
case 2:
if (!$this->RDP_onlyparse) {
switch ($funcName) {
case 'atan2':
if (is_numeric($params[0]) && is_numeric($params[1])) {
$result = $funcName(floatval($params[0]), floatval($params[1]));
} else {
$result = NAN;
}
break;
default:
$result = $funcName($params[0], $params[1]);
break;
}
}
break;
case 3:
if (!$this->RDP_onlyparse) {
$result = $funcName($params[0], $params[1], $params[2]);
}
break;
case 4:
if (!$this->RDP_onlyparse) {
$result = $funcName($params[0], $params[1], $params[2], $params[3]);
}
break;
//.........这里部分代码省略.........
示例13: ngT
private function ngT($sTextToTranslateSingular, $sTextToTranslatePlural, $number, $escapemode = 'html')
{
return ngT($sTextToTranslateSingular, $sTextToTranslatePlural, $number, $escapemode);
}
示例14: eT
<span class="ui-button-text"><?php eT("Cancel"); ?></span>
</a>
<?php echo CHtml::submitButton(gT("Continue"), array('class'=>"ajax_button ui-button ui-widget ui-state-default ui-corner-all",)); ?>
<?php echo CHtml::endForm(); ?>
</div>
</div>
<!-- The key informations-->
<div id="keyInfos">
<p></p>
<div>
<h4><?php eT('ComfortUpdate key information'); ?></h4>
<strong><?php printf(gT('Your update key is %s.'),$serverAnswer->key_infos->keyid); ?></strong><br/>
<strong><?php printf(gT('Your key is valid until %s.'),$serverAnswer->key_infos->validuntil); ?></strong><br/>
<?php if ($serverAnswer->key_infos->remaining_updates!=-999) { ?>
<strong><?php printf(ngT('It still has %s remaining updates.',$serverAnswer->key_infos->remaining_updates),$serverAnswer->key_infos->remaining_updates); ?> </strong><br/>
<?php } ?>
</div>
<div id="keyInfosbuttons">
<?php if ($serverAnswer->key_infos->remaining_updates!=-999) { ?>
<a class="button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only limebutton" href="https://www.limesurvey.org/en/" role="button" aria-disabled="false" target="_blank">
<span class="ui-button-text"><?php eT("Renew this key"); ?></span>
</a>
<?php } ?>
<a class="button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only limebutton" href="<?php echo $urlNew;?>" role="button" aria-disabled="false">
<span class="ui-button-text"><?php eT("Enter a new key"); ?></span>
</a>
</div>
</div>
示例15: csvExportCount
/**
* Returns a string with the number of participants available for export or 0
*
* @param type $search
* @return string|int
*/
protected function csvExportCount($search = null)
{
if (!Permission::model()->hasGlobalPermission('participantpanel', 'export')) {
return 0;
}
$attid = ParticipantAttributeName::model()->getVisibleAttributes();
//If super admin all the participants will be visible
if (Permission::model()->hasGlobalPermission('superadmin', 'read')) {
$iUserID = null;
} else {
$iUserID = Yii::app()->session['loginID'];
}
$count = Participant::model()->getParticipantsCount($attid, $search, $iUserID);
if ($count > 0) {
return ngT("Export {n} participant to CSV|Export {n} participants to CSV", $count);
} else {
return $count;
}
}