/php/component/editor.class.php

https://bitbucket.org/chamilo/chamilo-ext-repo-photobucket-dev/ · PHP · 49 lines · 40 code · 9 blank · 0 comment · 2 complexity · d44d8ce799808c5cd8bc6898a5f4f4eb MD5 · raw file

  1. <?php
  2. namespace common\extensions\external_repository_manager\implementation\photobucket;
  3. use common\libraries\Request;
  4. use common\libraries\Redirect;
  5. use common\libraries\Path;
  6. use common\extensions\external_repository_manager\ExternalRepositoryManager;
  7. require_once dirname(__FILE__) . '/../forms/photobucket_external_repository_manager_form.class.php';
  8. class PhotobucketExternalRepositoryManagerEditorComponent extends PhotobucketExternalRepositoryManager
  9. {
  10. function run()
  11. {
  12. $id = Request :: get(ExternalRepositoryManager :: PARAM_EXTERNAL_REPOSITORY_ID);
  13. $form = new PhotobucketExternalRepositoryManagerForm(PhotobucketExternalRepositoryManagerForm :: TYPE_EDIT, $this->get_url(array(
  14. ExternalRepositoryManager :: PARAM_EXTERNAL_REPOSITORY_ID => $id)), $this);
  15. $object = $this->retrieve_external_repository_object($id);
  16. $form->set_external_repository_object($object);
  17. if ($form->validate())
  18. {
  19. $success = $form->update_photo();
  20. $parameters = $this->get_parameters();
  21. $parameters[ExternalRepositoryManager :: PARAM_EXTERNAL_REPOSITORY_MANAGER_ACTION] = ExternalRepositoryManager :: ACTION_VIEW_EXTERNAL_REPOSITORY;
  22. $parameters[ExternalRepositoryManager :: PARAM_EXTERNAL_REPOSITORY_ID] = $object->get_id();
  23. if ($this->is_stand_alone())
  24. {
  25. Redirect :: web_link(Path :: get(WEB_PATH) . 'common/launcher/index.php', $parameters);
  26. }
  27. else
  28. {
  29. Redirect :: web_link(Path :: get(WEB_PATH) . 'index.php', $parameters);
  30. }
  31. }
  32. else
  33. {
  34. $this->display_header($trail, false);
  35. $form->display();
  36. $this->display_footer();
  37. }
  38. }
  39. }
  40. ?>