public static function get_list_filter($_FORM = array()) { $current_user =& singleton("current_user"); if (!$_FORM["tfIDs"] && !$current_user->have_role('admin')) { $_FORM["owner"] = true; } $_FORM["owner"] and $filter1[] = sprintf_implode("tfPerson.personID = %d", $current_user->get_id()); $tfIDs = tf::get_permitted_tfs($_FORM["tfIDs"]); $tfIDs and $filter1[] = sprintf_implode("tf.tfID = %d", $tfIDs); $tfIDs and $filter2[] = sprintf_implode("tf.tfID = %d", $tfIDs); $_FORM["showall"] or $filter1[] = "(tf.tfActive = 1)"; $_FORM["showall"] or $filter2[] = "(tf.tfActive = 1)"; return array($filter1, $filter2); }
function reduce_tfs($_FORM) { if ($_FORM["tfName"]) { $q = prepare("SELECT * FROM tf WHERE tfName = '%s'", $_FORM["tfName"]); $db = new db_alloc(); $db->query($q); $db->next_record(); $tfIDs[] = $db->f("tfID"); } if ($_FORM["tfID"]) { $tfIDs[] = $_FORM["tfID"]; } if ($_FORM["tfIDs"]) { $tfIDs = array_merge((array) $tfIDs, (array) $_FORM["tfIDs"]); } return tf::get_permitted_tfs($tfIDs); }