BxJobsMenuSnippetMeta.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 Jobs Jobs
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxJobsMenuSnippetMeta extends BxBaseModGroupsMenuSnippetMeta
  12. {
  13. public function __construct($aObject, $oTemplate = false)
  14. {
  15. $this->_sModule = 'bx_jobs';
  16. parent::__construct($aObject, $oTemplate);
  17. unset($this->_aConnectionToFunctionCheck['sys_profiles_friends']);
  18. }
  19. protected function _getMenuItemDateStart($aItem)
  20. {
  21. $CNF = &$this->_oModule->_oConfig->CNF;
  22. if ($this->_aContentInfo[$CNF['FIELD_DATE_START']])
  23. return $this->getUnitMetaItemText(bx_time_js($this->_aContentInfo[$CNF['FIELD_DATE_START']], BX_FORMAT_DATE_TIME, true));
  24. else
  25. return false;
  26. }
  27. protected function _getMenuItemDateEnd($aItem)
  28. {
  29. $CNF = &$this->_oModule->_oConfig->CNF;
  30. if ($this->_aContentInfo[$CNF['FIELD_DATE_END']])
  31. return $this->getUnitMetaItemText(bx_time_js($this->_aContentInfo[$CNF['FIELD_DATE_END']], BX_FORMAT_DATE_TIME, true));
  32. else
  33. return false;
  34. }
  35. protected function _getMenuItemBudget($aItem)
  36. {
  37. $CNF = &$this->_oModule->_oConfig->CNF;
  38. $sCurrencySign = BxDolPayments::getInstance()->getCurrencySign((int)$this->_aContentInfo[$CNF['FIELD_AUTHOR']]);
  39. $sResult = '';
  40. if(($sKey = $CNF['FIELD_PAY_TOTAL']) && !empty($this->_aContentInfo[$sKey]))
  41. $sResult .= _t('_bx_jobs_menu_item_title_sm_budget_total', _t_format_currency_ext((float)$this->_aContentInfo[$sKey], [
  42. 'sign' => $sCurrencySign
  43. ]));
  44. if(($sKey = $CNF['FIELD_PAY_HOURLY']) && !empty($this->_aContentInfo[$sKey]))
  45. $sResult .= ($sResult ? ', ' : '') . _t('_bx_jobs_menu_item_title_sm_budget_hourly', _t_format_currency_ext((float)$this->_aContentInfo[$sKey], [
  46. 'sign' => $sCurrencySign
  47. ]));
  48. if(!$sResult)
  49. $sResult = _t('_bx_jobs_menu_item_title_sm_budget_open');
  50. return $this->getUnitMetaItemText($sResult);
  51. }
  52. }
  53. /** @} */