本文整理汇总了PHP中BOL_LanguageService类的典型用法代码示例。如果您正苦于以下问题:PHP BOL_LanguageService类的具体用法?PHP BOL_LanguageService怎么用?PHP BOL_LanguageService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BOL_LanguageService类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
parent::__construct();
$language = OW::getLanguage();
$serviceLang = BOL_LanguageService::getInstance();
$addSectionForm = new Form('qst_add_section_form');
$addSectionForm->setAjax();
$addSectionForm->setAjaxResetOnSuccess(true);
$addSectionForm->setAction(OW::getRouter()->urlFor("ADMIN_CTRL_Questions", "ajaxResponder"));
$input = new HiddenField('command');
$input->setValue('addSection');
$addSectionForm->addElement($input);
$qstSectionName = new TextField('section_name');
$qstSectionName->addAttribute('class', 'ow_text');
$qstSectionName->addAttribute('style', 'width: auto;');
$qstSectionName->setRequired();
$qstSectionName->setLabel($language->text('admin', 'questions_new_section_label'));
$addSectionForm->addElement($qstSectionName);
$this->addForm($addSectionForm);
$addSectionForm->bindJsFunction('success', ' function (result) {
if ( result.result )
{
OW.info(result.message);
}
else
{
OW.error(result.message);
}
window.location.reload();
} ');
}
开发者ID:hardikamutech,项目名称:loov,代码行数:32,代码来源:add_question_section.php
示例2: index
public function index($params)
{
$id = (int) $params['id'];
$this->assign('id', $id);
$menu = BOL_NavigationService::getInstance()->findMenuItemById($id);
$service = BOL_NavigationService::getInstance();
$form = new EditExternalPageForm('edit-form', $menu);
if (OW::getRequest()->isPost() && $form->isValid($_POST)) {
$data = $form->getValues();
$visibleFor = 0;
$arr = !empty($data['visible-for']) ? $data['visible-for'] : array();
foreach ($arr as $val) {
$visibleFor += $val;
}
$service->saveMenuItem($menu->setExternalUrl($data['url'])->setVisibleFor($visibleFor)->setNewWindow(!empty($_POST['ext-open-in-new-window']) && $_POST['ext-open-in-new-window'] == 'on'));
$languageService = BOL_LanguageService::getInstance();
$plugin = OW::getPluginManager()->getPlugin('base');
$langKey = $languageService->findKey($plugin->getKey(), $menu->getKey());
if (empty($langKey)) {
$langPrefixDto = $languageService->findPrefix($menu->getPrefix());
$langKey = $languageService->addKey($langPrefixDto->getId(), $menu->getKey());
}
$langValue = $languageService->findValue($languageService->getCurrent()->getId(), $langKey->getId());
if (empty($langValue)) {
$languageService->addValue($languageService->getCurrent()->getId(), $menu->getPrefix(), $langKey->getKey(), $data['name']);
} else {
$languageService->saveValue($langValue->setValue($data['name']));
}
$adminPlugin = OW::getPluginManager()->getPlugin('admin');
OW::getFeedback()->info(OW::getLanguage()->text($adminPlugin->getKey(), 'updated_msg'));
$this->redirect();
}
$this->addForm($form);
}
开发者ID:ZyXelP,项目名称:oxwall,代码行数:34,代码来源:pages_edit_external.php
示例3: __construct
/**
* Constructor.
*
*/
public function __construct()
{
parent::__construct('');
$template = OW::getPluginManager()->getPlugin('BASE')->getCmpViewDir() . 'console_switch_language.html';
$this->setTemplate($template);
$languages = BOL_LanguageService::getInstance()->getLanguages();
$session_language_id = BOL_LanguageService::getInstance()->getCurrent()->getId();
$active_languages = array();
foreach ($languages as $id => $language) {
if ($language->status == 'active') {
$tag = $this->parseCountryFromTag($language->tag);
$active_lang = array('id' => $language->id, 'label' => $tag['label'], 'order' => $language->order, 'tag' => $language->tag, 'class' => "ow_console_lang{$tag['country']}", 'url' => OW::getRequest()->buildUrlQueryString(null, array("language_id" => $language->id)), 'is_current' => false);
if ($session_language_id == $language->id) {
$active_lang['is_current'] = true;
$this->assign('label', $tag['label']);
$this->assign('class', "ow_console_lang{$tag['country']}");
}
$active_languages[] = $active_lang;
}
}
if (count($active_languages) <= 1) {
$this->setVisible(false);
return;
}
function sortActiveLanguages($lang1, $lang2)
{
return $lang1['order'] < $lang2['order'] ? -1 : 1;
}
usort($active_languages, 'sortActiveLanguages');
$switchLanguage = new BASE_CMP_SwitchLanguage($active_languages);
$this->setContent($switchLanguage->render());
}
开发者ID:vazahat,项目名称:dudex,代码行数:36,代码来源:console_switch_language.php
示例4: import
public function import($params)
{
$importDir = $params['importDir'];
$sqlFile = $importDir . 'configs.sql';
//import configs
if (file_exists($sqlFile)) {
DATAIMPORTER_BOL_ImportService::getInstance()->sqlImport($sqlFile);
}
$configFile = $importDir . 'config.txt';
$string = file_get_contents($configFile);
$this->configs = json_decode($string, true);
$this->importAvatars($this->configs['avatarUrl']);
$this->importTheme($importDir);
$this->importMediaPanelFiles();
if (OW::getPluginManager()->getPlugin('dataimporter')) {
if (file_exists(OW::getPluginManager()->getPlugin('dataimporter')->getRootDir() . 'langs.zip')) {
OW::getLanguage()->importPluginLangs(OW::getPluginManager()->getPlugin('dataimporter')->getRootDir() . 'langs.zip', 'dataimporter');
}
}
$languageId = OW::getLanguage()->getCurrentId();
BOL_LanguageService::getInstance()->generateCache($languageId);
OW::getDbo()->query("TRUNCATE " . OW_DB_PREFIX . 'base_component_place_cache');
//TODO: Use service function
// ADD MENU ITEMS add plugin and add theme
try {
OW::getDbo()->query("INSERT IGNORE INTO `" . OW_DB_PREFIX . "base_menu_item` ( `prefix`, `key`, `documentKey`, `type`, `order`, `routePath`, `externalUrl`, `newWindow`, `visibleFor`) VALUES ( 'admin', 'sidebar_menu_plugins_add', '', 'admin_plugins', 3, 'admin_plugins_add', NULL, 0, 2) ");
} catch (Exception $ex) {
}
try {
OW::getDbo()->query("INSERT IGNORE INTO `" . OW_DB_PREFIX . "base_menu_item` ( `prefix`, `key`, `documentKey`, `type`, `order`, `routePath`, `externalUrl`, `newWindow`, `visibleFor`) VALUES ( 'admin', 'sidebar_menu_themes_add', '', 'admin_appearance', 3, 'admin_themes_add_new', NULL, 0, 3) ");
} catch (Exception $ex) {
}
}
开发者ID:vazahat,项目名称:dudex,代码行数:33,代码来源:import.php
示例5: index
public function index($params)
{
$id = (int) $params['id'];
$menu = BOL_NavigationService::getInstance()->findMenuItemById($id);
$form = new EditPluginPageForm('edit-form', $menu);
$service = BOL_NavigationService::getInstance();
if (OW::getRequest()->isPost() && $form->isValid($_POST)) {
$data = $form->getValues();
$visibleFor = 0;
$arr = !empty($data['visible-for']) ? $data['visible-for'] : array();
foreach ($arr as $val) {
$visibleFor += $val;
}
$service->saveMenuItem($menu->setVisibleFor($visibleFor));
$languageService = BOL_LanguageService::getInstance();
$langKey = $languageService->findKey($menu->getPrefix(), $menu->getKey());
$langValue = $languageService->findValue($languageService->getCurrent()->getId(), $langKey->getId());
$languageService->saveValue($langValue->setValue($data['name']));
$adminPlugin = OW::getPluginManager()->getPlugin('admin');
OW::getFeedback()->info(OW::getLanguage()->text($adminPlugin->getKey(), 'updated_msg'));
$this->redirect();
}
//--
$this->addForm($form);
}
开发者ID:vazahat,项目名称:dudex,代码行数:25,代码来源:pages_edit_plugin.php
示例6: process
/**
* Updates user settings configuration
*
* @return boolean
*/
public function process($post, $plugins)
{
$values = $this->getValues();
$config = OW::getConfig();
if ($plugins['photo']) {
$config->saveConfig('attachments', 'photo_share', empty($values['photo_share']) ? 0 : 1);
if (!empty($values['photo_share'])) {
$languageService = BOL_LanguageService::getInstance();
$langKey = $languageService->findKey('attachments', 'default_photo_album_name');
if (!empty($langKey)) {
$langValue = $languageService->findValue($languageService->getCurrent()->getId(), $langKey->getId());
if ($langValue === null) {
$langValue = new BOL_LanguageValue();
$langValue->setKeyId($langKey->getId());
$langValue->setLanguageId($languageService->getCurrent()->getId());
}
$languageService->saveValue($langValue->setValue($values['photo_album_name']));
}
}
}
if ($plugins['video']) {
$config->saveConfig('attachments', 'video_share', empty($values['video_share']) ? 0 : 1);
}
if ($plugins['links']) {
$config->saveConfig('attachments', 'link_share', empty($values['link_share']) ? 0 : 1);
}
return true;
}
开发者ID:vazahat,项目名称:dudex,代码行数:33,代码来源:admin.php
示例7: smarty_function_text_edit
function smarty_function_text_edit($params, $smarty)
{
$key = $params['key'];
unset($params['key']);
$key = explode('+', $key);
if (empty($key[0]) || empty($key[1])) {
return '_INVALID_KEY_';
}
$prefix = $key[0];
$key = $key[1];
$text = OW::getLanguage()->text($prefix, $key, $params);
$keyDto = BOL_LanguageService::getInstance()->findKey($prefix, $key);
if (!$keyDto) {
return '<span class="ow_red">' . $text . '</span>';
}
$script = '$("a.ow_text_edit").click(function(){
var self=$(this), lang = this.rel.split("+");
OW.editLanguageKey(lang[0],lang[1], function(e){
self.text(e.value);
});
});';
OW::getDocument()->addOnloadScript($script);
$rel = json_encode($prefix . '+' . $key);
return '<a href="javascript://" rel=' . $rel . ' class="ow_text_edit">' . $text . '</a>';
}
开发者ID:vazahat,项目名称:dudex,代码行数:25,代码来源:function.text_edit.php
示例8: deleteDepartment
public function deleteDepartment($id)
{
$id = (int) $id;
if ($id > 0) {
$key = BOL_LanguageService::getInstance()->findKey('contactus', $this->getDepartmentKey($id));
BOL_LanguageService::getInstance()->deleteKey($key->id, true);
CONTACTUS_BOL_DepartmentDao::getInstance()->deleteById($id);
}
}
开发者ID:vazahat,项目名称:dudex,代码行数:9,代码来源:service.php
示例9: deleteDepartment
public function deleteDepartment($id)
{
$id = (int) $id;
if ($id > 0) {
$key = BOL_LanguageService::getInstance()->findKey('shoppro', $this->getDepartmentKey($id));
BOL_LanguageService::getInstance()->deleteKey($key->id, true);
SHOPPRO_BOL_DepartmentDao::getInstance()->deleteById($id);
}
}
开发者ID:vazahat,项目名称:dudex,代码行数:9,代码来源:service.php
示例10: init
/**
* Application init actions.
*/
public function init()
{
require_once OW_DIR_SYSTEM_PLUGIN . 'base' . DS . 'classes' . DS . 'json_err_output.php';
OW_ErrorManager::getInstance()->setErrorOutput(new BASE_CLASS_JsonErrOutput());
$authToken = empty($_SERVER["HTTP_API_AUTH_TOKEN"]) ? null : $_SERVER["HTTP_API_AUTH_TOKEN"];
OW_Auth::getInstance()->setAuthenticator(new OW_TokenAuthenticator($authToken));
if (!empty($_SERVER["HTTP_API_LANGUAGE"])) {
$tag = $_SERVER["HTTP_API_LANGUAGE"];
$languageDto = BOL_LanguageService::getInstance()->findByTag($tag);
if (empty($languageDto)) {
$tag = mb_substr($tag, 0, 2);
$languageDto = BOL_LanguageService::getInstance()->findByTag($tag);
}
if (!empty($languageDto) && $languageDto->status == "active") {
BOL_LanguageService::getInstance()->setCurrentLanguage($languageDto);
}
}
$this->detectLanguage();
// setting default time zone
date_default_timezone_set(OW::getConfig()->getValue('base', 'site_timezone'));
if (OW::getUser()->isAuthenticated()) {
$userId = OW::getUser()->getId();
$timeZone = BOL_PreferenceService::getInstance()->getPreferenceValue('timeZoneSelect', $userId);
if (!empty($timeZone)) {
date_default_timezone_set($timeZone);
}
}
// synchronize the db's time zone
OW::getDbo()->setTimezone();
// OW::getRequestHandler()->setIndexPageAttributes('BASE_CTRL_ComponentPanel');
// OW::getRequestHandler()->setStaticPageAttributes('BASE_CTRL_StaticDocument');
//
// // router init - need to set current page uri and base url
$router = OW::getRouter();
$router->setBaseUrl(OW_URL_HOME . 'api/');
$uri = OW::getRequest()->getRequestUri();
// before setting in router need to remove get params
if (strstr($uri, '?')) {
$uri = substr($uri, 0, strpos($uri, '?'));
}
$router->setUri($uri);
$router->setDefaultRoute(new OW_ApiDefaultRoute());
OW::getPluginManager()->initPlugins();
$event = new OW_Event(OW_EventManager::ON_PLUGINS_INIT);
OW::getEventManager()->trigger($event);
$beckend = OW::getEventManager()->call('base.cache_backend_init');
if ($beckend !== null) {
OW::getCacheManager()->setCacheBackend($beckend);
OW::getCacheManager()->setLifetime(3600);
OW::getDbo()->setUseCashe(true);
}
OW::getResponse()->setDocument($this->newDocument());
if (OW::getUser()->isAuthenticated()) {
BOL_UserService::getInstance()->updateActivityStamp(OW::getUser()->getId(), $this->getContext());
}
}
开发者ID:ZyXelP,项目名称:oxwall,代码行数:59,代码来源:api_application.php
示例11: getLanguageCode
public function getLanguageCode()
{
$tag = BOL_LanguageService::getInstance()->getCurrent()->getTag();
$matches = array();
preg_match("/^([a-zA-Z]{2})-[a-zA-Z]{2}.*\$/", $tag, $matches);
$language = 'en';
if (!empty($matches[1])) {
$language = mb_strtolower($matches[1]);
}
return $language;
}
开发者ID:hardikamutech,项目名称:hammu,代码行数:11,代码来源:location_service.php
示例12: addCategory
public function addCategory($label, $parent, $id = null)
{
$category = new SPDOWNLOAD_BOL_Category();
$category->id = $id;
$category->name = $label;
$category->parentId = $parent;
SPDOWNLOAD_BOL_CategoryDao::getInstance()->save($category);
if ($id == null) {
BOL_LanguageService::getInstance()->addValue(OW::getLanguage()->getCurrentId(), 'spdownload', $this->getCategoryKey($category->id), trim($label));
}
}
开发者ID:SongPhi,项目名称:spdownload,代码行数:11,代码来源:category_service.php
示例13: getInstance
/**
* Returns class instance
* @param $includeCache bool
* @return BOL_LanguageService
*/
public static function getInstance($includeCache = true)
{
if (!isset(self::$classInstance)) {
try {
self::$classInstance = OW::getClassInstance(self::class, $includeCache);
} catch (ReflectionException $ex) {
self::$classInstance = new self($includeCache);
}
}
return self::$classInstance;
}
开发者ID:ZyXelP,项目名称:oxwall,代码行数:16,代码来源:language_service.php
示例14: isValidLangs
protected function isValidLangs()
{
$langService = BOL_LanguageService::getInstance();
$prefix = BOL_LanguageService::getInstance()->findPrefix('test_prefix');
$this->assertTrue((bool) (!empty($prefix) && $prefix instanceof BOL_LanguagePrefix));
$this->assertEquals('Test prefix', $prefix->label);
$lang = BOL_LanguageService::getInstance()->findByTag('en');
$this->assertEquals('test1', $langService->getText($lang->id, 'test_prefix', 'test_key_1'));
$this->assertEquals('test2', $langService->getText($lang->id, 'test_prefix', 'test_key_2'));
$this->assertEquals('test3', $langService->getText($lang->id, 'test_prefix', 'test_key_3'));
}
开发者ID:ZyXelP,项目名称:oxwall,代码行数:11,代码来源:importLanguageTest.php
示例15: __construct
public function __construct()
{
$accountType = new BOL_QuestionAccountType();
$accountType->name = md5(uniqid());
$accountType->roleId = 0;
$form = new ADMIN_CLASS_AddAccountTypeForm($accountType);
$this->addForm($form);
$list = BOL_LanguageService::getInstance()->findActiveList();
$this->assign('langs', $list);
$this->assign('prefix', 'base');
$this->assign('key', BOL_QuestionService::getInstance()->getQuestionLangKeyName(BOL_QuestionService::LANG_KEY_TYPE_ACCOUNT_TYPE, $accountType->name));
$this->assign('form', $form);
}
开发者ID:hardikamutech,项目名称:loov,代码行数:13,代码来源:add_account_type.php
示例16: process
public function process()
{
$values = $this->getValues();
$languageService = BOL_LanguageService::getInstance();
$langKey = $languageService->findKey('uavatars', 'default_photo_album_name');
if (!empty($langKey)) {
$langValue = $languageService->findValue($languageService->getCurrent()->getId(), $langKey->getId());
if ($langValue === null) {
$langValue = new BOL_LanguageValue();
$langValue->setKeyId($langKey->getId());
$langValue->setLanguageId($languageService->getCurrent()->getId());
}
$languageService->saveValue($langValue->setValue($values['photo_album_name']));
}
return true;
}
开发者ID:vazahat,项目名称:dudex,代码行数:16,代码来源:admin.php
示例17: __construct
/**
* Constructor.
*
* @param array $itemsList
*/
public function __construct($langId)
{
parent::__construct();
$this->service = BOL_LanguageService::getInstance();
if (empty($langId)) {
$this->setVisible(false);
return;
}
$languageDto = $this->service->findById($langId);
if ($languageDto === null) {
$this->setVisible(false);
return;
}
$language = OW::getLanguage();
$form = new Form('lang_edit');
$form->setAjax();
$form->setAction(OW::getRouter()->urlFor('ADMIN_CTRL_Languages', 'langEditFormResponder'));
$form->setAjaxResetOnSuccess(false);
$labelTextField = new TextField('label');
$labelTextField->setLabel($language->text('admin', 'clone_form_lbl_label'));
$labelTextField->setDescription($language->text('admin', 'clone_form_descr_label'));
$labelTextField->setRequired();
$labelTextField->setValue($languageDto->getLabel());
$form->addElement($labelTextField);
$tagTextField = new TextField('tag');
$tagTextField->setLabel($language->text('admin', 'clone_form_lbl_tag'));
$tagTextField->setDescription($language->text('admin', 'clone_form_descr_tag'));
$tagTextField->setRequired();
$tagTextField->setValue($languageDto->getTag());
if ($languageDto->getTag() == 'en') {
$tagTextField->addAttribute('disabled', 'disabled');
}
$form->addElement($tagTextField);
$rtl = new CheckboxField('rtl');
$rtl->setLabel($language->text('admin', 'lang_edit_form_rtl_label'));
$rtl->setDescription($language->text('admin', 'lang_edit_form_rtl_desc'));
$rtl->setValue((bool) $languageDto->getRtl());
$form->addElement($rtl);
$hiddenField = new HiddenField('langId');
$hiddenField->setValue($languageDto->getId());
$form->addElement($hiddenField);
$submit = new Submit('submit');
$submit->setValue($language->text('admin', 'btn_label_edit'));
$form->addElement($submit);
$form->bindJsFunction(Form::BIND_SUCCESS, "function(data){if(data.result){OW.info(data.message);setTimeout(function(){window.location.reload();}, 1000);}else{OW.error(data.message);}}");
$this->addForm($form);
}
开发者ID:ZyXelP,项目名称:oxwall,代码行数:52,代码来源:lang_edit.php
示例18: __construct
public function __construct($accountTypeName = '')
{
$accountType = BOL_QuestionService::getInstance()->findAccountTypeByName($accountTypeName);
if (empty($accountType)) {
$this->setVisible(false);
}
$form = new ADMIN_CLASS_AddAccountTypeForm($accountType, 'editAccountType');
$form->setAjaxResetOnSuccess(false);
$this->addForm($form);
$list = BOL_LanguageService::getInstance()->findActiveList();
$key = BOL_QuestionService::getInstance()->getQuestionLangKeyName(BOL_QuestionService::LANG_KEY_TYPE_ACCOUNT_TYPE, $accountType->name);
$this->assign('langs', $list);
$this->assign('prefix', 'base');
$this->assign('key', $key);
$this->assign('form', $form);
$this->setTemplate(OW::getPluginManager()->getPlugin('admin')->getCmpViewDir() . 'add_account_type.html');
}
开发者ID:hardikamutech,项目名称:loov,代码行数:17,代码来源:edit_account_type.php
示例19: index
public function index($params)
{
$listType = empty($params['list']) ? 'latest' : strtolower(trim($params['list']));
$this->addComponent('menu', self::getMenu($listType));
$page = !empty($_GET['page']) && intval($_GET['page']) > 0 ? intval($_GET['page']) : 1;
list($list, $itemCount) = $this->getData($listType, ($page - 1) * $this->usersPerPage, $this->usersPerPage);
$cmp = OW::getClassInstance("BASE_Members", $list, $itemCount, $this->usersPerPage, true, $listType);
$this->addComponent('cmp', $cmp);
$this->assign('listType', $listType);
$description = '';
try {
$description = BOL_LanguageService::getInstance()->getText(BOL_LanguageService::getInstance()->getCurrent()->getId(), 'base', 'users_list_' . $listType . '_meta_description');
} catch (Exception $e) {
}
if (!empty($description)) {
OW::getDocument()->setDescription($description);
}
}
开发者ID:ZyXelP,项目名称:oxwall,代码行数:18,代码来源:user_list.php
示例20: __construct
public function __construct($value, $languageData)
{
parent::__construct('lang-values-edit');
$this->setAjax(true);
//$this->setAction('javascript://');
$hidden = new HiddenField('value');
$hidden->setValue($value);
$this->addElement($hidden);
$languageService = BOL_LanguageService::getInstance();
$list = $languageService->findActiveList();
foreach ($list as $item) {
$textArea = new Textarea("lang[{$item->getId()}][value][{$value}]");
if (isset($languageData[$item->getId()])) {
$textArea->setValue($languageData[$item->getId()]);
}
$this->addElement($textArea);
}
$submit = new Submit('submit');
$submit->setValue(OW::getLanguage()->text('admin', 'save_btn_label'));
$this->addElement($submit);
}
开发者ID:hardikamutech,项目名称:loov,代码行数:21,代码来源:edit_question_value_label.php
注:本文中的BOL_LanguageService类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论