コード例 #1
0
ファイル: UmScApp.php プロジェクト: Hildy/cerb5
 /**
  * @param $instance Model_CommunityTool 
  */
 public function configure(Model_CommunityTool $instance)
 {
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl_path = dirname(dirname(__FILE__)) . '/templates/';
     $tpl->assign('config_path', $tpl_path);
     // Locales
     $default_locale = DAO_CommunityToolProperty::get($instance->code, self::PARAM_DEFAULT_LOCALE, 'en_US');
     $tpl->assign('default_locale', $default_locale);
     $locales = DAO_Translation::getDefinedLangCodes();
     $tpl->assign('locales', $locales);
     // Personalization
     $page_title = DAO_CommunityToolProperty::get($instance->code, self::PARAM_PAGE_TITLE, 'Support Center');
     $tpl->assign('page_title', $page_title);
     // Login Handlers
     $login_handlers = DevblocksPlatform::getExtensions('usermeet.login.authenticator');
     uasort($login_handlers, create_function('$a, $b', "return strcasecmp(\$a->name,\$b->name);\n"));
     $tpl->assign('login_handlers', $login_handlers);
     $login_handler = DAO_CommunityToolProperty::get($instance->code, self::PARAM_LOGIN_HANDLER, '');
     $tpl->assign('login_handler', $login_handler);
     // Modules
     @($visible_modules = unserialize(DAO_CommunityToolProperty::get($instance->code, self::PARAM_VISIBLE_MODULES, '')));
     $tpl->assign('visible_modules', $visible_modules);
     $all_modules = DevblocksPlatform::getExtensions('usermeet.sc.controller', true, true);
     $modules = array();
     // Sort the enabled modules first, in order.
     if (is_array($visible_modules)) {
         foreach ($visible_modules as $module_id => $visibility) {
             if (!isset($all_modules[$module_id])) {
                 continue;
             }
             $module = $all_modules[$module_id];
             $modules[$module_id] = $module;
             unset($all_modules[$module_id]);
         }
     }
     // Append the unused modules
     if (is_array($all_modules)) {
         foreach ($all_modules as $module_id => $module) {
             $modules[$module_id] = $module;
             $modules = array_merge($modules, $all_modules);
         }
     }
     $tpl->assign('modules', $modules);
     $tpl->display("file:{$tpl_path}portal/sc/config/index.tpl");
 }
コード例 #2
0
 /**
  * Clears any platform-level plugin caches.
  * 
  */
 static function clearCache($one_cache = null)
 {
     $cache = self::getCacheService();
     /* @var $cache _DevblocksCacheManager */
     if (!empty($one_cache)) {
         $cache->remove($one_cache);
     } else {
         // All
         $cache->remove(self::CACHE_ACL);
         $cache->remove(self::CACHE_PLUGINS);
         $cache->remove(self::CACHE_EVENT_POINTS);
         $cache->remove(self::CACHE_EVENTS);
         $cache->remove(self::CACHE_EXTENSIONS);
         $cache->remove(self::CACHE_POINTS);
         $cache->remove(self::CACHE_SETTINGS);
         $cache->remove(self::CACHE_TABLES);
         $cache->remove(_DevblocksClassLoadManager::CACHE_CLASS_MAP);
         // Clear all locale caches
         $langs = DAO_Translation::getDefinedLangCodes();
         if (is_array($langs) && !empty($langs)) {
             foreach ($langs as $lang_code => $lang_name) {
                 $cache->remove(self::CACHE_TAG_TRANSLATIONS . '_' . $lang_code);
             }
         }
     }
     // Cache-specific 'after' actions
     switch ($one_cache) {
         case self::CACHE_PLUGINS:
         case self::CACHE_EXTENSIONS:
         case NULL:
             self::getPluginRegistry();
             self::getExtensionRegistry();
             break;
     }
 }
