mgd_list_persons_in_department

(Midgard 1.4.2 'Bifrost')

mgd_list_persons_in_department -- List persons linked to a department

Description

object mgd_list_persons_in_department (int department, string [sort])

Minimum version: Midgard 1.0

Lists all persons linked to department topic department. The optional sort argument can be used to specify the order in which the results will be listed. Possible values include "alpha" and "created" for sorting alphabetically by lastname and firstname or by creation date (ascending) respectively. If this argument is not given, then the results will be sorted by descending creation date so that the most recently created person record in the deparment is listed first.

Returns an object traversable by calling fetch() if successful. Returns FALSE on failure.


<?php
 $dept = 13;
 $sort = "alpha";
 $people = mgd_list_persons_in_department( $dept, $sort );
 if( $people->N == 0 ) {
   echo "No people in department $dept.<br>";
 } else {
   while( $people->fetch() ) {
     echo $people->name . " username: " $people-username"
          . "<br>\n";
   }
 }
?>