当前位置: 首页>>代码示例>>PHP>>正文


PHP gT函数代码示例

本文整理汇总了PHP中gT函数的典型用法代码示例。如果您正苦于以下问题:PHP gT函数的具体用法?PHP gT怎么用?PHP gT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了gT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: outputRecord

 /**
  * @param array $headers
  * @param array $values
  * @param FormattingOptions $oOptions
  */
 protected function outputRecord($headers, $values, FormattingOptions $oOptions)
 {
     if ($oOptions->answerFormat == 'short') {
         //No headers at all, only output values.
         $this->output .= implode($this->separator, $values) . PHP_EOL;
     } elseif ($oOptions->answerFormat == 'long') {
         //Output each record, one per page, with a header preceding every value.
         if ($this->isBeginning) {
             $this->isBeginning = false;
         } else {
             $this->output .= "<br clear='all' style='page-break-before:always'>";
         }
         $this->output .= "<table><tr><th colspan='2'>" . gT("Survey response") . "</td></tr>" . PHP_EOL;
         $counter = 0;
         foreach ($headers as $header) {
             //if cell empty, output a space instead, otherwise the cell will be in 2pt font
             $value = "&nbsp;";
             if ($values[$counter] != "") {
                 $value = $values[$counter];
             }
             $this->output .= "<tr><td>" . $header . "</td><td>" . $value . "</td></tr>" . PHP_EOL;
             $counter++;
         }
         $this->output .= "</table>" . PHP_EOL;
     } else {
         safeDie('An invalid answer format was selected.  Only \'short\' and \'long\' are valid.');
     }
     if ($oOptions->output == 'display') {
         echo $this->output;
         $this->output = '';
     } elseif ($oOptions->output == 'file') {
         fwrite($this->file, $this->output);
         $this->output = '';
     }
 }
开发者ID:wrenchpilot,项目名称:LimeSurvey,代码行数:40,代码来源:DocWriter.php

示例2: index

 function index()
 {
     $aData = array();
     $needpermission = false;
     $aData['surveyid'] = $surveyid = sanitize_int(Yii::app()->request->getQuery('sid'));
     $aData['sa'] = $sa = sanitize_paranoid_string(Yii::app()->request->getQuery('sa', 'index'));
     if (($aData['sa'] == 'survey_logic_file' || $aData['sa'] == 'navigation_test') && $surveyid) {
         $needpermission = true;
     }
     if ($needpermission && !Permission::model()->hasSurveyPermission($surveyid, 'surveycontent', 'read')) {
         App()->getClientScript()->registerPackage('jquery-superfish');
         $message['title'] = gT('Access denied!');
         $message['message'] = gT('You do not have sufficient rights to access this page.');
         $message['class'] = "error";
         $this->_renderWrappedTemplate('survey', array("message" => $message), $aData);
     } else {
         App()->getClientScript()->registerPackage('jqueryui');
         App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('generalscripts') . "survey_runtime.js");
         App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('generalscripts') . "expressions/em_javascript.js");
         App()->getClientScript()->registerCssFile(Yii::app()->getConfig('adminstyleurl') . "adminstyle.css");
         $this->_printOnLoad(Yii::app()->request->getQuery('sa', 'index'));
         $aData['pagetitle'] = "ExpressionManager:  {$aData['sa']}";
         //header("Content-type: text/html; charset=UTF-8"); // needed for correct UTF-8 encoding
         if (isset($_GET['sa'])) {
             $this->test($aData['sa'], $aData);
         } else {
             $this->_renderWrappedTemplate('expressions', 'test_view', $aData);
         }
     }
 }
开发者ID:wrenchpilot,项目名称:LimeSurvey,代码行数:30,代码来源:expressions.php

示例3: dirReport

function dirReport($dir, $write)
{
    $error = 0;

    if ($dir == "Found")
    {
       $a = gT("Found");
    } else
    {
       $error = 1;
       $a = gT("Not found");
    }

    if ($write == "Writable")
    {
       $b = gT("Writable");
    } else
    {
       $error = 1;
       $b = gT("Unwritable");
    }

    if ($error)
    {
       return '<font color="red">'.$a.' &amp; '.$b.'</font>';
    }
    else
    {
       return $a.' &amp; '.$b;
    }
}
开发者ID:jgianpiere,项目名称:lime-survey,代码行数:31,代码来源:precheck_view.php

