本文整理汇总了PHP中viewHelper::flatEllipsizeText方法的典型用法代码示例。如果您正苦于以下问题:PHP viewHelper::flatEllipsizeText方法的具体用法?PHP viewHelper::flatEllipsizeText怎么用?PHP viewHelper::flatEllipsizeText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类viewHelper
的用法示例。
在下文中一共展示了viewHelper::flatEllipsizeText方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
//.........这里部分代码省略.........
$theanswer = addcslashes($arows['answer'], "'");
$canswers[] = array($rows['sid'] . $X . $rows['gid'] . $X . $rows['qid'], $arows['code'], $theanswer);
}
if ($rows['type'] == "D") {
// Only Show No-Answer if question is not mandatory
if ($rows['mandatory'] != 'Y') {
$canswers[] = array($rows['sid'] . $X . $rows['gid'] . $X . $rows['qid'], " ", gT("No answer"));
}
} elseif ($rows['type'] != "M" && $rows['type'] != "P" && $rows['type'] != "J" && $rows['type'] != "I") {
// For dropdown questions
// optinnaly add the 'Other' answer
if (($rows['type'] == "L" || $rows['type'] == "!") && $rows['other'] == "Y") {
$canswers[] = array($rows['sid'] . $X . $rows['gid'] . $X . $rows['qid'], "-oth-", gT("Other"));
}
// Only Show No-Answer if question is not mandatory
if ($rows['mandatory'] != 'Y') {
$canswers[] = array($rows['sid'] . $X . $rows['gid'] . $X . $rows['qid'], " ", gT("No answer"));
}
}
break;
}
//switch row type
}
//else
}
//foreach theserows
}
//if questionscount > 0
//END Gather Information for this question
$questionNavOptions = CHtml::openTag('optgroup', array('class' => 'activesurveyselect', 'label' => gT("Before", "js")));
foreach ($theserows as $row) {
$question = $row['question'];
$question = strip_tags($question);
$questionselecter = viewHelper::flatEllipsizeText($question, true, '40');
$questionNavOptions .= CHtml::tag('option', array('value' => $this->getController()->createUrl("/admin/conditions/sa/index/subaction/editconditionsform/surveyid/{$iSurveyID}/gid/{$row['gid']}/qid/{$row['qid']}")), strip_tags($row['title']) . ':' . $questionselecter);
}
$questionNavOptions .= CHtml::closeTag('optgroup');
$questionNavOptions .= CHtml::openTag('optgroup', array('class' => 'activesurveyselect', 'label' => gT("Current", "js")));
$question = strip_tags($sCurrentFullQuestionText);
$questiontextshort = viewHelper::flatEllipsizeText($question, true, '40');
$questionNavOptions .= CHtml::tag('option', array('value' => $this->getController()->createUrl("/admin/conditions/sa/index/subaction/editconditionsform/surveyid/{$iSurveyID}/gid/{$gid}/qid/{$qid}"), 'selected' => 'selected'), $questiontitle . ': ' . $questiontextshort);
$questionNavOptions .= CHtml::closeTag('optgroup');
$questionNavOptions .= CHtml::openTag('optgroup', array('class' => 'activesurveyselect', 'label' => gT("After", "js")));
foreach ($postrows as $row) {
$question = $row['question'];
$question = strip_tags($question);
$questionselecter = viewHelper::flatEllipsizeText($question, true, '40');
$questionNavOptions .= CHtml::tag('option', array('value' => $this->getController()->createUrl("/admin/conditions/sa/index/subaction/editconditionsform/surveyid/{$iSurveyID}/gid/{$row['gid']}/qid/{$row['qid']}")), strip_tags($row['title']) . ':' . $questionselecter);
}
$questionNavOptions .= CHtml::closeTag('optgroup');
//Now display the information and forms
//BEGIN: PREPARE JAVASCRIPT TO SHOW MATCHING ANSWERS TO SELECTED QUESTION
$javascriptpre = CHtml::openTag('script', array('type' => 'text/javascript')) . "<!--\n" . "\tvar Fieldnames = new Array();\n" . "\tvar Codes = new Array();\n" . "\tvar Answers = new Array();\n" . "\tvar QFieldnames = new Array();\n" . "\tvar Qcqids = new Array();\n" . "\tvar Qtypes = new Array();\n";
$jn = 0;
if (isset($canswers)) {
foreach ($canswers as $can) {
$an = ls_json_encode(flattenText($can[2]));
$javascriptpre .= "Fieldnames[{$jn}]='{$can[0]}';\n" . "Codes[{$jn}]='{$can[1]}';\n" . "Answers[{$jn}]={$an};\n";
$jn++;
}
}
$jn = 0;
if (isset($cquestions)) {
foreach ($cquestions as $cqn) {
$javascriptpre .= "QFieldnames[{$jn}]='{$cqn['3']}';\n" . "Qcqids[{$jn}]='{$cqn['1']}';\n" . "Qtypes[{$jn}]='{$cqn['2']}';\n";
$jn++;
示例2: getFullQuestionHeading
/**
* Return the question text part without any subquestion
*
* @param Survey $oSurvey
* @param FormattingOptions $oOptions
* @param string $fieldName
* @return string
*/
public function getFullQuestionHeading(SurveyObj $oSurvey, FormattingOptions $oOptions, $fieldName)
{
if (isset($oSurvey->fieldMap[$fieldName])) {
$aField = $oSurvey->fieldMap[$fieldName];
return viewHelper::flatEllipsizeText($aField['question'], true, $oOptions->headingTextLength, ".. ");
}
return false;
}
示例3: displayResults
//.........这里部分代码省略.........
break;
case 'html':
if (isset($aattr["statistics_graphtype"])) {
$req_chart_type = $aattr["statistics_graphtype"];
}
//// If user forced the chartype from statistics_view
if (isset($_POST['charttype']) && $_POST['charttype'] != 'default') {
$req_chart_type = $_POST['charttype'];
}
//// The value of the select box in the question advanced setting is numerical. So we need to translate it.
if (isset($req_chart_type)) {
switch ($req_chart_type) {
case '1':
$charttype = "Pie";
break;
case '2':
$charttype = "Radar";
break;
case '3':
$charttype = "Line";
break;
case '4':
$charttype = "PolarArea";
break;
case '5':
$charttype = "Doughnut";
break;
default:
$charttype = "Bar";
break;
}
}
//// Here the 72 colors of the original limesurvey palette.
//// This could be change by some user palette coming from database.
$COLORS_FOR_SURVEY = array('20,130,200', '232,95,51', '34,205,33', '210,211,28', '134,179,129', '201,171,131', '251,231,221', '23,169,161', '167,187,213', '211,151,213', '147,145,246', '147,39,90', '250,250,201', '201,250,250', '94,0,94', '250,125,127', '0,96,201', '201,202,250', '0,0,127', '250,0,250', '250,250,0', '0,250,250', '127,0,127', '127,0,0', '0,125,127', '0,0,250', '0,202,250', '201,250,250', '201,250,201', '250,250,151', '151,202,250', '251,149,201', '201,149,250', '250,202,151', '45,96,250', '45,202,201', '151,202,0', '250,202,0', '250,149,0', '250,96,0', '184,230,115', '102,128,64', '220,230,207', '134,191,48', '184,92,161', '128,64,112', '230,207,224', '191,48,155', '230,138,115', '128,77,64', '230,211,207', '191,77,48', '80,161,126', '64,128,100', '207,230,220', '48,191,130', '25,25,179', '18,18,125', '200,200,255', '145,145,255', '255,178,0', '179,125,0', '255,236,191', '255,217,128', '255,255,0', '179,179,0', '255,255,191', '255,255,128', '102,0,153', '71,0,107', '234,191,255', '213,128,255');
//// $lbl is generated somewhere upthere by the original code. We translate it for chartjs.
$labels = array();
foreach ($lbl as $name => $lb) {
$labels[] = $name;
}
if (isset($lblPercent)) {
foreach ($lblPercent as $name => $lb) {
$labels_percent[] = $name;
}
} else {
$labels_percent = array();
}
break;
default:
break;
}
}
}
}
//close table/output
if ($outputType == 'html') {
// show this block only when we show graphs and are not in the public statics controller
if ($usegraph == 1 && $bShowGraph && get_class(Yii::app()->getController()) !== 'Statistics_userController') {
// We clean the labels
$iMaxLabelLength = 0;
// We clean the labels
// Labels for graphs
$iMaxLabelLength = 0;
foreach ($aGraphLabels as $key => $label) {
$cleanLabel = $label;
$cleanLabel = viewHelper::flatEllipsizeText($cleanLabel, true, 20);
$graph_labels[$key] = $cleanLabel;
$iMaxLabelLength = strlen($cleanLabel) > $iMaxLabelLength ? strlen($cleanLabel) : $iMaxLabelLength;
}
if (isset($aGraphLabelsPercent)) {
foreach ($aGraphLabelsPercent as $key => $label) {
$cleanLabel = $label;
$cleanLabel = viewHelper::flatEllipsizeText($cleanLabel, true, 20);
$graph_labels_percent[$key] = $cleanLabel;
}
} else {
$graph_labels_percent = array();
}
$iCanvaHeight = $iMaxLabelLength * 3;
$aData['iCanvaHeight'] = $iCanvaHeight > 150 ? $iCanvaHeight : 150;
$qqid = str_replace('#', '_', $qqid);
$aData['rt'] = $rt;
$aData['qqid'] = $qqid;
$aData['graph_labels'] = $graph_labels;
$aData['graph_labels_percent'] = $labels_percent;
$aData['labels'] = $labels;
//$aData['COLORS_FOR_SURVEY'] = COLORS_FOR_SURVEY;
$aData['charttype'] = isset($charttype) ? $charttype : 'Bar';
$aData['sChartname'] = '';
$aData['grawdata'] = $grawdata;
$aData['color'] = rand(0, 70);
$aData['COLORS_FOR_SURVEY'] = $COLORS_FOR_SURVEY;
$aData['lbl'] = $lbl;
///
$statisticsoutput .= Yii::app()->getController()->renderPartial('/admin/export/generatestats/_statisticsoutput_graphs', $aData, true);
}
$statisticsoutput .= "</table></div> <!-- in statistics helper --> \n";
}
return array("statisticsoutput" => $statisticsoutput, "pdf" => $this->pdf, "astatdata" => $astatdata);
}
示例4: _surveysidemenu
/**
* Show side menu for survey view
* @param array $aData all the needed data
*/
function _surveysidemenu($aData)
{
$iSurveyID = $aData['surveyid'];
// TODO : create subfunctions
$sumresult1 = Survey::model()->with(array('languagesettings' => array('condition' => 'surveyls_language=language')))->find('sid = :surveyid', array(':surveyid' => $aData['surveyid']));
//$sumquery1, 1) ; //Checked
if (Permission::model()->hasSurveyPermission($iSurveyID, 'surveycontent', 'read')) {
$aData['permission'] = true;
} else {
$aData['gid'] = $gid = null;
$qid = null;
$aData['permission'] = false;
}
if (!is_null($sumresult1)) {
$surveyinfo = $sumresult1->attributes;
$surveyinfo = array_merge($surveyinfo, $sumresult1->defaultlanguage->attributes);
$surveyinfo = array_map('flattenText', $surveyinfo);
$aData['activated'] = $surveyinfo['active'] == 'Y';
// Tokens
$bTokenExists = tableExists('{{tokens_' . $iSurveyID . '}}');
if (!$bTokenExists) {
$aData['tokenmanagement'] = Permission::model()->hasSurveyPermission($iSurveyID, 'surveysettings', 'update') || Permission::model()->hasSurveyPermission($iSurveyID, 'tokens', 'create');
} else {
$aData['tokenmanagement'] = Permission::model()->hasSurveyPermission($iSurveyID, 'surveysettings', 'update') || Permission::model()->hasSurveyPermission($iSurveyID, 'tokens', 'create') || Permission::model()->hasSurveyPermission($iSurveyID, 'tokens', 'read') || Permission::model()->hasSurveyPermission($iSurveyID, 'tokens', 'export') || Permission::model()->hasSurveyPermission($iSurveyID, 'tokens', 'import');
// and export / import ?
}
// Question explorer
$aGroups = QuestionGroup::model()->findAllByAttributes(array('sid' => $iSurveyID, "language" => $sumresult1->defaultlanguage->surveyls_language), array('order' => 'group_order ASC'));
if (count($aGroups)) {
foreach ($aGroups as $group) {
$group->aQuestions = Question::model()->findAllByAttributes(array("sid" => $iSurveyID, "gid" => $group['gid'], "language" => $sumresult1->defaultlanguage->surveyls_language), array('order' => 'question_order ASC'));
foreach ($group->aQuestions as $question) {
if (is_object($question)) {
$question->question = viewHelper::flatEllipsizeText($question->question, true, 60, '[...]', 0.5);
}
}
}
}
$aData['aGroups'] = $aGroups;
$aData['surveycontent'] = Permission::model()->hasSurveyPermission($aData['surveyid'], 'surveycontent', 'read');
$this->getController()->renderPartial("/admin/super/sidemenu", $aData);
} else {
Yii::app()->session['flashmessage'] = gT("Invalid survey ID");
$this->getController()->redirect(array("admin/index"));
}
}
示例5: deleteMultiple
/**
* Delete multiple questions.
* Called by ajax from question list.
* Permission check is done by questions::delete()
* @return HTML
*/
public function deleteMultiple()
{
$aQidsAndLang = json_decode(Yii::app()->request->getPost('sItems'));
$aResults = array();
foreach ($aQidsAndLang as $sQidAndLang) {
$aQidAndLang = explode(',', $sQidAndLang);
$iQid = $aQidAndLang[0];
$sLanguage = $aQidAndLang[1];
$oQuestion = Question::model()->find('qid=:qid and language=:language', array(":qid" => $iQid, ":language" => $sLanguage));
if (is_object($oQuestion)) {
$aResults[$iQid]['question'] = viewHelper::flatEllipsizeText($oQuestion->question, true, 0);
$aResults[$iQid]['result'] = $this->delete($oQuestion->sid, $oQuestion->gid, $iQid, true);
}
}
Yii::app()->getController()->renderPartial('/admin/survey/Question/massive_actions/_delete_results', array('aResults' => $aResults));
}
示例6: eT
<?php
}
?>
<?php
if ($showLastQuestion) {
?>
<span id="last_question" class="rotateHidden">
<?php
eT("Last visited question:");
?>
<a href="<?php
echo $last_question_link;
?>
" class=""><?php
echo viewHelper::flatEllipsizeText($last_question_name, true, 60);
?>
</a>
</span>
<?php
}
?>
</div>
<br/><br/>
</div>
</div>
<?php
}
?>
<!-- Rendering all boxes in database -->