Ejemplo n.º 1
0
 public function cancelChanges($coverData)
 {
     $groupId = (int) $coverData['groupId'];
     $this->service->deleteCoverByGroupId($groupId, GHEADER_BOL_Cover::STATUS_TMP);
     $cover = $this->service->findCoverByGroupId($groupId, GHEADER_BOL_Cover::STATUS_ACTIVE);
     if ($cover !== null) {
         return array('src' => $this->service->getCoverUrl($cover), 'data' => $cover->getSettings());
     }
     return array('src' => null, 'data' => array('position' => array('top' => 0, 'left' => 0), 'css' => null));
 }
Ejemplo n.º 2
0
 public function getCover()
 {
     $permissions = $this->getPemissions();
     $cover = $permissions['view'] ? $this->service->findCoverByGroupId($this->groupId) : null;
     if ($cover === null) {
         return array('hasCover' => false, 'src' => null, 'data' => array(), 'css' => '');
     }
     $data = $cover->getSettings();
     $css = empty($data['css']) ? array() : $data['css'];
     if (!empty($data['position']['top'])) {
         $css['top'] = $data['position']['top'] . 'px;';
     }
     if (!empty($data['position']['left'])) {
         $css['left'] = $data['position']['left'] . 'px;';
     }
     $cssStr = '';
     foreach ($css as $k => $v) {
         $cssStr .= $k . ': ' . $v . '; ';
     }
     return array('hasCover' => true, 'src' => $this->service->getCoverUrl($cover), 'data' => $data, 'css' => $cssStr);
 }