示例4: ShowDBUpgradeNotice

function ShowDBUpgradeNotice()
{
    $message = '
        <div class="jumbotron message-box">
            <h2 class="">' . gT('Database upgrade') . '</h2>
            <p class="lead">' . gT('Please verify the following information before continuing with the database upgrade:') . '</p>
            <p>
                <ul class="list-unstyled">
                    <li><b>' . gT('Database type') . ':</b> ' . Yii::app()->db->getDriverName() . '</li>
                    <li><b>' . gT('Database name') . ':</b> ' . getDBConnectionStringProperty('dbname') . '</li>
                    <li><b>' . gT('Table prefix') . ':</b> ' . Yii::app()->db->tablePrefix . '</li>
                    <li><b>' . gT('Site name') . ':</b> ' . Yii::app()->getConfig("sitename") . '</li>
                    <li><b>' . gT('Root URL') . ':</b> ' . Yii::app()->getController()->createUrl('') . '</li>
                </ul>
            </p>

            <p>
                <a class="btn btn-lg btn-success" href="' . Yii::app()->getController()->createUrl("admin/databaseupdate/sa/db/continue/yes") . '" role="button">
                    ' . gT('Click here to continue') . '
                </a>
            </p>

        </div>
    ';
    return $message;
}
开发者ID:GuillaumeSmaha,项目名称:LimeSurvey,代码行数:26,代码来源:update_helper.php

示例5: outputRecord

 public function outputRecord($headers, $values, FormattingOptions $oOptions)
 {
     $this->rowCounter++;
     if ($oOptions->answerFormat == 'short') {
         $pdfstring = '';
         foreach ($values as $value) {
             $pdfstring .= $value . ' | ';
         }
         $this->pdf->intopdf($pdfstring);
     } elseif ($oOptions->answerFormat == 'long') {
         if ($this->rowCounter != 1) {
             $this->pdf->AddPage();
         }
         $this->pdf->addTitle(sprintf(gT("Survey response %d"), $this->rowCounter));
         foreach ($this->aGroupMap as $gid => $questions) {
             if ($gid != 0) {
                 $this->pdf->addGidAnswer($questions[0]['group_name']);
             }
             foreach ($questions as $question) {
                 if (isset($values[$question['index']]) && isset($headers[$question['index']])) {
                     $this->pdf->addAnswer($headers[$question['index']], $values[$question['index']], false);
                 }
             }
         }
     } else {
         safeDie('An invalid answer format was encountered: ' . $oOptions->answerFormat);
     }
 }
开发者ID:GuillaumeSmaha,项目名称:LimeSurvey,代码行数:28,代码来源:PdfWriter.php

示例6: ShowDBUpgradeNotice

function ShowDBUpgradeNotice()
{
    $message = '
        <div class="jumbotron message-box">
            <h2 class="">' . gT('Database upgrade') . '</h2>
            <p class="lead">' . gT('Please verify the following information before continuing with the database upgrade:') . '</p>
            <div class="row">
            <div class="col-md-offset-4 col-md-4">
                <table class="table table-striped">
                    <tr><th>' . gT('Database type:') . '</th><td>' . Yii::app()->db->getDriverName() . '</td></tr>
                    <tr><th>' . gT('Database name:') . '</th><td>' . getDBConnectionStringProperty('dbname') . '</td></tr>
                    <tr><th>' . gT('Table prefix:') . '</th><td>' . Yii::app()->db->tablePrefix . '</td></tr>
                    <tr><th>' . gT('Site name:') . '</th><td>' . Yii::app()->getConfig("sitename") . '</td></tr>
                    <tr><th>' . gT('Root URL:') . '</th><td>' . Yii::app()->getController()->createUrl('') . '</td></tr>
                    <tr><th>' . gT('Current database version:') . '</th><td>' . GetGlobalSetting('DBVersion') . '</td></tr>
                    <tr><th>' . gT('Target database version:') . '</th><td>' . Yii::app()->getConfig('dbversionnumber') . '</td></tr>
                </table>
            </div>
            </div>

            <p>
                <a class="btn btn-lg btn-success" href="' . Yii::app()->getController()->createUrl("admin/databaseupdate/sa/db/continue/yes") . '" role="button">
                    ' . gT('Click here to continue') . '
                </a>
            </p>

        </div>
    ';
    return $message;
}
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:30,代码来源:update_helper.php

