source: trunk/plugins/LocalFilesEditor/include/css.inc.php @ 13242

Last change on this file since 13242 was 13242, checked in by patdenice, 12 years ago

feature:2577
Automaticaly install smartpocket during install or upgrade.
hide mobile theme from themes list on user side.

File size: 2.8 KB
Line 
1<?php
2
3if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
4
5if ((isset($_POST['edit'])) and !is_numeric($_POST['file_to_edit']))
6{
7  $edited_file = $_POST['file_to_edit'];
8}
9elseif (isset($_POST['edited_file']))
10{
11  $edited_file = $_POST['edited_file'];
12}
13elseif (isset($_GET['theme']) and in_array($_GET['theme'], array_keys(get_pwg_themes(true))))
14{
15  $edited_file = PHPWG_ROOT_PATH.PWG_LOCAL_DIR . 'css/'.$_GET['theme'].'-rules.css';
16}
17else
18{
19  $edited_file = PHPWG_ROOT_PATH.PWG_LOCAL_DIR . 'css/'.get_default_theme().'-rules.css';
20}
21
22if (file_exists($edited_file))
23{
24  $content_file = file_get_contents($edited_file);
25}
26else
27{
28  $content_file = "/* " . l10n('locfiledit_newfile') . " */\n\n";
29}
30
31$selected = 0; 
32// $options[] = l10n('locfiledit_choose_file');
33// $options[] = '----------------------';
34$value = PHPWG_ROOT_PATH.PWG_LOCAL_DIR . "css/rules.css";
35
36$options[$value] = (file_exists($value) ? '&#x2714;' : '&#x2718;').' local / css / rules.css';
37if ($edited_file == $value)
38{
39  $selected = $value;
40}
41
42// themes are displayed in the same order as on screen
43// [Administration > Configuration > Themes]
44
45include_once(PHPWG_ROOT_PATH.'admin/include/themes.class.php');
46$themes = new themes();
47$themes->sort_fs_themes();
48$default_theme = get_default_theme();
49$db_themes = $themes->get_db_themes();
50
51$db_theme_ids = array();
52foreach ($db_themes as $db_theme)
53{
54  array_push($db_theme_ids, $db_theme['id']);
55}
56
57$active_themes = array();
58$inactive_themes = array();
59
60foreach ($themes->fs_themes as $theme_id => $fs_theme)
61{
62  if ($theme_id == 'default')
63  {
64    continue;
65  }
66
67  if (in_array($theme_id, $db_theme_ids))
68  {
69    if ($theme_id == $default_theme)
70    {
71      array_unshift($active_themes, $fs_theme);
72    }
73    else
74    {
75      array_push($active_themes, $fs_theme);
76    }
77  }
78  else
79  {
80    array_push($inactive_themes, $fs_theme);
81  }
82}
83
84$options[] = '';
85$options[] = '----- '.l10n('Active Themes').' -----';
86$options[] = '';
87foreach ($active_themes as $theme)
88{
89  $value = PHPWG_ROOT_PATH.PWG_LOCAL_DIR . 'css/'.$theme['id'].'-rules.css';
90
91  $options[$value] = (file_exists($value) ? '&#x2714;' : '&#x2718;').' '.$theme['name'];
92
93  if ($default_theme == $theme['id'])
94  {
95    $options[$value].= ' ('.l10n('default').')';
96  }
97 
98  if ($edited_file == $value)
99  {
100    $selected = $value;
101  }
102}
103
104$options[] = '';
105$options[] = '----- '.l10n('Inactive Themes').' -----';
106$options[] = '';
107foreach ($inactive_themes as $theme)
108{
109  $value = PHPWG_ROOT_PATH.PWG_LOCAL_DIR . 'css/'.$theme['id'].'-rules.css';
110
111  $options[$value] = (file_exists($value) ? '&#x2714;' : '&#x2718;').' '.$theme['name'];
112 
113  if ($edited_file == $value)
114  {
115    $selected = $value;
116  }
117}
118
119$template->assign('css_lang_tpl', array(
120  'OPTIONS' => $options,
121  'SELECTED' => $selected
122  )
123);
124
125$codemirror_mode = 'text/css';
126
127?>
Note: See TracBrowser for help on using the repository browser.