| 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 |
}
|