assemblies.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * Assemblies function library
  4. *
  5. * @package Lorea
  6. * @subpackage Assemblies
  7. *
  8. * Copyright 2012-2013 Lorea Faeries <federation@lorea.org>
  9. *
  10. * This file is part of the Assemblies plugin for Elgg.
  11. *
  12. * Assemblies is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License as
  14. * published by the Free Software Foundation, either version 3 of the
  15. * License, or (at your option) any later version.
  16. *
  17. * Assemblies is distributed in the hope that it will be useful, but
  18. * WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  20. * Affero General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Affero General Public
  23. * License along with this program. If not, see
  24. * <http://www.gnu.org/licenses/>.
  25. */
  26. function assemblies_get_next_assembly($group) {
  27. $options = array('types' => 'object',
  28. 'subtypes' => 'assembly',
  29. 'limit' => 1,
  30. 'container_guid' => $group->guid,
  31. 'metadata_name_value_pairs' => array(
  32. array('name' => 'date',
  33. 'value' => time(),
  34. 'operand' => '>=')
  35. ),
  36. 'order_by_metadata' => array('name' => 'date',
  37. 'direction' => 'ASC')
  38. );
  39. $assemblies = elgg_get_entities_from_metadata($options);
  40. if (count($assemblies))
  41. return $assemblies[0];
  42. else
  43. return false;
  44. }