mgd_list_persons_in_department

Name

mgd_list_persons_in_department -- List persons linked to a department

Synopsis

object mgd_list_persons_in_department(int department, string [sort]);

Description

Minimum version: Midgard 1.0 (Land Rover)

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 successfull. Returns false on failure.

Example

<?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";
   }
 }
?>