示例7: validateAttribute

 /**
  * Validates the attribute of the object.
  * If there is any error, the error message is added to the object.
  * @param CModel $object the object being validated
  * @param string $attribute the attribute being validated
  * @throws CException if invalid operator is used
  */
 protected function validateAttribute($object, $attribute)
 {
     $value = strtolower($object->{$attribute});
     if ($this->allowEmpty && $this->isEmpty($value)) {
         return;
     }
     if ($this->compareValue !== null) {
         $compareTo = $this->compareValue;
         $compareValue = strtolower($compareTo);
     } else {
         throw new CException('compareValue must be set when using LSYii_CompareInsensitiveValidator');
     }
     switch ($this->operator) {
         case '=':
         case '==':
             if ($value != $compareValue) {
                 $message = $this->message !== null ? $this->message : sprintf(gT('%s must be case-insensitive equal to %s'), $attribute, $compareTo);
             }
             break;
         case '!=':
             if ($value == $compareValue) {
                 $message = $this->message !== null ? $this->message : sprintf(gT('%s must not be case-insensitive equal to %s'), $attribute, $compareTo);
             }
             break;
         default:
             throw new CException(Yii::t('yii', 'Invalid operator "{operator}".', array('{operator}' => $this->operator)));
     }
     if (!empty($message)) {
         $this->addError($object, $attribute, $message, array('{compareAttribute}' => $compareTo, '{compareValue}' => $compareValue));
     }
 }
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:38,代码来源:LSYii_CompareInsensitiveValidator.php

示例8: run

 public function run()
 {
     App()->loadHelper('surveytranslator');
     $aData['issuperadmin'] = false;
     if (Permission::model()->hasGlobalPermission('superadmin', 'read')) {
         $aData['issuperadmin'] = true;
     }
     // We get the last survey visited by user
     $setting_entry = 'last_survey_' . Yii::app()->user->getId();
     $lastsurvey = getGlobalSetting($setting_entry);
     $survey = Survey::model()->findByPk($lastsurvey);
     if ($lastsurvey != null && $survey) {
         $aData['showLastSurvey'] = true;
         $iSurveyID = $lastsurvey;
         $surveyinfo = $survey->surveyinfo;
         $aData['surveyTitle'] = $surveyinfo['surveyls_title'] . "(" . gT("ID") . ":" . $iSurveyID . ")";
         $aData['surveyUrl'] = $this->getController()->createUrl("admin/survey/sa/view/surveyid/{$iSurveyID}");
     } else {
         $aData['showLastSurvey'] = false;
     }
     // We get the last question visited by user
     $setting_entry = 'last_question_' . Yii::app()->user->getId();
     $lastquestion = getGlobalSetting($setting_entry);
     // the question group of this question
     $setting_entry = 'last_question_gid_' . Yii::app()->user->getId();
     $lastquestiongroup = getGlobalSetting($setting_entry);
     // the sid of this question : last_question_sid_1
     $setting_entry = 'last_question_sid_' . Yii::app()->user->getId();
     $lastquestionsid = getGlobalSetting($setting_entry);
     $survey = Survey::model()->findByPk($lastquestionsid);
     if ($lastquestion && $lastquestiongroup && $survey) {
         $baselang = $survey->language;
         $aData['showLastQuestion'] = true;
         $qid = $lastquestion;
         $gid = $lastquestiongroup;
         $sid = $lastquestionsid;
         $qrrow = Question::model()->findByAttributes(array('qid' => $qid, 'gid' => $gid, 'sid' => $sid, 'language' => $baselang));
         if ($qrrow) {
             $aData['last_question_name'] = $qrrow['title'];
             if ($qrrow['question']) {
                 $aData['last_question_name'] .= ' : ' . $qrrow['question'];
             }
             $aData['last_question_link'] = $this->getController()->createUrl("admin/questions/sa/view/surveyid/{$sid}/gid/{$gid}/qid/{$qid}");
         } else {
             $aData['showLastQuestion'] = false;
         }
     } else {
         $aData['showLastQuestion'] = false;
     }
     $aData['countSurveyList'] = count(getSurveyList(true));
     // We get the home page display setting
     $aData['bShowSurveyList'] = getGlobalSetting('show_survey_list') == "show";
     $aData['bShowSurveyListSearch'] = getGlobalSetting('show_survey_list_search') == "show";
     $aData['bShowLogo'] = getGlobalSetting('show_logo') == "show";
     $aData['oSurveySearch'] = new Survey('search');
     $aData['bShowLastSurveyAndQuestion'] = getGlobalSetting('show_last_survey_and_question') == "show";
     $aData['iBoxesByRow'] = (int) getGlobalSetting('boxes_by_row');
     $aData['sBoxesOffSet'] = (string) getGlobalSetting('boxes_offset');
     $this->_renderWrappedTemplate('super', 'welcome', $aData);
 }
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:60,代码来源:index.php

