PEAK XOOPS - 2.82のピックアップブロックについて in englishin japanese

2.82のピックアップブロックについて

  • You cannot open a new topic into this forum
  • Guests cannot post into this forum
Previous post - Next post | Parent - Children.1 | Posted on 2004/7/19 17:04
oaktti  °ìÅùʼ   Posts: 12
さて、この度ピックアップ作品ブロックを設置しようと思い、
設定してみたのですが、表示されません。

当サイトはイメージではなく音声ファイルや、圧縮ファイルを扱っているためかなあ?と思ったりするのですが、何とか表示させる方法はないでしょうか?

http://okatti.kir.jp/garageband/
です。

以上、宜しくお願い申し上げます。
Votes:0 Average:0.00
Previous post - Next post | Parent - Children.1 | Posted on 2004/7/21 18:43
GIJOE  ÀèǤ·³Áâ   Posts: 4110
okattiさん、こんにちは。

ランダム画像ブロックには、いわゆる画像ファイル以外はピックアップされないような処理をしてあるのですが、考えてみれば、画像以外をピックアップされたくない人は、カテゴリーで絞れば良いんですよね。

というわけで、次のリリースでは、画像ファイル以外もピックアップされるようにしてみます。
変更したコードはこんな感じです。

blocks/myalbum_rphoto.php
function b_myalbum_rphoto_show( $options )
{
	global $xoopsDB ;

	// For myAlbum-P < 2.70
	if( strncmp( $options[0] , 'myalbum' , 7 ) != 0 ) {
		$photos_num = intval( $options[1] ) ;
		$box_size = intval( $options[0] ) ;
		$mydirname = 'myalbum' ;
	} else {
		$photos_num = intval( $options[2] ) ;
		$box_size = intval( $options[1] ) ;
		$mydirname = $options[0] ;
	}
	$cat_limitation = empty( $options[3] ) ? 0 : intval( $options[3] ) ;
	$cat_limit_recursive = empty( $options[4] ) ? 0 : 1 ;
	$cycle = empty( $options[5] ) ? 60 : intval( $options[5] ) ;

	include( XOOPS_ROOT_PATH."/modules/$mydirname/include/read_configs.php" ) ;

	// Category limitation
	if( $cat_limitation ) {
		if( $cat_limit_recursive ) {
			include_once( XOOPS_ROOT_PATH."/class/xoopstree.php" ) ;
			$cattree = new XoopsTree( $table_cat , "cid" , "pid" ) ;
			$children = $cattree->getAllChildId( $cat_limitation ) ;
			$whr_cat = "cid IN (" ;
			foreach( $children as $child ) {
				$whr_cat .= "$child," ;
			}
			$whr_cat .= "$cat_limitation)" ;
		} else {
			$whr_cat = "cid='$cat_limitation'" ;
		}
	} else {
		$whr_cat = '1' ;
	}

	// WHERE clause for ext
	$whr_ext = "ext IN ('" . implode( "','" , $myalbum_normal_exts ) . "')"  "1" ;

	$block = array() ;
	$myts =& MyTextSanitizer::getInstance() ;

	// Get number of photo 
	$result = $xoopsDB->query( "SELECT count(lid) FROM $table_photos WHERE status>0 AND $whr_cat AND $whr_ext" ) ;
	list( $numrows ) = $xoopsDB->fetchRow( $result ) ;
	if( $numrows < 1 ) return $block ;

	if( $numrows <= $photos_num ) {
		$result = $xoopsDB->query( "SELECT lid , cid , title , ext , res_x , res_y , submitter , status , date AS unixtime , hits , rating , votes , comments FROM $table_photos WHERE status>0 AND $whr_cat AND $whr_ext" ) ;
	} else {
		$result = $xoopsDB->query( "SELECT lid FROM $table_photos WHERE status>0 AND $whr_cat AND $whr_ext" ) ;
		$lids = array() ;
		$sel_lids = array() ;
		while( list( $lid ) = $xoopsDB->fetchRow( $result ) ) $lids[] = $lid ;
		srand( intval( time() / $cycle ) * $cycle ) ;
		$sel_lids = array_rand( $lids , $photos_num ) ;
		if( is_array( $sel_lids ) ) {
			$whr_lid = '' ;
			foreach( $sel_lids as $key ) $whr_lid .= $lids[ $key ] . "," ;
			$whr_lid = substr( $whr_lid , 0 , -1 ) ;
		} else {
			$whr_lid = $lids[ $sel_lids ] ;
		}
		$result = $xoopsDB->query( "SELECT lid , cid , title , ext , res_x , res_y , submitter , status , date AS unixtime , hits , rating , votes , comments FROM $table_photos WHERE status>0 AND lid IN ($whr_lid)" ) ;
	}

	while( $photo = $xoopsDB->fetchArray( $result ) ) {
		$photo['title'] = $myts->makeTboxData4Show( $photo['title'] ) ;
		$photo['suffix'] = $photo['hits'] > 1 ? 'hits' : 'hit' ;
		$photo['date'] = formatTimestamp( $photo['unixtime'] , 's' ) ;
		$photo['thumbs_url'] = $thumbs_url ;

		if( in_array( strtolower( $photo['ext'] ) , $myalbum_normal_exts ) ) {
		// width&height attirbs for <img>
		if( $box_size <= 0 ) {
			$photo['img_attribs'] = "" ;
		} else {
			list( $width , $height , $type ) = getimagesize( "$thumbs_dir/{$photo['lid']}.{$photo['ext']}" ) ;
			if( $width > $box_size || $height > $box_size ) {
				if( $width > $height ) $photo['img_attribs'] = "width='$box_size'" ;
				else $photo['img_attribs'] = "height='$box_size'" ;
			} else {
				$photo['img_attribs'] = "" ;
			}
		}
		} else {
			$photo['ext'] = 'gif' ;
			$photo['img_attribs'] = '' ;
		}

		$block['photo'][] = $photo ;
	}
	$block['mod_url'] = $mod_url ;

	return $block ;
}
Votes:2 Average:10.00
Previous post - Next post | Parent - Children.1 | Posted on 2004/7/22 10:40
oaktti  °ìÅùʼ   Posts: 12
ありがとうございます。

