setup-options.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. $exists = $chunks = false;
  3. $output = null;
  4. switch ($options[xPDOTransport::PACKAGE_ACTION]) {
  5. case xPDOTransport::ACTION_INSTALL:
  6. //$exists = $modx->getObject('transport.modTransportPackage', array('package_name' => 'pdoTools'));
  7. break;
  8. case xPDOTransport::ACTION_UPGRADE:
  9. //$exists = $modx->getObject('transport.modTransportPackage', array('package_name' => 'pdoTools'));
  10. if (!empty($options['attributes']['chunks'])) {
  11. $chunks = '<ul id="formCheckboxes" style="height:200px;overflow:auto;">';
  12. foreach ($options['attributes']['chunks'] as $k => $v) {
  13. $chunks .= '
  14. <li>
  15. <label>
  16. <input type="checkbox" name="update_chunks[]" value="' . $k . '"> ' . $k . '
  17. </label>
  18. </li>';
  19. }
  20. $chunks .= '</ul>';
  21. }
  22. break;
  23. case xPDOTransport::ACTION_UNINSTALL:
  24. break;
  25. }
  26. $output = '';
  27. /*
  28. if (!$exists) {
  29. switch ($modx->getOption('manager_language')) {
  30. case 'ru':
  31. $output = 'Этот компонент требует <b>pdoTools</b> для быстрой работы сниппетов.<br/>Он будет автоматически скачан и установлен.';
  32. break;
  33. default:
  34. $output = 'This component requires <b>pdoTools</b> for fast work of snippets.<br/><br/>It will be automaticly downloaded and installed?';
  35. }
  36. }
  37. */
  38. if ($chunks) {
  39. /*
  40. if (!$exists) {
  41. $output .= '<br/><br/>';
  42. }
  43. */
  44. switch ($modx->getOption('manager_language')) {
  45. case 'ru':
  46. $output .= 'Выберите чанки, которые нужно <b>перезаписать</b>:<br/>
  47. <small>
  48. <a href="#" onclick="Ext.get(\'formCheckboxes\').select(\'input\').each(function(v) {v.dom.checked = true;});">отметить все</a> |
  49. <a href="#" onclick="Ext.get(\'formCheckboxes\').select(\'input\').each(function(v) {v.dom.checked = false;});">cнять отметки</a>
  50. </small>
  51. ';
  52. break;
  53. default:
  54. $output .= 'Select chunks, which need to <b>overwrite</b>:<br/>
  55. <small>
  56. <a href="#" onclick="Ext.get(\'formCheckboxes\').select(\'input\').each(function(v) {v.dom.checked = true;});">select all</a> |
  57. <a href="#" onclick="Ext.get(\'formCheckboxes\').select(\'input\').each(function(v) {v.dom.checked = false;});">deselect all</a>
  58. </small>
  59. ';
  60. }
  61. $output .= $chunks;
  62. }
  63. return $output;