Advertisement
Guest User

Untitled

a guest
Dec 26th, 2012
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.13 KB | None | 0 0
  1. <?php
  2.  
  3. function catwalkozet_block_info() {
  4. // This hook returns an array, each component of which is an array of block
  5. // information. The array keys are the 'delta' values used in other block
  6. // hooks.
  7.  
  8. // The required block information is a block description, which is shown
  9. // to the site administrator in the list of possible blocks. You can also
  10. // provide initial settings for block weight, status, etc.
  11.  
  12. // Many options are defined in hook_block_info():
  13. $blocks['catwalkozet'] = array(
  14. // info: The name of the block.
  15. 'info' => t('CatWalk Özet'),
  16. // Block caching options (per role, per user, etc.)
  17. 'cache' => DRUPAL_CACHE_PER_ROLE, // default
  18. );
  19.  
  20. // This sample shows how to provide default settings. In this case we'll
  21. // enable the block in the first sidebar and make it visible only on
  22. // 'node/*' pages. See the hook_block_info() documentation for these.
  23.  
  24. return $blocks;
  25. }
  26.  
  27. function catwalkozet_block_view()
  28. {
  29. global $block,$node,$page;
  30.  
  31. $block['info'] = 'CatWalk Özet...';
  32. $block['content'] = _create_catwalkozet();
  33.  
  34. return $block;
  35. }
  36.  
  37.  
  38. function _create_catwalkozet()
  39. {
  40.  
  41. global $language;
  42.  
  43. if($language->language == 'tr'){
  44. $lang_path = '/';
  45. }else{
  46. $lang_path = '/en/';
  47. }
  48.  
  49. $themeurl = '/drupal/'.path_to_theme().'/images';
  50. $sql = "SELECT * FROM `node`
  51. LEFT JOIN `field_data_field_anasayfa_catwalk` ON `field_data_field_anasayfa_catwalk`.`entity_id` = `node`.`nid`
  52. WHERE type = 'designers_albums'
  53. AND `node`.`status` = 1
  54. AND `node`.`language` = '".$language->language."'
  55. AND `field_data_field_anasayfa_catwalk`.`field_anasayfa_catwalk_value` = 1
  56. ORDER BY `node`.`created` ASC";
  57.  
  58. $rsCount = db_query("SELECT COUNT(*) AS toplam FROM node WHERE type='designers_albums' AND status=1 AND language='".$language->language."'")->fetchAssoc();
  59. $rsCount = $rsCount['toplam'];
  60.  
  61. $rs = db_query($sql);
  62.  
  63. if($rsCount>3)
  64. {
  65. $arrows = '<a href="javascript:void(0)" id="catwalkleft" onclick="catwalk(false,'.$rsCount.')"></a>
  66. <a href="javascript:void(0)" id="catwalkright" onclick="catwalk(true,'.$rsCount.')"></a>';
  67. }else{$arrows = '';}
  68.  
  69. $output = '<div id="catwalk">
  70. '.$arrows.'
  71. <table cellpadding="0" cellspacing="0" border="0">
  72. <tr>';
  73.  
  74. foreach($rs as $r)
  75. {
  76. $c_detay = node_load($r->nid);
  77. $big = image_style_url('tmb_230x350', $c_detay->field_photos[$language->language][0]['uri']);
  78.  
  79. $output.='
  80. <td>
  81. <a class="catwalktitle" href="'.$lang_path.'catwalk/'.$c_detay->nid.'">
  82. '.$c_detay->title.'<br />
  83. <span>'.$c_detay->field_season[$language->language][0]['safe_value'].'</span>
  84. </a>
  85.  
  86. <img src="'.$big.'" border="0">
  87. </td>
  88. <td><div style="width:10px;"></div></td>';
  89. }
  90.  
  91. $output.='</tr></table></div>';
  92. return $output;
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement