All pastes #477609 Raw Edit

Miscellany

public php v1 · immutable
·published 2007-05-08 19:16 UTC
rendered paste body
    function navProjects($status) {        if($status == 'current'){            $output = $this->generateList("Project.archived IS NULL", 'created ASC', null, '{n}.Project.id', '{n}.Project.name');        }        elseif($status == 'archived'){            $query = "SELECT DISTINCT YEAR(archived) AS year FROM projects,accounts_projects WHERE archived IS NOT NULL ";            if ( $_SESSION['Account']['admin'] != 1) {                $query .= "AND project_id=id AND account_id = " .  $_SESSION['Account']['id'];            }            $query .=  " ORDER BY archived DESC";            $years = $this->query($query);            for($i=0;$i<count($years);$i++){                $year = $years[$i][0]['year'];                $output[$year] = $year;            }        }        else{            $condition = 'Project.archived >= \'' . $status . '-01-01\' AND Project.archived <= \'' . $status . '-12-31\'';            $output = $this->generateList("$condition", 'created ASC', null, '{n}.Project.id', '{n}.Project.name');        }        return $output;    }