*
* Global variables defined:
* $addSources - TODO
- * $attributes - TODO
+ * $attributes - (array) Attribute data from the config/attributes.php
+ * file.
* $browse_source_count - TODO
* $browse_source_options - TODO
* $cfgSources - TODO
protected function _init()
{
// Turba source and attribute configuration.
- include TURBA_BASE . '/config/attributes.php';
+ $attributes = Horde::loadConfiguration('attributes.php', 'attributes', 'turba');
include TURBA_BASE . '/config/sources.php';
/* UGLY UGLY UGLY - we should NOT be using this as a global
public $objects = array();
/**
- * Cached attributes array.
- *
- * @var array
- */
- protected $_attributes = null;
-
- /**
* The field to compare objects by.
*
* @var string
*/
protected function _cmp($a, $b)
{
- if (is_null($this->_attributes)) {
- $this->_attributes = Horde::loadConfiguration('attributes.php', 'attributes', 'turba');
- }
-
foreach ($this->_usortCriteria as $field) {
// Set the comparison type based on the type of attribute we're
// sorting by.
$sortmethod = 'text';
- if (isset($this->_attributes[$field['field']])) {
- $f = $this->_attributes[$field['field']];
+ if (isset($GLOBALS['attributes'][$field['field']])) {
+ $f = $GLOBALS['attributes'][$field['field']];
if (!empty($f['cmptype'])) {
$sortmethod = $f['cmptype'];
*/
public function display()
{
- $attributes = Horde::loadConfiguration(TURBA_BASE . '/config/attributes.php', 'attributes', 'turba');
-
$view = new Horde_View(array('templatePath' => TURBA_TEMPLATES . '/search/duplicate'));
new Horde_View_Helper_Text($view);
isset($this->_duplicates[$this->_type][$this->_duplicate]);
if ($hasDuplicate) {
$vars = new Horde_Variables();
- $view->type = $attributes[$this->_type]['label'];
+ $view->type = $GLOBALS['attributes'][$this->_type]['label'];
$view->value = $this->_duplicate;
echo $view->render('header');
$view->duplicates = $this->_duplicates;
$view->hasDuplicate = (bool)$hasDuplicate;
- $view->attributes = $attributes;
+ $view->attributes = $GLOBALS['attributes'];
$view->link = Horde::applicationUrl('search.php')
->add(array('source' => $this->_driver->name,
'search_mode' => 'duplicate'));