/[drupal]/contributions/modules/taxonomy_theme/taxonomy_theme_helper.inc
ViewVC logotype

Contents of /contributions/modules/taxonomy_theme/taxonomy_theme_helper.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download) (as text)
Mon Jan 12 19:58:32 2009 UTC (10 months, 1 week ago) by profix898
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +8 -2 lines
File MIME type: text/x-php
- bugfix: do not store properties for default theme
- bugfix: entries with conditions are not removed on selection method change
- task: change taxonomy_theme to support new themekey namespaces
1 <?php
2 // $Id: taxonomy_theme_helper.inc,v 1.1 2008/06/08 15:21:03 profix898 Exp $
3
4 require_once(drupal_get_path('module', 'themekey') .'/themekey_build.inc');
5
6 /**
7 * Function taxonomy_theme_get_theme().
8 */
9 function taxonomy_theme_get_theme($key, $value, $conditions = array()) {
10 $query = 'SELECT theme FROM {themekey_properties} WHERE property = \'%s\' AND value = \'%s\' AND conditions = \'%s\'';
11 return db_result(db_query($query, $key, $value, serialize($conditions)));
12 }
13
14 /**
15 * Function taxonomy_theme_set_theme().
16 */
17 function taxonomy_theme_set_theme($key, $value, $theme = 'default', $conditions = array()) {
18 $item = array('property' => $key, 'value' => $value, 'conditions' => $conditions, 'theme' => $theme);
19 $query = 'SELECT id FROM {themekey_properties} WHERE property = \'%s\' AND value = \'%s\' AND conditions = \'%s\'';
20 if ($id = db_result(db_query($query, $key, $value, serialize($conditions)))) {
21 $item['id'] = $id;
22 }
23
24 //
25 if ($theme != 'default') {
26 _themekey_properties_set($item);
27 }
28 else if (isset($item['id'])) {
29 _themekey_properties_del($item['id']);
30 }
31 }
32
33 /**
34 * Function taxonomy_theme_delall_theme().
35 */
36 function taxonomy_theme_delall_theme($key, $conditions = array()) {
37 $query = 'DELETE FROM {themekey_properties} WHERE property = \'%s\' AND conditions = \'%s\'';
38 db_query($query, $key, serialize($conditions));
39 }

  ViewVC Help
Powered by ViewVC 1.1.2