Annotation of /com_supacart/trunk/admin_files/html/product.filemanager.php
Parent Directory
|
Revision Log
Revision 4 - (view) (download)
| 1 : | andphe | 4 | <?php |
| 2 : | defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); | ||
| 3 : | /** | ||
| 4 : | * | ||
| 5 : | * @version $Id: product.filemanager.php 617 2007-01-04 19:43:08Z soeren_nb $ | ||
| 6 : | * @package SupaCart | ||
| 7 : | * @subpackage html | ||
| 8 : | * See COPYRIGHT.php for copyright notices and details. | ||
| 9 : | * @license GNU/GPL Version 2, see LICENSE.php | ||
| 10 : | * SupaCart is free software, originally derived from Virtuemart. This version may have been modified pursuant | ||
| 11 : | * to the GNU General Public License, and as distributed it includes or | ||
| 12 : | * is derivative of works licensed under the GNU General Public License or | ||
| 13 : | * other free or open source software licenses. | ||
| 14 : | * See /administrator/components/com_supacart/COPYRIGHT.php for copyright notices and details. | ||
| 15 : | * | ||
| 16 : | * http://www.supacart.com | ||
| 17 : | */ | ||
| 18 : | mm_showMyFileName( __FILE__ ); | ||
| 19 : | require_once( CLASSPATH . "pageNavigation.class.php" ); | ||
| 20 : | require_once( CLASSPATH . "htmlTools.class.php" ); | ||
| 21 : | |||
| 22 : | $product_id = mosGetParam($_REQUEST, 'product_id' ); | ||
| 23 : | |||
| 24 : | if (!empty($keyword)) { | ||
| 25 : | $list = "SELECT product_id, product_name, product_sku, product_publish,product_parent_id FROM #__{sc}_product WHERE "; | ||
| 26 : | $count = "SELECT count(*) as num_rows FROM #__{sc}_product WHERE "; | ||
| 27 : | //$q = "product.vendor_id = '$ps_vendor_id' "; | ||
| 28 : | $q = "(#__{sc}_product.product_name LIKE '%$keyword%' OR "; | ||
| 29 : | $q .= "#__{sc}_product.product_sku LIKE '%$keyword%' OR "; | ||
| 30 : | $q .= "#__{sc}_product.product_s_desc LIKE '%$keyword%' OR "; | ||
| 31 : | $q .= "#__{sc}_product.product_desc LIKE '%$keyword%'"; | ||
| 32 : | $q .= ") "; | ||
| 33 : | $q .= "ORDER BY product_name "; | ||
| 34 : | $list .= $q . " LIMIT $limitstart, " . $limit; | ||
| 35 : | $count .= $q; | ||
| 36 : | } | ||
| 37 : | else { | ||
| 38 : | $list = "SELECT product_id, product_name, product_sku, product_publish,product_parent_id FROM #__{sc}_product "; | ||
| 39 : | $count = "SELECT count(*) as num_rows FROM #__{sc}_product "; | ||
| 40 : | //$q = "WHERE product.vendor_id = '$ps_vendor_id' "; | ||
| 41 : | $q = "ORDER BY product_name "; | ||
| 42 : | $list .= $q . " LIMIT $limitstart, " . $limit; | ||
| 43 : | $count .= $q; | ||
| 44 : | } | ||
| 45 : | $db->query($count); | ||
| 46 : | $db->next_record(); | ||
| 47 : | $num_rows = $db->f("num_rows"); | ||
| 48 : | |||
| 49 : | // Create the Page Navigation | ||
| 50 : | $pageNav = new vmPageNav( $num_rows, $limitstart, $limit ); | ||
| 51 : | |||
| 52 : | // Create the List Object with page navigation | ||
| 53 : | $listObj = new listFactory( $pageNav ); | ||
| 54 : | |||
| 55 : | // print out the search field and a list heading | ||
| 56 : | $listObj->writeSearchHeader($VM_LANG->_PHPSHOP_FILEMANAGER_LIST, IMAGEURL."ps_image/mediamanager.png", $modulename, "filemanager"); | ||
| 57 : | |||
| 58 : | // start the list table | ||
| 59 : | $listObj->startTable(); | ||
| 60 : | |||
| 61 : | // these are the columns in the table | ||
| 62 : | $columns = Array( "#" => "width=\"20\"", | ||
| 63 : | $VM_LANG->_PHPSHOP_PRODUCT_LIST_NAME => '', | ||
| 64 : | $VM_LANG->_PHPSHOP_PRODUCT_LIST_SKU => '', | ||
| 65 : | $VM_LANG->_PHPSHOP_FILEMANAGER_ADD => '', | ||
| 66 : | $VM_LANG->_PHPSHOP_FILEMANAGER_IMAGES => '', | ||
| 67 : | $VM_LANG->_PHPSHOP_FILEMANAGER_DOWNLOADABLE => '', | ||
| 68 : | $VM_LANG->_PHPSHOP_FILEMANAGER_FILES => '', | ||
| 69 : | $VM_LANG->_PHPSHOP_FILEMANAGER_PUBLISHED => '' | ||
| 70 : | ); | ||
| 71 : | $listObj->writeTableHeader( $columns ); | ||
| 72 : | |||
| 73 : | $db->query($list); | ||
| 74 : | $i = 0; | ||
| 75 : | $dbp = new ps_DB; | ||
| 76 : | while ($db->next_record()) { | ||
| 77 : | |||
| 78 : | $listObj->newRow(); | ||
| 79 : | |||
| 80 : | $tmp_cell = ""; | ||
| 81 : | |||
| 82 : | // The row number | ||
| 83 : | $listObj->addCell( $pageNav->rowNumber( $i ) ); | ||
| 84 : | |||
| 85 : | // Is the product downloadable? | ||
| 86 : | $dbp->setQuery( "SELECT attribute_name FROM #__{sc}_product_attribute WHERE product_id='" . $db->f("product_id") . "' AND attribute_name='download'" ); | ||
| 87 : | $dbp->loadObject( $downloadable ); | ||
| 88 : | |||
| 89 : | // What Images does the product have ? | ||
| 90 : | $dbp->setQuery( "SELECT count(file_id) as images FROM #__{sc}_product_files WHERE file_product_id='" . $db->f("product_id") . "' AND file_is_image='1' " ); | ||
| 91 : | $images = array(); | ||
| 92 : | $dbp->loadObject($images); | ||
| 93 : | |||
| 94 : | // What Files does the product have ? | ||
| 95 : | $dbp->setQuery( "SELECT count(file_id) as files FROM #__{sc}_product_files WHERE file_product_id='" . $db->f("product_id") . "' AND file_is_image='0' " ); | ||
| 96 : | $files = array(); | ||
| 97 : | $dbp->loadObject($files); | ||
| 98 : | |||
| 99 : | if( $db->f("product_parent_id")) { | ||
| 100 : | $tmp_cell = " "; | ||
| 101 : | } | ||
| 102 : | $tmp_cell .= $db->f("product_name"); | ||
| 103 : | $listObj->addCell( $tmp_cell ); | ||
| 104 : | |||
| 105 : | $listObj->addCell( $db->f("product_sku") ); | ||
| 106 : | |||
| 107 : | $url = $_SERVER['PHP_SELF']."?page=$modulename.file_list&product_id=" . $db->f("product_id"); | ||
| 108 : | $tmp_cell = " <a href=\"" . $sess->url($url) . "\">[ ".$VM_LANG->_PHPSHOP_FILEMANAGER_ADD." ]</a>"; | ||
| 109 : | $listObj->addCell( $tmp_cell ); | ||
| 110 : | |||
| 111 : | $tmp_cell = empty($images->images) ? "0" : $images->images; | ||
| 112 : | $listObj->addCell( $tmp_cell ); | ||
| 113 : | |||
| 114 : | if (empty($downloadable)) { | ||
| 115 : | $tmp_cell = '<img src="'. $mosConfig_live_site .'/administrator/images/publish_x.png" border="0" alt="Publish" />'; | ||
| 116 : | } | ||
| 117 : | else { | ||
| 118 : | $tmp_cell = '<img src="'. $mosConfig_live_site .'/administrator/images/tick.png" border="0" alt="Unpublish" />'; | ||
| 119 : | } | ||
| 120 : | $listObj->addCell( $tmp_cell ); | ||
| 121 : | |||
| 122 : | unset( $downloadable ); | ||
| 123 : | |||
| 124 : | $tmp_cell = empty($files->files) ? "0" : $files->files; | ||
| 125 : | $listObj->addCell( $tmp_cell ); | ||
| 126 : | |||
| 127 : | if ($db->f("product_publish")=="N") { | ||
| 128 : | $tmp_cell = '<img src="'. $mosConfig_live_site .'/administrator/images/publish_x.png" border="0" alt="Publish" />'; | ||
| 129 : | } | ||
| 130 : | else { | ||
| 131 : | $tmp_cell = '<img src="'. $mosConfig_live_site .'/administrator/images/tick.png" border="0" alt="Unpublish" />'; | ||
| 132 : | } | ||
| 133 : | $listObj->addCell( $tmp_cell ); | ||
| 134 : | |||
| 135 : | $i++; | ||
| 136 : | } | ||
| 137 : | |||
| 138 : | $listObj->writeTable(); | ||
| 139 : | |||
| 140 : | $listObj->endTable(); | ||
| 141 : | |||
| 142 : | $listObj->writeFooter( $keyword, "&task=list" ); | ||
| 143 : | |||
| 144 : | ?> |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |
Web Hosting provided by Network Redux.

