Changeset 8345 for trunk/xmlrpc/BxDolXMLRPCMedia.php
- Timestamp:
- 01/11/09 21:37:12 (3 years ago)
- File:
-
- 1 edited
-
trunk/xmlrpc/BxDolXMLRPCMedia.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/xmlrpc/BxDolXMLRPCMedia.php
r8238 r8345 9 9 return new xmlrpcresp(new xmlrpcval(array('error' => new xmlrpcval(1,"int")), "scruct")); 10 10 11 global $tmpl; 12 require_once(BX_DIRECTORY_PATH_ROOT . 'templates/tmpl_'.$tmpl.'/scripts/BxTemplSearchSharedVideo.php'); 13 $oMedia = new BxTemplSearchSharedVideo(); 14 return BxDolXMLRPCMedia::_getFilesInCategory ($oMedia, $iIdProfile, $sCat); 11 return BxDolXMLRPCMedia::_getFilesInCategory ('shared_video', $iIdProfile, $sCat); 15 12 } 16 13 … … 21 18 return new xmlrpcresp(new xmlrpcval(array('error' => new xmlrpcval(1,"int")), "scruct")); 22 19 23 global $tmpl; 24 require_once(BX_DIRECTORY_PATH_ROOT . 'templates/tmpl_'.$tmpl.'/scripts/BxTemplSearchSharedMusic.php'); 25 $oMedia = new BxTemplSearchSharedMusic(); 26 return BxDolXMLRPCMedia::_getFilesInCategory ($oMedia, $iIdProfile, $sCat); 20 return BxDolXMLRPCMedia::_getFilesInCategory ('shared_music', $iIdProfile, $sCat); 27 21 } 28 22 … … 33 27 return new xmlrpcresp(new xmlrpcval(array('error' => new xmlrpcval(1,"int")), "scruct")); 34 28 35 require_once(BX_DIRECTORY_PATH_CLASSES . 'BxDolSharedMusic.php'); 36 $oMedia = new BxDolSharedMusic(); 37 38 return BxDolXMLRPCMedia::_getMediaCategories ($oMedia->sFileTable, $oMedia->aFileFields['medID'], $oMedia->sType, $iIdProfile); 29 return BxDolXMLRPCMedia::_getMediaCategories ('music', $iIdProfile); 39 30 } 40 31 … … 45 36 return new xmlrpcresp(new xmlrpcval(array('error' => new xmlrpcval(1,"int")), "scruct")); 46 37 47 require_once(BX_DIRECTORY_PATH_CLASSES . 'BxDolSharedVideo.php'); 48 $oMedia = new BxDolSharedVideo(); 49 50 return BxDolXMLRPCMedia::_getMediaCategories ($oMedia->sFileTable, $oMedia->aFileFields['medID'], $oMedia->sType, $iIdProfile); 38 return BxDolXMLRPCMedia::_getMediaCategories ('video', $iIdProfile); 51 39 } 52 40 53 function _getMediaCategories ($sT able, $sFieldId, $sType, $iIdProfile)41 function _getMediaCategories ($sType, $iIdProfile) 54 42 { 43 require_once(BX_DIRECTORY_PATH_CLASSES . 'BxDolCategories.php'); 44 $oCategories = new BxDolCategories(); 45 $oCategories->getTagObjectConfig(); 46 $aCategories = $oCategories->getCategoriesList($sType, $iIdProfile, true); 47 foreach ($aCategories as $sCat) 48 { 49 $aCat = array ( 50 'Id' => new xmlrpcval($sCat), 51 'Title' => new xmlrpcval($sCat), 52 'Num' =>new xmlrpcval(0), 53 ); 54 $aCats[] = new xmlrpcval($aCat, 'struct'); 55 } 56 return new xmlrpcval ($aCats, "array"); 57 58 /* 55 59 if (!($r = db_res (" 56 60 SELECT `c`.`Category`, COUNT(`f`.`$sFieldId`) AS `Num` … … 71 75 } 72 76 return new xmlrpcval ($aImages, "array"); 77 */ 73 78 } 74 79 75 function _getFilesInCategory (&$oMedia, $iIdProfile, $sCat) 76 { 77 $oMedia->aCurrent['restriction']['owner']['value'] = $iIdProfile; 78 $oMedia->aCurrent['paginate']['perPage'] = 1000; 79 $oMedia->aCurrent['join']['category'] = array( 80 'type' => 'left', 81 'table' => 'Categories', 82 'mainField' => $oMedia->aPseud['id'], 83 'onField' => 'ID', 84 'joinFields' => array('Category') 85 ); 86 $oMedia->aCurrent['restriction']['category'] = array( 87 'value' => $sCat, 88 'field' => 'Category', 89 'operator' => '=', 90 'table' => 'Categories' 91 ); 92 93 $aFiles = array(); 94 $a = $oMedia->getSearchData(); 80 function _getFilesInCategory ($sModuleName, $iIdProfile, $sCat) 81 { 82 $a = BxDolService::call ($sModuleName, 'get_files_in_cat', array($iIdProfile, $sCat), 'Search'); 95 83 if (!$a) 96 84 return new xmlrpcval (array(), "array"); 97 98 85 foreach ($a as $k => $aRow) 99 86 { … … 102 89 'title' => new xmlrpcval($aRow['title']), 103 90 'desc' => new xmlrpcval($aRow['size']), 104 'icon' =>new xmlrpcval($oMedia->getImgUrl($aRow['id'], 'icon')), 105 'thumb' =>new xmlrpcval($oMedia->getImgUrl($aRow['id'], 'thumb')), 106 'file' =>new xmlrpcval($oMedia->getImgUrl($aRow['id'], 'file')), 107 'cat' =>new xmlrpcval($sCat), 91 'icon' => new xmlrpcval($aRow['icon']), 92 'thumb' => new xmlrpcval($aRow['thumb']), 93 'file' => new xmlrpcval($aRow['file']), 94 'cat' => new xmlrpcval($sCat), 95 'rate' => new xmlrpcval($aRow['gal_rating_count'] ? $aRow['gal_rating_sum']/$aRow['gal_rating_count'] : 0), 96 'rate_count' => new xmlrpcval((int)$aRow['gal_rating_count']), 108 97 ); 109 98 $aFiles[] = new xmlrpcval($a, 'struct'); 110 99 } 111 112 100 return new xmlrpcval ($aFiles, "array"); 113 101 }
Note: See TracChangeset
for help on using the changeset viewer.