BxBaseStudioPermissionsLevels.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  1. <?php 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 DolphinView Dolphin Studio Representation classes
  7. * @ingroup DolphinStudio
  8. * @{
  9. */
  10. bx_import('BxDolStudioPermissionsLevels');
  11. bx_import('BxTemplStudioFormView');
  12. class BxBaseStudioPermissionsLevels extends BxDolStudioPermissionsLevels
  13. {
  14. public static $iBinMB = 1048576;
  15. protected $sUrlPage;
  16. function __construct($aOptions, $oTemplate = false)
  17. {
  18. parent::__construct($aOptions, $oTemplate);
  19. $this->_aOptions['actions_single']['edit']['attr']['title'] = _t('_adm_prm_btn_level_edit');
  20. $this->_aOptions['actions_single']['delete']['attr']['title'] = _t('_adm_prm_btn_level_delete');
  21. $this->sUrlPage = BX_DOL_URL_STUDIO . 'builder_permissions.php?page=levels';
  22. }
  23. public function performActionAdd()
  24. {
  25. $sAction = 'add';
  26. $oForm = $this->_getFormObject($sAction);
  27. $oForm->initChecker();
  28. if($oForm->isSubmittedAndValid()) {
  29. if(($iId = $this->_getAvailableId()) === false) {
  30. $this->_echoResultJson(array('msg' => _t('_adm_prm_err_level_id')), true);
  31. return;
  32. }
  33. $mixedIcon = '';
  34. if(!empty($_FILES['Icon_image']['tmp_name'])) {
  35. bx_import('BxDolStorage');
  36. $oStorage = BxDolStorage::getObjectInstance(BX_DOL_STORAGE_OBJ_IMAGES);
  37. $mixedIcon = $oStorage->storeFileFromForm($_FILES['Icon_image'], false, 0);
  38. if($mixedIcon === false) {
  39. $this->_echoResultJson(array('msg' => _t('_adm_prm_err_level_icon_image') . $oStorage->getErrorString()), true);
  40. return;
  41. }
  42. $oStorage->afterUploadCleanup($mixedIcon, 0);
  43. }
  44. if(empty($mixedIcon))
  45. $mixedIcon = $oForm->getCleanValue('Icon');
  46. if(empty($mixedIcon))
  47. $mixedIcon = 'acl-unconfirmed.png';
  48. BxDolForm::setSubmittedValue('Icon', $mixedIcon, $oForm->aFormAttrs['method']);
  49. $fQuotaSize = round($oForm->getCleanValue('QuotaSize'), 1);
  50. BxDolForm::setSubmittedValue('QuotaSize', self::$iBinMB * $fQuotaSize, $oForm->aFormAttrs['method']);
  51. $fQuotaMaxFileSize = round($oForm->getCleanValue('QuotaMaxFileSize'), 1);
  52. BxDolForm::setSubmittedValue('QuotaMaxFileSize', self::$iBinMB * $fQuotaMaxFileSize, $oForm->aFormAttrs['method']);
  53. $iId = (int)$oForm->insert(array('ID' => $iId, 'Icon' => $mixedIcon, 'Order' => $this->oDb->getLevelOrderMax() + 1));
  54. if($iId != 0)
  55. $aRes = array('grid' => $this->getCode(false), 'blink' => $iId);
  56. else
  57. $aRes = array('msg' => _t('_adm_prm_err_level_create'));
  58. $this->_echoResultJson($aRes, true);
  59. } else {
  60. bx_import('BxTemplStudioFunctions');
  61. $sContent = BxTemplStudioFunctions::getInstance()->popupBox('adm-prm-level-create-popup', _t('_adm_prm_txt_level_create_popup'), $this->_oTemplate->parseHtmlByName('prm_add_level.html', array(
  62. 'form_id' => $oForm->aFormAttrs['id'],
  63. 'form' => $oForm->getCode(true),
  64. 'object' => $this->_sObject,
  65. 'action' => $sAction
  66. )));
  67. $this->_echoResultJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))), true);
  68. }
  69. }
  70. public function performActionEdit()
  71. {
  72. $sAction = 'edit';
  73. $aIds = bx_get('ids');
  74. if(!$aIds || !is_array($aIds)) {
  75. $iId = (int)bx_get('id');
  76. if(!$iId) {
  77. $this->_echoResultJson(array());
  78. exit;
  79. }
  80. $aIds = array($iId);
  81. }
  82. $iId = $aIds[0];
  83. $aLevel = array();
  84. $iLevel = $this->oDb->getLevels(array('type' => 'by_id', 'value' => $iId), $aLevel);
  85. if($iLevel != 1 || empty($aLevel)){
  86. $this->_echoResultJson(array());
  87. exit;
  88. }
  89. $oForm = $this->_getFormObject($sAction, $aLevel);
  90. $oForm->initChecker();
  91. if($oForm->isSubmittedAndValid()) {
  92. $bIconImageCur = is_numeric($aLevel['icon']) && (int)$aLevel['icon'] != 0;
  93. $bIconImageNew = !empty($_FILES['Icon_image']['tmp_name']);
  94. $sIconFont = $oForm->getCleanValue('Icon');
  95. $bIconFont = !empty($sIconFont);
  96. if($bIconImageCur && ($bIconImageNew || $bIconFont)) {
  97. bx_import('BxDolStorage');
  98. $oStorage = BxDolStorage::getObjectInstance(BX_DOL_STORAGE_OBJ_IMAGES);
  99. if(!$oStorage->deleteFile((int)$aLevel['icon'], 0)) {
  100. $this->_echoResultJson(array('msg' => _t('_adm_prm_err_level_icon_image_remove')), true);
  101. return;
  102. }
  103. }
  104. $sIcon = $sIconFont;
  105. if($bIconImageNew) {
  106. bx_import('BxDolStorage');
  107. $oStorage = BxDolStorage::getObjectInstance(BX_DOL_STORAGE_OBJ_IMAGES);
  108. $sIcon = $oStorage->storeFileFromForm($_FILES['Icon_image'], false, 0);
  109. if($sIcon === false) {
  110. $this->_echoResultJson(array('msg' => _t('_adm_prm_err_level_icon_image') . $oStorage->getErrorString()), true);
  111. return;
  112. }
  113. $oStorage->afterUploadCleanup($sIcon, 0);
  114. } else if($bIconImageCur && !$bIconFont)
  115. $sIcon = $aLevel['icon'];
  116. BxDolForm::setSubmittedValue('Icon', $sIcon, $oForm->aFormAttrs['method']);
  117. $fQuotaSize = round($oForm->getCleanValue('QuotaSize'), 1);
  118. BxDolForm::setSubmittedValue('QuotaSize', self::$iBinMB * $fQuotaSize, $oForm->aFormAttrs['method']);
  119. $fQuotaMaxFileSize = round($oForm->getCleanValue('QuotaMaxFileSize'), 1);
  120. BxDolForm::setSubmittedValue('QuotaMaxFileSize', self::$iBinMB * $fQuotaMaxFileSize, $oForm->aFormAttrs['method']);
  121. if($oForm->update($iId) !== false)
  122. $aRes = array('grid' => $this->getCode(false), 'blink' => $iId);
  123. else
  124. $aRes = array('msg' => _t('_adm_prm_err_level_edit'));
  125. $this->_echoResultJson($aRes, true);
  126. } else {
  127. bx_import('BxTemplStudioFunctions');
  128. $sContent = BxTemplStudioFunctions::getInstance()->popupBox('adm-prm-level-edit-popup', _t('_adm_prm_txt_level_edit_popup', _t($aLevel['name'])), $this->_oTemplate->parseHtmlByName('prm_add_level.html', array(
  129. 'form_id' => $oForm->aFormAttrs['id'],
  130. 'form' => $oForm->getCode(true),
  131. 'object' => $this->_sObject,
  132. 'action' => $sAction
  133. )));
  134. $this->_echoResultJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))), true);
  135. }
  136. }
  137. public function performActionDelete()
  138. {
  139. $iAffected = 0;
  140. $aIds = bx_get('ids');
  141. if(!$aIds || !is_array($aIds)) {
  142. $this->_echoResultJson(array());
  143. exit;
  144. }
  145. $aIdsAffected = array ();
  146. foreach($aIds as $iId) {
  147. if(!$this->delete($iId))
  148. continue;
  149. $aIdsAffected[] = $iId;
  150. $iAffected++;
  151. }
  152. $this->_echoResultJson($iAffected ? array('grid' => $this->getCode(false), 'blink' => $aIdsAffected) : array('msg' => _t('_adm_prm_err_level_delete')));
  153. }
  154. public function performActionDeleteIcon()
  155. {
  156. $sAction = 'delete_icon';
  157. $aIds = bx_get('ids');
  158. if(empty($aIds[0])) {
  159. $this->_echoResultJson(array());
  160. exit;
  161. }
  162. $iId = (int)$aIds[0];
  163. $aLevel = array();
  164. $iLevel = $this->oDb->getLevels(array('type' => 'by_id', 'value' => $iId), $aLevel);
  165. if($iLevel != 1 || empty($aLevel)){
  166. $this->_echoResultJson(array());
  167. exit;
  168. }
  169. if(is_numeric($aLevel['icon']) && (int)$aLevel['icon'] != 0) {
  170. bx_import('BxDolStorage');
  171. if(!BxDolStorage::getObjectInstance(BX_DOL_STORAGE_OBJ_IMAGES)->deleteFile((int)$aLevel['icon'], 0)) {
  172. $this->_echoResultJson(array());
  173. exit;
  174. }
  175. }
  176. if($this->oDb->updateLevels($aLevel['id'], array('icon' => '')) !== false)
  177. $this->_echoResultJson(array('grid' => $this->getCode(false), 'blink' => $iId, 'preview' => $this->_getIconPreview($aLevel['id']), 'eval' => $this->getJsObject() . ".onDeleteIcon(oData)"), true);
  178. }
  179. public function getJsObject()
  180. {
  181. return 'oBxDolStudioPermissionsLevels';
  182. }
  183. public function getCode($isDisplayHeader = true)
  184. {
  185. return $this->_oTemplate->parseHtmlByName('prm_levels.html', array(
  186. 'content' => parent::getCode($isDisplayHeader),
  187. 'js_object' => $this->getJsObject(),
  188. 'page_url' => $this->sUrlPage,
  189. 'grid_object' => $this->_sObject,
  190. 'params_divider' => $this->sParamsDivider
  191. ));
  192. }
  193. protected function _addJsCss()
  194. {
  195. parent::_addJsCss();
  196. $this->_oTemplate->addJs(array('jquery.form.min.js', 'permissions_levels.js'));
  197. bx_import('BxTemplStudioFormView');
  198. $oForm = new BxTemplStudioFormView(array());
  199. $oForm->addCssJs();
  200. }
  201. protected function _getCellSwitcher ($mixedValue, $sKey, $aField, $aRow)
  202. {
  203. bx_import('BxDolAcl');
  204. if(in_array($aRow['ID'], array(MEMBERSHIP_ID_NON_MEMBER, MEMBERSHIP_ID_ACCOUNT, MEMBERSHIP_ID_STANDARD, MEMBERSHIP_ID_UNCONFIRMED, MEMBERSHIP_ID_PENDING, MEMBERSHIP_ID_SUSPENDED)))
  205. return parent::_getCellDefault('', $sKey, $aField, $aRow);;
  206. return parent::_getCellSwitcher($mixedValue, $sKey, $aField, $aRow);
  207. }
  208. protected function _getCellIcon ($mixedValue, $sKey, $aField, $aRow)
  209. {
  210. $mixedValue = $this->_oTemplate->getImage($mixedValue, array('class' => 'bx-prm-level-icon bx-def-border'));
  211. return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow);
  212. }
  213. protected function _getCellActionsList ($mixedValue, $sKey, $aField, $aRow)
  214. {
  215. $aActions = array();
  216. $iActions = $this->oDb->getActions(array('type' => 'by_level_id', 'value' => $aRow['ID']), $aActions);
  217. $mixedValue = $this->_oTemplate->parseHtmlByName('bx_a.html', array(
  218. 'href' => BX_DOL_URL_STUDIO . 'builder_permissions.php?page=actions&level=' . $aRow['ID'],
  219. 'title' => _t('_adm_prm_txt_manage_actions'),
  220. 'bx_repeat:attrs' => array(),
  221. 'content' => _t('_adm_prm_txt_n_actions', $iActions)
  222. ));
  223. return parent::_getCellDefault ($mixedValue, $sKey, $aField, $aRow);
  224. }
  225. protected function _getCellQuotaSize ($mixedValue, $sKey, $aField, $aRow)
  226. {
  227. return parent::_getCellDefault ($mixedValue > 0 ? _t_format_size($mixedValue) : '&infin;', $sKey, $aField, $aRow);
  228. }
  229. protected function _getCellQuotaNumber ($mixedValue, $sKey, $aField, $aRow)
  230. {
  231. return parent::_getCellDefault ($mixedValue > 0 ? $mixedValue : '&infin;', $sKey, $aField, $aRow);
  232. }
  233. protected function _getCellQuotaMaxFileSize ($mixedValue, $sKey, $aField, $aRow)
  234. {
  235. return parent::_getCellDefault ($mixedValue > 0 ? _t_format_size($mixedValue) : '&infin;', $sKey, $aField, $aRow);
  236. }
  237. protected function _getActionDelete ($sType, $sKey, $a, $isSmall = false, $isDisabled = false, $aRow = array())
  238. {
  239. if ($sType == 'single' && $aRow['Removable'] != 'yes')
  240. return '';
  241. return parent::_getActionDefault($sType, $sKey, $a, false, $isDisabled, $aRow);
  242. }
  243. protected function _getIconPreview($iId, $sIconImage = '', $sIconFont = '')
  244. {
  245. $bIconImage = !empty($sIconImage);
  246. $bIconFont = !empty($sIconFont);
  247. return $this->_oTemplate->parseHtmlByName('prm_level_icon_preview.html', array(
  248. 'id' => $iId,
  249. 'bx_if:show_icon_empty' => array(
  250. 'condition' => !$bIconImage && !$bIconFont,
  251. 'content' => array()
  252. ),
  253. 'bx_if:show_icon_image' => array(
  254. 'condition' => $bIconImage,
  255. 'content' => array(
  256. 'js_object' => $this->getJsObject(),
  257. 'url' => $sIconImage,
  258. 'id' => $iId
  259. )
  260. ),
  261. 'bx_if:show_icon_font' => array(
  262. 'condition' => $bIconFont,
  263. 'content' => array(
  264. 'icon' => $sIconFont
  265. )
  266. )
  267. ));
  268. }
  269. protected function _getFormObject($sAction, $aLevel = array())
  270. {
  271. $aForm = array(
  272. 'form_attrs' => array(
  273. 'id' => 'adm-prm-level-create',
  274. 'action' => BX_DOL_URL_ROOT . 'grid.php?o=' . $this->_sObject . '&a=' . $sAction,
  275. 'method' => BX_DOL_STUDIO_METHOD_DEFAULT,
  276. 'enctype' => 'multipart/form-data',
  277. ),
  278. 'params' => array (
  279. 'db' => array(
  280. 'table' => 'sys_acl_levels',
  281. 'key' => 'ID',
  282. 'uri' => '',
  283. 'uri_title' => '',
  284. 'submit_name' => 'do_submit'
  285. ),
  286. ),
  287. 'inputs' => array (
  288. 'id' => array(
  289. 'type' => 'hidden',
  290. 'name' => 'id',
  291. 'value' => isset($aLevel['id']) ? (int)$aLevel['id'] : 0,
  292. 'db' => array (
  293. 'pass' => 'Int',
  294. ),
  295. ),
  296. 'Active' => array(
  297. 'type' => 'hidden',
  298. 'name' => 'Active',
  299. 'value' => 'yes',
  300. 'db' => array (
  301. 'pass' => 'Xss',
  302. ),
  303. ),
  304. 'Purchasable' => array(
  305. 'type' => 'hidden',
  306. 'name' => 'Purchasable',
  307. 'value' => 'no',
  308. 'db' => array (
  309. 'pass' => 'Xss',
  310. ),
  311. ),
  312. 'Removable' => array(
  313. 'type' => 'hidden',
  314. 'name' => 'Removable',
  315. 'value' => 'yes',
  316. 'db' => array (
  317. 'pass' => 'Xss',
  318. ),
  319. ),
  320. 'Name' => array(
  321. 'type' => 'text_translatable',
  322. 'name' => 'Name',
  323. 'caption' => _t('_adm_prm_txt_level_name'),
  324. 'info' => _t('_adm_prm_dsc_level_name'),
  325. 'value' => '_adm_prm_txt_level',
  326. 'required' => '1',
  327. 'db' => array (
  328. 'pass' => 'Xss',
  329. ),
  330. 'checker' => array (
  331. 'func' => 'LengthTranslatable',
  332. 'params' => array(3, 100, 'Name'),
  333. 'error' => _t('_adm_prm_err_level_name'),
  334. ),
  335. ),
  336. 'Description' => array(
  337. 'type' => 'textarea_translatable',
  338. 'name' => 'Description',
  339. 'caption' => _t('_adm_prm_txt_level_description'),
  340. 'info' => _t('_adm_prm_dsc_level_description'),
  341. 'value' => isset($aLevel['description']) ? $aLevel['description'] : '_adm_prm_txt_level',
  342. 'db' => array (
  343. 'pass' => 'XssHtml',
  344. )
  345. ),
  346. 'QuotaSize' => array(
  347. 'type' => 'text',
  348. 'name' => 'QuotaSize',
  349. 'caption' => _t('_adm_prm_txt_level_quota_size'),
  350. 'info' => _t('_adm_prm_dsc_level_quota_size'),
  351. 'value' => isset($aLevel['quota_size']) ? round($aLevel['quota_size'] / self::$iBinMB, 1) : '0',
  352. 'required' => '1',
  353. 'db' => array (
  354. 'pass' => 'Float',
  355. ),
  356. 'checker' => array (
  357. 'func' => 'preg',
  358. 'params' => array('/^[0-9\.]+$/'),
  359. 'error' => _t('_adm_prm_err_level_quota_size'),
  360. ),
  361. ),
  362. 'QuotaMaxFileSize' => array(
  363. 'type' => 'text',
  364. 'name' => 'QuotaMaxFileSize',
  365. 'caption' => _t('_adm_prm_txt_level_quota_max_file_size'),
  366. 'info' => _t('_adm_prm_dsc_level_quota_max_file_size'),
  367. 'value' => isset($aLevel['quota_max_file_size']) ? round($aLevel['quota_max_file_size'] / self::$iBinMB, 1) : '',
  368. 'required' => '1',
  369. 'db' => array (
  370. 'pass' => 'Float',
  371. ),
  372. 'checker' => array (
  373. 'func' => 'preg',
  374. 'params' => array('/^[0-9\.]+$/'),
  375. 'error' => _t('_adm_prm_err_level_quota_max_file_size'),
  376. ),
  377. ),
  378. 'QuotaNumber' => array(
  379. 'type' => 'text',
  380. 'name' => 'QuotaNumber',
  381. 'caption' => _t('_adm_prm_txt_level_quota_number'),
  382. 'info' => _t('_adm_prm_dsc_level_quota_number'),
  383. 'value' => isset($aLevel['quota_number']) ? (int)$aLevel['quota_number'] : '0',
  384. 'required' => '1',
  385. 'db' => array (
  386. 'pass' => 'Int',
  387. ),
  388. 'checker' => array (
  389. 'func' => 'preg',
  390. 'params' => array('/^[0-9]+$/'),
  391. 'error' => _t('_adm_prm_err_level_quota_number'),
  392. ),
  393. ),
  394. 'Icon' => array(
  395. 'type' => 'text',
  396. 'name' => 'Icon',
  397. 'caption' => _t('_adm_prm_txt_level_icon'),
  398. 'info' => _t('_adm_prm_dsc_level_icon'),
  399. 'value' => '',
  400. 'required' => '0',
  401. 'db' => array (
  402. 'pass' => 'Xss',
  403. ),
  404. 'checker' => array (
  405. 'func' => '',
  406. 'params' => array(),
  407. 'error' => _t('_adm_prm_err_level_icon'),
  408. ),
  409. ),
  410. 'Icon_image' => array(
  411. 'type' => 'file',
  412. 'name' => 'Icon_image',
  413. 'caption' => _t('_adm_prm_txt_level_icon_image'),
  414. 'info' => _t('_adm_prm_dsc_level_icon_image'),
  415. 'value' => '',
  416. 'checker' => array (
  417. 'func' => '',
  418. 'params' => '',
  419. 'error' => _t('_adm_prm_err_level_icon_image'),
  420. ),
  421. ),
  422. 'Icon_preview' => array(
  423. 'type' => 'custom',
  424. 'name' => 'Icon_preview',
  425. 'caption' => _t('_adm_prm_txt_level_icon_image_old'),
  426. 'content' => ''
  427. ),
  428. 'controls' => array(
  429. 'name' => 'controls',
  430. 'type' => 'input_set',
  431. array(
  432. 'type' => 'submit',
  433. 'name' => 'do_submit',
  434. 'value' => _t('_adm_prm_btn_level_add'),
  435. ),
  436. array (
  437. 'type' => 'reset',
  438. 'name' => 'close',
  439. 'value' => _t('_adm_prm_btn_level_cancel'),
  440. 'attrs' => array(
  441. 'onclick' => "$('.bx-popup-applied:visible').dolPopupHide()",
  442. 'class' => 'bx-def-margin-sec-left',
  443. ),
  444. )
  445. )
  446. )
  447. );
  448. switch($sAction) {
  449. case 'add':
  450. unset($aForm['inputs']['id']);
  451. unset($aForm['inputs']['Icon_preview']);
  452. $aForm['form_attrs']['id'] .= 'create';
  453. break;
  454. case 'edit':
  455. unset($aForm['inputs']['Active']);
  456. unset($aForm['inputs']['Purchasable']);
  457. unset($aForm['inputs']['Removable']);
  458. unset($aForm['inputs']['Name']);
  459. $aForm['form_attrs']['id'] .= 'edit';
  460. $aForm['inputs']['Icon_image']['caption'] = _t('_adm_prm_txt_level_icon_image_new');
  461. $aForm['inputs']['controls'][0]['value'] = _t('_adm_prm_btn_level_save');
  462. $sIconImage = $sIconFont = "";
  463. if(!empty($aLevel['icon'])) {
  464. if(is_numeric($aLevel['icon']) && (int)$aLevel['icon'] != 0) {
  465. bx_import('BxDolStorage');
  466. $oStorage = BxDolStorage::getObjectInstance(BX_DOL_STORAGE_OBJ_IMAGES);
  467. $sIconImage = $oStorage->getFileUrlById((int)$aLevel['icon']);
  468. } else {
  469. $sIconFont = $aLevel['icon'];
  470. $aForm['inputs']['Icon']['value'] = $sIconFont;
  471. }
  472. }
  473. $aForm['inputs']['Icon_preview']['content'] = $this->_getIconPreview($aLevel['id'], $sIconImage, $sIconFont);
  474. break;
  475. }
  476. return new BxTemplStudioFormView($aForm);
  477. }
  478. protected function _getAvailableId()
  479. {
  480. $aLevels = array();
  481. $this->oDb->getLevels(array('type' =>'all_order_id'), $aLevels, false);
  482. $iId = 1;
  483. foreach($aLevels as $aLevel) {
  484. if($iId != (int)$aLevel['id'])
  485. break;
  486. $iId++;
  487. }
  488. return $iId <= BX_DOL_STUDIO_PERMISSIONS_LEVEL_ID_INT_MAX ? $iId : false;
  489. }
  490. }
  491. /** @} */