<?php
// $Id: realty_new.php,v 1.91 2009/01/05 16:43:54 yoshis Exp $
//  ------------------------------------------------------------------------ //
//                XOOPS Cube Realty - Realty Management System               //
//                    Copyright (c) 2010 Bluemoon inc.                       //
//                       <http://www.bluemooninc.jp/>                        //
//  ------------------------------------------------------------------------ //
//  This program is free software; you can redistribute it and/or modify     //
//  it under the terms of the GNU General Public License as published by     //
//  the Free Software Foundation; either version 2 of the License, or        //
//  (at your option) any later version.                                      //
//                                                                           //
//  You may not change or alter any portion of this comment or credits       //
//  of supporting developers from this source code or any supporting         //
//  source code which is considered copyrighted (c) material of the          //
//  original comment or credit authors.                                      //
//                                                                           //
//  This program 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 this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //

function realty_info_show($options){
	global $xoopsUser,$xoopsModuleConfig;
    $db =& Database::getInstance();
    $myts =& MyTextSanitizer::getInstance();
    $block = array();

    $query = "SELECT COUNT(*) FROM ".$db->prefix('realty');
    list($total) = $db->fetchRow($db->query($query));
    $query = "SELECT COUNT(*) FROM ".$db->prefix('realty')." WHERE updated>=NOW()-interval ". $options[0] . " day";
    list($newentry) = $db->fetchRow($db->query($query));
    $query = "SELECT last_modified FROM ".$db->prefix('realty_detail')." ORDER BY last_modified DESC LIMIT 1";
    list($last_modified) = $db->fetchRow($db->query($query));
    if ( $options[1] != 0 ) {
        $block['full_view'] = true;
    } else {
        $block['full_view'] = false;
    }
    $block['total'] = $total;
    $block['newentry'] = $newentry;
    $block['last_modified'] = $last_modified;
    return $block;
}
function b_realty_info( $options )
{
    $inputtag = "<input type='text' name='options[0]' value='".$options[0]."' />";
    $form = sprintf(_MB_REALTY_DISPDAYS,$inputtag);
    $form .= "<br />"._MB_REALTY_DISPLAYF."&nbsp;<input type='radio' name='options[1]' value='1'";
    if ( $options[1] == 1 ) {
        $form .= " checked='checked'";
    }
    $form .= " />&nbsp;"._YES."<input type='radio' name='options[1]' value='0'";
    if ( $options[1] == 0 ) {
        $form .= " checked='checked'";
    }
    $form .= " />&nbsp;"._NO;
    return $form;
}
?>