| [ Index ] | PHP Cross Reference of Mambo 4.6.5 |
|
| [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @package Mambo 4 * @subpackage Weblinks 5 * @author Mambo Foundation Inc see README.php 6 * @copyright (C) 2000 - 2009 Mambo Foundation Inc. 7 * See COPYRIGHT.php for copyright notices and details. 8 * @license GNU/GPL Version 2, see LICENSE.php 9 * 10 * Redistributions of files must retain the above copyright notice. 11 * 12 * Mambo is free software; you can redistribute it and/or 13 * modify it under the terms of the GNU General Public License 14 * as published by the Free Software Foundation; version 2 of the License. 15 */ 16 17 /** ensure this file is being included by a parent file */ 18 defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); 19 20 require_once( $GLOBALS['mosConfig_absolute_path'] . '/includes/HTML_toolbar.php' ); 21 22 class HTML_weblinks { 23 24 function displaylist( &$categories, &$rows, $catid, $currentcat=NULL, &$params, $tabclass ) { 25 global $Itemid, $mosConfig_live_site, $hide_js; 26 if ( $params->get( 'page_title' ) ) { 27 ?> 28 <div class="componentheading<?php echo $params->get( 'pageclass_sfx' ); ?>"> 29 <?php echo $currentcat->header; ?> 30 </div> 31 <?php 32 } 33 ?> 34 <form action="index.php" method="post" name="adminForm"> 35 36 <table width="100%" cellpadding="4" cellspacing="0" border="0" align="center" class="contentpane<?php echo $params->get( 'pageclass_sfx' ); ?>"> 37 <tr> 38 <td width="60%" valign="top" class="contentdescription<?php echo $params->get( 'pageclass_sfx' ); ?>" colspan="2"> 39 <?php 40 // show image 41 if ( $currentcat->img ) { 42 ?> 43 <img src="<?php echo $currentcat->img; ?>" align="<?php echo $currentcat->align; ?>" hspace="6" alt="<?php echo T_('Web Links'); ?>" /> 44 <?php 45 } 46 echo $currentcat->descrip; 47 ?> 48 </td> 49 </tr> 50 <tr> 51 <td> 52 <?php 53 if ( count( $rows ) ) { 54 HTML_weblinks::showTable( $params, $rows, $catid, $tabclass ); 55 } 56 ?> 57 </td> 58 </tr> 59 <tr> 60 <td> 61 62 </td> 63 </tr> 64 <tr> 65 <td> 66 <?php 67 // Displays listing of Categories 68 if ( ( $params->get( 'type' ) == 'category' ) && $params->get( 'other_cat' ) ) { 69 HTML_weblinks::showCategories( $params, $categories, $catid ); 70 } else if ( ( $params->get( 'type' ) == 'section' ) && $params->get( 'other_cat_section' ) ) { 71 HTML_weblinks::showCategories( $params, $categories, $catid ); 72 } 73 ?> 74 </td> 75 </tr> 76 </table> 77 </form> 78 <?php 79 // displays back button 80 mosHTML::BackButton ( $params, $hide_js ); 81 } 82 83 /** 84 * Display Table of items 85 */ 86 function showTable( &$params, &$rows, $catid, $tabclass ) { 87 global $mosConfig_live_site; 88 // icon in table display 89 if ( $params->get( 'weblink_icons' ) <> -1 ) { 90 $mainframe =& mosMainFrame::getInstance(); 91 $img = $mainframe->ImageCheck( 'weblink.png', '/images/M_images/', $params->get( 'weblink_icons' ) ); 92 } else { 93 $img = NULL; 94 } 95 ?> 96 <table width="100%" border="0" cellspacing="0" cellpadding="0"> 97 <?php 98 if ( $params->get( 'headings' ) ) { 99 ?> 100 <tr> 101 <?php 102 if ( $img ) { 103 ?> 104 <td class="sectiontableheader<?php echo $params->get( 'pageclass_sfx' ); ?>"> 105 106 </td> 107 <?php 108 } 109 ?> 110 <td width="90%" height="20" class="sectiontableheader<?php echo $params->get( 'pageclass_sfx' ); ?>"> 111 <?php echo T_('Web Link'); ?> 112 </td> 113 <?php 114 if ( $params->get( 'hits' ) ) { 115 ?> 116 <td width="30px" height="20" class="sectiontableheader<?php echo $params->get( 'pageclass_sfx' ); ?>" align="right"> 117 <?php echo T_('Hits'); ?> 118 </td> 119 <?php 120 } 121 ?> 122 </tr> 123 <?php 124 } 125 126 $k = 0; 127 foreach ($rows as $row) { 128 $iparams =& new mosParameters( $row->params ); 129 130 $link = sefRelToAbs( 'index.php?option=com_weblinks&task=view&catid='. $catid .'&id='. $row->id ); 131 $menuclass = 'category'.$params->get( 'pageclass_sfx' ); 132 switch ($iparams->get( 'target' )) { 133 // cases are slightly different 134 case 1: 135 // open in a new window 136 $txt = '<a href="'. $link .'" target="_blank" class="'. $menuclass .'">'. stripslashes($row->title) .'</a>'; 137 break; 138 139 case 2: 140 // open in a popup window 141 $txt = "<a href=\"#\" onclick=\"javascript: window.open('". $link ."', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\" class=\"$menuclass\">". stripslashes($row->title) ."</a>\n"; 142 break; 143 144 default: // formerly case 2 145 // open in parent window 146 $txt = '<a href="'. $link .'" class="'. $menuclass .'">'. stripslashes($row->title) .'</a>'; 147 break; 148 } 149 ?> 150 <tr class="<?php echo $tabclass[$k]; ?>"> 151 <?php 152 if ( $img ) { 153 ?> 154 <td width="100px" height="20" align="center"> 155 <?php echo $img;?> 156 </td> 157 <?php 158 } 159 ?> 160 <td height="20"> 161 <?php echo $txt; ?> 162 <?php 163 if ( $params->get( 'item_description' ) ) { 164 ?> 165 <br /> 166 <?php echo $row->description; ?> 167 <?php 168 } 169 ?> 170 </td> 171 <?php 172 if ( $params->get( 'hits' ) ) { 173 ?> 174 <td align="center"> 175 <?php echo $row->hits; ?> 176 </td> 177 <?php 178 } 179 ?> 180 </tr> 181 <?php 182 $k = 1 - $k; 183 } 184 ?> 185 </table> 186 <?php 187 } 188 189 /** 190 * Display links to categories 191 */ 192 function showCategories( &$params, &$categories, $catid ) { 193 global $mosConfig_live_site, $Itemid; 194 ?> 195 <ul> 196 <?php 197 if ($categories) { 198 foreach ( $categories as $cat ) { 199 if ( $catid == $cat->catid ) { 200 ?> 201 <li> 202 <strong> 203 <?php echo $cat->name;?> 204 </strong> 205 206 <span class="small"> 207 (<?php echo $cat->numlinks;?>) 208 </span> 209 </li> 210 <?php 211 } else { 212 $link = 'index.php?option=com_weblinks&catid='. $cat->catid .'&Itemid='. $Itemid; 213 ?> 214 <li> 215 <a href="<?php echo sefRelToAbs( $link ); ?>" class="category<?php echo $params->get( 'pageclass_sfx' ); ?>"> 216 <?php echo $cat->name;?> 217 </a> 218 219 <span class="small"> 220 (<?php echo $cat->numlinks;?>) 221 </span> 222 </li> 223 <?php 224 } 225 } 226 } else { 227 echo T_('There are currently no links'); 228 } 229 ?> 230 </ul> 231 <?php 232 } 233 234 /** 235 * Writes the edit form for new and existing record (FRONTEND) 236 * 237 * A new record is defined when <var>$row</var> is passed with the <var>id</var> 238 * property set to 0. 239 * @param mosWeblink The weblink object 240 * @param string The html for the categories select list 241 */ 242 function editWeblink( $option, &$row, &$lists ) { 243 $Returnid = intval( mosGetParam( $_REQUEST, 'Returnid', 0 ) ); 244 ?> 245 <script type="text/javascript"> 246 function submitbutton(pressbutton) { 247 var form = document.adminForm; 248 if (pressbutton == 'cancel') { 249 submitform( pressbutton ); 250 return; 251 } 252 253 // do field validation 254 if (form.title.value == ""){ 255 alert( '<?php echo T_("Web Link item must have a title"); ?>' ); 256 } else if (getSelectedValue('adminForm','catid') < 1) { 257 alert( '<?php echo T_("You must select a category."); ?>' ); 258 } else if (form.url.value == ""){ 259 alert( '<?php echo T_("You must have a url."); ?>' ); 260 } else { 261 submitform( pressbutton ); 262 } 263 } 264 </script> 265 266 <form action="<?php echo sefRelToAbs("index.php"); ?>" method="post" name="adminForm" id="adminForm"> 267 <table cellpadding="0" cellspacing="0" border="0" width="100%"> 268 <tr> 269 <td class="contentheading"> 270 <?php echo T_('Submit A Web Link'); ?> 271 </td> 272 <td width="10%"> 273 <?php 274 mosToolBar::startTable(); 275 mosToolBar::spacer(); 276 mosToolBar::save(); 277 mosToolBar::cancel(); 278 mosToolBar::endtable(); 279 ?> 280 </td> 281 </tr> 282 </table> 283 284 <table cellpadding="4" cellspacing="1" border="0" width="100%"> 285 <tr> 286 <td width="20%" align="right"> 287 <?php echo T_('Name:'); ?> 288 </td> 289 <td width="80%"> 290 <input class="inputbox" type="text" name="title" size="50" maxlength="250" value="<?php echo htmlspecialchars( stripslashes($row->title));?>" /> 291 </td> 292 </tr> 293 <tr> 294 <td valign="top" align="right"> 295 <?php echo T_('Section:'); ?> 296 </td> 297 <td> 298 <?php echo $lists['catid']; ?> 299 </td> 300 </tr> 301 <tr> 302 <td valign="top" align="right"> 303 <?php echo T_('URL:'); ?> 304 </td> 305 <td> 306 <input class="inputbox" type="text" name="url" value="<?php echo $row->url; ?>" size="50" maxlength="250" /> 307 </td> 308 </tr> 309 <tr> 310 <td valign="top" align="right"> 311 <?php echo T_('Description:'); ?> 312 </td> 313 <td> 314 <textarea class="inputbox" cols="30" rows="6" name="description" style="width:300px" width="300"><?php echo htmlspecialchars( $row->description, ENT_QUOTES );?></textarea> 315 </td> 316 </tr> 317 </table> 318 319 <input type="hidden" name="id" value="<?php echo $row->id; ?>" /> 320 <input type="hidden" name="option" value="<?php echo $option;?>" /> 321 <input type="hidden" name="task" value="" /> 322 <input type="hidden" name="ordering" value="<?php echo $row->ordering; ?>" /> 323 <input type="hidden" name="approved" value="<?php echo $row->approved; ?>" /> 324 <input type="hidden" name="Returnid" value="<?php echo $Returnid; ?>" /> 325 </form> 326 <?php 327 } 328 329 } 330 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Feb 8 00:05:01 2012 | Cross-referenced by PHPXref 0.7 |
| Mambo API: Mambo is Free software released under the GNU/General Public License, Version 2 |