~xibo-maintainers/xibo/tempel

« back to all changes in this revision

Viewing changes to lib/Widget/ModuleWidget.php

  • Committer: Dan Garner
  • Date: 2016-03-18 11:43:06 UTC
  • mfrom: (487.1.44)
  • Revision ID: git-v1:cf7951907ad488d5d0d1710026eaec2d43afae97
Merge pull request #144 from dasgarner/develop

1.8.0-alpha3 release tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
use Xibo\Factory\DataSetColumnFactory;
30
30
use Xibo\Factory\DataSetFactory;
31
31
use Xibo\Factory\DisplayFactory;
 
32
use Xibo\Factory\DisplayGroupFactory;
 
33
use Xibo\Factory\LayoutFactory;
32
34
use Xibo\Factory\MediaFactory;
33
35
use Xibo\Factory\ModuleFactory;
34
36
use Xibo\Factory\TransitionFactory;
 
37
use Xibo\Factory\WidgetFactory;
35
38
use Xibo\Service\ConfigService;
36
39
use Xibo\Service\ConfigServiceInterface;
37
40
use Xibo\Service\DateServiceInterface;
144
147
     */
145
148
    protected $commandFactory;
146
149
 
 
150
    /** @var  LayoutFactory */
 
151
    protected $layoutFactory;
 
152
 
 
153
    /** @var  WidgetFactory */
 
154
    protected $widgetFactory;
 
155
 
 
156
    /** @var  DisplayGroupFactory */
 
157
    protected $displayGroupFactory;
 
158
 
147
159
    /**
148
160
     * ModuleWidget constructor.
149
161
     * @param Slim $app
181
193
    }
182
194
 
183
195
    /**
 
196
     * Set Child Object Dependencies
 
197
     * @param LayoutFactory $layoutFactory
 
198
     * @param WidgetFactory $widgetFactory
 
199
     * @param DisplayGroupFactory $displayGroupFactory
 
200
     */
 
201
    public function setChildObjectDependencies($layoutFactory, $widgetFactory, $displayGroupFactory)
 
202
    {
 
203
        $this->layoutFactory = $layoutFactory;
 
204
        $this->widgetFactory = $widgetFactory;
 
205
        $this->displayGroupFactory = $displayGroupFactory;
 
206
    }
 
207
 
 
208
    /**
184
209
     * Get the App
185
210
     * @return Slim
186
211
     */
811
836
    }
812
837
 
813
838
    /**
 
839
     * Count Library Media
 
840
     * @return int
 
841
     */
 
842
    public function countLibraryMedia()
 
843
    {
 
844
        return 0;
 
845
    }
 
846
 
 
847
    /**
814
848
     * Get Media Id
815
849
     * @return int
816
850
     * @throws NotFoundException
817
851
     */
818
852
    public function getMediaId()
819
853
    {
820
 
        $this->getLog()->debug('Getting first MediaID for Widget: %d', $this->getWidgetId());
 
854
        $this->getLog()->debug('Getting first MediaID for Widget: %d. Media: %s', $this->getWidgetId(), json_encode($this->widget->mediaIds));
821
855
 
822
856
        if (count($this->widget->mediaIds) <= 0)
823
857
            throw new NotFoundException(__('No file to return'));
832
866
     */
833
867
    public function getMedia()
834
868
    {
835
 
        return $this->mediaFactory->getById($this->getMediaId());
 
869
        $media = $this->mediaFactory->getById($this->getMediaId());
 
870
        $media->setChildObjectDependencies($this->layoutFactory, $this->widgetFactory, $this->displayGroupFactory);
 
871
        return $media;
836
872
    }
837
873
 
838
874
    /**