public function get_table() {
        $table = new html_table();
        $table->tablealign = 'center';
        $table->cellpadding = 5;
        $table->cellspacing = 0;
        $table->width = '90%';
        $table->align = array('left');
        $table->rotateheaders = true;
        $table->head = array('&#xa0;');
        $table->colclasses = array('');

        // Add role name headers.
        foreach ($this->roles as $targetrole) {
            $table->head[] = $targetrole->localname;
            $table->align[] = 'left';
            if ($this->is_allowed_target($targetrole->id)) {
                $table->colclasses[] = '';
            } else {
                $table->colclasses[] = 'dimmed_text';
            }
        }

        // Now the rest of the table.
        foreach ($this->roles as $fromrole) {
            $row = array($fromrole->localname);
            foreach ($this->roles as $targetrole) {
                $checked = '';
                $disabled = '';
                if ($this->allowed[$fromrole->id][$targetrole->id]) {
                    $checked = 'checked="checked" ';
                }
                if (!$this->is_allowed_target($targetrole->id)) {
                    $disabled = 'disabled="disabled" ';
                }
                $name = 's_' . $fromrole->id . '_' . $targetrole->id;
                $tooltip = $this->get_cell_tooltip($fromrole, $targetrole);
                $row[] = '<input type="checkbox" name="' . $name . '" id="' . $name .
                    '" title="' . $tooltip . '" value="1" ' . $checked . $disabled . '/>' .
                    '<label for="' . $name . '" class="accesshide">' . $tooltip . '</label>';
            }
            $table->data[] = $row;
        }

        return $table;
    }
public function get_table() {
        $table = new html_table();
        $table->tablealign = 'center';
        $table->cellpadding = 5;
        $table->cellspacing = 0;
        $table->width = '90%';
        $table->align = array('left');
        $table->rotateheaders = true;
        $table->head = array('&#xa0;');
        $table->colclasses = array('');

        // Add role name headers.
        foreach ($this->roles as $targetrole) {
            $table->head[] = $targetrole->localname;
            $table->align[] = 'left';
            if ($this->is_allowed_target($targetrole->id)) {
                $table->colclasses[] = '';
            } else {
                $table->colclasses[] = 'dimmed_text';
            }
        }

        // Now the rest of the table.
        foreach ($this->roles as $fromrole) {
            $row = array($fromrole->localname);
            foreach ($this->roles as $targetrole) {
                $checked = '';
                $disabled = '';
                if ($this->allowed[$fromrole->id][$targetrole->id]) {
                    $checked = 'checked="checked" ';
                }
                if (!$this->is_allowed_target($targetrole->id)) {
                    $disabled = 'disabled="disabled" ';
                }
                $name = 's_' . $fromrole->id . '_' . $targetrole->id;
                $tooltip = $this->get_cell_tooltip($fromrole, $targetrole);
                $row[] = '<input type="checkbox" name="' . $name . '" id="' . $name .
                    '" title="' . $tooltip . '" value="1" ' . $checked . $disabled . '/>' .
                    '<label for="' . $name . '" class="accesshide">' . $tooltip . '</label>';
            }
            $table->data[] = $row;
        }

        return $table;
    }
public function get_table ( ) { $ table = new html_table ( ) ; $ table -> tablealign = 'center' ; $ table -> cellpadding = 5 ; $ table -> cellspacing = 0 ; $ table -> width = '90%' ; $ table -> align = array ( 'left' ) ; $ table -> rotateheaders = true ; $ table -> head = array ( '&#xa0;' ) ; $ table -> colclasses = array ( '' ) ; // Add role name headers. foreach ( $ this -> roles as $ targetrole ) { $ table -> head [ ] = $ targetrole -> localname ; $ table -> align [ ] = 'left' ; if ( $ this -> is_allowed_target ( $ targetrole -> id ) ) { $ table -> colclasses [ ] = '' ; } else { $ table -> colclasses [ ] = 'dimmed_text' ; } } // Now the rest of the table. foreach ( $ this -> roles as $ fromrole ) { $ row = array ( $ fromrole -> localname ) ; foreach ( $ this -> roles as $ targetrole ) { $ checked = '' ; $ disabled = '' ; if ( $ this -> allowed [ $ fromrole -> id ] [ $ targetrole -> id ] ) { $ checked = 'checked="checked" ' ; } if ( ! $ this -> is_allowed_target ( $ targetrole -> id ) ) { $ disabled = 'disabled="disabled" ' ; } $ name = 's_' . $ fromrole -> id . '_' . $ targetrole -> id ; $ tooltip = $ this -> get_cell_tooltip ( $ fromrole , $ targetrole ) ; $ row [ ] = '<input type="checkbox" name="' . $ name . '" id="' . $ name . '" title="' . $ tooltip . '" value="1" ' . $ checked . $ disabled . '/>' . '<label for="' . $ name . '" class="accesshide">' . $ tooltip . '</label>' ; } $ table -> data [ ] = $ row ; } return $ table ; }
Returns structure that can be passed to print_table,
containing one cell for each checkbox.
@return html_table a table
Returns structure that can be passed to print_table containing one cell for each checkbox .