Пример #1
0
                if (!isset(${$key}) && !is_null(${$key}) && !${$key} === "") {
                    trigger_error("unknown parameter", E_USER_NOTICE);
                } else {
                    ${$key} = $value;
                }
            }
        }
        $str_project = $project ? 'AND i.project=' . intval($project) : '';
        $str_created_by = $created_by ? 'AND i.created_by=' . intval($created_by) : '';
        $str_date_min = $date_min ? "AND i.modified >= '" . asCleanString($date_min) . "'" : '';
        $str_date_max = $date_max ? "AND i.modified <= '" . asCleanString($date_max) . "'" : '';
        $str_task = $task ? 'AND tp.task =' . intval($task) : '';
        $str_person = $person ? 'AND tp.person =' . intval($person) : '';
        $str_forward = $forward ? 'AND tp.forward = 1' : '';
        $str_state = $state ? 'AND i.state =' . intval($state) : '';
        ### show all ###
        $str_query = "SELECT tp.*, i.* from {$prefix}taskperson tp, {$prefix}item i\r\n\t\t\t WHERE\r\n\t\t\ti.type = '" . ITEM_TASKPERSON . "'\r\n\t\t\t{$str_project}\r\n\t\t\t{$str_created_by}\r\n\t\t\t{$str_forward}\r\n\t\t\t{$str_state}\r\n\t\t\tAND tp.id = i.id\r\n\t\t\t\t{$str_person}\r\n\t\t\t\t{$str_task}\r\n\t\t\t{$str_date_max}\r\n\t\t\t{$str_date_min}\r\n\t\t\t";
        $dbh = new DB_Mysql();
        $sth = $dbh->prepare($str_query);
        $sth->execute("", 1);
        $tmp = $sth->fetchall_assoc();
        $tps = array();
        foreach ($tmp as $t) {
            $c = new TaskPerson($t);
            $tps[] = $c;
        }
        return $tps;
    }
}
TaskPerson::initFields();