예제 #1
0
 public static function user_settings($settings_edit = false)
 {
     if ($settings_edit) {
         Base_ActionBarCommon::add(Base_ThemeCommon::get_template_file('Base_Notify', 'icon.png'), __('Browser Settings'), 'onClick="Base_Notify__notify (\'Notification\', {body: \'enabled\', icon: \'' . self::get_icon('Base_Notify') . '\'}, true);"', __('Click to set browser settings for tray notifications'));
     }
     $ret = array(array('name' => null, 'label' => __('General'), 'type' => 'header'), array('name' => 'general_timeout', 'reload' => 1, 'label' => __('Close Message Timeout'), 'type' => 'select', 'values' => Utils_CommonDataCommon::get_translated_array('Base_Notify/Timeout', true), 'default' => 0), array('name' => 'general_group', 'label' => __('Group Similar Notifications'), 'type' => 'checkbox', 'default' => 1), array('name' => null, 'label' => __('Module Specific Timeout'), 'type' => 'header'));
     $modules = ModuleManager::check_common_methods('tray_notification');
     foreach ($modules as $module) {
         $label = self::get_module_caption($module);
         $ret = array_merge($ret, array(array('name' => $module . '_timeout', 'label' => $label, 'type' => 'select', 'values' => array(-2 => _M('Use general setting')) + Utils_CommonDataCommon::get_translated_array('Base_Notify/Timeout', true), 'default' => -2)));
     }
     return array(__('Notify') => $ret);
 }
예제 #2
0
파일: Search_0.php 프로젝트: cretzu89/EPESI
 public function body()
 {
     $qs_keyword = $this->get_module_variable('qs_keyword', '');
     if (isset($_REQUEST['quick_search'])) {
         $qs_keyword = $_REQUEST['quick_search'];
     }
     $this->set_module_variable('qs_keyword', $qs_keyword);
     $form = $this->init_module(Libs_QuickForm::module_name(), __('Searching'));
     $theme = $this->pack_module(Base_Theme::module_name());
     $form->addElement('header', 'quick_search_header', __('Quick Search'));
     $form->addElement('text', 'quick_search', __('Keyword'), array('id' => 'quick_search_text'));
     $form->addRule('quick_search', __('Field required'), 'required');
     $form->addElement('header', 'categories_header', __('Categories'));
     $modules_with_search = ModuleManager::check_common_methods('search');
     $search_categories = ModuleManager::call_common_methods('search_categories');
     $search_categories_checkboxes = array();
     $defaults = array();
     $defaults['search_categories'] = array();
     $categories_tmp =& $this->get_module_variable('categories', array());
     foreach ($search_categories as $mod => $cats) {
         foreach ($cats as $cat_id => $cat_name) {
             $checked = 0;
             if (is_array($cat_name)) {
                 if (!isset($cat_name['caption'])) {
                     continue;
                 }
                 $checked = isset($cat_name['checked']) && $cat_name['checked'];
                 $cat_name = $cat_name['caption'];
             }
             $search_categories_checkboxes[] = $form->createElement('advcheckbox', $mod . '#' . $cat_id, '', $cat_name);
             if (isset($categories_tmp[$mod . '#' . $cat_id])) {
                 $checked = $categories_tmp[$mod . '#' . $cat_id];
             }
             $defaults['search_categories'][$mod . '#' . $cat_id] = $checked;
         }
     }
     $form->addGroup($search_categories_checkboxes, 'search_categories', '', '</li><li>');
     $form->addElement('submit', 'quick_search_submit', __('Search'), array('class' => 'submit'));
     $form->addElement('button', 'quick_search_select_none', __('Deselect all'), array('onClick' => 'jq("#' . $form->getAttribute('name') . ' input[type=checkbox]").removeAttr("checked")', 'class' => 'submit'));
     $form->addElement('button', 'quick_search_select_all', __('Select all'), array('onClick' => 'jq("#' . $form->getAttribute('name') . ' input[type=checkbox]").attr("checked","checked")', 'class' => 'submit'));
     $defaults['quick_search'] = $qs_keyword;
     $form->setDefaults($defaults);
     $form->assign_theme('form', $theme);
     $theme->assign('form_mini', 'no');
     $theme->display('Search');
     if ($form->validate() || $qs_keyword) {
         if ($form->exportValue('submited') == 1) {
             $keyword = $form->exportValue('quick_search');
         } elseif (isset($_POST['qs_keyword'])) {
             $keyword = $_POST['qs_keyword'];
         } elseif (isset($qs_keyword)) {
             $keyword = $qs_keyword;
         }
         if ($keyword) {
             $categories_tmp = $form->exportValue('search_categories');
             $categories = array();
             if ($categories_tmp) {
                 foreach ($categories_tmp as $cat => $val) {
                     if (!$val) {
                         continue;
                     }
                     list($mod, $cat_id) = explode('#', $cat, 2);
                     if (!isset($categories[$mod])) {
                         $categories[$mod] = array();
                     }
                     $categories[$mod][] = $cat_id;
                 }
             }
             $links = array();
             $this->set_module_variable('quick_search', $keyword);
             $count = 0;
             foreach ($modules_with_search as $k) {
                 $results = call_user_func(array($k . 'Common', 'search'), $keyword, isset($categories[$k]) ? $categories[$k] : array());
                 if (!empty($results)) {
                     foreach ($results as $rk => $rv) {
                         $count++;
                         if ($count == 101) {
                             $warning = __('Only 100 results are displayed.');
                             break;
                         }
                         $links[] = $rv;
                     }
                 }
             }
             $qs_theme = $this->pack_module(Base_Theme::module_name());
             $qs_theme->assign('header', __('Search results'));
             $qs_theme->assign('links', $links);
             $qs_theme->assign('warning', isset($warning) ? $warning : null);
             $qs_theme->display('Results');
             return;
         }
     }
 }
