-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
186 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?php defined('BX_DOL') or die('hack attempt'); | ||
/** | ||
* Copyright (c) UNA, Inc - https://una.io | ||
* MIT License - https://opensource.org/licenses/MIT | ||
* | ||
* @defgroup Albums Albums | ||
* @ingroup UnaModules | ||
* | ||
* @{ | ||
*/ | ||
|
||
/** | ||
* Create/Edit entry form | ||
*/ | ||
class BxAlbumsFormMedia extends BxTemplFormView | ||
{ | ||
protected $_sModule; | ||
protected $_oModule; | ||
|
||
protected $_iMediaId; | ||
protected $_aMediaInfo; | ||
|
||
public function __construct($aInfo, $oTemplate = false) | ||
{ | ||
$this->_sModule = 'bx_albums'; | ||
$this->_oModule = BxDolModule::getInstance($this->_sModule); | ||
|
||
parent::__construct($aInfo, $oTemplate); | ||
} | ||
|
||
public function initChecker($aValues = array (), $aSpecificValues = array()) | ||
{ | ||
if(!empty($this->_aMediaInfo) && is_array($this->_aMediaInfo)) | ||
$aValues = $this->_aMediaInfo; | ||
|
||
parent::initChecker($aValues, $aSpecificValues); | ||
} | ||
|
||
public function initForm($aAction, $iMediaId) | ||
{ | ||
$CNF = &$this->_oModule->_oConfig->CNF; | ||
|
||
$this->_iMediaId = $iMediaId; | ||
$this->_aMediaInfo = $this->_oModule->_oDb->getMediaInfoById($iMediaId); | ||
|
||
$this->aFormAttrs['action'] = BX_DOL_URL_ROOT . $this->_oModule->_oConfig->getBaseUri() . $aAction . '_media/' . $iMediaId; | ||
|
||
if(isset($this->aInputs['content_id'])) { | ||
$aAlbums = $this->_oModule->_oDb->getEntriesBy(array('type' => 'author', 'author' => $this->_aMediaInfo['author'])); | ||
foreach($aAlbums as $aAlbum) | ||
$this->aInputs['content_id']['values'][] = ['key' => $aAlbum[$CNF['FIELD_ID']], 'value' => $aAlbum[$CNF['FIELD_TITLE']]]; | ||
} | ||
} | ||
|
||
public function update($val, $aValsToAdd = array(), &$aTrackTextFieldsChanges = null) | ||
{ | ||
$CNF = &$this->_oModule->_oConfig->CNF; | ||
|
||
$sField = 'content_id'; | ||
if(isset($this->aInputs[$sField])) { | ||
$iContentId = $this->getCleanValue($sField); | ||
|
||
$oStorage = BxDolStorage::getObjectInstance($CNF['OBJECT_STORAGE']); | ||
if(!$oStorage->updateGhostsContentId($this->_aMediaInfo['file_id'], $this->_aMediaInfo['author'], $iContentId)) | ||
return false; | ||
} | ||
|
||
return parent::update($val, $aValsToAdd, $aTrackTextFieldsChanges); | ||
} | ||
} | ||
|
||
/** @} */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters