LTIToolProviderMembershipsContextEntityController.class.php

  1. cis7 sites/all/modules/ulmus/lti_tool_provider/lti_tool_provider_memberships/LTIToolProviderMembershipsContextEntityController.class.php
  2. cle7 sites/all/modules/ulmus/lti_tool_provider/lti_tool_provider_memberships/LTIToolProviderMembershipsContextEntityController.class.php
  3. ecd7 sites/all/modules/ulmus/lti_tool_provider/lti_tool_provider_memberships/LTIToolProviderMembershipsContextEntityController.class.php
  4. elmsmedia7 sites/all/modules/ulmus/lti_tool_provider/lti_tool_provider_memberships/LTIToolProviderMembershipsContextEntityController.class.php
  5. harmony7 sites/all/modules/ulmus/lti_tool_provider/lti_tool_provider_memberships/LTIToolProviderMembershipsContextEntityController.class.php
  6. icor7 sites/all/modules/ulmus/lti_tool_provider/lti_tool_provider_memberships/LTIToolProviderMembershipsContextEntityController.class.php
  7. meedjum_blog7 sites/all/modules/ulmus/lti_tool_provider/lti_tool_provider_memberships/LTIToolProviderMembershipsContextEntityController.class.php
  8. mooc7 sites/all/modules/ulmus/lti_tool_provider/lti_tool_provider_memberships/LTIToolProviderMembershipsContextEntityController.class.php

Contains LTIToolProviderMembershipsContextEntityController.

Classes

Namesort descending Description
LTIToolProviderMembershipsContextEntityController Memberships Context Entity controller.

Interfaces

Namesort descending Description
LTIToolProviderMembershipsContextEntityControllerInterface Memberships Context Entity controller interface.

File

sites/all/modules/ulmus/lti_tool_provider/lti_tool_provider_memberships/LTIToolProviderMembershipsContextEntityController.class.php
View source
  1. <?php
  2. /**
  3. * @file
  4. * Contains LTIToolProviderMembershipsContextEntityController.
  5. */
  6. /**
  7. * Memberships Context Entity controller interface.
  8. */
  9. interface LTIToolProviderMembershipsContextEntityControllerInterface
  10. extends DrupalEntityControllerInterface {
  11. public function create();
  12. public function save($entity);
  13. public function delete($entity);
  14. }
  15. /**
  16. * Memberships Context Entity controller.
  17. */
  18. class LTIToolProviderMembershipsContextEntityController
  19. extends DrupalDefaultEntityController
  20. implements LTIToolProviderMembershipsContextEntityControllerInterface {
  21. public function create() {
  22. $entity = new stdClass();
  23. $entity->lti_tool_provider_memberships_context_id = 0;
  24. $entity->lti_tool_provider_memberships_context_context_id = NULL;
  25. $entity->lti_tool_provider_memberships_context_file_id = 0;
  26. return $entity;
  27. }
  28. /**
  29. * Save a memberships context entity.
  30. *
  31. * @param object $entity
  32. * The memberships context to be saved.
  33. *
  34. * @return object|boolean
  35. * The saved entity or FALSE.
  36. */
  37. public function save($entity) {
  38. $transaction = db_transaction();
  39. try {
  40. $entity->is_new = empty($entity->lti_tool_provider_memberships_context_id);
  41. field_attach_presave('lti_tool_provider_memberships_context', $entity);
  42. $primary_key = $entity->lti_tool_provider_memberships_context_id ? 'lti_tool_provider_memberships_context_id' : array();
  43. if (empty($primary_key)) {
  44. drupal_write_record('lti_tool_provider_memberships_context', $entity);
  45. field_attach_insert('lti_tool_provider_memberships_context', $entity);
  46. $op = 'insert';
  47. }
  48. else {
  49. drupal_write_record('lti_tool_provider_memberships_context', $entity, $primary_key);
  50. $op = 'update';
  51. }
  52. $function = 'field_attach_' . $op;
  53. $function('lti_tool_provider_memberships_context', $entity);
  54. module_invoke_all('entity_' . $op, $entity, 'lti_tool_provider_memberships_context');
  55. unset($entity->is_new);
  56. db_ignore_slave();
  57. return $entity;
  58. }
  59. catch (Exception $e) {
  60. $transaction->rollback();
  61. drupal_set_message(t('%e', array('%e' => $entity->$e)));
  62. watchdog_exception('lti_tool_provider_memberships_context', $e, NULL, WATCHDOG_ERROR);
  63. return FALSE;
  64. }
  65. }
  66. /**
  67. * Delete a memberships context entity.
  68. *
  69. * @param object $entity
  70. * The memberships context to be deleted.
  71. */
  72. public function delete($entity) {
  73. $this->delete_multiple(array($entity));
  74. }
  75. /**
  76. * Delete a list of memberships context entities.
  77. *
  78. * @param object $entities
  79. * An array of memberships contexts to be deleted.
  80. */
  81. public function delete_multiple($entities) {
  82. $ids = array();
  83. if (!empty($entities)) {
  84. $transaction = db_transaction();
  85. try {
  86. foreach ($entities as $entity) {
  87. module_invoke_all('lti_tool_provider_memberships_context_delete', $entity);
  88. module_invoke_all('entity_delete', $entity, 'lti_tool_provider_memberships_context');
  89. field_attach_delete('lti_tool_provider_memberships_context', $entity);
  90. $ids[] = $entity->lti_tool_provider_memberships_context_id;
  91. }
  92. db_delete('lti_tool_provider_memberships_context')
  93. ->condition('lti_tool_provider_memberships_context_id', $ids, 'IN')
  94. ->execute();
  95. }
  96. catch (Exception $e) {
  97. $transaction->rollback();
  98. watchdog_exception('lti_tool_provider_memberships_context', $e);
  99. throw $e;
  100. }
  101. }
  102. }
  103. }
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.