コード例 #1
0
ファイル: language_service.php プロジェクト: Taissas/oxwall
 private function __construct($includeCache = true)
 {
     $this->languageDao = BOL_LanguageDao::getInstance();
     $this->prefixDao = BOL_LanguagePrefixDao::getInstance();
     $this->keyDao = BOL_LanguageKeyDao::getInstance();
     $this->valueDao = BOL_LanguageValueDao::getInstance();
     $this->languageCacheDir = OW::getPluginManager()->getPlugin('base')->getPluginFilesDir();
     if ($includeCache) {
         $this->loadFromCahce();
     }
 }
コード例 #2
0
ファイル: language_service.php プロジェクト: ZyXelP/oxwall
 /**
  * Adds or updates new key and value
  *
  * @param int $languageId
  * @param string $prefix
  * @param string $key
  * @param string $value
  * @param bool $generateCache
  *
  * @return BOL_LanguageValue
  *
  * @throws LogicException
  */
 public function addOrUpdateValue($languageId, $prefix, $key, $value, $generateCache = true)
 {
     $prefixDto = $this->prefixDao->findByPrefix($prefix);
     if ($prefixDto == null) {
         throw new LogicException("Prefix `{$prefix}` not found!");
     }
     $keyDto = $this->findKey($prefix, $key);
     if ($keyDto === null) {
         $keyDto = new BOL_LanguageKey();
         $keyDto->setPrefixId($prefixDto->id)->setKey($key);
         $this->keyDao->save($keyDto);
     }
     $valueDto = $this->findValue($languageId, $keyDto->id);
     if ($valueDto === null) {
         $valueDto = new BOL_LanguageValue();
     }
     $valueDto->setLanguageId($languageId)->setKeyId($keyDto->getId())->setValue($value);
     $this->valueDao->save($valueDto);
     if ($generateCache) {
         $this->generateCache($valueDto->languageId);
     }
     return $valueDto;
 }
コード例 #3
0
ファイル: language_value_dao.php プロジェクト: vazahat/dudex
 public function countSearchResultKeys($languageId, $search)
 {
     $search = $this->dbo->escapeString($search);
     $_query = "\n\t\t\t SELECT COUNT(*)\n\t\t\t FROM `" . BOL_LanguageValueDao::getInstance()->getTableName() . "` as `v`\n\t\t\t INNER JOIN `" . BOL_LanguageKeyDao::getInstance()->getTableName() . "` as `k`\n\t\t\t      ON( `v`.`keyId` = `k`.`id` )\n\t\t\t INNER JOIN `" . BOL_LanguagePrefixDao::getInstance()->getTableName() . "` as `p`\n\t\t\t      ON( `k`.`prefixId` = `p`.`id` )\n\t\t\t WHERE `v`.`value` LIKE ? AND `v`.`languageId` = ? \n\t\t\t";
     return $this->dbo->queryForColumn($_query, array("%{$search}%", $languageId));
 }
コード例 #4
0
ファイル: admin.php プロジェクト: vazahat/dudex
 public function hint(array $params = array())
 {
     $this->document->addStyleSheet($this->plugin->getStaticCssUrl() . $this->theme . '.css');
     $this->document->addStyleSheet($this->plugin->getStaticCssUrl() . 'tipTip.css');
     $this->document->addScript($this->plugin->getStaticJsUrl() . 'jquery.tipTip.minified.js');
     $features = array_filter(@get_object_vars(json_decode(OW::getConfig()->getValue('profileprogressbar', 'features'))));
     $_features = array();
     foreach ($features as $feature => $count) {
         $_features[$feature] = OW::getLanguage()->text('profileprogressbar', $feature . '_desc');
         $_features[$feature . 'Count'] = $count;
     }
     $form = new PROFILEPROGRESSBAR_CLASS_HintForm();
     function unsetUnusedHint($val)
     {
         return strpos($val, '{$') === FALSE;
     }
     function getHint($_features)
     {
         $vars = array();
         foreach ($_features as $key => $value) {
             $vars['{$' . $key . '}'] = $value;
         }
         $hintText = explode('#', OW::getLanguage()->text('profileprogressbar', 'hint_text'));
         foreach ($hintText as $key => $hint) {
             $hintText[$key] = str_replace(array_keys($vars), array_values($vars), $hint);
         }
         $hintText = array_filter($hintText, 'unsetUnusedHint');
         return trim(implode('', $hintText));
     }
     if (OW::getRequest()->isAjax() && $form->isValid($_POST)) {
         OW::getConfig()->saveConfig('profileprogressbar', 'show_hint', (int) $form->getElement('show-hint')->getValue());
         $languageService = BOL_LanguageService::getInstance();
         $langKey = $languageService->findKey('profileprogressbar', 'hint_text');
         $langValue = BOL_LanguageValueDao::getInstance()->findValue($languageService->getCurrent()->getId(), $langKey->getId());
         $langValue->setValue($_POST['hint-text']);
         BOL_LanguageService::getInstance()->saveValue($langValue);
         exit(json_encode(array('content' => getHint($_features))));
     }
     $hintText = getHint($_features);
     OW::getDocument()->addOnloadScript(UTIL_JsGenerator::composeJsString(';$("#profile-progressbar").tipTip({
                 maxWidth: "auto",
                 content: {$hint}
             });', array('hint' => $hintText)));
     $this->addForm($form);
 }
コード例 #5
0
ファイル: language_key_dao.php プロジェクト: vazahat/dudex
 public function findMissingKeyCount($languageId)
 {
     $query = "\n                SELECT COUNT(*)\n                FROM `" . BOL_LanguageKeyDao::getInstance()->getTableName() . "` as k\n                LEFT JOIN `" . BOL_LanguageValueDao::getInstance()->getTableName() . "` as v\n                     ON( k.id = v.keyId  and v.`languageId` = ? )\n                INNER JOIN `" . BOL_LanguagePrefixDao::getInstance()->getTableName() . "` as p\n                      ON(k.`prefixId` = p.id)\n                WHERE v.keyId IS NULL OR (`v`.`value` IS NOT NULL AND LENGTH(`v`.`value`) = 0 )\n\t\t\t";
     return $this->dbo->queryForColumn($query, array($languageId));
 }