本文整理汇总了PHP中Vtiger_Language_Handler类的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Language_Handler类的具体用法?PHP Vtiger_Language_Handler怎么用?PHP Vtiger_Language_Handler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Vtiger_Language_Handler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
public function process(Vtiger_Request $request)
{
$mode = $request->get('mode');
if (!empty($mode)) {
$this->invokeExposedMethod($mode, $request);
return;
}
$recordModel = $this->saveRecord($request);
$settingsModuleModel = Settings_Users_Module_Model::getInstance();
$settingsModuleModel->refreshSwitchUsers();
$fieldModelList = $recordModel->getModule()->getFields();
$result = array();
foreach ($fieldModelList as $fieldName => $fieldModel) {
$fieldValue = $displayValue = Vtiger_Util_Helper::toSafeHTML($recordModel->get($fieldName));
if ($fieldModel->getFieldDataType() !== 'currency') {
$displayValue = $fieldModel->getDisplayValue($fieldValue, $recordModel->getId());
}
if ($fieldName == 'language') {
$displayValue = Vtiger_Language_Handler::getLanguageLabel($fieldValue);
}
if (($fieldName == 'currency_decimal_separator' || $fieldName == 'currency_grouping_separator') && $displayValue == ' ') {
$displayValue = vtranslate('LBL_SPACE', 'Users');
}
$result[$fieldName] = array('value' => $fieldValue, 'display_value' => $displayValue);
}
$result['_recordLabel'] = $recordModel->getName();
$result['_recordId'] = $recordModel->getId();
$response = new Vtiger_Response();
$response->setEmitType(Vtiger_Response::$EMIT_JSON);
$response->setResult($result);
$response->emit();
}
示例2: process
public function process(Vtiger_Request $request)
{
PDFMaker_Debugger_Model::GetInstance()->Init();
$adb = PearDatabase::getInstance();
$PDFMaker = new PDFMaker_PDFMaker_Model();
$viewer = $this->getViewer($request);
$currentLanguage = Vtiger_Language_Handler::getLanguage();
list($oLabels, $languages) = $PDFMaker->GetCustomLabels();
$currLang = array();
foreach ($languages as $langId => $langVal) {
if ($langVal["prefix"] == $currentLanguage) {
$currLang["id"] = $langId;
$currLang["name"] = $langVal["name"];
$currLang["label"] = $langVal["label"];
$currLang["prefix"] = $langVal["prefix"];
break;
}
}
$viewLabels = array();
foreach ($oLabels as $lblId => $oLabel) {
$viewLabels[$lblId]["key"] = $oLabel->GetKey();
$viewLabels[$lblId]["lang_values"] = $oLabel->GetLangValsArr();
}
$viewer->assign("LABELS", $viewLabels);
$viewer->assign("LANGUAGES", $languages);
$viewer->assign("CURR_LANG", $currLang);
$viewer->view('CustomLabels.tpl', 'PDFMaker');
}
示例3: process
public function process(Vtiger_Request $request)
{
$mode = $request->get('mode');
if (!empty($mode)) {
$this->invokeExposedMethod($mode, $request);
return;
}
$recordModel = $this->saveRecord($request);
$fieldModelList = $recordModel->getModule()->getFields();
$result = array();
foreach ($fieldModelList as $fieldName => $fieldModel) {
$fieldValue = $displayValue = Vtiger_Util_Helper::toSafeHTML($recordModel->get($fieldName));
if ($fieldModel->getFieldDataType() !== 'currency') {
$displayValue = $fieldModel->getDisplayValue($fieldValue, $recordModel->getId());
}
if ($fieldName == 'language') {
$displayValue = Vtiger_Language_Handler::getLanguageLabel($fieldValue);
}
$result[$fieldName] = array('value' => $fieldValue, 'display_value' => $displayValue);
}
$result['_recordLabel'] = $recordModel->getName();
$result['_recordId'] = $recordModel->getId();
$response = new Vtiger_Response();
$response->setEmitType(Vtiger_Response::$EMIT_JSON);
$response->setResult($result);
$response->emit();
}
示例4: getDisplayValue
/**
* Function to get the Display Value, for the current field type with given DB Insert Value
* @param <Object> $value
* @return <Object>
*/
public function getDisplayValue($value)
{
if ($value == 1 || $value == '1' || strtolower($value) == 'on') {
return Vtiger_Language_Handler::getTranslatedString('LBL_YES', $this->get('field')->getModuleName());
}
return Vtiger_Language_Handler::getTranslatedString('LBL_NO', $this->get('field')->getModuleName());
}
示例5: _getFile
protected function _getFile($id, $moduleName, $crmid)
{
$current_user = \Users_Record_Model::getCurrentUserModel();
$useUser = \Users::getActiveAdminUser();
$oldUser = vglobal('current_user');
vglobal('current_user', $useUser);
$tmpFilename = $this->_getTmpFilename();
$mpdf = "";
$language = $current_user->language;
if (empty($language)) {
$language = \Vtiger_Language_Handler::getLanguage();
}
$Records = array($crmid);
// $request = $_REQUEST;
// $_REQUEST['search'] = true;
//$_REQUEST['submode'] = true;
\Vtiger_Loader::autoLoad('PDFMaker_PDFMaker_Model');
$PDFMaker = new \PDFMaker_PDFMaker_Model();
$name = $PDFMaker->GetPreparedMPDF($mpdf, $Records, array($id), $moduleName, $language);
$name = $PDFMaker->generate_cool_uri($name);
if ($name != "") {
$name = $name . ".pdf";
}
$mpdf->Output($tmpFilename);
vglobal('current_user', $oldUser);
$filetype = "application/pdf";
//$_REQUEST = $request;
return array('path' => $tmpFilename, 'name' => $name, 'type' => $filetype);
}
示例6: preProcess
public function preProcess(Vtiger_Request $request)
{
date_default_timezone_set('Europe/London');
// to overcome the pre configuration settings
// Added to redirect to default module if already installed
$request->set('module', 'Install');
$configFileName = 'config/config.inc.php';
if (is_file($configFileName) && filesize($configFileName) > 0) {
$defaultModule = vglobal('default_module');
$defaultModuleInstance = Vtiger_Module_Model::getInstance($defaultModule);
$defaultView = $defaultModuleInstance->getDefaultViewName();
header('Location:../index.php?module=' . $defaultModule . '&view=' . $defaultView);
exit;
}
$request = $this->setLanguage($request);
$_SESSION['default_language'] = $defaultLanguage = $request->get('lang') ? $request->get('lang') : 'en_us';
vglobal('default_language', $defaultLanguage);
$viewer = new Vtiger_Viewer();
$viewer->setTemplateDir('install/tpl/');
$viewer->assign('LANGUAGE_STRINGS', $this->getJSLanguageStrings($request));
$viewer->assign('HTMLLANG', Vtiger_Language_Handler::getShortLanguageName());
define('INSTALLATION_MODE', true);
define('INSTALLATION_MODE_DEBUG', $this->debug);
echo $viewer->fetch('InstallPreProcess.tpl');
}
示例7: getDisplayValue
/**
* Function to get the Display Value, for the current field type with given DB Insert Value
* @param <Object> $value
* @return <Object>
*/
public function getDisplayValue($value)
{
global $log;
$log->debug("Entering ./uitypes/Boolean.php::getDisplayValue");
if ($value == 1 || $value == '1' || strtolower($value) == 'on') {
return Vtiger_Language_Handler::getTranslatedString('LBL_YES', $this->get('field')->getModuleName());
}
return Vtiger_Language_Handler::getTranslatedString('LBL_NO', $this->get('field')->getModuleName());
}
示例8: getHeaderScripts
/**
* Function to get the list of Script models to be included
* @param Vtiger_Request $request
* @return <Array> - List of Vtiger_JsScript_Model instances
*/
function getHeaderScripts(Vtiger_Request $request)
{
$headerScriptInstances = parent::getHeaderScripts($request);
$moduleName = $request->getModule();
$jsFileNames = array('libraries.bootstrap.js.eternicode-bootstrap-datepicker.js.bootstrap-datepicker', '~libraries/bootstrap/js/eternicode-bootstrap-datepicker/js/locales/bootstrap-datepicker.' . Vtiger_Language_Handler::getShortLanguageName() . '.js', '~libraries/jquery/timepicker/jquery.timepicker.min.js', 'modules.Vtiger.resources.Popup', "modules.{$moduleName}.resources.Popup", 'modules.Vtiger.resources.BaseList', "modules.{$moduleName}.resources.BaseList", 'libraries.jquery.jquery_windowmsg', 'modules.Vtiger.resources.validator.BaseValidator', 'modules.Vtiger.resources.validator.FieldValidator', "modules.{$moduleName}.resources.validator.FieldValidator");
$jsScriptInstances = $this->checkAndConvertJsScripts($jsFileNames);
$headerScriptInstances = array_merge($headerScriptInstances, $jsScriptInstances);
return $headerScriptInstances;
}
示例9: vtranslateMenu
public static function vtranslateMenu($key, $module)
{
$language = Vtiger_Language_Handler::getLanguage();
$moduleStrings = Vtiger_Language_Handler::getModuleStringsFromFile($language, 'Menu');
if (array_key_exists($key, $moduleStrings['languageStrings'])) {
return stripslashes($moduleStrings['languageStrings'][$key]);
}
return vtranslate($key, $module);
}
示例10: getFooterScripts
/**
* Function to get the list of Script models to be included
* @param Vtiger_Request $request
* @return <Array> - List of Vtiger_JsScript_Model instances
*/
function getFooterScripts(Vtiger_Request $request)
{
$headerScriptInstances = parent::getFooterScripts($request);
$moduleName = $request->getModule();
$jsFileNames = array('libraries.bootstrap.js.eternicode-bootstrap-datepicker.js.bootstrap-datepicker', '~libraries/bootstrap/js/eternicode-bootstrap-datepicker/js/locales/bootstrap-datepicker.' . Vtiger_Language_Handler::getShortLanguageName() . '.js', '~libraries/jquery/timepicker/jquery.timepicker.min.js', '~libraries/jquery/inputmask/jquery.inputmask.js', '~libraries/jquery/mousetrap/mousetrap.min.js', 'modules.Vtiger.resources.Menu', 'modules.Vtiger.resources.Header', 'modules.Vtiger.resources.Edit', "modules.{$moduleName}.resources.Edit", 'modules.Vtiger.resources.Popup', "modules.{$moduleName}.resources.Popup", 'modules.Vtiger.resources.Field', "modules.{$moduleName}.resources.Field", 'modules.Vtiger.resources.validator.BaseValidator', 'modules.Vtiger.resources.validator.FieldValidator', "modules.{$moduleName}.resources.validator.FieldValidator", 'libraries.jquery.jquery_windowmsg', 'modules.Vtiger.resources.BasicSearch', "modules.{$moduleName}.resources.BasicSearch", 'modules.Vtiger.resources.AdvanceFilter', "modules.{$moduleName}.resources.AdvanceFilter", 'modules.Vtiger.resources.SearchAdvanceFilter', "modules.{$moduleName}.resources.SearchAdvanceFilter", 'modules.Vtiger.resources.AdvanceSearch', "modules.{$moduleName}.resources.AdvanceSearch", 'modules.Vtiger.resources.Mobile', 'modules.Settings.DataAccess.resources.SaveResult');
$jsScriptInstances = $this->checkAndConvertJsScripts($jsFileNames);
$headerScriptInstances = array_merge($headerScriptInstances, $jsScriptInstances);
return $headerScriptInstances;
}
示例11: getDisplayValue
/**
* Function to get the Display Value, for the current field type with given DB Insert Value
* @param <Object> $value
* @return <Object>
*/
public function getDisplayValue($value)
{
if ($value === 1 || $value === '1' || strtolower($value) === 'on' || strtolower($value) === 'yes' || true === $value) {
return Vtiger_Language_Handler::getTranslatedString('LBL_YES', $this->get('field')->getModuleName());
} else if ($value === 0 || $value === '0' || strtolower($value) === 'off' || strtolower($value) === 'no' || false === $value) {
return Vtiger_Language_Handler::getTranslatedString('LBL_NO', $this->get('field')->getModuleName());
}
return $value;
}
示例12: getDisplayValue
/**
* Function to get the Display Value, for the current field type with given DB Insert Value
* @param <Object> $value
* @return <Object>
*/
public function getDisplayValue($value, $record = false, $recordInstance = false, $rawText = false)
{
$value = explode(' |##| ', $value);
$trValue = array();
for ($i = 0; $i < count($value); $i++) {
$trValue[] = Vtiger_Language_Handler::getTranslatedString($value[$i], $this->get('field')->getModuleName());
}
if (is_array($trValue)) {
$trValue = implode(' |##| ', $trValue);
}
return str_ireplace(' |##| ', ', ', $trValue);
}
示例13: preProcess
public function preProcess(Vtiger_Request $request, $display = true)
{
if ($this->checkPermission($request)) {
$viewer = $this->getViewer($request);
$currentUser = Users_Record_Model::getCurrentUserModel();
$selectedModule = $request->getModule();
$companyDetails = Vtiger_CompanyDetails_Model::getInstanceById();
$companyLogo = $companyDetails->getLogo();
$currentDate = Vtiger_Date_UIType::getDisplayDateValue(date('Y-n-j'));
$viewer->assign('CURRENTDATE', $currentDate);
$viewer->assign('MODULE', $selectedModule);
$viewer->assign('MODULE_NAME', $selectedModule);
$viewer->assign('QUALIFIED_MODULE', $selectedModule);
$viewer->assign('PARENT_MODULE', $request->get('parent'));
$viewer->assign('MENUS', Vtiger_Menu_Model::getAll(true));
$viewer->assign('VIEW', $request->get('view'));
$viewer->assign('COMPANY_LOGO', $companyLogo);
$viewer->assign('USER_MODEL', $currentUser);
$homeModuleModel = Vtiger_Module_Model::getInstance('Home');
$viewer->assign('HOME_MODULE_MODEL', $homeModuleModel);
$viewer->assign('HEADER_LINKS', $this->getHeaderLinks());
$viewer->assign('ANNOUNCEMENT', $this->getAnnouncement());
$viewer->assign('SEARCHABLE_MODULES', Vtiger_Module_Model::getSearchableModules());
$viewer->assign('CHAT_ACTIVE', vtlib_isModuleActive('AJAXChat'));
//Additional parameters
$recordId = $request->get('record');
$moduleName = $request->getModule();
$detailViewModel = Vtiger_DetailView_Model::getInstance($moduleName, $recordId);
$recordModel = $detailViewModel->getRecord();
$detailViewLinkParams = array('MODULE' => $moduleName, 'RECORD' => $recordId);
$detailViewLinks = $detailViewModel->getDetailViewLinks($detailViewLinkParams);
$viewer->assign('RECORD', $recordModel);
$viewer->assign('MODULE_MODEL', $detailViewModel->getModule());
$viewer->assign('DETAILVIEW_LINKS', $detailViewLinks);
$viewer->assign('IS_EDITABLE', $detailViewModel->getRecord()->isEditable($moduleName));
$viewer->assign('IS_DELETABLE', $detailViewModel->getRecord()->isDeletable($moduleName));
$linkParams = array('MODULE' => $moduleName, 'ACTION' => $request->get('view'));
$linkModels = $detailViewModel->getSideBarLinks($linkParams);
$viewer->assign('QUICK_LINKS', $linkModels);
$viewer->assign('PAGETITLE', $this->getPageTitle($request));
$viewer->assign('SCRIPTS', $this->getHeaderScripts($request));
$viewer->assign('STYLES', $this->getHeaderCss($request));
$viewer->assign('LANGUAGE_STRINGS', $this->getJSLanguageStrings($request));
$viewer->assign('CURRENT_VIEW', $request->get('view'));
$viewer->assign('SKIN_PATH', Vtiger_Theme::getCurrentUserThemePath());
$viewer->assign('HTMLLANG', Vtiger_Language_Handler::getShortLanguageName());
$viewer->assign('LANGUAGE', $currentUser->get('language'));
if ($display) {
$this->preProcessDisplay($request);
}
}
}
示例14: process
public function process(Vtiger_Request $request)
{
${"GLOBALS"}["pcjpcgy"] = "current_user";
global $root_directory;
${"GLOBALS"}["qnnpnmctvkh"] = "adb";
${"GLOBALS"}["sbwrerrdfpiq"] = "viewer";
${${"GLOBALS"}["pcjpcgy"]} = ${${"GLOBALS"}["enwvewqev"]} = Users_Record_Model::getCurrentUserModel();
${${"GLOBALS"}["myvnqjtagyw"]} = Vtiger_Language_Handler::getLanguage();
${${"GLOBALS"}["qnnpnmctvkh"]} = PearDatabase::getInstance();
${${"GLOBALS"}["sbwrerrdfpiq"]} = $this->getViewer(${${"GLOBALS"}["klrvtdauww"]});
$viewer->assign("lastUrl", $_SESSION["_url_before_import"]);
$viewer->view("ImporterStep3.tpl", "Workflow2");
}
示例15: process
public function process(Vtiger_Request $request)
{
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$qualifiedModuleName = $request->getModule(false);
$settings_block = $request->get('block');
$settings_fieldid = $request->get('fieldid');
$viewer->assign('LANGUAGES', Vtiger_Language_Handler::getAllLanguages());
$viewer->assign('ALL_MODULES', Vtiger_Module_Model::getEntityModules());
$viewer->assign('MODULE', $moduleName);
$viewer->assign('SETTINGS_BLOCK', $settings_block);
$viewer->assign('SETTINGS_FIELDID', $settings_fieldid);
echo $viewer->view('List.tpl', $qualifiedModuleName, true);
}