setup-options.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /**
  3. * Script to interact with user during MyComponent package install
  4. *
  5. * Copyright 2011 Your Name <you@yourdomain.com>
  6. * @author Your Name <you@yourdomain.com>
  7. * 1/1/11
  8. *
  9. * is free software; you can redistribute it and/or modify it
  10. * under the terms of the GNU General Public License as published by the Free
  11. * Software Foundation; either version 2 of the License, or (at your option) any
  12. * later version.
  13. *
  14. * is distributed in the hope that it will be useful, but WITHOUT ANY
  15. * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  16. * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License along with
  19. * ; if not, write to the Free Software Foundation, Inc., 59 Temple
  20. * Place, Suite 330, Boston, MA 02111-1307 USA
  21. *
  22. * @package mycomponent
  23. */
  24. /**
  25. * Description: Script to interact with user during MyComponent package install
  26. * @package mycomponent
  27. * @subpackage build
  28. */
  29. /* Use these if you would like to do different things depending on what's happening */
  30. /* The return value from this script should be an HTML form (minus the
  31. * <form> tags and submit button) in a single string.
  32. *
  33. * The form will be shown to the user during install
  34. * after the readme.txt display.
  35. *
  36. * This example presents an HTML form to the user with one input field
  37. * (you can have more).
  38. *
  39. * The user's entries in the form's input field(s) will be available
  40. * in any php resolvers with $modx->getOption('field_name', $options, 'default_value').
  41. *
  42. * You can use the value(s) to set system settings, snippet properties,
  43. * chunk content, etc. One common use is to use a checkbox and ask the
  44. * user if they would like to install an example resource for your
  45. * component.
  46. */
  47. $output = '';
  48. switch ($options[xPDOTransport::PACKAGE_ACTION]) {
  49. case xPDOTransport::ACTION_INSTALL:
  50. $output = '
  51. <p>
  52. <input type="checkbox" name="createSample" id="ck_createSample" checked="checked" value="1" style="float:left; margin-right: 10px;" />
  53. <label for="ck_createSample">Install sample slides</label>
  54. </p>';
  55. case xPDOTransport::ACTION_UPGRADE:
  56. break;
  57. case xPDOTransport::ACTION_UNINSTALL:
  58. break;
  59. }
  60. return $output;