Trac

Ignore:
Timestamp:
02/08/12 05:13:10 (2 years ago)
Author:
Anton Lesnikov
Message:
  1. "Page Builder" checklist from Andrew
  2. Visible For Levels feature unification.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/studio/classes/BxDolStudioUtils.php

    r15958 r15963  
    1313define('BX_DOL_STUDIO_MODULE_SYSTEM', 'system'); 
    1414define('BX_DOL_STUDIO_MODULE_CUSTOM', 'custom'); 
     15 
     16define('BX_DOL_STUDIO_VISIBLE_ALL', 'all'); 
     17define('BX_DOL_STUDIO_VISIBLE_SELECTED', 'selected'); 
    1518 
    1619class BxDolStudioUtils extends BxDol { 
     
    7376    } 
    7477 
     78    public static function getVisibilityValue($sVisibleFor, $aVisibleForLevels) { 
     79        if($sVisibleFor == BX_DOL_STUDIO_VISIBLE_ALL) 
     80            return PHP_INT_MAX; 
     81 
     82        $iVisibleFor = 0; 
     83        foreach($aVisibleForLevels as $iLevelId) 
     84            $iVisibleFor += pow(2, (int)$iLevelId - 1); 
     85 
     86        return $iVisibleFor; 
     87    } 
     88 
     89    public static function getVisibilityValues($iValue, &$aValuesAll, &$aValuesSelected) { 
     90        bx_import('BxDolAcl'); 
     91        $aLevels = BxDolAcl::getInstance()->getMemberships(); 
     92        foreach($aLevels as $iKey => $sValue) { 
     93            if(((int)$iValue & pow(2, (int)$iKey - 1)) != 0) 
     94                $aValuesSelected[] = $iKey; 
     95             
     96            $aValuesAll[$iKey] = _t($sValue); 
     97        } 
     98    } 
     99     
    75100    public static function addInArray($aInput, $sKey, $aValues) { 
    76101        reset($aInput); 
Note: See TracChangeset for help on using the changeset viewer.