Skip to content

Commit

Permalink
Добавление настройки глобальности сохранения режима переключения
Browse files Browse the repository at this point in the history
  • Loading branch information
Dayver committed Apr 6, 2014
1 parent 5449833 commit 478c119
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 46 deletions.
26 changes: 17 additions & 9 deletions cattemplateswitcher/cattemplateswitcher.page.list.main.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,30 @@
==================== */
defined('COT_CODE') or die('Wrong URL');

$tpl_arr = array('page', 'list');
require_once cot_langfile('cattemplateswitcher', 'plug');

$mode = cot_import('mode', 'R', 'ALP');
require_once cot_langfile('cattemplateswitcher', 'plug');

$tpl_arr = array('page', 'list');
$modes = explode(',', $cfg['plugin']['cattemplateswitcher']['mode']);
if (!empty($mode) && in_array($mode, $modes) && $mode != 'default') $_SESSION[$c]['cat_tpl_mode'] = $mode;
elseif($mode == 'default') unset($_SESSION[$c]['cat_tpl_mode']);
if (isset($_SESSION[$c]['cat_tpl_mode']) && !empty($_SESSION[$c]['cat_tpl_mode']))
if ($cfg['plugin']['cattemplateswitcher']['global_save']) $saved_mode = &$_SESSION[$c]['cat_tpl_mode'];
else $saved_mode = &$_SESSION['cat_tpl_mode'];

if (!empty($mode) && in_array($mode, $modes) && $mode != 'default') $saved_mode = $mode;
elseif($mode == 'default')
{
$mode = $_SESSION[$c]['cat_tpl_mode'];
if ($cfg['plugin']['cattemplateswitcher']['global_save']) unset($_SESSION[$c]['cat_tpl_mode']);
else unset($_SESSION['cat_tpl_mode']);
unset($saved_mode);
}

if (isset($saved_mode) && !empty($saved_mode))
{
$mode = $saved_mode;
$tpl_arr[] = $mode;
}
else $mode = 'default';

if (!empty($cat['tpl'])) $tpl_arr[] = $cat['tpl'];

$mskin = cot_tplfile($tpl_arr);

?>
$mskin = cot_tplfile($tpl_arr);
13 changes: 5 additions & 8 deletions cattemplateswitcher/cattemplateswitcher.setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
Name=Category template switcher
Category=navigation-structure
Description=Adds visitors the opportunity to switch the display mode (templates) category
Version=1.0
Date=2013-09-23
Version=1.1
Date=2014-04-06
Author=Dayver
Copyright=Partial copyright (c) Dayver 2013
Copyright=Partial copyright (c) Dayver 2013-2014
Notes=BSD License
SQL=
Auth_guests=R
Lock_guests=W12345A
Auth_members=R
Expand All @@ -20,9 +19,7 @@
[BEGIN_COT_EXT_CONFIG]
mode=01:string::default,table,line:Mode codes, comma separated
global_save=02:radio::0:Save switched mode for any cat or for all
[END_COT_EXT_CONFIG]
==================== */
defined('COT_CODE') or die('Wrong URL');


?>
defined('COT_CODE') or die('Wrong URL');
3 changes: 2 additions & 1 deletion cattemplateswitcher/lang/cattemplateswitcher.en.lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/

$L['cfg_mode'] = array('Mode codes', 'comma separated');
$L['cfg_global_save'] = array('Save switched mode for any cat or for all', '');

/**
* Plugin Admin
Expand All @@ -25,4 +26,4 @@

$L['plug_cattemplateswitcher_mode']['line'] = 'linear';
$L['plug_cattemplateswitcher_mode']['table'] = 'Table';
$L['plug_cattemplateswitcher_mode']['default'] = 'Default';
$L['plug_cattemplateswitcher_mode']['default'] = 'Default';
57 changes: 29 additions & 28 deletions cattemplateswitcher/lang/cattemplateswitcher.ru.lang.php
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
<?php
defined('COT_CODE') or die('Wrong URL.');

/**
* Plugin Info
*/

$L['info_desc'] = 'Добавляет возможность посетителям переключать режим отображения(шаблоны) категории';

/**
* Plugin Config
*/

$L['cfg_mode'] = array('Коды режимов', 'через запятую');

/**
* Plugin Admin
*/

//$L['adm_'] = '';

/**
* Plugin Body
*/

$L['plug_cattemplateswitcher_mode']['line'] = 'Линейный';
$L['plug_cattemplateswitcher_mode']['table'] = 'Таблица';
$L['plug_cattemplateswitcher_mode']['default'] = 'По умолчанию';
<?php
defined('COT_CODE') or die('Wrong URL.');

/**
* Plugin Info
*/

$L['info_desc'] = 'Добавляет возможность посетителям переключать режим отображения(шаблоны) категории';

/**
* Plugin Config
*/

$L['cfg_mode'] = array('Коды режимов', 'через запятую');
$L['cfg_global_save'] = array('Сохранять переключение режима для каждой категории отдельно или для всех?', 'Если "Да" то для каждой, если "Нет" то для всех');

/**
* Plugin Admin
*/

//$L['adm_'] = '';

/**
* Plugin Body
*/

$L['plug_cattemplateswitcher_mode']['line'] = 'Линейный';
$L['plug_cattemplateswitcher_mode']['table'] = 'Таблица';
$L['plug_cattemplateswitcher_mode']['default'] = 'По умолчанию';

0 comments on commit 478c119

Please sign in to comment.