|
|
@@ -72,38 +72,18 @@ class BxBaseModGeneralModule extends BxDolModule
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
public function actionUpdateImage($sFiledName, $iContentId, $sValue)
|
|
|
{
|
|
|
- $CNF = &$this->_oConfig->CNF;
|
|
|
- $aData = $this->_oDb->getContentInfoById($iContentId);
|
|
|
- if ($this->checkAllowedEdit($aData) === CHECK_ACTION_RESULT_ALLOWED){
|
|
|
-
|
|
|
- $this->_oDb->updateEntriesBy([$sFiledName => $sValue], [$CNF['FIELD_ID'] => $iContentId]);
|
|
|
- //TODO add transcoder settings
|
|
|
- $oImgStorage = BxDolStorage::getObjectInstance($CNF['OBJECT_STORAGE']);
|
|
|
- $sImageUrl = $oImgStorage->getFileUrlById($sValue);
|
|
|
-
|
|
|
- $this->actionUpdateImagePosition($iContentId, $sFiledName, '', '');
|
|
|
-
|
|
|
- echo $sImageUrl;
|
|
|
- }
|
|
|
-
|
|
|
+ $mixedResult = $this->serviceUpdateImage($sFiledName, $iContentId, $sValue);
|
|
|
+ if($mixedResult !== false)
|
|
|
+ echo $mixedResult;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public function actionUpdateImagePosition($iContentId, $sFiledName, $sH, $sV)
|
|
|
{
|
|
|
- $CNF = &$this->_oConfig->CNF;
|
|
|
- $sFieldNamePos = 'FIELD_' . strtoupper($sFiledName) . '_POSITION';
|
|
|
- if (isset($CNF[$sFieldNamePos])){
|
|
|
- $sValue = '';
|
|
|
- $CNF = &$this->_oConfig->CNF;
|
|
|
- if ($sH != '' || $sV != '')
|
|
|
- $sValue = json_encode(['x' => $sH, 'y' => $sV]);
|
|
|
- $this->_oDb->updateEntriesBy([$CNF[$sFieldNamePos] => $sValue], [$CNF['FIELD_ID'] => $iContentId]);
|
|
|
- }
|
|
|
+ $this->serviceUpdateImagePosition($iContentId, $sFiledName, $sH, $sV);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public function actionApprove()
|
|
|
{
|
|
|
$CNF = &$this->_oConfig->CNF;
|
|
|
@@ -657,6 +637,48 @@ class BxBaseModGeneralModule extends BxDolModule
|
|
|
return $aTextFields;
|
|
|
}
|
|
|
|
|
|
+ public function serviceUpdateImage($sFiledName, $iContentId, $sValue)
|
|
|
+ {
|
|
|
+ $CNF = &$this->_oConfig->CNF;
|
|
|
+
|
|
|
+ $aData = $this->_oDb->getContentInfoById($iContentId);
|
|
|
+ if(empty($aData) || !is_array($aData))
|
|
|
+ return false;
|
|
|
+
|
|
|
+ if($this->checkAllowedEdit($aData) !== CHECK_ACTION_RESULT_ALLOWED)
|
|
|
+ return false;
|
|
|
+
|
|
|
+ //TODO add transcoder settings
|
|
|
+ $oImgStorage = BxDolStorage::getObjectInstance($CNF['OBJECT_STORAGE']);
|
|
|
+ if(!$oImgStorage)
|
|
|
+ return false;
|
|
|
+
|
|
|
+ $this->_oDb->updateEntriesBy([$sFiledName => $sValue], [$CNF['FIELD_ID'] => $iContentId]);
|
|
|
+
|
|
|
+ $this->serviceUpdateImagePosition($iContentId, $sFiledName, '', '');
|
|
|
+
|
|
|
+ $this->onUpdateImage($iContentId, $sFiledName, $sValue);
|
|
|
+
|
|
|
+ return $oImgStorage->getFileUrlById($sValue);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function serviceUpdateImagePosition($iContentId, $sFiledName, $sH, $sV)
|
|
|
+ {
|
|
|
+ $CNF = &$this->_oConfig->CNF;
|
|
|
+
|
|
|
+ $sFieldNamePos = 'FIELD_' . strtoupper($sFiledName) . '_POSITION';
|
|
|
+ if(!isset($CNF[$sFieldNamePos]))
|
|
|
+ return false;
|
|
|
+
|
|
|
+ $sValue = '';
|
|
|
+ if($sH != '' || $sV != '')
|
|
|
+ $sValue = json_encode(['x' => $sH, 'y' => $sV]);
|
|
|
+
|
|
|
+ $this->_oDb->updateEntriesBy([$CNF[$sFieldNamePos] => $sValue], [$CNF['FIELD_ID'] => $iContentId]);
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
public function serviceManageTools($sType = 'common')
|
|
|
{
|
|
|
if(!isLogged())
|
|
|
@@ -2847,6 +2869,8 @@ class BxBaseModGeneralModule extends BxDolModule
|
|
|
$this->onPublished($mixedContent[$CNF['FIELD_ID']]);
|
|
|
}
|
|
|
|
|
|
+ public function onUpdateImage($iContentId, $sFiledName, $sFiledValue, $iProfileId = 0) {}
|
|
|
+
|
|
|
public function alertAfterAdd($aContentInfo) {}
|
|
|
|
|
|
public function alertAfterEdit($aContentInfo) {}
|