~xibo-maintainers/xibo/tempel

« back to all changes in this revision

Viewing changes to lib/Factory/CampaignFactory.php

  • Committer: Dan Garner
  • Date: 2016-06-08 14:41:13 UTC
  • Revision ID: git-v1:a40b425046fb32fdd52f01ea37f9102c32bb79d2
Feature - Campaign Preview (#180)

* New feature campaign preview

* preview button in order to open a preview page

* preview with includes

* css for the campaign preview

* add campaign duration in the campain preview

* delete the add campaign button from the campaign view

* raw in the preview options twig template

* making the layout preview work again

* date format with gmdate

* previewOptions in the campaign view

* preview widgets size in big screens

* refactoring html-preview library

* disabled finish event in the multi-html previews

* layout preview mode and campaign preview mode

* campaign preview route placed in routes-web

* changing file permissions

* adding install previously deleted file

* layout duration in hh:mm:ss format

* hyperlinks on the vignette's campaign preview

* column 'total duration' in the campaign view

* some i18n translations

* add CLA agreement

* capaign page, table colum duration not orderable

* Revert "add CLA agreement"

This reverts commit 06a19d6adf9c24b20679dc6a0c44ae2851cae984.

* time format placed in the twig template

* urlFor for the preview template url instead of absolute path

* add some SQL to select the SUM of layout duration

Show diffs side-by-side

added added

removed removed

Lines of Context:
140
140
     * @param array $filterBy
141
141
     * @return array[Campaign]
142
142
     */
143
 
    public function query($sortOrder = null, $filterBy = array())
 
143
    public function query($sortOrder = null, $filterBy = array(), $options = array())
144
144
    {
145
145
        if ($sortOrder == null)
146
146
            $sortOrder = array('campaign');
235
235
            $limit = ' LIMIT ' . intval($this->getSanitizer()->getInt('start', $filterBy), 0) . ', ' . $this->getSanitizer()->getInt('length', 10, $filterBy);
236
236
        }
237
237
 
 
238
        $intProperties = ['intProperties' => ['numberLayouts']];
 
239
 
 
240
        // Layout durations
 
241
        if ($this->getSanitizer()->getInt('totalDuration', 0, $options) != 0) {
 
242
            $select .= ", SUM(`layout`.duration) AS totalDuration";
 
243
            $intProperties = ['intProperties' => ['numberLayouts', 'totalDuration']];
 
244
        }
 
245
 
238
246
        $sql = $select . $body . $group . $order . $limit;
239
247
 
240
 
        $intProperties = ['intProperties' => ['numberLayouts']];
241
248
 
242
249
        foreach ($this->getStore()->select($sql, $params) as $row) {
243
250
            $campaigns[] = $this->createEmpty()->hydrate($row, $intProperties);
251
258
 
252
259
        return $campaigns;
253
260
    }
254
 
}
 
 
b'\\ No newline at end of file'
 
261
 
 
262
}