예제 #3
0
 public static function user_settings()
 {
     $ret = array(array('name' => null, 'label' => __('General'), 'type' => 'header'), array('name' => 'one_cache', 'label' => __('Show each notification'), 'type' => 'select', 'values' => array(0 => __('multiple times every login and on each device'), 1 => __('only once and only on one device')), 'default' => 1), array('name' => null, 'label' => __('Browser Notification') . ' - ' . __('General'), 'type' => 'header'), array('name' => 'general_timeout', 'reload' => 1, 'label' => __('Close Message Timeout'), 'type' => 'select', 'values' => Utils_CommonDataCommon::get_translated_array('Base_Notify/Timeout', true), 'default' => 0), array('name' => 'general_group', 'label' => __('Group Similar Notifications'), 'type' => 'checkbox', 'default' => 1), array('name' => 'browser_settings', 'label' => '', 'type' => 'static', 'values' => '<a class="button" onClick="Base_Notify.notify (\'Notification\', {body: \'enabled\', icon: \'' . self::get_icon('Base_Notify') . '\'}, true);">' . __('Browser Settings') . '</a>'), array('name' => null, 'label' => __('Browser Notification') . ' - ' . __('Module Specific Timeout'), 'type' => 'header'));
     $modules = ModuleManager::check_common_methods('notification');
     foreach ($modules as $module) {
         $label = self::get_module_caption($module);
         $ret = array_merge($ret, array(array('name' => $module . '_timeout', 'label' => $label, 'type' => 'select', 'values' => array(-2 => _M('Use general setting')) + Utils_CommonDataCommon::get_translated_array('Base_Notify/Timeout', true), 'default' => -2)));
     }
     $ret[] = array('name' => null, 'label' => __('Telegram Notification'), 'type' => 'header');
     $telegram = DB::GetOne('SELECT 1 FROM base_notify WHERE single_cache_uid=%d AND telegram=1', array(Base_AclCommon::get_user()));
     if ($telegram && isset($_GET['telegram'])) {
         $telegram = 0;
         DB::Execute('UPDATE base_notify SET telegram=0 WHERE single_cache_uid=%d', array(Base_AclCommon::get_user()));
     }
     $ret[] = array('name' => 'telegram_url', 'label' => '<a class="button" href="modules/Base/Notify/telegram.php" target="_blank">' . ($telegram ? __('Connect to another telegram account') : __('Connect to your telegram account')) . '</a>', 'type' => 'static', 'values' => $telegram ? '<a class="button" ' . Module::create_href(array('telegram' => 1)) . '>' . __('Disconnect telegram') . '</a>' : '');
     return array(__('Notifications') => $ret);
 }