Exemplo n.º 1
0
 /**
 	Contact getContactList
 
 	@param flag
 	@return Array of Contacts
 */
 function getContactList($flag = null)
 {
     if (intval($this->id) == 0) {
         return null;
     }
     $sql = 'SELECT * ';
     $sql .= 'FROM contact ';
     $sql .= sprintf('WHERE ( id=%d OR parent_id=%d )', $this->id, $this->id);
     if ($flag) {
         $sql .= sprintf(' AND flag & %d = %d ', $flag, $flag);
     }
     $sql .= ' ORDER BY id ';
     $res = SQL::fetchAll($sql);
     if (is_array($res) && count($res) > 0) {
         return $res;
     }
     return null;
 }