とても便利になりました〜。

いつも素早い対応に感謝感謝です。

でも、これくらいは自分でコード読んで、
出来るようにならないとダメですね。

少しずつ勉強します。

ついでに聞いてしまってよろしいでしょうか?

BopCommentと言うモジュールで、myalbum-Pの
更新情報がおかしくなってしまうと言う件がありまして、
http://finalgear.s33.xrea.com:8080/xoops/modules/newbb/viewtopic.php?forum=26&topic_id=219
こちらで話題になっております。

解決のヒントを頂ければ、と思い、
書き込みさせて頂きます。

以上、宜しくお願い申し上げます。

Votes:0 Average:0.00
Previous post - Next post | Parent - No child | Posted on 2004/7/26 7:07
GIJOE  ÀèǤ·³Áâ   Posts: 4110
okattiさん、こんにちは。
Quote:
BopCommentと言うモジュールで、myalbum-Pの
更新情報がおかしくなってしまうと言う件がありまして、
http://finalgear.s33.xrea.com:8080/xoops/modules/newbb/viewtopic.php?forum=26&topic_id=219
こちらで話題になっております。
BopCommentsは当然知ってますよ。piCal用のプラグインを書いたこともあります。
ただ、そのスレッドを拝見した限りでは、すでに修正されたのではないでしょうか?

それと、DanielさんのMyAlbumでも、修正後のstatusは2だったはずで、そのあたりの互換性問題も出ないとおもいます。
Votes:0 Average:0.00

  Advanced search


Login
Username or e-mail:

Password:

Remember Me

Lost Password?

Register now!