Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
tag_manager_management.inc
1 <?php
17 require_once SQ_INCLUDE_PATH.'/asset_management.inc';
18 
31 {
32 
33 
38  function Tag_Manager_Management(&$pm)
39  {
40  $this->Asset_Management($pm);
41 
42  $this->vars = Array(
43  'thesaurus' => Array(
44  'added' => '0.1',
45  'type' => 'assetid',
46  'description' => 'The thesaurus from which tags may be selected',
47  'default' => '',
48  ),
49  'restrict_tag_source' => Array(
50  'added' => '0.2',
51  'type' => 'boolean',
52  'parameters' => Array(
53  'allow_empty' => FALSE,
54  ),
55  'description' => 'Determines whether or not tags are restricted to a single thesaurus',
56  'default' => FALSE,
57  ),
58  );
59 
60 
61  }//end constructor
62 
63 
73  function _upgrade($current_version)
74  {
75  if (!parent::_upgrade($current_version)) return FALSE;
76 
77  if (version_compare($current_version, '0.2', '<')) {
78  pre_echo('UPGRADING TAG MANAGER - FROM VERSION '.$current_version);
79  // adding 'restrict_tag_source' attribute - set it to TRUE/FALSE based
80  // on whether a tagging thesaurus is currently selected
81  $tag_manager = $GLOBALS['SQ_SYSTEM']->getTagManager();
82  if ($tag_manager->attr('thesaurus')) {
83  $tag_manager->setAttrValue('restrict_tag_source', TRUE);
84  $tag_manager->saveAttributes();
85  }
86  }//end if version 0.2
87 
88  return TRUE;
89 
90  }//end _upgrade()
91 
92 
93 
94 }//end class
95 
96 ?>