| 1 |
<?php
|
| 2 |
// $Id:$
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Set default feature for spaces.
|
| 6 |
* @param node object $node
|
| 7 |
* @param string $features_home - default feature
|
| 8 |
* @param array $features - array of features to activate. if not specified, default features will be used.
|
| 9 |
*/
|
| 10 |
function mtk_spaces_set_features($node, $features_home, $features = 0) {
|
| 11 |
db_query('DELETE FROM {spaces_features} WHERE gid = %d', $node->nid);
|
| 12 |
if (!$features) {
|
| 13 |
$features = spaces_features(0);
|
| 14 |
}
|
| 15 |
foreach ($features as $id => $value) {
|
| 16 |
db_query('INSERT INTO {spaces_features}(gid, type, id, value) VALUES (%d, 0, "%s", "%s")', $node->nid, $id, $value);
|
| 17 |
}
|
| 18 |
db_query('DELETE FROM {spaces_features} WHERE gid = %d AND type = 1 AND id = "spaces_home"', $node->nid);
|
| 19 |
db_query('INSERT INTO {spaces_features} (gid, type, id, value) VALUES (%d, 1, "spaces_home", "%s")', $node->nid, $features_home);
|
| 20 |
}
|