/[drupal]/contributions/modules/flexiblock/flexiblock.module
ViewVC logotype

Diff of /contributions/modules/flexiblock/flexiblock.module

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

revision 1.7, Sat Jul 30 19:24:58 2005 UTC revision 1.8, Sat Aug 6 21:35:35 2005 UTC
# Line 1  Line 1 
1  <?php // $Id: flexiblock.module,v 1.6 2005/07/29 22:18:02 djnz Exp $  <?php // $Id: flexiblock.module,v 1.7 2005/07/30 19:24:58 djnz Exp $
2    
3  /**  /**
4   * @file   * @file
# Line 127  function flexiblock_admin_display() { Line 127  function flexiblock_admin_display() {
127    $header[] = array('data' => t('Operations'), 'colspan' => 1);    $header[] = array('data' => t('Operations'), 'colspan' => 1);
128    $header[] = t('Location');    $header[] = t('Location');
129    
130    $left = array();    $flexi = $left = $right = $disabled = array();
   $right = array();  
   $disabled = array();  
131    $select_mapping = array('0'=>'None', '1'=>'1', '2'=>'2', '3'=>'3', '4'=>'4', '5'=>'5', '6'=>'6', '7'=>'7', '8'=>'8', '9'=>'9');    $select_mapping = array('0'=>'None', '1'=>'1', '2'=>'2', '3'=>'3', '4'=>'4', '5'=>'5', '6'=>'6', '7'=>'7', '8'=>'8', '9'=>'9');
132    foreach ($blocks as $block) {    foreach ($blocks as $block) {
133      if ($block['module'] == 'block') {      if ($block['module'] == 'block') {
# Line 142  function flexiblock_admin_display() { Line 140  function flexiblock_admin_display() {
140      $row = array(array('data' => $block['info'], 'class' => 'block'),      $row = array(array('data' => $block['info'], 'class' => 'block'),
141        form_checkbox(NULL, $block['module'] .']['. $block['delta'] .'][status', 1, $block['status']),        form_checkbox(NULL, $block['module'] .']['. $block['delta'] .'][status', 1, $block['status']),
142        form_weight(NULL, $block['module'] .']['. $block['delta'] .'][weight', $block['weight']),        form_weight(NULL, $block['module'] .']['. $block['delta'] .'][weight', $block['weight']),
143        form_radios(NULL, $block['module'] .']['. $block['delta'] .'][region', $block['region'],        form_select(NULL, $block['module'] .']['. $block['delta'] .'][region', $block['region'],
144        array(t('left'), t('right'))));        array('99' => t('flexi'), '0' => t('left'), '1' => t('right'))));
145    
146      if (module_exist('throttle')) {      if (module_exist('throttle')) {
147        $row[] = form_checkbox(NULL, $block['module'] .']['. $block['delta'] .'][throttle', 1, $block['throttle']);        $row[] = form_checkbox(NULL, $block['module'] .']['. $block['delta'] .'][throttle', 1, $block['throttle']);
# Line 153  function flexiblock_admin_display() { Line 151  function flexiblock_admin_display() {
151      $row[] = form_select(NULL, $block['module'] .']['. $block['delta'] .'][flexi', $_mapping, $select_mapping);      $row[] = form_select(NULL, $block['module'] .']['. $block['delta'] .'][flexi', $_mapping, $select_mapping);
152      $row[] = $delete;      $row[] = $delete;
153      if ($block['status']) {      if ($block['status']) {
154        if ($block['region'] == 0) {        if ($block['region'] == 99) {
155            $flexi[$_mapping][] = $row;
156          } elseif ($block['region'] == 0) {
157          $left[] = $row;          $left[] = $row;
158        }        } elseif ($block['region'] == 1) {
       if ($block['region'] == 1) {  
159          $right[] = $row;          $right[] = $row;
160        }        }
161      }      }
162      else if ($block['region'] <= 1) {      else {
163        $disabled[] = $row;        $disabled[] = $row;
164      }      }
165    }    }
# Line 174  function flexiblock_admin_display() { Line 173  function flexiblock_admin_display() {
173      $rows[] = array(array('data' => t('Right sidebar'), 'class' => 'region', 'colspan' => (module_exist('throttle') ? 7 : 6)));      $rows[] = array(array('data' => t('Right sidebar'), 'class' => 'region', 'colspan' => (module_exist('throttle') ? 7 : 6)));
174      $rows = array_merge($rows, $right);      $rows = array_merge($rows, $right);
175    }    }
176      if (count($flexi)) {
177        ksort($flexi);
178        foreach ( $flexi as $region => $_flexi ) {
179          $rows[] = array(array('data' => t('Flexiblock location') . " $region", 'class' => 'region', 'colspan' => (module_exist('throttle') ? 7 : 6)));
180          $rows = array_merge($rows, $_flexi);
181        }
182      }
183    if (count($disabled)) {    if (count($disabled)) {
184      $rows[] = array(array('data' => t('Disabled'), 'class' => 'region', 'colspan' => (module_exist('throttle') ? 7 : 6)));      $rows[] = array(array('data' => t('Disabled'), 'class' => 'region', 'colspan' => (module_exist('throttle') ? 7 : 6)));
185      $rows = array_merge($rows, $disabled);      $rows = array_merge($rows, $disabled);
# Line 280  function _flexiblock_set_mapping($theme, Line 286  function _flexiblock_set_mapping($theme,
286  function theme_flexiblock_blocks($region=FALSE) {  function theme_flexiblock_blocks($region=FALSE) {
287  static $blocks, $regions;  static $blocks, $regions;
288    
289    // cache all available blocks    // run all flexiblock blocks
290    if ( !isset($blocks) ) {    if ( !isset($blocks) ) {
291      $regions = array();      $regions = array();
292      // get all the blocks      // get all the blocks
293      $blocks = block_list('all');      $blocks = block_list('flexi', array('flexi' => 99));
294      $mapping = _flexiblock_get_mapping();      $mapping = _flexiblock_get_mapping();
295      foreach ( $blocks as $key=>$block ) {      foreach ( $blocks as $key=>$block ) {
296        if ( isset($mapping[$key]) ) {        if ( isset($mapping[$key]) ) {

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

  ViewVC Help
Powered by ViewVC 1.1.2