/[drupal]/contributions/modules/flickr/block/flickr_block.module
ViewVC logotype

Diff of /contributions/modules/flickr/block/flickr_block.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.15.2.1, Fri Jan 30 10:39:01 2009 UTC revision 1.15.2.2, Tue Mar 17 21:56:54 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: flickr_block.module,v 1.15 2008/11/21 10:19:37 paulbooker Exp $  // $Id: flickr_block.module,v 1.15.2.1 2009/01/30 10:39:01 paulbooker Exp $
3    
4  /**  /**
5   * Implementation of hook_block().   * Implementation of hook_block().
# Line 16  function flickr_block($op = 'list', $del Line 16  function flickr_block($op = 'list', $del
16      $blocks[3]['info'] = t('Flickr recent photos');      $blocks[3]['info'] = t('Flickr recent photos');
17      $blocks[4]['info'] = t('Flickr recent photosets');      $blocks[4]['info'] = t('Flickr recent photosets');
18      $blocks[5]['info'] = t('Flickr random photos');      $blocks[5]['info'] = t('Flickr random photos');
19            $blocks[6]['info'] = t('Flickr group photos');
20    
21          // Photoset blocks          // Photoset blocks
22          $blocks[6]['info'] = t('Flickr random photo from photoset');          $blocks[7]['info'] = t('Flickr random photo from photoset');
23    
24      return $blocks;      return $blocks;
25    
# Line 78  function flickr_block($op = 'list', $del Line 79  function flickr_block($op = 'list', $del
79        break;        break;
80      case 5: // sitewide, random      case 5: // sitewide, random
81        break;        break;
82          case 6: // sitewide, random          case 6: // sitewide, group
83              $form["flickr_block_{$delta}_user_id"]['#title'] = t('Show photos from this group id');
84              $form["flickr_block_{$delta}_user_id"]['#description'] = t('Will select photos from this group pool');
85              break;
86            case 7: // sitewide, random
87            $form["flickr_block_{$delta}_photoset"] = array(            $form["flickr_block_{$delta}_photoset"] = array(
88              '#type' => 'textfield',              '#type' => 'textfield',
89              '#title' => t('Flickr Photoset Id'),              '#title' => t('Flickr Photoset Id'),
# Line 105  function flickr_block($op = 'list', $del Line 110  function flickr_block($op = 'list', $del
110      case 3:      case 3:
111      case 4:      case 4:
112      case 5:      case 5:
113        case 6:
114        variable_set('flickr_block_'. $delta, array(        variable_set('flickr_block_'. $delta, array(
115          'user_id' => $edit["flickr_block_{$delta}_user_id"],          'user_id' => $edit["flickr_block_{$delta}_user_id"],
116          'show_n' => (int) $edit["flickr_block_{$delta}_show_n"],          'show_n' => (int) $edit["flickr_block_{$delta}_show_n"],
117          'size' => $edit["flickr_block_{$delta}_size"],          'size' => $edit["flickr_block_{$delta}_size"],
118        ));        ));
119        break;        break;
120          case 6:          case 7:
121            variable_set('flickr_block_'. $delta, array(            variable_set('flickr_block_'. $delta, array(
122            'user_id' => $edit["flickr_block_{$delta}_user_id"],            'user_id' => $edit["flickr_block_{$delta}_user_id"],
123            'show_n' => (int) $edit["flickr_block_{$delta}_show_n"],            'show_n' => (int) $edit["flickr_block_{$delta}_show_n"],
# Line 169  function flickr_block($op = 'list', $del Line 175  function flickr_block($op = 'list', $del
175        $block['subject'] = t('Flickr random photos');        $block['subject'] = t('Flickr random photos');
176        $block['content'] = _flickr_block_random($settings['user_id'], $settings['show_n'], $settings['size']);        $block['content'] = _flickr_block_random($settings['user_id'], $settings['show_n'], $settings['size']);
177      }      }
178          elseif ($delta == 6) {      elseif ($delta == 6) {
179              $block['subject'] = t('Flickr Group photos');
180              $block['content'] = _flickr_block_group_recent($settings['user_id'], $settings['show_n'], $settings['size']);
181            }
182            elseif ($delta == 7) {
183            $block['subject'] = t('Flickr random photoset photos');            $block['subject'] = t('Flickr random photoset photos');
184            $block['content'] = _flickr_block_photoset_random($settings['user_id'], $settings['show_n'], $settings['size'], $settings['photoset_id']);            $block['content'] = _flickr_block_photoset_random($settings['user_id'], $settings['show_n'], $settings['size'], $settings['photoset_id']);
185          }          }
# Line 258  function _flickr_block_photoset_random($ Line 268  function _flickr_block_photoset_random($
268    return $output;    return $output;
269  }  }
270    
271    /*
272     * This renders a block with photos from the selected groupid
273     */
274    function _flickr_block_group_recent($groupid, $show_n, $size) {
275      $output = '';
276      if ($photos = flickr_get_group_photos($groupid, 1, array('per_page' => $show_n))) {
277        foreach ($photos['photo'] as $photo) {
278          $output .= theme('flickr_block_photo', $photo, $size);
279        }
280      }
281      return $output;
282    }
283    
284  /**  /**
285   * Implementation of hook_theme().   * Implementation of hook_theme().
286   */   */

Legend:
Removed from v.1.15.2.1  
changed lines
  Added in v.1.15.2.2

  ViewVC Help
Powered by ViewVC 1.1.2