mgd_list_persons_in_office

(Midgard 1.4.2 'Bifrost')

mgd_list_persons_in_office -- List persons linked to a office topic

Description

object mgd_list_persons_in_office (int office, string [sort])

Minimum version: Midgard 1.0

Lists all persons linked to office topic office. The office link in the person record contains an id number that should point to a topic record. This function returns all the person records with the given office link. 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 department 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_office( $dept, $sort );
 if( $people->N == 0 ) {
   echo "No people in office $dept.&lt;br>";
 } else {
   while( $people->fetch() ) {
     echo $people->name . "<br>\n";
   }
 }
?>