Changeset 23259 for trunk/admin/themes_installed.php
- Timestamp:
- Jun 16, 2013, 6:23:45 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/themes_installed.php
r19703 r23259 66 66 } 67 67 68 $active_themes = array(); 69 $inactive_themes = array(); 68 $tpl_themes = array(); 70 69 71 70 foreach ($themes->fs_themes as $theme_id => $fs_theme) … … 75 74 continue; 76 75 } 76 77 $tpl_theme = array( 78 'ID' => $theme_id, 79 'NAME' => $fs_theme['name'], 80 'VISIT_URL' => $fs_theme['uri'], 81 'VERSION' => $fs_theme['version'], 82 'DESC' => $fs_theme['description'], 83 'AUTHOR' => $fs_theme['author'], 84 'AUTHOR_URL' => @$fs_theme['author uri'], 85 'PARENT' => @$fs_theme['parent'], 86 'SCREENSHOT' => $fs_theme['screenshot'], 87 'IS_MOBILE' => $fs_theme['mobile'], 88 'ADMIN_URI' => @$fs_theme['admin_uri'], 89 ); 77 90 78 91 if (in_array($theme_id, $db_theme_ids)) 79 92 { 80 $fs_theme['deactivable'] = true; 93 $tpl_theme['STATE'] = 'active'; 94 $tpl_theme['DEACTIVABLE'] = true; 81 95 82 96 if (count($db_theme_ids) <= 1) 83 97 { 84 $ fs_theme['deactivable'] = false;85 $ fs_theme['deactivate_tooltip'] = l10n('Impossible to deactivate this theme, you need at least one theme.');98 $tpl_theme['DEACTIVABLE'] = false; 99 $tpl_theme['DEACTIVATE_TOOLTIP'] = l10n('Impossible to deactivate this theme, you need at least one theme.'); 86 100 } 87 88 if ($theme_id == $default_theme) 101 102 $tpl_theme['IS_DEFAULT'] = ($theme_id == $default_theme); 103 } 104 else 105 { 106 $tpl_theme['STATE'] = 'inactive'; 107 108 // is the theme "activable" ? 109 if (isset($fs_theme['activable']) and !$fs_theme['activable']) 89 110 { 90 $ fs_theme['is_default'] = true;91 array_unshift($active_themes, $fs_theme);111 $tpl_theme['ACTIVABLE'] = false; 112 $tpl_theme['ACTIVABLE_TOOLTIP'] = l10n('This theme was not designed to be directly activated'); 92 113 } 93 114 else 94 115 { 95 $fs_theme['is_default'] = false; 96 array_push($active_themes, $fs_theme); 97 } 98 } 99 else 100 { 101 // is the theme "activable" ? 102 if (isset($fs_theme['activable']) and !$fs_theme['activable']) 103 { 104 $fs_theme['activate_tooltip'] = l10n('This theme was not designed to be directly activated'); 105 } 106 else 107 { 108 $fs_theme['activable'] = true; 116 $tpl_theme['ACTIVABLE'] = true; 109 117 } 110 118 … … 112 120 if (isset($missing_parent)) 113 121 { 114 $ fs_theme['activable'] = false;122 $tpl_theme['ACTIVABLE'] = false; 115 123 116 $ fs_theme['activate_tooltip'] = sprintf(124 $tpl_theme['ACTIVABLE_TOOLTIP'] = sprintf( 117 125 l10n('Impossible to activate this theme, the parent theme is missing: %s'), 118 126 $missing_parent … … 123 131 $children = $themes->get_children_themes($theme_id); 124 132 125 $ fs_theme['deletable'] = true;133 $tpl_theme['DELETABLE'] = true; 126 134 127 135 if (count($children) > 0) 128 136 { 129 $ fs_theme['deletable'] = false;137 $tpl_theme['DELETABLE'] = false; 130 138 131 $ fs_theme['delete_tooltip'] = sprintf(139 $tpl_theme['DELETE_TOOLTIP'] = sprintf( 132 140 l10n('Impossible to delete this theme. Other themes depends on it: %s'), 133 141 implode(', ', $children) 134 142 ); 135 143 } 144 } 145 146 array_push($tpl_themes, $tpl_theme); 147 } 136 148 137 array_push($inactive_themes, $fs_theme); 138 } 149 // sort themes by state then by name 150 function cmp($a, $b) 151 { 152 $s = array('active' => 0, 'inactive' => 1); 153 154 if (@$a['IS_DEFAULT']) return -1; 155 if (@$b['IS_DEFAULT']) return 1; 156 157 if($a['STATE'] == $b['STATE']) 158 return strcasecmp($a['NAME'], $b['NAME']); 159 else 160 return $s[$a['STATE']] >= $s[$b['STATE']]; 139 161 } 162 usort($tpl_themes, 'cmp'); 140 163 141 164 $template->assign( … … 146 169 'delete_baseurl' => $base_url.'&action=delete&theme=', 147 170 148 'active_themes' => $active_themes, 149 'inactive_themes' => $inactive_themes, 171 'tpl_themes' => $tpl_themes, 150 172 ) 151 173 );
Note: See TracChangeset
for help on using the changeset viewer.