mostly filebased Content Presentation System
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

103 lines
3.9KB

  1. <?php
  2. namespace Modules;
  3. class CVideo extends ContentType {
  4. public $keys = array(
  5. 'TARGET' => 'target',
  6. 'STILL' => 'still',
  7. 'STILL2' => 'still2',
  8. 'NAME' => 'name',
  9. 'CAPTION' => 'caption',
  10. 'STYLE' => 'style',
  11. 'RATIO' => 'ratio'
  12. );
  13. public $values;
  14. protected $layout;
  15. protected $layouts = array(
  16. 'default' => 'view_default',
  17. 'lightbox' => 'view_in_lightbox',
  18. 'audio' => 'view_in_lightbox2'
  19. );
  20. function __construct($keys,$config) {
  21. parent::__construct($keys,$config);
  22. }
  23. function view_in_toc() {
  24. $v = (object) $this->values;
  25. return sprintf("<div class=\"location\"><a href=\"/%s\"><h3>%s</h3></a><span>%s</span></div>",
  26. $this->href,
  27. $v->name,
  28. $v->town
  29. );
  30. }
  31. function view_default() {
  32. $v = (object) $this->values;
  33. return sprintf("<video style=\"width:300px;\" id=\"asd\" class=\"video-js\" controls preload=\"auto\" "
  34. ."data-setup=\"{}\"><source src=\"%s%s\" /></video>",
  35. $this->config['path'],
  36. $v->target
  37. );
  38. }
  39. function view_in_lightbox1() {
  40. $v = (object) $this->values;
  41. $id = "video_".$v->name;
  42. return sprintf("<div class='video-container %s'><div class=\"media\"><div class=\"video-thumbnail\"><a href=\"%s\" data-featherlight=\"#%s\">"
  43. ."<img class=\"thumbnail\" src=\"%s\" alt=\"video-preview\"/>"
  44. ."<img class=\"play-button\" src=\"%s\" alt=\"play-button\" />"
  45. ."</a></div><div class=\"lightbox\" id=\"%s\" >%s</div></div><div class=\"caption\">%s</div></div>",
  46. $v->style,
  47. $v->target,
  48. $id,
  49. $v->still->get_src(1200),
  50. "/rsc/img/play-button.png",
  51. $id,
  52. $this->view_default(),
  53. $v->caption
  54. );
  55. }
  56. function view_in_lightbox() {
  57. $v = (object) $this->values;
  58. $id = $v->name;
  59. $target = $this->config['path'].$v->target;
  60. return sprintf("<div class='video-container %s'>"
  61. ."<div class=\"media\"><div class=\"video-thumbnail\"><a href=\"%s\" class=\"trigger_video\" data-poster=\"%s\" data-video-url=\"%s\" data-video-name=\"%s\" data-ce-type=\"video\">"
  62. ."<img class=\"thumbnail\" src=\"%s\" alt=\"video-preview\"/>"
  63. ."</a></div><div class=\"lightbox\" id=\"container%s\" ></div></div><div class=\"caption\">%s</div></div>",
  64. $v->style,
  65. $target,
  66. $v->still2,
  67. $target,
  68. $id,
  69. $v->still->get_src(1200),
  70. $id,
  71. $v->caption
  72. );
  73. }
  74. function view_in_lightbox2() {
  75. $v = (object) $this->values;
  76. $id = $v->name;
  77. $target = $this->config['path'].$v->target;
  78. return sprintf("<div class='audio-container %s'>"
  79. ."<div class=\"media\"><div class=\"video-thumbnail\"><a href=\"%s\" class=\"trigger_video\" data-video-url=\"%s\" data-video-name=\"%s\" data-ce-type=\"audio\" data-ratio=\"%s\">"
  80. ."<img class=\"thumbnail\" src=\"%s\" alt=\"video-preview\"/>"
  81. ."</a></div><div class=\"lightbox\" id=\"container%s\" ></div></div><div class=\"caption\">%s</div></div>",
  82. $v->style,
  83. $target,
  84. //$v->still2,
  85. $target,
  86. $id,
  87. $v->ratio,
  88. $v->still->get_src(1200),
  89. $id,
  90. $v->caption
  91. );
  92. }
  93. }