Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- db_set_active('internet');
- function generateAbolistNames($sUIDs) {
- // no UIDs
- if($sUIDs == NULL) {
- return array();
- }
- // get UIDs
- $aUIDs = explode(' ', trim($sUIDs));
- $users = array();
- $sqlWhere = '';
- // get user objects by UID
- foreach($aUIDs as $sUID) {
- $u = user_load(array('uid' => $sUID));
- if($u->name == '') {
- $sqlWhere .= "n.field_imt_loginname_value = '-1' OR ";
- } else {
- $sqlWhere .= "n.field_imt_loginname_value = '".$u->name."' OR ";
- }
- }
- $sqlWhere = substr($sqlWhere, 0, strlen($sqlWhere)-4);
- $result = db_query(
- "SELECT
- n.nid,
- n.field_staff_surename_value,
- n.field_staff_lastname_value,
- n.field_staff_room_value
- FROM
- `content_type_staff` as n
- WHERE
- ".$sqlWhere."
- ORDER BY
- n.field_staff_room_value ASC
- "
- , $u->name);
- while ($row = db_fetch_object($result)) {
- $user = array();
- $user['nid'] = $row->nid;
- $user['field_staff_surename_value'] = trim($row->field_staff_surename_value);
- $user['field_staff_lastname_value'] = trim($row->field_staff_lastname_value);
- $user['field_staff_room_value'] = trim($row->field_staff_room_value);
- $users[] = $user;
- }
- return $users;
- }
- $aboNames = generateAbolistNames($node->field_zeitschrift_abonnenten[0]['value']);
- ?>
- <table border="1" width="100%">
- <tr>
- <th>#</th>
- <th>Name</th>
- <th>Büro</th>
- <th>Unterschrift</th>
- <th>Datum</th>
- </tr>
- <?php
- for($i = 0; $i < count($aboNames); $i++) {
- echo " <tr>\n";
- echo " <td>".($i+1)."</td>\n";
- echo " <td>".$aboNames[$i]['field_staff_surename_value'].' '.$aboNames[$i]['field_staff_lastname_value']."</td>\n";
- echo " <td>".$aboNames[$i]['field_staff_room_value']."</td>\n";
- echo " <td> </td>\n";
- echo " <td> </td>\n";
- echo " </tr>\n";
- }
- ?>
- </table>
- <?php
- db_set_active('default');
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement