source: extensions/GrumPluginClasses/classes/GPCTabSheet.class.inc.php @ 5918

Last change on this file since 5918 was 5918, checked in by grum, 14 years ago

Prepare release 3.1.0

File size: 3.6 KB
Line 
1<?php
2/* -----------------------------------------------------------------------------
3  class name     : GPCTabSheet
4  class version  : 1.0.0
5  plugin version : 3.0.2
6  date           : 2010-04-18
7  ------------------------------------------------------------------------------
8  author: grum at piwigo.org
9  << May the Little SpaceFrog be with you >>
10  ------------------------------------------------------------------------------
11
12  :: HISTORY
13
14| release | date       |
15| 1.0.0   | 2010/04/18 | * create class
16|         |            |
17|         |            |
18|         |            |
19|         |            |
20|         |            |
21|         |            |
22
23  ------------------------------------------------------------------------------
24
25   this class provides base functions to manage tabsheet navigation
26
27   this class extends the Piwigo tabsheet class
28
29    - constructor GPCPagesNavigation()
30    - (public) function setNbItems($nbitems)
31    - (public) function getNbItems()
32    - (public) function setNbItemsPerPage($nbitems)
33    - (public) function getNbItemsPerPage()
34    - (public) function getNbPages()
35    - (public) function setCurrentPage($page)
36    - (public) function getCurrentPage()
37    - (public) function setBaseUrl($url)
38    - (public) function getBaseUrl()
39    - (public) function setOptions($var)
40    - (public) function getOptions()
41    - (public) function makeNavigation()
42    - (private) function calcNbPages()
43   ---------------------------------------------------------------------- */
44
45include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
46
47class GPCTabSheet extends tabsheet
48{
49  protected $classes;
50  protected $id;
51  protected $tplFile;
52  /*
53    $name is the tabsheet's name inside the template .tpl file
54    $titlename in the template is affected by $titlename value
55  */
56  public function __construct($name = 'TABSHEET', $titlename = 'TABSHEET_TITLE', $classes="", $id="", $tplFile="")
57  {
58    parent::tabsheet($name, $titlename);
59    $this->classes=$classes;
60    $this->id=$id;
61    $this->setTplFile($tplFile);
62  }
63
64
65  public function setClasses($classes)
66  {
67    $this->classes=$classes;
68    return($this->classes);
69  }
70
71  public function getClasses()
72  {
73    return($this->classes);
74  }
75
76  public function setId($id)
77  {
78    $this->id=$id;
79    return($this->id);
80  }
81
82  public function getId()
83  {
84    return($this->id);
85  }
86
87  public function setTplFile($fileName)
88  {
89    if(file_exists($fileName) or $fileName=="")
90    {
91      $this->tplFile=$fileName;
92    }
93    return($this->tplFile);
94  }
95
96  public function getTplFile()
97  {
98    return($this->tplFile);
99  }
100
101
102  /*
103   * Build TabSheet and assign this content to current page
104   *
105   * Fill $this->$name {default value = TABSHEET} with HTML code for tabsheet
106   * Fill $this->titlename {default value = TABSHEET_TITLE} with formated caption of the selected tab
107   */
108  function assign()
109  {
110    global $template;
111
112    if($this->tplFile=="")
113    {
114      $tplFile=dirname(dirname(__FILE__)).'/templates/GPCTabSheet.tpl';
115    }
116    else
117    {
118      $tplFile=$this->tplFile;
119    }
120
121    $template->set_filename('tabsheet', $tplFile);
122    $template->assign('tabsheet', $this->sheets);
123    $template->assign('tabsheet_selected', $this->selected);
124
125    $selected_tab = $this->get_selected();
126
127    if (isset($selected_tab))
128    {
129      $template->assign(
130        array($this->titlename => '['.$selected_tab['caption'].']'));
131    }
132
133    if($this->classes!="") $template->assign('tabsheet_classes', $this->classes);
134    if($this->id!="") $template->assign('tabsheet_id', $this->id);
135
136    $template->assign_var_from_handle($this->name, 'tabsheet');
137    $template->clear_assign('tabsheet');
138  }
139}
140
141?>
Note: See TracBrowser for help on using the repository browser.