示例9: afterAdminMenuLoaded

 public function afterAdminMenuLoaded()
 {
     $event = $this->event;
     $menu = $event->get('menu', array());
     $menu['left'][] = array('href' => "http://docs.limesurvey.org", 'alt' => gT('LimeSurvey online manual'), 'image' => 'showhelp.png');
     $event->set('menu', $menu);
 }
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:7,代码来源:Example.php

示例10: getPdfLanguageSettings

 /**
  * getPdfLanguageSettings
  *
  * Usage: getPdfLanguageSettings($language)
  *
  * @return array ('pdffont','pdffontsize','lg'=>array('a_meta_charset','a_meta_dir','a_meta_language','w_page')
  * @param string $language : language code for the PDF
  */
 public static function getPdfLanguageSettings($language)
 {
     Yii::import('application.libraries.admin.pdf', true);
     Yii::import('application.helpers.surveytranslator_helper', true);
     $pdffont = Yii::app()->getConfig('pdfdefaultfont');
     if ($pdffont == 'auto') {
         $pdffont = PDF_FONT_NAME_DATA;
     }
     $pdfcorefont = array("freesans", "dejavusans", "courier", "helvetica", "freemono", "symbol", "times", "zapfdingbats");
     if (in_array($pdffont, $pdfcorefont)) {
         $alternatepdffontfile = Yii::app()->getConfig('alternatepdffontfile');
         if (array_key_exists($language, $alternatepdffontfile)) {
             $pdffont = $alternatepdffontfile[$language];
             // Actually use only core font
         }
     }
     $pdffontsize = Yii::app()->getConfig('pdffontsize');
     if ($pdffontsize == 'auto') {
         $pdffontsize = PDF_FONT_SIZE_MAIN;
     }
     $lg = array();
     $lg['a_meta_charset'] = 'UTF-8';
     if (getLanguageRTL($language)) {
         $lg['a_meta_dir'] = 'rtl';
     } else {
         $lg['a_meta_dir'] = 'ltr';
     }
     $lg['a_meta_language'] = $language;
     $lg['w_page'] = gT("page");
     return array('pdffont' => $pdffont, 'pdffontsize' => $pdffontsize, 'lg' => $lg);
 }
开发者ID:wrenchpilot,项目名称:LimeSurvey,代码行数:39,代码来源:pdfHelper.php

示例11: attributeLabels

 public function attributeLabels()
 {
     $labels = array('tid' => gT('Token ID'), 'partcipant' => gT('Participant ID'), 'firstname' => gT('First name'), 'lastname' => gT('Last name'), 'email' => gT('Email address'), 'emailstatus' => gT('Email status'), 'token' => gT('Token'), 'language' => gT('Language code'), 'blacklisted' => gT('Blacklisted'), 'sent' => gT('Invitation sent date'), 'remindersent' => gT('Last reminder sent date'), 'remindercount' => gT('Total numbers of sent reminders'), 'completed' => gT('Completed'), 'usesleft' => gT('Uses left'), 'validfrom' => gT('Valid from'), 'validuntil' => gT('Valid until'));
     foreach (decodeTokenAttributes($this->survey->attributedescriptions) as $key => $info) {
         $labels[$key] = $info['description'];
     }
     return $labels;
 }