コード例 #3
0
ファイル: preferences.php プロジェクト: Hildy/cerb5
 function showGeneralAction()
 {
     $date_service = DevblocksPlatform::getDateService();
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl_path = $this->_TPL_PATH;
     $tpl->assign('path', $tpl_path);
     $worker = CerberusApplication::getActiveWorker();
     $tpl->assign('worker', $worker);
     $tour_enabled = intval(DAO_WorkerPref::get($worker->id, 'assist_mode', 1));
     $tpl->assign('assist_mode', $tour_enabled);
     $keyboard_shortcuts = intval(DAO_WorkerPref::get($worker->id, 'keyboard_shortcuts', 1));
     $tpl->assign('keyboard_shortcuts', $keyboard_shortcuts);
     $mail_inline_comments = DAO_WorkerPref::get($worker->id, 'mail_inline_comments', 1);
     $tpl->assign('mail_inline_comments', $mail_inline_comments);
     $mail_always_show_all = DAO_WorkerPref::get($worker->id, 'mail_always_show_all', 0);
     $tpl->assign('mail_always_show_all', $mail_always_show_all);
     $addresses = DAO_AddressToWorker::getByWorker($worker->id);
     $tpl->assign('addresses', $addresses);
     // Timezones
     $tpl->assign('timezones', $date_service->getTimezones());
     @($server_timezone = date_default_timezone_get());
     $tpl->assign('server_timezone', $server_timezone);
     // Languages
     $langs = DAO_Translation::getDefinedLangCodes();
     $tpl->assign('langs', $langs);
     $tpl->assign('selected_language', DAO_WorkerPref::get($worker->id, 'locale', 'en_US'));
     $tpl->display('file:' . $tpl_path . 'preferences/modules/general.tpl');
 }
コード例 #4
0
ファイル: Devblocks.class.php プロジェクト: Hildy/devblocks
 /**
  * Clears any platform-level plugin caches.
  * 
  */
 static function clearCache()
 {
     $cache = self::getCacheService();
     /* @var $cache Zend_Cache_Core */
     $cache->remove(self::CACHE_ACL);
     $cache->remove(self::CACHE_PLUGINS);
     $cache->remove(self::CACHE_EVENT_POINTS);
     $cache->remove(self::CACHE_EVENTS);
     $cache->remove(self::CACHE_EXTENSIONS);
     $cache->remove(self::CACHE_POINTS);
     $cache->remove(self::CACHE_SETTINGS);
     $cache->remove(self::CACHE_TABLES);
     $cache->remove(_DevblocksClassLoadManager::CACHE_CLASS_MAP);
     // Clear all locale caches
     $langs = DAO_Translation::getDefinedLangCodes();
     if (is_array($langs) && !empty($langs)) {
         foreach ($langs as $lang_code => $lang_name) {
             $cache->remove(self::CACHE_TAG_TRANSLATIONS . '_' . $lang_code);
         }
     }
     // Recache plugins
     self::getPluginRegistry();
     self::getExtensionRegistry();
 }
