Exemple #1
0
 public function show()
 {
     $aElements = $this->_oPage->getElementsByField($this->_oField);
     if (count($aElements)) {
         $oElement = $aElements[0];
         /* @var $oElement AM_Model_Db_Element */
         $aElementView = array('id' => $oElement->id);
         $aExtraDataItem = array(AM_Model_Db_Element_Data_Html::DATA_KEY_TEMPLATE_TYPE, AM_Model_Db_Element_Data_Html::DATA_KEY_URL);
         foreach ($aExtraDataItem as $sItem) {
             $aElementView[$sItem] = $oElement->getResources()->getDataValue($sItem);
         }
         $aResourceView = $this->_getResourceViewData($oElement);
         $aElementView = array_merge($aElementView, $aResourceView);
     }
     $aFieldView = array();
     if (isset($aElementView)) {
         $aFieldView['element'] = $aElementView;
     }
     if (!isset($aElementView) || !isset($aElementView['fileName'])) {
         $aFieldView['defaultImageUri'] = AM_Tools::getImageUrl(AM_Handler_Thumbnail_Interface::PRESET_FIELD . '-' . $this->_sPageOrientation, 'element', null, null);
     }
     $sExtensions = array_map('strtoupper', AM_Model_Db_Element_Data_Html::getAllowedFileExtensions());
     sort($sExtensions, SORT_STRING);
     $aFieldView['allowedExtensions'] = implode(' / ', $sExtensions);
     $this->_setFieldData($aFieldView);
     parent::show();
 }
Exemple #2
0
 public function show()
 {
     $aElements = $this->_oPage->getElementsByField($this->_oField);
     if (count($aElements)) {
         $aElementsView = array();
         foreach ($aElements as $oElement) {
             /* @var $oElement AM_Model_Db_Element */
             $aElementView = array('id' => $oElement->id);
             $sVideo = $oElement->getResources()->getDataValue(AM_Model_Db_Element_Data_Slide::DATA_KEY_VIDEO);
             if (false !== $sVideo) {
                 $aElementView[AM_Model_Db_Element_Data_Slide::DATA_KEY_VIDEO] = $sVideo;
             }
             $aResourceView = $this->_getResourceViewData($oElement);
             $aElementView = array_merge($aElementView, $aResourceView);
             $aElementsView[] = $aElementView;
         }
     }
     $aFieldView = array();
     if (isset($aElementsView)) {
         $aFieldView['elements'] = $aElementsView;
     }
     $aExtensions = array_map('strtoupper', AM_Model_Db_Element_Data_Slide::getAllowedFileExtensions());
     sort($aExtensions, SORT_STRING);
     $aFieldView['allowedExtensions'] = implode(' / ', $aExtensions);
     $this->_setFieldData($aFieldView);
     parent::show();
 }
Exemple #3
0
 public function show()
 {
     $aFieldView = array();
     $aFieldView['current_game_type'] = null;
     $aElements = $this->_oPage->getElementsByField($this->_oField);
     if (count($aElements)) {
         $oElement = $aElements[0];
         $aFieldView['current_game_type'] = $oElement->getResources()->getDataValue(AM_Model_Db_Element_Data_Games::DATA_KEY_GAME_TYPE);
     }
     $aFieldView['game_types'] = AM_Model_Db_Element_Data_Games::$aGamesList;
     $this->_setFieldData($aFieldView);
     parent::show();
 }
 public function show()
 {
     $aElements = $this->_oPage->getElementsByField($this->_oField);
     if (count($aElements)) {
         $aElementsView = array();
         foreach ($aElements as $oElement) {
             /* @var $oElement AM_Model_Db_Element */
             $aElementView = array('id' => $oElement->id);
             $sUniq = '?' . strtotime($oElement->updated);
             $sVideo = $oElement->getResources()->getDataValue(AM_Model_Db_Element_Data_MiniArticle::DATA_KEY_VIDEO);
             if (false !== $sVideo) {
                 $aElementView[AM_Model_Db_Element_Data_MiniArticle::DATA_KEY_VIDEO] = $sVideo;
             }
             $sThumbnail = $oElement->getResources()->getDataValue(AM_Model_Db_Element_Data_MiniArticle::DATA_KEY_THUMBNAIL);
             if (false !== $sThumbnail) {
                 $sFileExtension = pathinfo($sThumbnail, PATHINFO_EXTENSION);
                 $aElementView['thumbnail'] = $sThumbnail;
                 $aElementView['thumbnailUri'] = AM_Tools::getImageUrl('none', 'element', $oElement->id, AM_Model_Db_Element_Data_MiniArticle::DATA_KEY_THUMBNAIL . '.' . $sFileExtension) . $sUniq;
             }
             $sThumbnailSelected = $oElement->getResources()->getDataValue(AM_Model_Db_Element_Data_MiniArticle::DATA_KEY_THUMBNAIL_SELECTED);
             if (false !== $sThumbnailSelected) {
                 $sFileExtension = pathinfo($sThumbnail, PATHINFO_EXTENSION);
                 $aElementView['thumbnailSelected'] = $sThumbnailSelected;
                 $aElementView['thumbnailSelectedUri'] = AM_Tools::getImageUrl('none', 'element', $oElement->id, AM_Model_Db_Element_Data_MiniArticle::DATA_KEY_THUMBNAIL_SELECTED . '.' . $sFileExtension) . $sUniq;
             }
             $aResourceView = $this->_getResourceViewData($oElement);
             $aElementView = array_merge($aElementView, $aResourceView);
             $aElementsView[] = $aElementView;
         }
     }
     $aFieldView = array();
     if (isset($aElementsView)) {
         $aFieldView['elements'] = $aElementsView;
     }
     $aExtensions = array_map('strtoupper', AM_Model_Db_Element_Data_MiniArticle::getAllowedFileExtensions());
     sort($aExtensions, SORT_STRING);
     $aFieldView['allowedExtensions'] = implode(' / ', $aExtensions);
     $this->_setFieldData($aFieldView);
     parent::show();
 }
