Location: PHPKode > projects > CHASERS > chasers_gpl_snapshot1a/heet.php
<?php

/*
<LICENSE>
This file is part of CHASERS.
CHASERS is Copyright (c) 2003-2008 Downtown Emergency Service Center (DESC).
All rights reserved.
For more information, about DESC, see http://www.desc.org/.
For more information about CHASERS, see http://chasers.desc.org/.

CHASERS is free software: you can redistribute it and/or modify
it under the terms of version 3 of the GNU General Public License 
as published by the Free Software Foundation.

CHASERS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with CHASERS.  If not, see <http://www.gnu.org/licenses/>.

</LICENSE>
*/

// Heet = (some acronym), HOPWA funded, previously called STAR
// to hire a couple of Evergreen case managers to work with folks
/*
function show_heet_reg($heet_reg)
{
    $out="";
    if (sql_num_rows($heet_reg)==0)
    {
        $out .= oline("<br>No HEET Registrations to Display");
        return $out;
    }
    $out.=tablestart("", "border=5")
        . header_row("Start Date", "Exit Date");
    while ($row = sql_fetch_assoc($heet_reg))
    {
        $out .= row(
                    cell(dateof($row['heet_reg_date']))
                    . cell(dateof($row["heet_reg_date_end"]))
                    . cell(link_engine(array("object"=>"heet_reg","id"=>$row["heet_reg_id"]))));
    }
    $out .=tableend();
    return $out;
}
*/
function get_heet_reg($filter,$order="",$limit="")
{
	global $engine;
	$select=$engine['heet_reg']['sel_sql'];
	$order=orr($order,implode(',',array_keys($engine['heet_reg']['list_order'])));
	return desc_query( $select, $filter,$order,$limit);
}

function heet_status_f( $id )
{
// returns a formatted string displaying CRP status
// never enrolled, last enrollment, or currently enrolled
// this currently relies on get_crp_reg returning records in descending date order

    $regs = get_heet_reg( array( "client_id"=>$id ));
    if (sql_num_rows($regs)==0)
    {
        $result = smaller("(never enrolled in HEET)");
    }
    else
    {
        $reg = sql_fetch_assoc($regs);
        if (be_null($reg["heet_reg_date_end"]))
        {
            $result = "Current " . blue("HEET") . " Registration Began " 
			. link_engine(array('object'=>'heet_reg','id'=>$reg['heet_reg_id']),dateof($reg["heet_reg_date"]));
        }
        else
        {
            $result = "Last " . blue("HEET") . " Registration " 
			. link_engine(array('object'=>'heet_reg','id'=>$reg['heet_reg_id']),dateof($reg["heet_reg_date"])
					  . "-->" . dateof($reg["heet_reg_date_end"]));
        }
    }
    return $result;
}



?>
Return current item: CHASERS