Changeset 18760


Ignore:
Timestamp:
Oct 27, 2012, 2:32:43 PM (11 years ago)
Author:
mistic100
Message:

feature:2781 Add template method to sort actions buttons

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/template.class.php

    r18630 r18760  
    4747  const COMBINED_CSS_TAG = '<!-- COMBINED_CSS -->';
    4848  var $css_by_priority = array();
     49 
     50  var $picture_buttons = array();
     51  var $index_buttons = array();
    4952
    5053  function Template($root = ".", $theme= "", $path = "template")
     
    853856    return $themeconfs[$dir];
    854857  }
     858 
     859  function add_picture_button($content, $rank)
     860  {
     861    $this->picture_buttons[$rank][] = $content;
     862  }
     863 
     864  function add_index_button($content, $rank)
     865  {
     866    $this->index_buttons[$rank][] = $content;
     867  }
     868 
     869  function parse_picture_buttons()
     870  {
     871    if (!empty($this->picture_buttons))
     872    {
     873      ksort($this->picture_buttons);
     874      foreach ($this->picture_buttons as $ranked)
     875        foreach ($ranked as $content)
     876          $this->concat('PLUGIN_PICTURE_ACTIONS', $content);
     877    }
     878  }
     879   
     880  function parse_index_buttons()
     881  {
     882    if (!empty($this->index_buttons))
     883    {
     884      ksort($this->index_buttons);
     885      foreach ($this->index_buttons as $ranked)
     886        foreach ($ranked as $content)
     887          $this->concat('PLUGIN_INDEX_ACTIONS', $content);
     888    }
     889  }
     890   
    855891}
    856892
  • trunk/index.php

    r18667 r18760  
    335335trigger_action('loc_end_index');
    336336include(PHPWG_ROOT_PATH.'include/page_messages.php');
     337$template->parse_index_buttons();
    337338$template->pparse('index');
    338339//------------------------------------------------------------ log informations
  • trunk/picture.php

    r18757 r18760  
    10001000else
    10011001{
     1002  $template->parse_picture_buttons();
    10021003  $template->pparse('picture');
    10031004}
Note: See TracChangeset for help on using the changeset viewer.