Example #1
0
        </a>
    </th>
    <th width="1%" align="right">
        <a href="<?php 
echo URLHelper::getLink('?cmd=deleteRole&role_id=' . $id);
?>
">
            <?php 
echo Icon::create('trash', 'attention', ['title' => _("Gruppe mit Personenzuordnung entfernen")])->asImg();
?>
        </a>
    </th>
</tr>
<?
    $pos = 0;
    $persons = getPersonsForRole($id);
?>
<!-- Persons assigned to this role -->
<? if (is_array($persons)) foreach ($persons as $person) :
            $pos ++;
?>
<tr>
    <td width="1%" nowrap>
        <?php 
echo $pos;
?>
    </td>

    <td>
        <a href="<?php 
echo URLHelper::getLink('dispatch.php/profile?username='******'username']);
Example #2
0
        &nbsp;
    </td>
</tr>
<?

    // if the current $role has followers, we need to display a straight line later
    $new_followers = $followers;
    $new_followers[$indent] = (sizeof($roles) > $pos);

    // if we have opened an entry, we show edit fields
    if ($open == $id) :
        $partial = LockRules::Check($range_id, 'groups') ?
                   'statusgruppen/role_administration_locked.php' :
                   'statusgruppen/role_administration.php';
        echo $this->render_partial($partial,
            array('indent' => $indent, 'followers' => $new_followers,
                'persons' => getPersonsForRole($id), 'role_id' => $id, 'editRole' => ($editRole == $id), 'role' => $role['role'],
                'role_size' => sizeof($roles), 'role_pos' => $pos, 'has_child' => ($role['child']) ? true : false, 'all_roles' => $all_roles)
        );
    endif;

    // if we have childs, we display them with the same template and some indention
    if($role['child']) {
        echo $this->render_partial('statusgruppen/roles.php',
            array('indent' => $indent + 1, 'roles' => $role['child'], 'followers' => $new_followers, 'all_roles' => $all_roles));
    }

    $pos++;
endforeach;
Example #3
0
function display_roles_recursive($roles, $level = 0, $pred = '') {
    if (is_array($roles))
    foreach ($roles as $role_id => $data) {
        $css_rec = new cssClassSwitcher();
        if ($level > 0) {
            $title = $pred.' > '. $data['name'];
        } else {
            $title = $data['name'];
        }
        echo '<tr><td colspan="2" class="content_seperator"><b>'.$title.'</b></td></tr>';
        if ($persons = getPersonsForRole($role_id)) {
            $z = 1;
            if (is_array($persons))
            foreach ($persons as $p) {
                $css_rec->switchClass();
                $class = 'class="'.$css_rec->getClass().'"';
                //echo '<tr><td '.$class.' width="20" align="center">'.$p['position'].'</td>';
                echo '<tr><td '.$class.' width="20" align="center">'.$z.'&nbsp;</td>';
                echo '<td '.$class.'><a href="'.URLHelper::getLink('dispatch.php/profile?username='******'username']).'">'.$p['fullname'].'</a></td>';
                $z++;
            }
        }
        echo '<tr><td colspan="2" class="blank">&nbsp;</td></tr>';
        echo '</tr>';
        if ($data['child']) {
            if ($level > 0) {
                $zw = $pred . ' > '.$data['name'];
            } else {
                $pred = $data['name'];
                $zw = $pred;
            }
            display_roles_recursive($data['child'], $level+1, $zw);
        }
    }
}