HomeHelpTrac

Changeset 15905 for trunk/inc


Ignore:
Timestamp:
01/22/12 23:18:49 (4 months ago)
Author:
Alexander Trofimov
Message:

Forms - hidden_for_levels renamed to visible_for_levels

Location:
trunk/inc/classes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/inc/classes/BxDolForm.php

    r15835 r15905  
    154154 * - display_name - name of the Form Display from sys_form_displays table. 
    155155 * - input_name - name of the Form Field from sys_form_inputs table. 
    156  * - hidden_for_levels - bit field with set of member level ids. To use member level id in bit field the level id minus 1 is used as power of 2, for example: 
     156 * - visible_for_levels - bit field with set of member level ids. To use member level id in bit field the level id minus 1 is used as power of 2, for example: 
    157157 *      - user level id = 1 -> 2^(1-1) = 1 
    158158 *      - user level id = 2 -> 2^(2-1) = 2 
     
    962962        return $isValid; 
    963963    } 
     964 
     965    /** 
     966     * Check if form field is visible. 
     967     * @param $aInput form field array 
     968     * @return boolean 
     969     */  
     970    protected function _isVisible ($aInput) { 
     971        bx_import('BxDolAcl'); 
     972        echo $aInput['name'] . ' - ' . BxDolAcl::getInstance()->isMemberLevelInSet($aInput['visible_for_levels']) . '<br />'; 
     973        return BxDolAcl::getInstance()->isMemberLevelInSet($aInput['visible_for_levels']); 
     974    } 
    964975} 
    965976 
  • trunk/inc/classes/BxDolFormQuery.php

    r15798 r15905  
    7070 
    7171        // form inputs 
    72         $sQuery = $oDb->prepare("SELECT `i`.* FROM `sys_form_inputs` AS `i` INNER JOIN `sys_form_display_inputs` AS `d` ON (`d`.`input_name` = `i`.`name`) WHERE `d`.`active` = 1 AND `d`.`display_name` = ? ORDER BY `d`.`order` ASC", $aDisplay['display_name']); 
     72        $sQuery = $oDb->prepare("SELECT `i`.*, `d`.`visible_for_levels` FROM `sys_form_inputs` AS `i` INNER JOIN `sys_form_display_inputs` AS `d` ON (`d`.`input_name` = `i`.`name`) WHERE `d`.`active` = 1 AND `d`.`display_name` = ? ORDER BY `d`.`order` ASC", $aDisplay['display_name']); 
    7373        $aInputs = $oDb->getAllWithKey($sQuery, 'name'); 
    7474        $aForm['inputs'] = array(); 
     
    7878            // main attributes 
    7979            $aInput = array ( 
    80                 'type' => $a['type'], 
     80                'type' => $a['type'],                 
    8181                'name' => $a['name'], 
    8282                'caption' => _t($a['caption']), 
     
    8888                'tr_attrs' => $a['attrs_tr'] ? unserialize($a['attrs_tr']) : false, 
    8989                'attrs_wrapper' => $a['attrs_wrapper'] ? unserialize($a['attrs_wrapper']) : false, 
     90                'visible_for_levels' => $a['visible_for_levels'], 
    9091            ); 
    9192             
Note: See TracChangeset for help on using the changeset viewer.