$cols, '###TABLE_HEAD###' => $table_head, '###TABLE_ROWS###' => $table_rows ); if(defined('__GAL_BIG')) $table=h_template_get_parsed_file("dmi-table-big", $replace); else $table=h_template_get_parsed_file("dmi-table", $replace); // h_cache_put_object($param_string, $table, 'object', __GAL_THUMBS_DIR); //} return $table; } function gal_get_container_head($objects, $count, $first, $cols, $area, $template_prefix) { global $PHP_SELF; s_log("count: $count\tfirst: $first\tcols: $cols\tarea: $area"); if($first==0) $previous=''; else { $prev_last=($area>$count)?$count:$area; $prev_last=$prev_last==1?"":" - $prev_last"; $previous=cal_get_container_head_first($prev_last, $template_prefix); if($first>$area) $previous.=cal_get_container_head_previous($first, $area, $template_prefix); else if(__GAL_NAV_SHOW_EDGES) $previous.=cal_get_container_head_previous_edges($prev_last, $template_prefix); } $last=$first+$area; if($last<$count) { $next_last=$last+$area; if($next_last<$count) { $next=cal_get_container_head_next($last, $next_last, $template_prefix); if($count-$next_last>$area) $next_last=$count-$area; } else { $next_last=$last; if(__GAL_NAV_SHOW_EDGES) $next=cal_get_container_head_next_edges($next_last, $count, $template_prefix); } $next.=cal_get_container_head_last($next_last, $count, $template_prefix); } else { $last=$count; $next=''; } if(empty($previous)&&empty($next)) return; $center=cal_get_container_head_center($first, $last, $template_prefix); return cal_get_container_head_all($previous, $center, $next, $template_prefix); } function gal_get_container_table($objects, $sort_objects, $first, $cols, $area, $template_prefix) { if((!is_array($objects))||(!is_array($sort_objects))) return; $j=-1; $cell_count=0; $img_row=''; $table_row=''; foreach ($sort_objects as $key => $value) { $j++; s_log("key: $key\tval: $value\tFIRST: $first\tarea: $area\tj: $j\tcell_count: $cell_count"); if($j<$first) continue; s_log("key: $key\tval: $value\tFIRST: $first\tarea: $area\tj: $j\tcell_count: $cell_count"); if($area<1) break; s_log("key: $key\tval: $value\tFIRST: $first\tarea: $area\tj: $j\tcell_count: $cell_count"); if( $cell_count >= $cols) { $table_row.=cal_get_container_table_row($img_row, $template_prefix); $img_row=''; $cell_count = 0; } $thumb_size=gal_get_thumb_size_from_file($objects[$key]['FILE'], $objects[$key]['DIR'], __GAL_THUMB_WIDTH, __GAL_THUMB_HEIGHT); if(defined('__GAL_BIG')) $img_row.=cal_get_container_table_big_image($key, $objects, $thumb_size, $template_prefix); else $img_row.=cal_get_container_table_small_image($key, $j, $objects, $thumb_size, $template_prefix); $cell_count++; $area--; } // fill up all the empty sells for($i=$cell_count;$i<$cols;$i++) { $img_row.=h_template_get_file($template_prefix."-table_image-empty"); } $table_row.=cal_get_container_table_row($img_row, $template_prefix); return $table_row; } #--------------------------------------------------------------------- function cal_get_container_table_small_image($key, $j, $objects, $thumb_size, $template_prefix) { global $PHP_SELF; $replace=array( '###IMG_LINK###' => "$PHP_SELF?" .__GAL_EXT_PARAMETERS ."GAL_IMG_FIRST=$j&GAL_IMG_SIZE=BIG", '###IMG_SIZE###' => "$thumb_size", '###IMG_SRC###' => __GAL_THUMB_APP.'?GAL_IMG_FILE='.$objects[$key]['FILE'], '###IMG_ALT###' => $objects[$key]['IMG_TITLE'], '###IMG_CTIME###' => date(__GAL_TEMPLATE_DATE_FORMAT,$objects[$key]['CTIME']), '###IMG_BORDER###' => 0, //Legacy, should be template-managed '###IMG_TITLE###' => $objects[$key]['IMG_TITLE'] ); s_log("--------------------------------------------------------*****"); return h_template_get_parsed_file($template_prefix."-table_image", $replace); } function cal_get_container_table_big_image($key, $objects, $thumb_size, $template_prefix) { $replace=array( '###IMG_LINK###' => __GAL_WEB_PHOTO_DIR.'/'.$objects[$key]['FILE'], '###IMG_SIZE###' => $thumb_size, '###IMG_SRC###' => __GAL_THUMB_APP.'?GAL_IMG_FILE='.$objects[$key]['FILE'].'&GAL_IMG_SIZE=BIG', '###IMG_ALT###' => $objects[$key]['IMG_TITLE'], '###IMG_CTIME###' => date(__GAL_TEMPLATE_DATE_FORMAT,$objects[$key]['CTIME']), '###IMG_BORDER###' => 0, //Legacy, $ould be template-managed '###IMG_TITLE###' => $objects[$key]['IMG_TITLE'] ); s_log("------------------__GAL_BIG--------------------------------------"); return h_template_get_parsed_file($template_prefix."-table_image-big", $replace); } function cal_get_container_table_row($img_row, $template_prefix) { $replace=array('###IMAGES###' => $img_row); return h_template_get_parsed_file("$template_prefix-table_image-row", $replace); } #--------------------------------------------------------------------- function cal_get_container_head_first($prev_last, $template_prefix) { global $PHP_SELF; $replace=array( '###FIRST_URL###' => "$PHP_SELF?". __GAL_EXT_PARAMETERS .(defined('__GAL_BIG')?'GAL_IMG_SIZE=BIG':''), '###FIRST_NAME###' => "1$prev_last" ); return h_template_get_parsed_file("$template_prefix-first", $replace); } function cal_get_container_head_previous($first, $area, $template_prefix) { global $PHP_SELF; $prev_first=$first-$area; $prev_first_num=$prev_first+1; $prev_first_num=$prev_first_num==$first?"":"$prev_first_num - "; $replace=array( '###PREV_URL###' => "$PHP_SELF?" . __GAL_EXT_PARAMETERS. "GAL_IMG_FIRST=$prev_first".(defined('__GAL_BIG')?'&GAL_IMG_SIZE=BIG':''), '###PREV_NAME###' => "$prev_first_num$first" ); return h_template_get_parsed_file("$template_prefix-previous", $replace); } function cal_get_container_head_previous_edges($prev_last, $template_prefix) { global $PHP_SELF; $replace=array( '###PREV_URL###' => "$PHP_SELF?". __GAL_EXT_PARAMETERS . (defined('__GAL_BIG')?'GAL_IMG_SIZE=BIG':''), '###PREV_NAME###' => "1$prev_last" ); return h_template_get_parsed_file("$template_prefix-previous", $replace); } function cal_get_container_head_center($first, $last, $template_prefix) { global $PHP_SELF; $first_num=$first+1; if(defined('__GAL_BIG')) { $replace=array( '###CENT_URL###' => "$PHP_SELF?" .__GAL_EXT_PARAMETERS ."GAL_IMG_FIRST=$first", '###CENT_NAME###' => __GAL_THUMB_LINK_TITLE ); $center=h_template_get_parsed_file("$template_prefix-center-big", $replace); } else { $replace=array( '###CENT_NAME###' => "$first_num - $last" ); $center=h_template_get_parsed_file("$template_prefix-center", $replace); } return $center; } function cal_get_container_head_next($last, $next_last, $template_prefix) { global $PHP_SELF; $next_first_num=$last+1; $next_first_num=$next_first_num==$next_last?'':"$next_first_num - "; $replace=array( '###NEXT_URL###' => "$PHP_SELF?".__GAL_EXT_PARAMETERS ."GAL_IMG_FIRST=$last".(defined('__GAL_BIG')?'&GAL_IMG_SIZE=BIG':''), '###NEXT_NAME###' => "$next_first_num$next_last" ); return h_template_get_parsed_file("$template_prefix-next", $replace); } function cal_get_container_head_next_edges($next_last, $count, $template_prefix) { global $PHP_SELF; $last_first_num=$next_last+1; $last_first_num=$last_first_num==$count?'':"$last_first_num - "; $replace=array( '###NEXT_URL###' => "$PHP_SELF?".__GAL_EXT_PARAMETERS . "GAL_IMG_FIRST=$next_last".(defined('__GAL_BIG')?'&GAL_IMG_SIZE=BIG':''), '###NEXT_NAME###' => "$last_first_num$count" ); return h_template_get_parsed_file("$template_prefix-next", $replace); } function cal_get_container_head_last($next_last, $count, $template_prefix) { global $PHP_SELF; $last_first_num=$next_last+1; $last_first_num=$last_first_num==$count?'':"$last_first_num - "; $replace=array( '###LAST_URL###' => "$PHP_SELF?" . __GAL_EXT_PARAMETERS . "GAL_IMG_FIRST=$next_last".(defined('__GAL_BIG')?'&GAL_IMG_SIZE=BIG':''), '###LAST_NAME###' => "$last_first_num$count" ); return h_template_get_parsed_file("$template_prefix-last", $replace); } function cal_get_container_head_all($previous, $center, $next, $template_prefix) { $replace=array( '###PREV###' => $previous, '###CENT###' => $center, '###NEXT###' => $next ); if(defined('__GAL_BIG')) return h_template_get_parsed_file("$template_prefix-table_head-big", $replace); else return h_template_get_parsed_file("$template_prefix-table_head", $replace); } #--------------------------------------------------------------------- } //__GAL_CONTAINER__ ?>