コード例 #5
0
ファイル: App.php プロジェクト: jstanden/portsensor
 function saveAddLanguagePanelAction()
 {
     $active_worker = PortSensorApplication::getActiveWorker();
     // Make sure we're an active worker
     if (empty($active_worker) || empty($active_worker->id)) {
         return;
     }
     $codes = DAO_Translation::getDefinedLangCodes();
     @($add_lang_code = DevblocksPlatform::importGPC($_REQUEST['add_lang_code'], 'string', ''));
     @($copy_lang_code = DevblocksPlatform::importGPC($_REQUEST['copy_lang_code'], 'string', ''));
     @($del_lang_ids = DevblocksPlatform::importGPC($_REQUEST['del_lang_ids'], 'array', array()));
     if (!empty($del_lang_ids)) {
         if (is_array($del_lang_ids)) {
             foreach ($del_lang_ids as $lang_id) {
                 DAO_Translation::deleteByLangCodes($lang_id);
             }
         }
     }
     // Don't add blanks or the same language twice.
     if (!empty($add_lang_code) && !isset($codes[$add_lang_code])) {
         // English reference strings (to know our scope)
         $english_strings = DAO_Translation::getMapByLang('en_US');
         $copy_strings = array();
         // If we have a desired source language for defaults, load it.
         if (!empty($copy_lang_code)) {
             if (0 == strcasecmp('en_US', $copy_lang_code)) {
                 $copy_strings = $english_strings;
             } else {
                 $copy_strings = DAO_Translation::getMapByLang($copy_lang_code);
             }
         }
         // Loop through English strings for new language
         if (is_array($english_strings)) {
             foreach ($english_strings as $string_id => $src_en) {
                 /* @var $src_en Model_Translation */
                 $override = '';
                 // If we have a valid source, copy its override or its default (in that order)
                 @($copy_string = $copy_strings[$string_id]);
                 if (is_a($copy_string, 'Model_Translation')) {
                     $override = !empty($copy_string->string_override) ? $copy_string->string_override : $copy_string->string_default;
                 }
                 // Insert the new string as an override.  Only official translations are defaults
                 $fields = array(DAO_Translation::STRING_ID => $string_id, DAO_Translation::LANG_CODE => $add_lang_code, DAO_Translation::STRING_DEFAULT => '', DAO_Translation::STRING_OVERRIDE => $override);
                 DAO_Translation::create($fields);
             }
         }
     }
     // If we added a new language then change the view to display it
     if (!empty($add_lang_code)) {
         $defaults = new Ps_AbstractViewModel();
         $defaults->class_name = 'Ps_TranslationView';
         $defaults->id = Ps_TranslationView::DEFAULT_ID;
         // Clear the existing view
         $view = Ps_AbstractViewLoader::getView(Ps_TranslationView::DEFAULT_ID, $defaults);
         $view->doResetCriteria();
         // Set search to untranslated strings that aren't English
         $view->renderSortBy = SearchFields_Translation::STRING_ID;
         $view->renderSortAsc = true;
         $view->params = array(SearchFields_Translation::LANG_CODE => new DevblocksSearchCriteria(SearchFields_Translation::LANG_CODE, DevblocksSearchCriteria::OPER_EQ, $add_lang_code));
         /*
          * If we didn't copy from another language, only show empty strings 
          * which makes it easier to translate in the GUI.
          */
         if (empty($copy_lang_code)) {
             $view->params[SearchFields_Translation::STRING_OVERRIDE] = new DevblocksSearchCriteria(SearchFields_Translation::STRING_OVERRIDE, DevblocksSearchCriteria::OPER_EQ, '');
         }
         Ps_AbstractViewLoader::setView($view->id, $view);
     }
     self::_clearCache();
     DevblocksPlatform::redirect(new DevblocksHttpResponse(array('setup', 'translations')));
 }
コード例 #6
0
ファイル: preferences.php プロジェクト: jstanden/portsensor
 function showTabGeneralAction()
 {
     $date_service = DevblocksPlatform::getDateService();
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl_path = $this->_TPL_PATH;
     $tpl->assign('path', $tpl_path);
     $worker = PortSensorApplication::getActiveWorker();
     $tpl->assign('worker', $worker);
     $assist_mode = intval(DAO_WorkerPref::get($worker->id, 'assist_mode', 1));
     $tpl->assign('assist_mode', $assist_mode);
     $keyboard_shortcuts = intval(DAO_WorkerPref::get($worker->id, 'keyboard_shortcuts', 1));
     $tpl->assign('keyboard_shortcuts', $keyboard_shortcuts);
     // Timezones
     $tpl->assign('timezones', $date_service->getTimezones());
     @($server_timezone = date_default_timezone_get());
     $tpl->assign('server_timezone', $server_timezone);
     // Languages
     $langs = DAO_Translation::getDefinedLangCodes();
     $tpl->assign('langs', $langs);
     $tpl->assign('selected_language', DAO_WorkerPref::get($worker->id, 'locale', 'en_US'));
     $tpl->display('file:' . $tpl_path . 'preferences/tabs/general.tpl');
 }