1
0

BxBaseModGeneralFormEntry.php 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup BaseGeneral Base classes for modules
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. /**
  12. * Create/edit entry form
  13. */
  14. class BxBaseModGeneralFormEntry extends BxTemplFormView
  15. {
  16. protected static $_isCssJsGeneralModuleAdded = false;
  17. protected $MODULE;
  18. protected $_oModule;
  19. protected $_aMetatagsFieldsWithKeywords = array();
  20. protected $_oMetatagsObject = null;
  21. protected $_oMetatagsContentId = 0;
  22. protected $_sGhostTemplate = 'form_ghost_template.html';
  23. protected $_aTrackFieldsChanges;
  24. protected $_iContentId;
  25. public function __construct($aInfo, $oTemplate = false)
  26. {
  27. parent::__construct($aInfo, $oTemplate);
  28. $this->_oModule = BxDolModule::getInstance($this->MODULE);
  29. $this->_aTrackFieldsChanges = array();
  30. $CNF = &$this->_oModule->_oConfig->CNF;
  31. if (isset($CNF['FIELD_ADDED']) && isset($this->aInputs[$CNF['FIELD_ADDED']])) {
  32. $this->aInputs[$CNF['FIELD_ADDED']]['date_filter'] = BX_DATA_INT;
  33. $this->aInputs[$CNF['FIELD_ADDED']]['date_format'] = BX_FORMAT_DATE;
  34. }
  35. if (isset($CNF['FIELD_CHANGED']) && isset($this->aInputs[$CNF['FIELD_CHANGED']])) {
  36. $this->aInputs[$CNF['FIELD_CHANGED']]['date_filter'] = BX_DATA_INT;
  37. $this->aInputs[$CNF['FIELD_CHANGED']]['date_format'] = BX_FORMAT_DATE;
  38. }
  39. if (isset($CNF['FIELD_TEXT']) && isset($this->aInputs[$CNF['FIELD_TEXT']]) && isset($CNF['FIELD_TEXT_ID'])) {
  40. $this->aInputs[$CNF['FIELD_TEXT']]['attrs'] = array_merge (
  41. array ('id' => $CNF['FIELD_TEXT_ID']),
  42. is_array($this->aInputs[$CNF['FIELD_TEXT']]['attrs']) ? $this->aInputs[$CNF['FIELD_TEXT']]['attrs'] : array ()
  43. );
  44. }
  45. if (isset($CNF['FIELD_LABELS']) && isset($this->aInputs[$CNF['FIELD_LABELS']]) && !empty($CNF['OBJECT_METATAGS']) && ($oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS'])) && $oMetatags->keywordsIsEnabled()) {
  46. $this->aInputs[$CNF['FIELD_LABELS']]['meta_object'] = $CNF['OBJECT_METATAGS'];
  47. }
  48. if (isset($CNF['FIELD_LOCATION_PREFIX']) && isset($this->aInputs[$CNF['FIELD_LOCATION_PREFIX']])) {
  49. $this->aInputs[$CNF['FIELD_LOCATION_PREFIX']]['manual_input'] = true;
  50. }
  51. if (isset($CNF['FIELD_PHOTO']) && isset($this->aInputs[$CNF['FIELD_PHOTO']])) {
  52. $this->aInputs[$CNF['FIELD_PHOTO']]['storage_object'] = $CNF['OBJECT_STORAGE'];
  53. $this->aInputs[$CNF['FIELD_PHOTO']]['uploaders'] = !empty($this->aInputs[$CNF['FIELD_PHOTO']]['value']) ? unserialize($this->aInputs[$CNF['FIELD_PHOTO']]['value']) : $CNF['OBJECT_UPLOADERS'];
  54. $this->aInputs[$CNF['FIELD_PHOTO']]['images_transcoder'] = $CNF['OBJECT_IMAGES_TRANSCODER_PREVIEW'];
  55. $this->aInputs[$CNF['FIELD_PHOTO']]['storage_private'] = 0;
  56. $this->aInputs[$CNF['FIELD_PHOTO']]['multiple'] = true;
  57. $this->aInputs[$CNF['FIELD_PHOTO']]['content_id'] = 0;
  58. $this->aInputs[$CNF['FIELD_PHOTO']]['ghost_template'] = '';
  59. }
  60. $aPrivacyFields = $this->_getPrivacyFields();
  61. foreach($aPrivacyFields as $sField => $sObject)
  62. $this->_preparePrivacyField($sField, $sObject);
  63. foreach($this->aInputs as $sKey => $aInput) {
  64. if ($aInput['type'] == 'nested_form'){
  65. $this->genGhostTemplateForInputNestedForm ($this->aInputs[$sKey]);
  66. }
  67. }
  68. }
  69. function getCode($bDynamicMode = false)
  70. {
  71. $CNF = &$this->_oModule->_oConfig->CNF;
  72. if(!$bDynamicMode && bx_is_dynamic_request())
  73. $bDynamicMode = true;
  74. $sResult = parent::getCode($bDynamicMode);
  75. $aPrivacyFields = $this->_getPrivacyFields();
  76. foreach($aPrivacyFields as $sField => $sObject)
  77. $this->_addCssJsPrivacyField($sField, $sObject, $bDynamicMode);
  78. if(isset($CNF['PARAM_MULTICAT_ENABLED']) && $CNF['PARAM_MULTICAT_ENABLED'] === true) {
  79. $sInclude2 = '';
  80. $sInclude2 .= $this->_oModule->_oTemplate->addJs(array('BxDolCategories.js'), $bDynamicMode);
  81. $sInclude2 .= $this->_oModule->_oTemplate->addCss(array('categories.css'), $bDynamicMode);
  82. $sResult .= ($bDynamicMode ? $sInclude2 : '') . $this->_oModule->_oTemplate->getJsCode('categories');
  83. }
  84. return $sResult;
  85. }
  86. /**
  87. * Nested forms processing
  88. */
  89. function genInputNestedForm (&$aInput, $sInfo = '', $sError = '')
  90. {
  91. $sUniqId = genRndPwd (8, false);
  92. $aNestedForms = array();
  93. if (!$this->isSubmitted()){
  94. $aNestedValues = $this->_oModule->_oDb->getNestedBy(array('type' => 'content_id', 'id' => $this->_iContentId, 'key_name' => $aInput['ghost_template']['params']['db']['key']), $aInput['ghost_template']['params']['db']['table']);
  95. foreach($aNestedValues as $aNestedValue) {
  96. $aNestedValuesRv = array();
  97. $oForm = $this->getNestedFormObject($aInput);
  98. foreach($aNestedValue as $aNestedKey => $aNestedItem) {
  99. if ($oForm->aParams['db']['key'] == $aNestedKey)
  100. $aNestedValuesRv[$aNestedKey . '[]'] = $aNestedItem;
  101. else
  102. $aNestedValuesRv[$aNestedKey] = $aNestedItem;
  103. }
  104. $oForm->initChecker($aNestedValuesRv);
  105. array_push(
  106. $aNestedForms,
  107. array(
  108. 'key_value' => $aNestedValuesRv[$oForm->aParams['db']['key'] . '[]'],
  109. 'key_name' => $aInput['name'],
  110. 'form_code' => $oForm->genRows(),
  111. 'js_instance_name' => 'oBxNestedForm_' . $sUniqId,
  112. 'nested_type' => $aInput['name'],
  113. )
  114. );
  115. }
  116. }
  117. else{
  118. $aInput['ghost_templates'] = $aInput['ghost_template'];
  119. $this->genGhostTemplateForInputNestedForm ($aInput);
  120. foreach($aInput['ghost_templates'] as $oForm) {
  121. array_push(
  122. $aNestedForms,
  123. array(
  124. 'key_value' => $oForm->aInputs[$aInput['name']]['value'],
  125. 'key_name' => $aInput['name'],
  126. 'form_code' => $oForm->genRows(),
  127. 'js_instance_name' => 'oBxNestedForm_' . $sUniqId,
  128. 'nested_type' => $aInput['name'],
  129. )
  130. );
  131. }
  132. }
  133. return $this->oTemplate->parseHtmlByName('form_field_nested_form.html', array(
  134. 'bx_repeat:items' => $aNestedForms,
  135. 'info' => $sInfo,
  136. 'error' => $sError,
  137. 'uniq_id' => $sUniqId,
  138. 'js_instance_name' => 'oBxNestedForm_' . $sUniqId,
  139. 'options' => json_encode(array(
  140. 'uniq_id' => $sUniqId,
  141. 'js_instance_name' => 'oBxNestedForm_' . $sUniqId,
  142. 'template_ghost' => $this->genGhostTemplate($aInput),
  143. 'form_name' => $aInput['value'],
  144. 'action_uri' => $this->_oModule->_oConfig->getBaseUri(),
  145. 'nested_type' => $aInput['name'],
  146. )),
  147. ));
  148. }
  149. function genNestedForm (&$aInput)
  150. {
  151. $sResult = '';
  152. $aNestedValues = $this->_oModule->_oDb->getNestedBy(array('type' => 'content_id', 'id' => $this->_iContentId, 'key_name' => $aInput['ghost_template']['params']['db']['key']), $aInput['ghost_template']['params']['db']['table']);
  153. foreach($aNestedValues as $aNestedValue) {
  154. $sValue = '';
  155. $aNestedValuesRv = array();
  156. $oForm = $this->getNestedFormObject($aInput, true);
  157. foreach($aNestedValue as $aNestedKey => $aNestedItem) {
  158. if ($oForm->aParams['db']['key'] == $aNestedKey)
  159. $aNestedValuesRv[$aNestedKey . '[]'] = $aNestedItem;
  160. else
  161. $aNestedValuesRv[$aNestedKey] = $aNestedItem;
  162. }
  163. $oForm->initChecker($aNestedValuesRv);
  164. if ($aInput['rateable']){
  165. $sVote = '';
  166. $sVoteBtn = '';
  167. $iId = BxDolFormQuery::getFormField($this->id, $aInput['name'], $this->_iContentId, $aNestedValuesRv[$oForm->aParams['db']['key'] . '[]']);
  168. $oVote = BxDolVote::getObjectInstance($aInput['rateable'], $iId, true, BxDolTemplate::getInstance());
  169. if ($oVote){
  170. $sVote = $oVote->getCounter(array('show_counter_empty' => true, 'show_counter' => true, 'show_counter_style' => 'simple', 'dynamic_mode' => $this->_bDynamicMode));
  171. $sVoteBtn = $oVote->getElementInline(array('show_counter_empty' => true, 'show_counter' => false, 'show_counter_style' => 'simple', 'dynamic_mode' => $this->_bDynamicMode));
  172. }
  173. $sValue = $this->oTemplate->parseHtmlByName('form_view_rateable_row.html', array(
  174. 'value' => $oForm->getCode(),
  175. 'rate' => $sVote,
  176. 'rate_btn' => $sVoteBtn
  177. ));
  178. }
  179. else{
  180. $sValue = $oForm->getCode();
  181. }
  182. $sResult .= $this->oTemplate->parseHtmlByName('form_view_nested_row.html', array(
  183. 'value' => $sValue
  184. ));
  185. }
  186. if ($sResult != ''){
  187. return $this->oTemplate->parseHtmlByName('form_view_row.html', array(
  188. 'type' => $aInput['type'],
  189. 'caption' => isset($aInput['caption']) ? bx_process_output($aInput['caption']) : '',
  190. 'value' => $sResult
  191. ));
  192. }
  193. }
  194. protected function genGhostTemplateForInputNestedForm (&$aInput)
  195. {
  196. $oForm = $this->getNestedFormObject($aInput);
  197. $aInput['ghost_template'] = array (
  198. 'params' => array(
  199. 'nested_form_template' => 'form_field_nested_form_wrapper.html',
  200. 'db' => array(
  201. 'table' => $oForm->aParams['db']['table'],
  202. 'key' => $oForm->aParams['db']['key'],
  203. 'submit_name' => $oForm->aParams['db']['key'],
  204. ),
  205. ),
  206. 'inputs' => $oForm->aInputs
  207. );
  208. }
  209. function getNestedFormObject (&$aInput, $bViewMode = false)
  210. {
  211. $oForm = BxDolForm::getObjectInstance($aInput['value'], $aInput['value'] . ($bViewMode ? '_view' : ''));
  212. foreach($oForm->aInputs as $sKey => $aInput2) {
  213. $sName = $oForm->aInputs[$sKey]['name'];
  214. if (strpos($sName,'[]') === false)
  215. $oForm->aInputs[$sKey]['name'] = $sName . '[]';
  216. }
  217. return $oForm;
  218. }
  219. /**
  220. * Add field(s) which will be tracked during content update.
  221. */
  222. public function addTrackFields($mixedFields, $mixedContent)
  223. {
  224. if(empty($mixedContent) || empty($mixedFields))
  225. return;
  226. if(!is_array($mixedContent)) {
  227. $mixedContent = $this->_oModule->_oDb->getContentInfoById((int)$mixedContent);
  228. if(empty($mixedContent) || !is_array($mixedContent))
  229. return;
  230. }
  231. if(!is_array($mixedFields))
  232. $mixedFields = array($mixedFields);
  233. foreach($mixedFields as $sField) {
  234. if(!isset($mixedContent[$sField]))
  235. continue;
  236. $this->_aTrackFieldsChanges[$sField] = array(
  237. 'old' => $mixedContent[$sField],
  238. );
  239. }
  240. }
  241. /**
  242. * Checks if the field was changed.
  243. */
  244. public function isTrackFieldChanged($sField, $bReturnValues = false)
  245. {
  246. if(!isset($this->_aTrackFieldsChanges[$sField]) || $this->_aTrackFieldsChanges[$sField] === false)
  247. return false;
  248. return $bReturnValues ? $this->_aTrackFieldsChanges[$sField] : true;
  249. }
  250. function initChecker ($aValues = array (), $aSpecificValues = array())
  251. {
  252. $CNF = &$this->_oModule->_oConfig->CNF;
  253. $bValues = $aValues && !empty($aValues['id']);
  254. $this->_iContentId = isset($aValues['id']) ? $aValues['id'] : false;
  255. if (!empty($CNF['FIELD_LOCATION_PREFIX']) && isset($this->aInputs[$CNF['FIELD_LOCATION_PREFIX']]) && isset($aValues[$CNF['FIELD_ID']]) && !empty($CNF['OBJECT_METATAGS']) && ($oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS'])) && $oMetatags->locationsIsEnabled())
  256. $this->aInputs[$CNF['FIELD_LOCATION_PREFIX']]['value'] = $oMetatags->locationsString($aValues[$CNF['FIELD_ID']], false);
  257. if (isset($CNF['FIELD_PHOTO']) && isset($this->aInputs[$CNF['FIELD_PHOTO']])) {
  258. $aContentInfo = false;
  259. if ($aValues && !empty($aValues['id'])) {
  260. $aContentInfo = $this->_oModule->_oDb->getContentInfoById ($aValues['id']);
  261. $this->aInputs[$CNF['FIELD_PHOTO']]['content_id'] = $aValues['id'];
  262. }
  263. $this->aInputs[$CNF['FIELD_PHOTO']]['ghost_template'] = $this->_oModule->_oTemplate->parseHtmlByName($this->_sGhostTemplate, $this->_getPhotoGhostTmplVars($aContentInfo));
  264. }
  265. if (isset($CNF['FIELD_LABELS']) && isset($this->aInputs[$CNF['FIELD_LABELS']]) && !empty($CNF['OBJECT_METATAGS']) && ($oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS'])) && $oMetatags->keywordsIsEnabled() && !empty($aValues['id'])) {
  266. $this->aInputs[$CNF['FIELD_LABELS']]['content_id'] = $aValues['id'];
  267. if(($aLabels = $oMetatags->keywordsGet($aValues['id'])))
  268. $this->aInputs[$CNF['FIELD_LABELS']]['value'] = array_intersect($aLabels, BxDolLabel::getInstance()->getLabels(array('type' => 'values')));
  269. }
  270. if (isset($CNF['FIELD_ANONYMOUS']) && isset($this->aInputs[$CNF['FIELD_ANONYMOUS']]) && isset($CNF['FIELD_AUTHOR']) && isset($aValues[$CNF['FIELD_AUTHOR']])) {
  271. $this->aInputs[$CNF['FIELD_ANONYMOUS']]['checked'] = $aValues[$CNF['FIELD_AUTHOR']] < 0;
  272. }
  273. if (isset($CNF['FIELD_MULTICAT']) && isset($this->aInputs[$CNF['FIELD_MULTICAT']]) && $CNF['PARAM_MULTICAT_ENABLED']) {
  274. if ($bValues)
  275. $this->aInputs[$CNF['FIELD_MULTICAT']]['content_id'] = $aValues['id'];
  276. }
  277. $aPrivacyFields = $this->_getPrivacyFields();
  278. foreach($aPrivacyFields as $sField => $sObject)
  279. $this->_preloadPrivacyField($sField, $sObject, $aValues);
  280. parent::initChecker ($aValues, $aSpecificValues);
  281. }
  282. public function insert ($aValsToAdd = array(), $isIgnore = false)
  283. {
  284. $CNF = &$this->_oModule->_oConfig->CNF;
  285. if (isset($CNF['FIELD_AUTHOR']) && empty($aValsToAdd[$CNF['FIELD_AUTHOR']]))
  286. $aValsToAdd[$CNF['FIELD_AUTHOR']] = (isset($CNF['FIELD_ANONYMOUS']) && isset($this->aInputs[$CNF['FIELD_ANONYMOUS']]) && $this->getCleanValue($CNF['FIELD_ANONYMOUS']) ? -1 : 1) * bx_get_logged_profile_id ();
  287. if (isset($CNF['FIELD_ADDED']) && empty($aValsToAdd[$CNF['FIELD_ADDED']]) && empty($this->getCleanValue($CNF['FIELD_ADDED'])))
  288. $aValsToAdd[$CNF['FIELD_ADDED']] = time();
  289. if (isset($CNF['FIELD_CHANGED']) && empty($aValsToAdd[$CNF['FIELD_CHANGED']]) && empty($this->getCleanValue($CNF['FIELD_CHANGED'])))
  290. $aValsToAdd[$CNF['FIELD_CHANGED']] = time();
  291. if (CHECK_ACTION_RESULT_ALLOWED === $this->_oModule->checkAllowedSetThumb() && isset($CNF['FIELD_THUMB'])) {
  292. $aThumb = isset($_POST[$CNF['FIELD_THUMB']]) ? bx_process_input ($_POST[$CNF['FIELD_THUMB']], BX_DATA_INT) : false;
  293. $aValsToAdd[$CNF['FIELD_THUMB']] = 0;
  294. if (!empty($aThumb) && is_array($aThumb) && ($iFileThumb = array_pop($aThumb)))
  295. $aValsToAdd[$CNF['FIELD_THUMB']] = $iFileThumb;
  296. }
  297. if(!empty($CNF['OBJECT_METATAGS']))
  298. $this->_processMetas($aValsToAdd);
  299. if(isset($CNF['FIELD_STATUS']) && !empty($CNF['FIELDS_DELAYED_PROCESSING']) && !empty($CNF['OBJECT_VIDEOS_TRANSCODERS']['mp4'])) {
  300. $oTranscoder = BxDolTranscoder::getObjectInstance($CNF['OBJECT_VIDEOS_TRANSCODERS']['mp4']);
  301. $aFields = $CNF['FIELDS_DELAYED_PROCESSING'];
  302. if(is_string($aFields))
  303. $aFields = explode(',', $aFields);
  304. foreach($aFields as $sField) {
  305. $mixedFieldValues = $this->getCleanValue($sField);
  306. if(empty($mixedFieldValues))
  307. continue;
  308. $oStorage = BxDolStorage::getObjectInstance($this->aInputs[$sField]['storage_object']);
  309. if(!$oStorage)
  310. continue;
  311. if(!is_array($mixedFieldValues))
  312. $mixedFieldValues = array($mixedFieldValues);
  313. foreach($mixedFieldValues as $mixedFieldValue) {
  314. $aInfo = $oStorage->getFile((int)$mixedFieldValue);
  315. if(empty($aInfo) || !is_array($aInfo))
  316. continue;
  317. if(strncmp($aInfo['mime_type'], 'video/', 6) != 0)
  318. continue;
  319. if($oTranscoder->isFileReady((int)$mixedFieldValue))
  320. continue;
  321. $aValsToAdd[$CNF['FIELD_STATUS']] = 'awaiting';
  322. break 2;
  323. }
  324. }
  325. }
  326. $bMulticatEnabled = $this->_isMulticatEnabled();
  327. if ($bMulticatEnabled)
  328. $this->processMulticatBefore($CNF['FIELD_MULTICAT'], $aValsToAdd);
  329. $iContentId = parent::insert ($aValsToAdd, $isIgnore);
  330. if(!empty($iContentId)){
  331. foreach($this->aInputs as $aInput) {
  332. if ($aInput['type'] == 'nested_form'){
  333. if (is_array($aInput['ghost_template']) && !isset($aInput['ghost_template']['inputs'])) {
  334. foreach ($aInput['ghost_template'] as $oFormNested) {
  335. $iNestedContentId = $oFormNested->insert(array('content_id' => $iContentId));
  336. if ($aInput['rateable']){
  337. BxDolFormQuery::addFormField($this->id, $aInput['name'], $iContentId, $aValsToAdd[$CNF['FIELD_AUTHOR']], $this->_oModule->getName(), $iNestedContentId);
  338. }
  339. }
  340. }
  341. }
  342. }
  343. if ($bMulticatEnabled)
  344. $this->processMulticatAfter($CNF['FIELD_MULTICAT'], $iContentId);
  345. }
  346. foreach($this->aInputs as $aInput) {
  347. if (isset($aInput['rateable']) && $aInput['rateable'] && $aInput['type'] != 'nested_form'){
  348. BxDolFormQuery::addFormField($this->id, $aInput['name'], $iContentId, $aValsToAdd[$CNF['FIELD_AUTHOR']], $this->_oModule->getName());
  349. }
  350. }
  351. return $iContentId;
  352. }
  353. function update ($iContentId, $aValsToAdd = array(), &$aTrackTextFieldsChanges = null)
  354. {
  355. $CNF = &$this->_oModule->_oConfig->CNF;
  356. $aContentInfo = $this->_oModule->_oDb->getContentInfoById($iContentId);
  357. if(isset($CNF['FIELD_AUTHOR']) && isset($CNF['FIELD_ANONYMOUS']) && isset($this->aInputs[$CNF['FIELD_ANONYMOUS']]))
  358. $aValsToAdd[$CNF['FIELD_AUTHOR']] = ($this->getCleanValue($CNF['FIELD_ANONYMOUS']) ? -1 : 1) * abs($aContentInfo[$CNF['FIELD_AUTHOR']]);
  359. if(isset($CNF['FIELD_CHANGED']) && empty($aValsToAdd[$CNF['FIELD_CHANGED']]) && empty($this->getCleanValue($CNF['FIELD_CHANGED'])))
  360. $aValsToAdd[$CNF['FIELD_CHANGED']] = time();
  361. if(CHECK_ACTION_RESULT_ALLOWED === $this->_oModule->checkAllowedSetThumb($iContentId) && isset($CNF['FIELD_THUMB'])) {
  362. $aThumb = bx_process_input (bx_get($CNF['FIELD_THUMB']), BX_DATA_INT);
  363. $aValsToAdd[$CNF['FIELD_THUMB']] = 0;
  364. if (!empty($aThumb) && is_array($aThumb) && ($iFileThumb = array_pop($aThumb)))
  365. $aValsToAdd[$CNF['FIELD_THUMB']] = $iFileThumb;
  366. }
  367. if(!empty($CNF['OBJECT_METATAGS']))
  368. $this->_processMetas($aValsToAdd);
  369. if(isset($CNF['FIELD_STATUS']) && isset($aContentInfo[$CNF['FIELD_STATUS']]) && $aContentInfo[$CNF['FIELD_STATUS']] == 'failed')
  370. $aValsToAdd[$CNF['FIELD_STATUS']] = 'active';
  371. $bMulticatEnabled = $this->_isMulticatEnabled();
  372. if ($bMulticatEnabled)
  373. $this->processMulticatBefore($CNF['FIELD_MULTICAT'], $aValsToAdd);
  374. $mixedResult = parent::update($iContentId, $aValsToAdd, $aTrackTextFieldsChanges);
  375. foreach($this->aInputs as $aInput) {
  376. if ($aInput['type'] == 'nested_form'){
  377. if (is_array($aInput['ghost_template']) && !isset($aInput['ghost_template']['inputs'])) {
  378. foreach ($aInput['ghost_template'] as $oFormNested) {
  379. $iNestedContentId = $oFormNested->aInputs[$aInput['name']]['value'];
  380. if (empty($iNestedContentId)){
  381. $iNestedContentId = $oFormNested->insert(array('content_id' => $iContentId));
  382. if ($aInput['rateable']){
  383. BxDolFormQuery::addFormField($this->id, $aInput['name'], $iContentId, $aContentInfo[$CNF['FIELD_AUTHOR']], $this->_oModule->getName(), $iNestedContentId);
  384. }
  385. }
  386. else{
  387. $oFormNested->update($iNestedContentId, array('content_id' => $iContentId));
  388. }
  389. }
  390. }
  391. }
  392. }
  393. if ($bMulticatEnabled)
  394. $this->processMulticatAfter($CNF['FIELD_MULTICAT'], $iContentId);
  395. foreach($this->aInputs as $aInput) {
  396. if (isset($aInput['rateable']) && $aInput['rateable'] && $aInput['type'] != 'nested_form'){
  397. BxDolFormQuery::addFormField($this->id, $aInput['name'], $iContentId, $aContentInfo[$CNF['FIELD_AUTHOR']], $this->_oModule->getName());
  398. }
  399. }
  400. if($mixedResult !== false)
  401. $this->_processTrackFields($iContentId);
  402. return $mixedResult;
  403. }
  404. protected function _associalFileWithContent($oStorage, $iFileId, $iProfileId, $iContentId, $sPictureField = '')
  405. {
  406. $oStorage->updateGhostsContentId ($iFileId, $iProfileId, $iContentId, $this->_isAdmin($iContentId));
  407. }
  408. protected function _getPhotoGhostTmplVars($aContentInfo = array())
  409. {
  410. $CNF = &$this->_oModule->_oConfig->CNF;
  411. return array (
  412. 'name' => $this->aInputs[$CNF['FIELD_PHOTO']]['name'],
  413. 'content_id' => (int)$this->aInputs[$CNF['FIELD_PHOTO']]['content_id'],
  414. 'editor_id' => isset($CNF['FIELD_TEXT_ID']) ? $CNF['FIELD_TEXT_ID'] : '',
  415. 'thumb_id' => isset($CNF['FIELD_THUMB']) && isset($aContentInfo[$CNF['FIELD_THUMB']]) ? $aContentInfo[$CNF['FIELD_THUMB']] : 0,
  416. 'name_thumb' => isset($CNF['FIELD_THUMB']) ? $CNF['FIELD_THUMB'] : '',
  417. 'bx_if:set_thumb' => array (
  418. 'condition' => CHECK_ACTION_RESULT_ALLOWED === $this->_oModule->checkAllowedSetThumb($this->aInputs[$CNF['FIELD_PHOTO']]['content_id']),
  419. 'content' => array (
  420. 'name_thumb' => isset($CNF['FIELD_THUMB']) ? $CNF['FIELD_THUMB'] : '',
  421. 'txt_pict_use_as_thumb' => _t(!empty($CNF['T']['txt_pict_use_as_thumb']) ? $CNF['T']['txt_pict_use_as_thumb'] : '_sys_txt_form_entry_input_picture_use_as_thumb')
  422. ),
  423. ),
  424. );
  425. }
  426. function delete ($iContentId, $aContentInfo = array())
  427. {
  428. $CNF = &$this->_oModule->_oConfig->CNF;
  429. // delete associated files
  430. $a = array('OBJECT_STORAGE', 'OBJECT_STORAGE_FILES', 'OBJECT_STORAGE_PHOTOS', 'OBJECT_STORAGE_VIDEOS', 'OBJECT_STORAGE_SOUNDS');
  431. foreach ($a as $k) {
  432. if (!empty($CNF[$k])) {
  433. $oStorage = BxDolStorage::getObjectInstance($CNF[$k]);
  434. if ($oStorage)
  435. $oStorage->queueFilesForDeletionFromGhosts($aContentInfo[$CNF['FIELD_AUTHOR']], $iContentId);
  436. }
  437. }
  438. // delete associated objects data
  439. if (!empty($CNF['OBJECT_VIEWS'])) {
  440. $o = BxDolView::getObjectInstance($CNF['OBJECT_VIEWS'], $iContentId);
  441. if ($o) $o->onObjectDelete();
  442. }
  443. if (!empty($CNF['OBJECT_VOTES'])) {
  444. $o = BxDolVote::getObjectInstance($CNF['OBJECT_VOTES'], $iContentId);
  445. if ($o) $o->onObjectDelete();
  446. }
  447. if (!empty($CNF['OBJECT_SCORES'])) {
  448. $o = BxDolScore::getObjectInstance($CNF['OBJECT_SCORES'], $iContentId);
  449. if ($o) $o->onObjectDelete();
  450. }
  451. if (!empty($CNF['OBJECT_COMMENTS'])) {
  452. $o = BxDolCmts::getObjectInstance($CNF['OBJECT_COMMENTS'], $iContentId);
  453. if ($o) $o->onObjectDelete();
  454. }
  455. if (!empty($CNF['OBJECT_METATAGS'])) {
  456. $o = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS']);
  457. if ($o) $o->onDeleteContent($iContentId);
  458. }
  459. // delete db record
  460. BxDolFormQuery::removeFormField($this->id, $iContentId);
  461. return parent::delete($iContentId);
  462. }
  463. protected function _isAdmin ($iContentId = 0)
  464. {
  465. return $this->_oModule->_isModerator();
  466. }
  467. public function processFiles ($sFieldFile, $iContentId = 0, $isAssociateWithContent = false)
  468. {
  469. $CNF = &$this->_oModule->_oConfig->CNF;
  470. if (!isset($this->aInputs[$sFieldFile]))
  471. return true;
  472. $mixedFileIds = $this->getCleanValue($sFieldFile);
  473. if(!$mixedFileIds)
  474. return true;
  475. $oStorage = BxDolStorage::getObjectInstance($this->aInputs[$sFieldFile]['storage_object']);
  476. if (!$oStorage)
  477. return false;
  478. $iProfileId = $this->getContentOwnerProfileId($iContentId);
  479. $aGhostFiles = $oStorage->getGhosts ($iProfileId, $isAssociateWithContent ? 0 : $iContentId, true, $this->_isAdmin($iContentId));
  480. if (!$aGhostFiles)
  481. return true;
  482. foreach ($aGhostFiles as $aFile) {
  483. if (is_array($mixedFileIds) && !in_array($aFile['id'], $mixedFileIds))
  484. continue;
  485. if ($aFile['private'])
  486. $oStorage->setFilePrivate ($aFile['id'], 1);
  487. if ($iContentId)
  488. $this->_associalFileWithContent($oStorage, $aFile['id'], $iProfileId, $iContentId, $sFieldFile);
  489. }
  490. return true;
  491. }
  492. function _deleteFile ($iFileId, $sStorage = '')
  493. {
  494. $CNF = &$this->_oModule->_oConfig->CNF;
  495. if (!$iFileId)
  496. return true;
  497. $sStorage = !empty($sStorage) ? $sStorage : $CNF['OBJECT_STORAGE'];
  498. $oStorage = BxDolStorage::getObjectInstance($sStorage);
  499. if (!$oStorage)
  500. return false;
  501. if (!$oStorage->getFile($iFileId))
  502. return true;
  503. $iProfileId = bx_get_logged_profile_id();
  504. return $oStorage->deleteFile($iFileId, $iProfileId);
  505. }
  506. function addCssJs ()
  507. {
  508. if ((!isset($this->aParams['view_mode']) || !$this->aParams['view_mode']) && !self::$_isCssJsGeneralModuleAdded) {
  509. $this->_oModule->_oTemplate->addCss('forms.css');
  510. $this->_oModule->_oTemplate->addJs('modules/base/general/js/|forms.js');
  511. self::$_isCssJsGeneralModuleAdded = true;
  512. }
  513. return parent::addCssJs ();
  514. }
  515. function genViewRowValue(&$aInput)
  516. {
  517. $s = parent::genViewRowValue($aInput);
  518. if ($this->_oMetatagsObject && in_array($aInput['name'], $this->_aMetatagsFieldsWithKeywords) && $s)
  519. $s = $this->_oMetatagsObject->metaParse($this->_oMetatagsContentId, $s);
  520. return $s;
  521. }
  522. function genViewRowWrapped(&$aInput)
  523. {
  524. $sResult = parent::genViewRowWrapped($aInput);
  525. if (!$aInput['rateable']){
  526. return $sResult;
  527. }
  528. $sValue = $this->genViewRowValue($aInput);
  529. if (null === $sValue)
  530. return '';
  531. // process rateable fields
  532. $iId = BxDolFormQuery::getFormField($this->id, $aInput['name'], $this->_iContentId);
  533. $sVote = '';
  534. $oVote = BxDolVote::getObjectInstance($aInput['rateable'], $iId, true, BxDolTemplate::getInstance());
  535. if ($oVote){
  536. $sVote = $oVote->getCounter(array('show_counter_empty' => true, 'show_counter' => true, 'show_counter_style' => 'simple', 'dynamic_mode' => $this->_bDynamicMode));
  537. $sVoteBtn = $oVote->getElementInline(array('show_counter_empty' => true, 'show_counter' => false, 'show_counter_style' => 'simple', 'dynamic_mode' => $this->_bDynamicMode));
  538. return $this->oTemplate->parseHtmlByName('form_view_rateable_row.html', array(
  539. 'value' => $sResult,
  540. 'rate' => $sVote,
  541. 'rate_btn' => $sVoteBtn
  542. ));
  543. }
  544. return $sResult;
  545. }
  546. function setMetatagsKeywordsData($iId, $a, $o)
  547. {
  548. $this->_oMetatagsContentId = $iId;
  549. $this->_aMetatagsFieldsWithKeywords = $a;
  550. $this->_oMetatagsObject = $o;
  551. }
  552. function getContentOwnerProfileId ($iContentId)
  553. {
  554. return $this->_oModule->serviceGetContentOwnerProfileId($iContentId);
  555. }
  556. protected function _processTrackFields($mixedContent)
  557. {
  558. if(empty($mixedContent) || empty($this->_aTrackFieldsChanges))
  559. return;
  560. if(!is_array($mixedContent)) {
  561. $mixedContent = $this->_oModule->_oDb->getContentInfoById((int)$mixedContent);
  562. if(empty($mixedContent) || !is_array($mixedContent))
  563. return;
  564. }
  565. foreach($this->_aTrackFieldsChanges as $sField => $aValues)
  566. if($mixedContent[$sField] == $aValues['old'])
  567. $this->_aTrackFieldsChanges[$sField] = false;
  568. else
  569. $this->_aTrackFieldsChanges[$sField]['new'] = $mixedContent[$sField];
  570. }
  571. protected function _processMetas(&$aValsToAdd)
  572. {
  573. $CNF = &$this->_oModule->_oConfig->CNF;
  574. $sKey = 'FIELD_LABELS';
  575. if(isset($CNF[$sKey]) && isset($this->aInputs[$CNF[$sKey]]) && empty($aValsToAdd[$CNF[$sKey]])) {
  576. $aLabels = $this->getCleanValue($CNF[$sKey]);
  577. if(!empty($aLabels) && is_array($aLabels))
  578. $aValsToAdd[$CNF[$sKey]] = serialize($aLabels);
  579. else
  580. $aValsToAdd[$CNF[$sKey]] = '';
  581. }
  582. $sKey1 = 'FIELD_LOCATION';
  583. $sKey2 = 'FIELD_LOCATION_PREFIX';
  584. if(isset($CNF[$sKey1]) && isset($CNF[$sKey2]) && isset($this->aInputs[$CNF[$sKey1]]) && empty($aValsToAdd[$CNF[$sKey1]])) {
  585. $aLocation = BxDolMetatags::locationsRetrieveFromForm($CNF[$sKey2], $this);
  586. if(!empty($aLocation) && is_array($aLocation))
  587. $aValsToAdd[$CNF[$sKey1]] = serialize(BxDolMetatags::locationsParseComponents($aLocation));
  588. }
  589. }
  590. protected function _getPrivacyFields($aKeysF2O = array())
  591. {
  592. $CNF = &$this->_oModule->_oConfig->CNF;
  593. if(isset($CNF['PRIVACY_FIELD_TO_OBJECT']) && is_array($CNF['PRIVACY_FIELD_TO_OBJECT']))
  594. return $CNF['PRIVACY_FIELD_TO_OBJECT'];
  595. if(empty($aKeysF2O))
  596. $aKeysF2O = array('FIELD_ALLOW_VIEW_TO' => 'OBJECT_PRIVACY_VIEW');
  597. $aResult = array();
  598. foreach($aKeysF2O as $sKeyField => $sKeyObject) {
  599. if(!isset($CNF[$sKeyField]) || !isset($this->aInputs[$CNF[$sKeyField]]) || !isset($CNF[$sKeyObject]))
  600. continue;
  601. $aResult[$CNF[$sKeyField]] = $CNF[$sKeyObject];
  602. }
  603. return $aResult;
  604. }
  605. function _addCssJsPrivacyField($sField, $sPrivacyObject, $bDynamicMode = false)
  606. {
  607. $oPrivacy = BxDolPrivacy::getObjectInstance($sPrivacyObject);
  608. if(!$oPrivacy)
  609. return;
  610. $this->aInputs[$sField]['content'] = $oPrivacy->addCssJs($bDynamicMode) . $this->aInputs[$sField]['content'];
  611. }
  612. protected function _preparePrivacyField($sField, $sPrivacyObject)
  613. {
  614. $oPrivacy = BxDolPrivacy::getObjectInstance($sPrivacyObject);
  615. if(!$oPrivacy)
  616. return;
  617. $aSave = array('db' => array('pass' => 'Xss'));
  618. array_walk($this->aInputs[$sField], function ($a, $k, $aSave) {
  619. if (in_array($k, array('info', 'caption', 'value')))
  620. $aSave[0][$k] = $a;
  621. }, array(&$aSave));
  622. $aGroupChooser = $oPrivacy->getGroupChooser($sPrivacyObject, 0, array(
  623. 'object' => $this->aParams['object'],
  624. 'display' => $this->aParams['display']
  625. ));
  626. $this->aInputs[$sField] = array_merge($this->aInputs[$sField], $aGroupChooser, $aSave);
  627. }
  628. protected function _preloadPrivacyField($sField, $sPrivacyObject, $aValues)
  629. {
  630. $CNF = &$this->_oModule->_oConfig->CNF;
  631. $oPrivacy = BxDolPrivacy::getObjectInstance($sPrivacyObject);
  632. if(!$oPrivacy)
  633. return;
  634. $iContentId = !empty($aValues[$CNF['FIELD_ID']]) ? (int)$aValues[$CNF['FIELD_ID']] : 0;
  635. $iProfileId = !empty($iContentId) ? (int)$this->getContentOwnerProfileId($iContentId) : bx_get_logged_profile_id();
  636. $iGroupId = !empty($aValues[$sField]) ? $aValues[$sField] : 0;
  637. if(!isset($this->aInputs[$sField]['content']))
  638. $this->aInputs[$sField]['content'] = '';
  639. $this->aInputs[$sField]['content'] .= $oPrivacy->initGroupChooser($sPrivacyObject, $iProfileId, array(
  640. 'content_id' => $iContentId,
  641. 'group_id' => $iGroupId,
  642. 'html_ids' => array(
  643. 'form' => $this->getId()
  644. )
  645. ));
  646. }
  647. /**
  648. *
  649. * MultiCategories related methods.
  650. *
  651. */
  652. protected function processMulticatBefore($sFieldName, &$aValsToAdd){
  653. if (isset($this->aInputs[$sFieldName])){
  654. $this->aInputs[$sFieldName]['value'] = array_unique(array_filter($this->aInputs[$sFieldName]['value'], function($sTmp){
  655. return trim($sTmp);
  656. }));
  657. $aValsToAdd[$sFieldName] = implode(',', $this->aInputs[$sFieldName]['value']);
  658. }
  659. }
  660. protected function processMulticatAfter($sFieldName, $iContentId){
  661. $CNF = &$this->_oModule->_oConfig->CNF;
  662. $bAutoActivation = (isset($CNF['PARAM_MULTICAT_AUTO_ACTIVATION_FOR_CATEGORIES']) && getParam($CNF['PARAM_MULTICAT_AUTO_ACTIVATION_FOR_CATEGORIES']) == 'on') ? true : false;
  663. $oCategories = BxDolCategories::getInstance();
  664. if (isset($this->aInputs[$sFieldName])){
  665. $oCategories->delete($this->_oModule->getName(), $iContentId);
  666. foreach($this->aInputs[$sFieldName]['value'] as $sValue) {
  667. $oCategories->add($this->_oModule->getName(), bx_get_logged_profile_id(), $sValue, $iContentId, $bAutoActivation);
  668. }
  669. }
  670. }
  671. protected function genCustomViewRowValueMulticat(&$aInput)
  672. {
  673. $oCategories = BxDolCategories::getInstance();
  674. $aValues = $oCategories->getData(array('type' => 'by_module_and_object', 'module' => $this->_oModule->getName(), 'object_id' => (!empty($aInput['content_id']) ? (int)$aInput['content_id'] : 0 )));
  675. if (count($aValues) > 0){
  676. $aVars = array('bx_repeat:cats' => array());
  677. foreach ($aValues as $sValue) {
  678. $aVars['bx_repeat:cats'][] = array(
  679. 'url' => $oCategories->getUrl($this->_oModule->getName(), $sValue),
  680. 'name' => _t($sValue),
  681. 'bx_if:more' => array(
  682. 'condition' => $sValue === end($aValues) ? false : true,
  683. 'content' => array('1')
  684. ),
  685. );
  686. }
  687. if (!$aVars['bx_repeat:cats'])
  688. return '';
  689. return $this->_oModule->_oTemplate->parseHtmlByName('category_list_inline.html', $aVars);
  690. }
  691. return '';
  692. }
  693. protected function genCustomInputMulticat(&$aInput)
  694. {
  695. $sJsObject = $this->_oModule->_oConfig->getJsObject('categories');
  696. $aValuesForSelect = BxDolCategories::getInstance()->getData(array('type' => 'by_module_and_author', 'module' => $this->_oModule->getName(), 'author' => bx_get_logged_profile_id()));
  697. $aSelectedItems = array();
  698. if (isset($aInput['value']) && is_array($aInput['value']))
  699. $aInput['value'] = array_filter($aInput['value']);
  700. if(!empty($aInput['value'])) {
  701. if (!is_array($aInput['value']))
  702. $aValues = BxDolCategories::getInstance()->getData(array('type' => 'by_module_and_object', 'module' => $this->_oModule->getName(), 'object_id' => (!empty($aInput['content_id']) ? (int)$aInput['content_id'] : 0 )));
  703. else
  704. $aValues = $aInput['value'];
  705. $aValues = array_filter($aValues);
  706. foreach($aValues as $sValue) {
  707. if (!array_key_exists($sValue, $aValuesForSelect)){
  708. $aValuesForSelect[$sValue] = array('key' => $sValue, 'value' => $sValue);
  709. }
  710. }
  711. foreach($aValues as $sValue) {
  712. $sInput = $this->genCustomInputMulticatSelect($aInput, $aValuesForSelect, $sValue);
  713. $aSelectedItems[] = array('js_object' => $sJsObject, 'select_cat' => $sInput);
  714. }
  715. }
  716. else{
  717. $aSelectedItems = array(
  718. array('js_object' => $sJsObject, 'select_cat' => $this->genCustomInputMulticatSelect($aInput, $aValuesForSelect))
  719. );
  720. }
  721. return $this->_oModule->_oTemplate->parseHtmlByName('form_categories.html', array(
  722. 'bx_repeat:items' => $aSelectedItems,
  723. 'js_object' => $sJsObject,
  724. 'select_cat' => $this->genCustomInputMulticatSelect($aInput, $aValuesForSelect, -1),
  725. 'input_cat' => $this->genCustomInputMulticatInput($aInput),
  726. 'js_object' => $sJsObject,
  727. 'btn_add' => $this->genCustomInputMulticatButton($aInput),
  728. 'btn_add_new' => $this->genCustomInputMulticatButtonNew($aInput)
  729. ));
  730. }
  731. protected function genCustomInputMulticatSelect($aInput, $aValues, $mixedValue = '')
  732. {
  733. foreach($aValues as $sKey => $aValue) {
  734. $aValues[$sKey]['value'] = _t($aValue['key']);
  735. }
  736. $aValues = array_merge(array('1' => array('key' => false, 'value' => _t('_sys_please_select'))), $aValues);
  737. $aInput['type'] = 'select';
  738. $aInput['name'] .= '[]';
  739. $aInput['value'] = $mixedValue;
  740. $aInput['values'] = $aValues;
  741. return $this->genInput($aInput);
  742. }
  743. protected function genCustomInputMulticatInput($aInput)
  744. {
  745. $aInput['type'] = 'text';
  746. $aInput['name'] .= '[]';
  747. $aInput['value'] = '';
  748. return $this->genInput($aInput);
  749. }
  750. protected function genCustomInputMulticatButton($aInput)
  751. {
  752. $sName = $aInput['name'];
  753. $aInput['type'] = 'button';
  754. $aInput['name'] .= '_add';
  755. $aInput['value'] = _t('_sys_txt_categories_button_caption_add');
  756. $aInput['attrs']['class'] = 'bx-def-margin-right bx-def-margin-sec-top';
  757. $aInput['attrs']['onclick'] = $this->_oModule->_oConfig->getJsObject('categories') . ".categoryAdd(this, '" . $sName . "');";
  758. return $this->genInputButton($aInput);
  759. }
  760. protected function genCustomInputMulticatButtonNew($aInput)
  761. {
  762. $sName = $aInput['name'];
  763. $aInput['type'] = 'button';
  764. $aInput['name'] .= '_add';
  765. $aInput['value'] = _t('_sys_txt_categories_button_caption_addnew');
  766. $aInput['attrs']['class'] = 'bx-def-margin-sec-top';
  767. $aInput['attrs']['onclick'] = $this->_oModule->_oConfig->getJsObject('categories') . ".categoryAddNew(this, '" . $sName . "');";
  768. return $this->genInputButton($aInput);
  769. }
  770. protected function _isMulticatEnabled(){
  771. $CNF = $this->_oModule->_oConfig->CNF;
  772. return isset($CNF['PARAM_MULTICAT_ENABLED']) && $CNF['PARAM_MULTICAT_ENABLED'] === true && isset($CNF['FIELD_MULTICAT']);
  773. }
  774. }
  775. /** @} */