BxBaseStudioFunctions.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 UnaView UNA Studio Representation classes
  7. * @ingroup UnaStudio
  8. * @{
  9. */
  10. class BxBaseStudioFunctions extends BxBaseFunctions implements iBxDolSingleton
  11. {
  12. function __construct($oTemplate = false)
  13. {
  14. if (isset($GLOBALS['bxDolClasses'][get_class($this)]))
  15. trigger_error ('Multiple instances are not allowed for the class: ' . get_class($this), E_USER_ERROR);
  16. parent::__construct($oTemplate ? $oTemplate : BxDolStudioTemplate::getInstance());
  17. }
  18. public static function getInstance()
  19. {
  20. if (!isset($GLOBALS['bxDolClasses']['BxBaseStudioFunctions']))
  21. $GLOBALS['bxDolClasses']['BxBaseStudioFunctions'] = new BxTemplStudioFunctions();
  22. return $GLOBALS['bxDolClasses']['BxBaseStudioFunctions'];
  23. }
  24. function getLoginForm()
  25. {
  26. $oTemplate = BxDolStudioTemplate::getInstance();
  27. $sUrlRelocate = bx_get('relocate');
  28. if (empty($sUrlRelocate) || basename($sUrlRelocate) == 'index.php')
  29. $sUrlRelocate = '';
  30. $sHtml = $oTemplate->parseHtmlByName('login_form.html', array (
  31. 'role' => BX_DOL_ROLE_ADMIN,
  32. 'csrf_token' => BxDolForm::genCsrfToken(true),
  33. 'relocate_url' => bx_html_attribute($sUrlRelocate),
  34. 'action_url' => BX_DOL_URL_ROOT . 'member.php',
  35. 'forgot_password_url' => BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=forgot-password'),
  36. ));
  37. $sHtml = $oTemplate->parseHtmlByName('login.html', array (
  38. 'form' => $this->transBox('bx-std-login-form-box', $sHtml, true),
  39. ));
  40. $oTemplate->setPageNameIndex(BX_PAGE_CLEAR);
  41. $oTemplate->setPageParams(array(
  42. 'css_name' => array('forms.css', 'login.css'),
  43. 'js_name' => array('jquery-ui/jquery.ui.position.min.js', 'jquery.form.min.js', 'jquery.dolPopup.js', 'login.js'),
  44. 'header' => _t('_adm_page_cpt_login'),
  45. ));
  46. $oTemplate->setPageContent ('page_main_code', $sHtml);
  47. $oTemplate->getPageCode();
  48. }
  49. protected function getInjFooterPopupMenus()
  50. {
  51. return '';
  52. }
  53. }
  54. /** @} */