Exemple #5
0
 public function show()
 {
     $aElements = $this->_oPage->getElementsByField($this->_oField);
     $aFieldView = array();
     if (count($aElements)) {
         $aElementView = array();
         $oElement = $aElements[0];
         /* @var $oElement AM_Model_Db_Element */
         $sBody = $oElement->getResources()->getDataValue(AM_Model_Db_Element_Data_Html5::DATA_KEY_HTML5_BODY);
         $aElementView[AM_Model_Db_Element_Data_Html5::DATA_KEY_HTML5_BODY] = $sBody;
         if (!empty($sBody)) {
             /** Select and fill fields, that refers to selected body */
             foreach (AM_Model_Db_Element_Data_Html5::$aFieldList[$sBody] as $sFieldName) {
                 $sFieldValue = $oElement->getResources()->getDataValue($sFieldName);
                 if (AM_Model_Db_Element_Data_Resource::DATA_KEY_RESOURCE == $sFieldName && !empty($sFieldValue)) {
                     $aFileInfo = pathinfo($sFieldValue);
                     $sFileName = $aFileInfo['filename'];
                     $sFileExtension = $aFileInfo['extension'];
                     $aElementView['element']['fileName'] = $sFileName . '.' . $sFileExtension;
                     $aElementView['element']['fileNameShort'] = $this->getHelper('String')->cut($sFileName) . '.' . $sFileExtension;
                     $sResourceFileName = AM_Model_Db_Element_Data_Html5::DATA_KEY_RESOURCE . '.' . $sFileExtension;
                     $aElementView['element']['smallUri'] = AM_Tools::getIconForNonImageFile($sResourceFileName);
                 }
                 $aElementView[$sFieldName] = $sFieldValue;
             }
             $aElementView['element']['id'] = $oElement->id;
         }
     }
     if (isset($aElementView)) {
         $aFieldView = $aElementView;
     }
     $aFieldView['select_body'] = AM_Model_Db_Element_Data_Html5::$aBodyList;
     $aExtensions = array_map('strtoupper', AM_Model_Db_Element_Data_Html5::getAllowedFileExtensions());
     sort($aExtensions, SORT_STRING);
     $aFieldView['allowedExtensions'] = implode(' / ', $aExtensions);
     $aFieldView['defaultImageUri'] = AM_Tools::getImageUrl(AM_Handler_Thumbnail_Interface::PRESET_FIELD . '-' . $this->_sPageOrientation, 'element', null, null);
     $this->_setFieldData($aFieldView);
     parent::show();
 }
Exemple #6
0
 public function show()
 {
     $aGalleries = array_fill_keys(array(1, 2, 3, 4, 5, 6, 7), array());
     $aElements = $this->_oPage->getElementsByField($this->_oField);
     if (count($aElements)) {
         foreach ($aElements as $oElement) {
             /* @var $oElement AM_Model_Db_Element */
             $iGalleryId = $oElement->getResources()->getDataValue(AM_Model_Db_Element_Data_Gallery::DATA_KEY_GALLERY_ID, 1);
             $aElementView = array('id' => $oElement->id, 'gallery' => $iGalleryId);
             $aResourceView = $this->_getResourceViewData($oElement);
             $aElementView = array_merge($aElementView, $aResourceView);
             $aElementView['zoom'] = $oElement->getResources()->getDataValue(AM_Model_Db_Element_Data_Gallery::DATA_KEY_ENABLE_ZOOM, 0);
             $aGalleries[$iGalleryId][] = $aElementView;
         }
     }
     $aFieldView = array();
     $aFieldView['galleries'] = $aGalleries;
     $aExtensions = array_map('strtoupper', AM_Model_Db_Element_Data_Gallery::getAllowedFileExtensions());
     sort($aExtensions, SORT_STRING);
     $aFieldView['allowedExtensions'] = implode(' / ', $aExtensions);
     $this->_setFieldData($aFieldView);
     parent::show();
 }