piecemaker.xml.inc 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. * @file
  4. * Function related to the Building of the Piecemaker XML file
  5. */
  6. /**
  7. * Builds a Piecemaker XML file
  8. *
  9. */
  10. function piecemaker_xml_build($settings) {
  11. drupal_add_http_header('Content-Type', 'text/xml; charset=utf-8');
  12. print theme('piecemaker_xml', $settings);
  13. exit();
  14. }
  15. /**
  16. * Preprocess Function for the Settings XML file
  17. * @param $vars
  18. * An associative array of the needed items to generate an XML file
  19. * - 'Settings': The settings array of to be used. Most likely this comes from a piecemaker profile
  20. * - 'Transitions': The transitions array to be used. Once again this is most likely comming from a profile
  21. * - 'Contents': An item array containing the following keys
  22. * - '#type': Either 'Image', 'Video', or 'Flash'
  23. * - '#attributes': An array of attributes to add to the main node
  24. * - 'Source': The Source of the file. This should be generated using $base_url to ensure it points correctly. REQUIRED for all file types.
  25. * - 'Title': The title of the file. Will be shown in the tooltip on the menu. Avaialable to all file types.
  26. * - 'Width': Only used in Video files. The width of the video file.
  27. * - 'Height': Only used in Video files. The height of the video file.
  28. * - 'Autoplay': Only used in Video files. Autoplay defines whether or not the video will start playing as soon as it‘s ready.
  29. * - 'Text': Used in Image nodes. The Text node can hold a description text, which can be formatted with simple HTML tags.
  30. * Which HTML tags are supported, is determined by the piecemaker.css file. Per default you can use <h1>, <p>, <p-italic>, <a>.
  31. * But you can add and specify as many tags as you want, for example different headline types. If you want to use different fonts,
  32. * you will have to make sure that you embed these fonts in the Flash file. If you don‘t add a Text node, no info text appears.
  33. * - 'Hyperlink': An array that contains an #attributes key which holds the attributes URL and Target.
  34. * - 'Image': The Flash and Video nodes must have a child array Image, which will also have a Source #attribute key. This will specify the path to a preview image to be loaded before the SWF/Video file is shown.
  35. * This preview image might show the first image of the SWF/Video file though, which would cause a smooth transition from the image to the actual SWF/Video.
  36. * Please note that this image will still be shown left and right of the video, in case that the video is not as wide as the image.
  37. */
  38. function template_preprocess_piecemaker_xml(&$vars) {
  39. foreach($vars['Contents'] as $item) {
  40. $Contents[] = theme('piecemaker_xml_node', array('item' => $item));
  41. }
  42. $vars['ContentNodes'] = $Contents;
  43. }
  44. /**
  45. * Generates the individual nodes for a piecemaker XML file.
  46. */
  47. function theme_piecemaker_xml_node(&$vars) {
  48. $hook = 'piecemaker_xml_node_' . $vars['item']['#type'];
  49. return theme($hook, $vars);
  50. }