Source for file PruneAllVersionConstraint.class.php

Documentation is available at PruneAllVersionConstraint.class.php

  1. <?php
  2.  
  3. require_once HARMONI."dataManager/versionConstraints/VersionConstraint.interface.php";
  4.  
  5. /**
  6. * Prunes out ALL inactive values, of everything.
  7. *
  8. * @package harmoni.datamanager.versionconstraint
  9. *
  10. * @copyright Copyright &copy; 2005, Middlebury College
  11. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  12. *
  13. * @version $Id: PruneAllVersionConstraint.class.php,v 1.6 2007/09/04 20:25:33 adamfranco Exp $
  14. */
  15. class PruneAllVersionConstraint extends VersionConstraint {
  16.  
  17. function checkRecordFieldValue($value) {
  18. foreach ($value->getVersionIDs() as $verID) {
  19. $ver =$value->getVersion($verID);
  20. // these are the conditions under which we will prune the version: (OR)
  21. // 1) it is inactive
  22. // 2) the field it is part of has been entirely deleted (deactivated) in the Schema
  23. // 3) the Record it is part of is inactive
  24. if (!$ver->isActive() || !$ver->_parent->_parent->_schemaField->isActive()
  25. || !$ver->_parent->_parent->_parent->isActive())
  26. $ver->prune();
  27. // if (!$ver->isActive()) print "version";
  28. // if (!$ver->_parent->_parent->_schemaField->isActive()) print "schemaField";
  29. // if (!$ver->_parent->_parent->_parent->isActive()) print "record";
  30. }
  31. }
  32. function checkTags($record) {
  33. $mgr = Services::getService("RecordTagManager");
  34. $mgr->pruneTags($record);
  35. }
  36. function checkRecord($record) {
  37. // FALSE if we are to be deleted
  38. return ($record->isActive())?true:false;
  39. }
  40. }

Documentation generated on Wed, 19 Sep 2007 10:25:43 -0400 by phpDocumentor 1.3.0RC3