source: temp/test-xoops.ec-cube.net/html/modules/xoopspartners/index.php @ 405

Revision 405, 5.5 KB checked in by root, 20 years ago (diff)
Line 
1<?php
2// $Id: index.php,v 1.4 2005/08/03 12:40:02 onokazu Exp $
3//  ------------------------------------------------------------------------ //
4//                XOOPS - PHP Content Management System                      //
5//                    Copyright (c) 2000 XOOPS.org                           //
6//                       <http://www.xoops.org/>                             //
7//  ------------------------------------------------------------------------ //
8//  This program is free software; you can redistribute it and/or modify     //
9//  it under the terms of the GNU General Public License as published by     //
10//  the Free Software Foundation; either version 2 of the License, or        //
11//  (at your option) any later version.                                      //
12//                                                                           //
13//  You may not change or alter any portion of this comment or credits       //
14//  of supporting developers from this source code or any supporting         //
15//  source code which is considered copyrighted (c) material of the          //
16//  original comment or credit authors.                                      //
17//                                                                           //
18//  This program is distributed in the hope that it will be useful,          //
19//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
20//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
21//  GNU General Public License for more details.                             //
22//                                                                           //
23//  You should have received a copy of the GNU General Public License        //
24//  along with this program; if not, write to the Free Software              //
25//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
26// ------------------------------------------------------------------------- //
27// Author: Raul Recio (AKA UNFOR)                                            //
28// Project: The XOOPS Project                                                //
29// ------------------------------------------------------------------------- //
30
31include "header.php";
32$xoopsOption['template_main'] = 'xoopspartners_index.html';
33include XOOPS_ROOT_PATH."/header.php";
34$part = new PartnerSystem();
35$start = isset($_GET['start']) ? intval($_GET['start']) : 0;
36
37$admin = 0;
38if ($xoopsUser) {
39    $xoopsTpl->assign("partner_join" ,"<a href='join.php'><b>"._MD_JOIN."</b></a>");
40}
41$query = $xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix("partners")." WHERE status=1");
42list($numrows) = $xoopsDB->fetchrow($query);
43if( $xoopsModuleConfig['modlimit'] != 0 ) {
44    $partners = $part->getAllPartners("status = 1",true,$xoopsModuleConfig['modorder'],$xoopsModuleConfig['modorderd'],$xoopsModuleConfig['modlimit'],$start);
45}else{
46    $partners = $part->getAllPartners("status = 1",true,$xoopsModuleConfig['modorder'],$xoopsModuleConfig['modorderd']);
47}
48foreach ( $partners as $part_obj ) {
49    $array_partners[] = array(
50            "id"                  =>  $part_obj->getVar("id"),
51            "hits"                =>  $part_obj->getVar("hits"),
52            "url"                 =>  $part_obj->getVar("url"),
53            "image"               =>  $part_obj->getVar("image"),
54            "title"               =>  $part_obj->getVar("title"),
55            "description"         =>  $part_obj->getVar("description")
56            );
57}
58$partner_count = count($array_partners);
59for ( $i = 0; $i < $partner_count; $i++ ) {
60    $ImagePartner = "<a href='vpartner.php?id=".$array_partners[$i]["id"]."' target='_blank'>";
61    if ( !empty($array_partners[$i]["image"]) && ($xoopsModuleConfig['modshow'] == 1 || $xoopsModuleConfig['modshow'] == 3) ) {
62        $ImagePartner .= "<img src='".$array_partners[$i]["image"]."' alt='".$array_partners[$i]["url"]."' width='102' height='47' border='0' />";
63    }
64    if ( $xoopsModuleConfig['modshow'] == 3 ) {
65        $ImagePartner .= "<br />";
66    }
67    if ( empty($array_partners[$i]["image"]) || $xoopsModuleConfig['modshow'] == 2 || $xoopsModuleConfig['modshow'] == 3 ) {
68        $ImagePartner .= $array_partners[$i]["title"];
69    }
70    $ImagePartner .= "</a>";
71    $partner[$i]['id']           = $array_partners[$i]['id'];
72    $partner[$i]['hits']         = $array_partners[$i]['hits'];
73    $partner[$i]['url']          = $array_partners[$i]['url'];
74    $partner[$i]['image']        = $ImagePartner;
75    $partner[$i]['title']        = $array_partners[$i]['title'];
76    $partner[$i]['description']  = $array_partners[$i]['description'];
77    if ($xoopsUserIsAdmin) {
78        $partner[$i]['admin_option']  = "<br />[<a href='admin/index.php?op=editPartner&amp;id=".$array_partners[$i]["id"]."'>"._MD_EDIT."</a>] [<a href='admin/index.php?op=delPartner&amp;id=".$array_partners[$i]["id"]."'>"._MD_DELETE."</a>]";
79    }
80    $xoopsTpl->append("partners", $partner[$i]);
81}
82if ( $xoopsModuleConfig['modlimit'] != 0 ) {
83    $nav = new XoopsPageNav($numrows,$xoopsModuleConfig['modlimit'],$start);
84    $pagenav = $nav->renderImageNav();
85}
86$xoopsTpl->assign(array(
87        "lang_partner"         => _MD_PARTNER,
88        "lang_desc"            => _MD_DESCRIPTION,
89        "lang_hits"            => _MD_HITS,
90        "lang_no_partners"     => _MD_NOPART,
91        "lang_main_partner"    => _MD_PARTNERS,
92        "sitename"             => htmlspecialchars($xoopsConfig['sitename']),
93        "pagenav"              => $pagenav
94        ));
95include_once XOOPS_ROOT_PATH.'/footer.php';
96?>
Note: See TracBrowser for help on using the repository browser.