| 1 |
<?php |
<?php |
| 2 |
// $Id: spaces.module,v 1.25.4.33.2.26 2009/08/13 14:19:29 yhahn Exp $ |
// $Id: spaces.module,v 1.25.4.33.2.27 2009/08/13 14:55:33 yhahn Exp $ |
| 3 |
|
|
| 4 |
define('SPACES_FEATURE_DISABLED', 0); |
define('SPACES_FEATURE_DISABLED', 0); |
| 5 |
|
|
| 374 |
function feature_options(); |
function feature_options(); |
| 375 |
|
|
| 376 |
/** |
/** |
| 377 |
* Method that allows the space type to add to/modify the utility |
* Method that allows the space type to add user links provided to |
| 378 |
* "links" provided to visitors in a space. |
* visitors in a space. |
| 379 |
* |
* |
| 380 |
* @param $links |
* @return array() |
| 381 |
* The current space utility links (for use with theme_links) array |
* Array of links for use with theme_links. |
|
* passed by reference. |
|
| 382 |
*/ |
*/ |
| 383 |
function links(&$links); |
function user_links(); |
| 384 |
|
|
| 385 |
|
/** |
| 386 |
|
* Method that allows the space type to provide to administrative links |
| 387 |
|
* for users who pass the $space->admin_access() check. It is the |
| 388 |
|
* responsibility of the caller to perform this access check. |
| 389 |
|
* |
| 390 |
|
* @return array() |
| 391 |
|
* Array of links for use with theme_links. |
| 392 |
|
*/ |
| 393 |
|
function admin_links(); |
| 394 |
|
|
| 395 |
/** |
/** |
| 396 |
* Method that provides a space-type specific check for whether the |
* Method that provides a space-type specific check for whether the |
| 1380 |
*/ |
*/ |
| 1381 |
|
|
| 1382 |
/** |
/** |
| 1383 |
* Generates an array of utility links for the current space suitable |
* Generates an array of admin links for the current space suitable |
| 1384 |
* for use in theme_links(). |
* for use in theme_links(). |
| 1385 |
*/ |
*/ |
| 1386 |
function spaces_space_links() { |
function spaces_admin_links($space = NULL) { |
| 1387 |
$links = array(); |
$space = !isset($space) ? spaces_get_space() : $space; |
| 1388 |
if ($space = spaces_get_space()) { |
if ($space && $space->admin_access()) { |
| 1389 |
$space->links($links); |
$links = $space->admin_links(); |
| 1390 |
drupal_alter('space_links', $links); |
drupal_alter('spaces_admin_links', $links, $space); |
| 1391 |
|
return $links; |
| 1392 |
} |
} |
| 1393 |
return $links; |
return array(); |
| 1394 |
|
} |
| 1395 |
|
|
| 1396 |
|
/** |
| 1397 |
|
* Generates an array of user links for the current space suitable |
| 1398 |
|
* for use in theme_links(). |
| 1399 |
|
*/ |
| 1400 |
|
function spaces_user_links($space = NULL) { |
| 1401 |
|
$space = !isset($space) ? spaces_get_space() : $space; |
| 1402 |
|
if ($space) { |
| 1403 |
|
$links = $space->user_links(); |
| 1404 |
|
drupal_alter('spaces_user_links', $links, $space); |
| 1405 |
|
return $links; |
| 1406 |
|
} |
| 1407 |
|
return array(); |
| 1408 |
} |
} |
| 1409 |
|
|
| 1410 |
/** |
/** |
| 1424 |
function spaces_preprocess_page(&$vars) { |
function spaces_preprocess_page(&$vars) { |
| 1425 |
$space = spaces_get_space(); |
$space = spaces_get_space(); |
| 1426 |
if ($space) { |
if ($space) { |
| 1427 |
if ($links = spaces_space_links()) { |
if ($links = spaces_admin_links()) { |
| 1428 |
$vars['space_links'] = theme('links', $links, array('class' => 'links space-links')); |
$vars['space_admin_links'] = theme('links', $links); |
| 1429 |
|
} |
| 1430 |
|
if ($links = spaces_user_links()) { |
| 1431 |
|
$vars['space_user_links'] = theme('links', $links); |
| 1432 |
} |
} |
| 1433 |
if (!empty($space->title)) { |
if (!empty($space->title)) { |
| 1434 |
$vars['space_title'] = l($space->title, '<front>'); |
$vars['space_title'] = l($space->title, '<front>'); |