1
0

BxDevFunctions.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <? defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
  4. * CC-BY License - http://creativecommons.org/licenses/by/3.0/
  5. *
  6. * @defgroup Developer Developer
  7. * @ingroup DolphinModules
  8. *
  9. * @{
  10. */
  11. bx_import('BxDolStudioUtils');
  12. class BxDevFunctions {
  13. function __construct() {}
  14. /*
  15. * Is needed to change fields in "Form's Field" creation form.
  16. *
  17. * @see BxDevFormsField
  18. */
  19. public static function changeFormField($aParams, &$aInputs, &$oDb) {
  20. $aInputs['module']['type'] = 'select';
  21. $aInputs['module']['values'] = array_merge(array('' => _t('_bx_dev_frm_txt_select_module')), BxDolStudioUtils::getModules());
  22. $aInputs['module']['value'] = $aParams['module'];
  23. $aForms = array();
  24. $oDb->getForms(array('type' => 'by_module', 'value' => $aParams['module']), $aForms, false);
  25. foreach($aForms as $aForm)
  26. $aInputs['object']['values'][$aForm['object']] = _t($aForm['title']);
  27. asort($aInputs['object']['values']);
  28. $aInputs['object']['type'] = 'select';
  29. $aInputs['object']['values'] = array_merge(array('' => _t('_bx_dev_frm_txt_select_object')), $aInputs['object']['values']);
  30. $aInputs['object']['value'] = $aParams['object'];
  31. }
  32. public static function serializeString($sValue) {
  33. if(empty($sValue))
  34. return '';
  35. $aValue = array();
  36. @eval("\$aValue = " . $sValue . ";");
  37. if(empty($aValue) || !is_array($aValue))
  38. return '';
  39. return serialize($aValue);
  40. }
  41. public static function unserializeString($sValue) {
  42. if(empty($sValue))
  43. return '';
  44. $aValue = @unserialize($sValue);
  45. if(empty($aValue) || !is_array($aValue))
  46. return '';
  47. return var_export($aValue, true);
  48. }
  49. }
  50. /** @} */