Ignore:
Timestamp:
Apr 8, 2006 3:15:27 AM (18 years ago)
Author:
scdev
Message:

minor improvements

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/NodeHeirarchy.inc.php

    r83 r84  
    342342     * @return string   The parents as an array of serialized node identifiers.
    343343     */
    344     function getParents($child_type=null, $child_id=null)
     344    function getParents($child_type=null, $child_id=null, $type_constraint=null, $order='')
    345345    {
    346346        if (!isset($child_type) || !isset($child_id)) {
     
    352352                return false;
    353353            }
     354        }
     355
     356        $in_clause = '';
     357        if (isset($type_constraint)) {
     358            if (!is_array($type_constraint)) {
     359                $type_constraint = array($type_constraint);
     360            }
     361            $in_clause = "AND parent_type IN ('" . join("','", array_map('addslashes', $type_constraint)) . "')";
    354362        }
    355363
     
    359367            WHERE child_type = '" . addslashes($child_type) . "'
    360368            AND child_id = '" . addslashes($child_id) . "'
     369            $in_clause
     370            " . addslashes($order) . "
    361371        ");
    362372
Note: See TracChangeset for help on using the changeset viewer.