本文整理汇总了PHP中viewHelper::getFieldText方法的典型用法代码示例。如果您正苦于以下问题:PHP viewHelper::getFieldText方法的具体用法?PHP viewHelper::getFieldText怎么用?PHP viewHelper::getFieldText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类viewHelper
的用法示例。
在下文中一共展示了viewHelper::getFieldText方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view
/**
* View a single response in detail
*
* @param mixed $iSurveyID
* @param mixed $iId
* @param mixed $sBrowseLang
*/
public function view($iSurveyID, $iId, $sBrowseLang = '')
{
if (Permission::model()->hasSurveyPermission($iSurveyID, 'responses', 'read')) {
$aData = $this->_getData(array('iId' => $iId, 'iSurveyId' => $iSurveyID, 'browselang' => $sBrowseLang));
$sBrowseLanguage = $aData['language'];
extract($aData);
$aViewUrls = array();
$fieldmap = createFieldMap($iSurveyID, 'full', false, false, $aData['language']);
$bHaveToken = $aData['surveyinfo']['anonymized'] == "N" && tableExists('tokens_' . $iSurveyID);
// Boolean : show (or not) the token
if (!Permission::model()->hasSurveyPermission($iSurveyID, 'tokens', 'read')) {
unset($fieldmap['token']);
$bHaveToken = false;
}
//add token to top of list if survey is not private
if ($bHaveToken) {
$fnames[] = array("token", gT("Token ID"), 'code' => 'token');
$fnames[] = array("firstname", gT("First name"), 'code' => 'firstname');
// or token:firstname ?
$fnames[] = array("lastname", gT("Last name"), 'code' => 'lastname');
$fnames[] = array("email", gT("Email"), 'code' => 'email');
}
$fnames[] = array("submitdate", gT("Submission date"), gT("Completed"), "0", 'D', 'code' => 'submitdate');
$fnames[] = array("completed", gT("Completed"), "0");
foreach ($fieldmap as $field) {
if ($field['fieldname'] == 'lastpage' || $field['fieldname'] == 'submitdate') {
continue;
}
if ($field['type'] == 'interview_time') {
continue;
}
if ($field['type'] == 'page_time') {
continue;
}
if ($field['type'] == 'answer_time') {
continue;
}
//$question = $field['question'];
$question = viewHelper::getFieldText($field);
if ($field['type'] != "|") {
$fnames[] = array($field['fieldname'], viewHelper::getFieldText($field), 'code' => viewHelper::getFieldCode($field, array('LEMcompat' => true)));
} elseif ($field['aid'] !== 'filecount') {
$qidattributes = getQuestionAttributeValues($field['qid']);
for ($i = 0; $i < $qidattributes['max_num_of_files']; $i++) {
$filenum = sprintf(gT("File %s"), $i + 1);
if ($qidattributes['show_title'] == 1) {
$fnames[] = array($field['fieldname'], "{$filenum} - {$question} (" . gT('Title') . ")", 'code' => viewHelper::getFieldCode($field) . '(title)', "type" => "|", "metadata" => "title", "index" => $i);
}
if ($qidattributes['show_comment'] == 1) {
$fnames[] = array($field['fieldname'], "{$filenum} - {$question} (" . gT('Comment') . ")", 'code' => viewHelper::getFieldCode($field) . '(comment)', "type" => "|", "metadata" => "comment", "index" => $i);
}
$fnames[] = array($field['fieldname'], "{$filenum} - {$question} (" . gT('File name') . ")", 'code' => viewHelper::getFieldCode($field) . '(name)', "type" => "|", "metadata" => "name", "index" => $i);
$fnames[] = array($field['fieldname'], "{$filenum} - {$question} (" . gT('File size') . ")", 'code' => viewHelper::getFieldCode($field) . '(size)', "type" => "|", "metadata" => "size", "index" => $i);
//$fnames[] = array($field['fieldname'], "File ".($i+1)." - ".$field['question']." (extension)", "type"=>"|", "metadata"=>"ext", "index"=>$i);
}
} else {
$fnames[] = array($field['fieldname'], gT("File count"));
}
}
$nfncount = count($fnames) - 1;
if ($iId < 1) {
$iId = 1;
}
$exist = SurveyDynamic::model($iSurveyID)->exist($iId);
$next = SurveyDynamic::model($iSurveyID)->next($iId, true);
$previous = SurveyDynamic::model($iSurveyID)->previous($iId, true);
$aData['exist'] = $exist;
$aData['next'] = $next;
$aData['previous'] = $previous;
$aData['id'] = $iId;
$aViewUrls[] = 'browseidheader_view';
if ($exist) {
$oPurifier = new CHtmlPurifier();
//SHOW INDIVIDUAL RECORD
$oCriteria = new CDbCriteria();
if ($bHaveToken) {
$oCriteria = SurveyDynamic::model($iSurveyID)->addTokenCriteria($oCriteria);
}
$oCriteria->addCondition("id = {$iId}");
$iIdresult = SurveyDynamic::model($iSurveyID)->findAllAsArray($oCriteria);
foreach ($iIdresult as $iIdrow) {
$iId = $iIdrow['id'];
$rlanguage = $iIdrow['startlanguage'];
}
$aData['bHasFile'] = false;
if (isset($rlanguage)) {
$aData['rlanguage'] = $rlanguage;
}
foreach ($iIdresult as $iIdrow) {
$highlight = false;
for ($i = 0; $i < $nfncount + 1; $i++) {
if ($fnames[$i][0] != 'completed' && is_null($iIdrow[$fnames[$i][0]])) {
continue;
//.........这里部分代码省略.........
示例2: oldbrowse
/**
* @deprecated
* */
function oldbrowse($iSurveyID)
{
$aData = $this->_getData($iSurveyID);
extract($aData);
$aViewUrls = array();
$sBrowseLanguage = $aData['language'];
$tokenRequest = Yii::app()->request->getParam('token', null);
/**
* 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", gT("Token ID"), 'code' => 'token');
$fnames[] = array("firstname", gT("First name"), 'code' => 'firstname');
// or token:firstname ?
$fnames[] = array("lastname", gT("Last name"), 'code' => 'lastname');
$fnames[] = array("email", gT("Email"), 'code' => 'email');
}
}
$fnames[] = array("submitdate", gT("Completed"), gT("Completed"), "0", 'D');
$fields = createFieldMap($iSurveyID, 'full', false, false, $aData['language']);
foreach ($fields as $fielddetails) {
if ($fielddetails['fieldname'] == 'lastpage' || $fielddetails['fieldname'] == 'submitdate') {
continue;
}
$question = $fielddetails['question'];
if ($fielddetails['type'] != "|") {
if ($fielddetails['fieldname'] == 'lastpage' || $fielddetails['fieldname'] == 'submitdate' || $fielddetails['fieldname'] == 'token') {
continue;
}
// no headers for time data
if ($fielddetails['type'] == 'interview_time') {
continue;
}
if ($fielddetails['type'] == 'page_time') {
continue;
}
if ($fielddetails['type'] == 'answer_time') {
continue;
}
$fnames[] = array($fielddetails['fieldname'], viewHelper::getFieldText($fielddetails), 'code' => viewHelper::getFieldCode($fielddetails, array('LEMcompat' => true)));
} elseif ($fielddetails['aid'] !== 'filecount') {
$qidattributes = getQuestionAttributeValues($fielddetails['qid']);
for ($i = 0; $i < $qidattributes['max_num_of_files']; $i++) {
$filenum = sprintf(gT("File %s"), $i + 1);
if ($qidattributes['show_title'] == 1) {
$fnames[] = array($fielddetails['fieldname'], "{$filenum} - {$question} (" . gT('Title') . ")", 'code' => viewHelper::getFieldCode($fielddetails) . '(title)', "type" => "|", "metadata" => "title", "index" => $i);
}
if ($qidattributes['show_comment'] == 1) {
$fnames[] = array($fielddetails['fieldname'], "{$filenum} - {$question} (" . gT('Comment') . ")", 'code' => viewHelper::getFieldCode($fielddetails) . '(comment)', "type" => "|", "metadata" => "comment", "index" => $i);
}
$fnames[] = array($fielddetails['fieldname'], "{$filenum} - {$question} (" . gT('File name') . ")", 'code' => viewHelper::getFieldCode($fielddetails) . '(name)', "type" => "|", "metadata" => "name", "index" => $i);
$fnames[] = array($fielddetails['fieldname'], "{$filenum} - {$question} (" . gT('File size') . ")", 'code' => viewHelper::getFieldCode($fielddetails) . '(size)', "type" => "|", "metadata" => "size", "index" => $i);
//$fnames[] = array($fielddetails['fieldname'], "File ".($i+1)." - ".$fielddetails['question']."(extension)", "type"=>"|", "metadata"=>"ext", "index"=>$i);
}
} else {
$fnames[] = array($fielddetails['fieldname'], gT("File count"), 'code' => viewHelper::getFieldCode($fielddetails));
}
}
$fncount = count($fnames);
$start = (int) Yii::app()->request->getParam('start', 0);
$limit = (int) Yii::app()->request->getParam('limit', 50);
$order = Yii::app()->request->getParam('order', 'asc');
if (!$limit) {
$limit = 50;
}
$oCriteria = new CDbCriteria();
//Create the query
if ($aData['surveyinfo']['anonymized'] == "N" && tableExists("{{tokens_{$iSurveyID}}}") && Permission::model()->hasSurveyPermission($iSurveyID, 'tokens', 'read')) {
$oCriteria = SurveyDynamic::model($iSurveyID)->addTokenCriteria($oCriteria);
}
if (incompleteAnsFilterState() == "incomplete") {
$oCriteria->addCondition("submitdate IS NULL");
} elseif (incompleteAnsFilterState() == "complete") {
$oCriteria->addCondition("submitdate IS NOT NULL");
}
$dtcount = SurveyDynamic::model($iSurveyID)->count($oCriteria);
// or die("Couldn't get response data<br />");
if ($limit > $dtcount) {
$limit = $dtcount;
}
//NOW LETS SHOW THE DATA
if (Yii::app()->request->getPost('sql') && stripcslashes(Yii::app()->request->getPost('sql')) !== "" && Yii::app()->request->getPost('sql') != "NULL") {
$oCriteria->addCondition(stripcslashes(Yii::app()->request->getPost('sql')));
}
if (!is_null($tokenRequest)) {
$oCriteria->addCondition('t.token = ' . Yii::app()->db->quoteValue($tokenRequest));
}
$oCriteria->order = 'id ' . ($order == 'desc' ? 'desc' : 'asc');
$oCriteria->offset = $start;
//.........这里部分代码省略.........
示例3: getFullFieldSubHeading
/**
* Return the subquestion part, if not empty : add a space before it.
*
* @param Survey $oSurvey
* @param FormattingOptions $oOptions
* @param string $fieldName
* @return string
*/
public function getFullFieldSubHeading(SurveyObj $oSurvey, FormattingOptions $oOptions, $fieldName)
{
if (isset($oSurvey->fieldMap[$fieldName])) {
$aField = $oSurvey->fieldMap[$fieldName];
$aField['question'] = '';
$subHeading = trim(viewHelper::getFieldText($aField, array('separator' => array('[', ']'), 'abbreviated' => $oOptions->headingTextLength, 'ellipsis' => ".. ")));
if ($subHeading) {
return " {$subHeading}";
}
}
return false;
}
示例4: browse
//.........这里部分代码省略.........
$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 ?
$fnames[] = array("lastname", $clang->gT("Last name"), 'code' => 'lastname');
$fnames[] = array("email", $clang->gT("Email"), 'code' => 'email');
}
}
$fnames[] = array("submitdate", $clang->gT("Completed"), $clang->gT("Completed"), "0", 'D');
$fields = createFieldMap($iSurveyID, 'full', false, false, $aData['language']);
foreach ($fields as $fielddetails) {
if ($fielddetails['fieldname'] == 'lastpage' || $fielddetails['fieldname'] == 'submitdate') {
continue;
}
$question = $fielddetails['question'];
if ($fielddetails['type'] != "|") {
if ($fielddetails['fieldname'] == 'lastpage' || $fielddetails['fieldname'] == 'submitdate' || $fielddetails['fieldname'] == 'token') {
continue;
}
// no headers for time data
if ($fielddetails['type'] == 'interview_time') {
continue;
}
if ($fielddetails['type'] == 'page_time') {
continue;
}
if ($fielddetails['type'] == 'answer_time') {
continue;
}
$fnames[] = array($fielddetails['fieldname'], viewHelper::getFieldText($fielddetails), 'code' => viewHelper::getFieldCode($fielddetails, array('LEMcompat' => true)));
} elseif ($fielddetails['aid'] !== 'filecount') {
$qidattributes = getQuestionAttributeValues($fielddetails['qid']);
for ($i = 0; $i < $qidattributes['max_num_of_files']; $i++) {
$filenum = sprintf($clang->gT("File %s"), $i + 1);
if ($qidattributes['show_title'] == 1) {
$fnames[] = array($fielddetails['fieldname'], "{$filenum} - {$question} (" . $clang->gT('Title') . ")", 'code' => viewHelper::getFieldCode($fielddetails) . '(title)', "type" => "|", "metadata" => "title", "index" => $i);
}
if ($qidattributes['show_comment'] == 1) {
$fnames[] = array($fielddetails['fieldname'], "{$filenum} - {$question} (" . $clang->gT('Comment') . ")", 'code' => viewHelper::getFieldCode($fielddetails) . '(comment)', "type" => "|", "metadata" => "comment", "index" => $i);
}
$fnames[] = array($fielddetails['fieldname'], "{$filenum} - {$question} (" . $clang->gT('File name') . ")", 'code' => viewHelper::getFieldCode($fielddetails) . '(name)', "type" => "|", "metadata" => "name", "index" => $i);
$fnames[] = array($fielddetails['fieldname'], "{$filenum} - {$question} (" . $clang->gT('File size') . ")", 'code' => viewHelper::getFieldCode($fielddetails) . '(size)', "type" => "|", "metadata" => "size", "index" => $i);
//$fnames[] = array($fielddetails['fieldname'], "File ".($i+1)." - ".$fielddetails['question']."(extension)", "type"=>"|", "metadata"=>"ext", "index"=>$i);
}
} else {
$fnames[] = array($fielddetails['fieldname'], $clang->gT("File count"), 'code' => viewHelper::getFieldCode($fielddetails));
}
}
$fncount = count($fnames);
$start = (int) Yii::app()->request->getParam('start', 0);
$limit = (int) Yii::app()->request->getParam('limit', 50);
$order = Yii::app()->request->getParam('order', 'asc');
if (!$limit) {
$limit = 50;
}
$oCriteria = new CDbCriteria();
//Create the query
if ($aData['surveyinfo']['anonymized'] == "N" && tableExists("{{tokens_{$iSurveyID}}}") && Permission::model()->hasSurveyPermission($iSurveyID, 'tokens', 'read')) {
$oCriteria = SurveyDynamic::model($iSurveyID)->addTokenCriteria($oCriteria);
}
if (incompleteAnsFilterState() == "incomplete") {
$oCriteria->addCondition("submitdate IS NULL");
示例5: exportresults
public function exportresults()
{
$iSurveyID = sanitize_int(Yii::app()->request->getParam('surveyid'));
if (!isset($imageurl)) {
$imageurl = "./images";
}
if (!isset($iSurveyID)) {
$iSurveyID = returnGlobal('sid');
}
if (!isset($convertyto1)) {
$convertyto1 = returnGlobal('convertyto1');
}
if (!isset($convertnto2)) {
$convertnto2 = returnGlobal('convertnto2');
}
if (!isset($convertyto)) {
$convertyto = returnGlobal('convertyto');
}
if (!isset($convertnto)) {
$convertnto = returnGlobal('convertnto');
}
if (!Permission::model()->hasSurveyPermission($iSurveyID, 'responses', 'export')) {
$this->getController()->error('Access denied!');
}
Yii::app()->loadHelper("admin/exportresults");
App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('generalscripts') . "expressions/em_javascript.js");
App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('adminscripts') . '/exportresults.js');
$sExportType = Yii::app()->request->getPost('type');
$sHeadingFormat = Yii::app()->request->getPost('headstyle');
$sAnswerFormat = Yii::app()->request->getPost('answers');
$bHeaderSpacesToUnderscores = Yii::app()->request->getPost('headspacetounderscores');
$bConvertY = Yii::app()->request->getPost('converty');
$bConvertN = Yii::app()->request->getPost('convertn');
$sYValue = Yii::app()->request->getPost('convertyto');
$sNValue = Yii::app()->request->getPost('convertnto');
$surveybaselang = Survey::model()->findByPk($iSurveyID)->language;
$exportoutput = "";
// Get info about the survey
$thissurvey = getSurveyInfo($iSurveyID);
// Load ExportSurveyResultsService so we know what exports are available
$resultsService = new ExportSurveyResultsService();
$exports = $resultsService->getExports();
if (!$sExportType) {
//FIND OUT HOW MANY FIELDS WILL BE NEEDED - FOR 255 COLUMN LIMIT
$aFieldMap = createFieldMap($iSurveyID, 'full', false, false, getBaseLanguageFromSurveyID($iSurveyID));
if ($thissurvey['savetimings'] === "Y") {
//Append survey timings to the fieldmap array
$aFieldMap = $aFieldMap + createTimingsFieldMap($iSurveyID, 'full', false, false, getBaseLanguageFromSurveyID($iSurveyID));
}
$iFieldCount = count($aFieldMap);
$selecthide = "";
$selectshow = "";
$selectinc = "";
if (incompleteAnsFilterState() == "complete") {
$selecthide = "selected='selected'";
} elseif (incompleteAnsFilterState() == "incomplete") {
$selectinc = "selected='selected'";
} else {
$selectshow = "selected='selected'";
}
$aFields = array();
foreach ($aFieldMap as $sFieldName => $fieldinfo) {
$sCode = viewHelper::getFieldCode($fieldinfo);
$aFields[$sFieldName] = $sCode . ' - ' . htmlspecialchars(ellipsize(html_entity_decode(viewHelper::getFieldText($fieldinfo)), 30, 0.6, '...'));
$aFieldsOptions[$sFieldName] = array('title' => viewHelper::getFieldText($fieldinfo), 'data-fieldname' => $fieldinfo['fieldname'], 'data-emcode' => viewHelper::getFieldCode($fieldinfo, array('LEMcompat' => true)));
// No need to filter title : Yii do it (remove all tag)
}
$data['SingleResponse'] = (int) returnGlobal('id');
$data['selecthide'] = $selecthide;
$data['selectshow'] = $selectshow;
$data['selectinc'] = $selectinc;
$data['afieldcount'] = $iFieldCount;
$data['aFields'] = $aFields;
$data['aFieldsOptions'] = $aFieldsOptions;
//get max number of datasets
$iMaximum = SurveyDynamic::model($iSurveyID)->getMaxId();
$data['max_datasets'] = $iMaximum;
$data['surveyid'] = $iSurveyID;
$data['imageurl'] = Yii::app()->getConfig('imageurl');
$data['thissurvey'] = $thissurvey;
$data['display']['menu_bars']['browse'] = gT("Export results");
// Export plugins, leave out all entries that are not plugin
$exports = array_filter($exports);
$exportData = array();
foreach ($exports as $key => $plugin) {
$event = new PluginEvent('listExportOptions');
$event->set('type', $key);
$oPluginManager = App()->getPluginManager();
$oPluginManager->dispatchEvent($event, $plugin);
$exportData[$key] = array('onclick' => $event->get('onclick'), 'label' => $event->get('label'), 'checked' => $event->get('default', false), 'tooltip' => $event->get('tooltip', null));
}
$data['exports'] = $exportData;
// Pass available exports
$data['headexports'] = array('code' => array('label' => gT("Question code"), 'help' => null, 'checked' => false), 'abbreviated' => array('label' => gT("Abbreviated question text"), 'help' => null, 'checked' => false), 'full' => array('label' => gT("Full question text"), 'help' => null, 'checked' => true), 'codetext' => array('label' => gT("Question code and question text"), 'help' => null, 'checked' => false));
// Add a plugin for adding headexports : a public function getRegistereddPlugins($event) can help here.
$aLanguagesCode = Survey::model()->findByPk($iSurveyID)->getAllLanguages();
$aLanguages = array();
foreach ($aLanguagesCode as $sLanguage) {
$aLanguages[$sLanguage] = getLanguageNameFromCode($sLanguage, false);
}
//.........这里部分代码省略.........
示例6: foreach
$clang->eT("Choose columns");
?>
:
<?php
if ($afieldcount > 255) {
echo "\t<img src='{$imageurl}/help.gif' alt='" . $clang->gT("Help") . "' onclick='javascript:alert(\"" . $clang->gT("Your survey contains more than 255 columns of responses. Spreadsheet applications such as Excel are limited to loading no more than 255. Select the columns you wish to export in the list below.", "js") . "\")' />";
} else {
echo "\t<img src='{$imageurl}/help.gif' alt='" . $clang->gT("Help") . "' onclick='javascript:alert(\"" . $clang->gT("Choose the columns you wish to export.", "js") . "\")' />";
}
?>
<br /><select name='colselect[]' multiple size='20'>
<?php
$i = 1;
foreach ($excesscols as $sFieldName => $fieldinfo) {
$questiontext = viewHelper::getFieldText($fieldinfo);
$questioncode = viewHelper::getFieldCode($fieldinfo);
echo "<option value='{$sFieldName}'";
if (isset($_POST['summary'])) {
if (in_array($ec, $_POST['summary'])) {
echo "selected";
}
} elseif ($i < 256) {
echo " selected";
}
echo " title='{$sFieldName} : " . str_replace("'", "'", $questiontext) . "'>" . ellipsize("{$i} : {$questioncode} - " . str_replace(array("\r\n", "\n", "\r"), " ", $questiontext), 45) . "</option>\n";
$i++;
}
?>
</select>
<br /> </fieldset>