开发者ID:Spycomb,项目名称:LimeSurvey,代码行数:8,代码来源:Token.php

示例12: delete

 /**
  * Deletes a particular model.
  * If deletion is successful, the browser will be redirected to the 'admin' page.
  * @param integer $id the ID of the model to be deleted
  */
 public function delete($id)
 {
     $this->loadModel($id)->delete();
     Yii::app()->user->setFlash('success', gT('Box deleted'));
     // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
     if (!isset($_GET['ajax'])) {
         $this->getController()->redirect(array('admin/homepagesettings'));
     }
 }
开发者ID:CSCI-462-01-2016,项目名称:LimeSurvey,代码行数:14,代码来源:homepagesettings.php

示例13: __construct

 function __construct($controller, $id)
 {
     parent::__construct($controller, $id);
     if (!Permission::model()->hasGlobalPermission('superadmin', 'read')) {
         die;
     }
     if (!in_array(Yii::app()->db->getDriverName(), array('mysql', 'mysqli')) || Yii::app()->getConfig('demoMode') == true) {
         die(gT('This feature is only available for MySQL databases.'));
     }
 }
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:10,代码来源:dumpdb.php

示例14: afterAdminMenuLoad

 /**
  * Runs after Admin Menu Loads. Used to display New Icon that will link to
  * the Community Action Data report page.
  **/
 public function afterAdminMenuLoad()
 {
     //Check for if current user is authenticated as a superadmin
     if ($this->isSuperAdmin()) {
         $event = $this->event;
         $menu = $event->get('menu', array());
         $menu['items']['left'][] = array('href' => "plugins/direct?plugin=Report&function=managePrograms", 'alt' => gT('CA Report'), 'image' => 'chart_bar.png');
         $event->set('menu', $menu);
     }
 }
开发者ID:schreinerkw,项目名称:CommunityActionProject,代码行数:14,代码来源:Report.php

示例15: getGlobalBasePermissions

 /**
  * Returns the global permissions including description and title
  *
  * @access public
  * @static
  * @return array
  */
 public static function getGlobalBasePermissions()
 {
     $defaults = array('create' => true, 'read' => true, 'update' => true, 'delete' => true, 'import' => true, 'export' => true);
     $aPermissions = array('surveys' => array('import' => false, 'title' => gT("Surveys"), 'description' => gT("Permission to create surveys (for which all permissions are automatically given) and view, update and delete surveys from other users"), 'img' => 'survey'), 'users' => array('import' => false, 'export' => false, 'title' => gT("Users"), 'description' => gT("Permission to create, view, update and delete users"), 'img' => 'security'), 'usergroups' => array('import' => false, 'export' => false, 'title' => gT("User groups"), 'description' => gT("Permission to create, view, update and delete user groups"), 'img' => 'usergroup'), 'templates' => array('title' => gT("Templates"), 'description' => gT("Permission to create, view, update, delete, export and import templates"), 'img' => 'templates'), 'labelsets' => array('title' => gT("Label sets"), 'description' => gT("Permission to create, view, update, delete, export and import label sets/labels"), 'img' => 'labels'), 'settings' => array('create' => false, 'delete' => false, 'export' => false, 'title' => gT("Settings & Plugins"), 'description' => gT("Permission to view and update global settings & plugins and to delete and import plugins"), 'img' => 'global'), 'participantpanel' => array('import' => false, 'title' => gT("Participant panel"), 'description' => gT("Permission to create your own participants in the central participants database (for which all permissions are automatically given) and view, update and delete participants from other users"), 'img' => 'cpdb'));
     uasort($aPermissions, array(__CLASS__, "comparePermissionTitle"));
     $aPermissions['superadmin'] = array('create' => false, 'update' => false, 'delete' => false, 'import' => false, 'export' => false, 'title' => gT("Superadministrator"), 'description' => gT("Unlimited administration permissions"), 'img' => 'superadmin');
     foreach ($aPermissions as &$permission) {
         $permission = array_merge($defaults, $permission);
     }
     return $aPermissions;
 }
开发者ID:Narasimman,项目名称:UrbanExpansion,代码行数:18,代码来源:Permission.php


注:本文中的gT函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。