source: extensions/ASearchEngine/ase_root.class.inc.php @ 7236

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

Admin interface implemented

  • Property svn:executable set to *
File size: 5.8 KB
Line 
1<?php
2/* -----------------------------------------------------------------------------
3  Plugin     : Advanced Search Engine
4  Author     : Grum
5    email    : grum@piwigo.org
6    website  : http://photos.grum.fr
7
8    << May the Little SpaceFrog be with you ! >>
9  ------------------------------------------------------------------------------
10  See main.inc.php for release information
11
12  ASE_root : common classe for admin and public classes
13
14  --------------------------------------------------------------------------- */
15  include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php');
16  include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCCss.class.inc.php');
17
18  class ASE_root extends CommonPlugin
19  {
20    protected $css;
21
22    public function __construct($prefixeTable, $filelocation)
23    {
24      $this->setPluginName('Advanced Search Engine');
25      $this->setPluginNameFiles("ase");
26      parent::__construct($prefixeTable, $filelocation);
27      $this->section_name=$this->getPluginNameFiles();
28
29      $this->css = new GPCCss(dirname($this->getFileLocation()).'/'.$this->getPluginNameFiles().".css");
30    }
31
32    public function __destruct()
33    {
34      parent::__destruct();
35    }
36
37    public function initEvents()
38    {
39    }
40
41
42    /*
43      surchage of CommonPlugin->saveConfig function
44    */
45    public function saveConfig()
46    {
47      if(parent::saveConfig())
48      {
49        return(true);
50      }
51      return(false);
52    }
53
54    /*
55      surchage of CommonPlugin->saveConfig function
56    */
57    public function loadConfig()
58    {
59      parent::loadConfig();
60    }
61
62    /*
63      initialize default values
64    */
65    public function initConfig()
66    {
67      //global $user;
68      $this->config=array(
69        'ase_keyword_minLength' => 3,
70        'ase_publicAccess_active' => false,
71        'ase_publicAccess_applyLimits' => true,
72        'ase_publicAccess_limits' => 1000,
73        'ase_publicAccess_allowedPlugins' => array()
74      );
75    }
76
77
78    /**
79     *
80     */
81    protected function configForTemplate()
82    {
83      global $template;
84
85      $template->assign('aseConfig', $this->config);
86    }
87
88
89    public function getAdminLink($mode='')
90    {
91      if($mode=='ajax')
92      {
93        return('plugins/'.basename(dirname($this->getFileLocation())).'/ase_ajax.php');
94      }
95      else
96      {
97        return(parent::getAdminLink());
98      }
99    }
100
101    protected function displayResult($action_msg, $result)
102    {
103      global $page;
104
105      if($result)
106      {
107        array_push($page['infos'], $action_msg);
108      }
109      else
110      {
111        array_push($page['errors'], $action_msg);
112      }
113    }
114
115
116    /* ---------------------------------------------------------------------------
117
118    --------------------------------------------------------------------------- */
119
120
121
122  } //class
123
124
125
126class ASE_functions
127  {
128    static private $tables = Array();
129    static private $config = Array();
130
131    /**
132     * initialise the class
133     *
134     * @param String $prefixeTable : the piwigo prefixe used on tables name
135     * @param String $pluginNameFile : the plugin name used for tables name
136     */
137    static public function init($prefixeTable)
138    {
139      // no tables for this plugin
140    }
141
142
143    /**
144     *  return all HTML&JS code necessary to display a dialogbox to choose
145     *  tags
146     */
147    static public function dialogBoxASETags()
148    {
149      global $template;
150
151      $template->set_filename('ase_tag_choose',
152                    dirname(__FILE__).'/templates/ase_dialog_tag_choose.tpl');
153
154      $datas=Array();
155
156      $template->assign('datas', $datas);
157
158      return($template->parse('ase_tag_choose', true));
159    }
160
161
162    /**
163     *  return all HTML&JS code necessary to display a dialogbox to choose
164     *  categories
165     */
166    static public function dialogBoxASECategory()
167    {
168      global $template;
169
170      $template->set_filename('ase_category_choose',
171                    dirname(__FILE__).'/templates/ase_dialog_category_choose.tpl');
172
173      $datas=Array();
174
175      $template->assign('datas', $datas);
176
177      return($template->parse('ase_category_choose', true));
178    }
179
180    /**
181     *  return all HTML&JS code necessary to display a dialogbox to choose
182     *  dates
183     */
184    static public function dialogBoxASEDate()
185    {
186      global $template;
187
188      $template->set_filename('ase_date_choose',
189                    dirname(__FILE__).'/templates/ase_dialog_date_choose.tpl');
190
191      $datas=Array();
192
193      $template->assign('datas', $datas);
194
195      return($template->parse('ase_date_choose', true));
196    }
197
198    /**
199     *  return all HTML&JS code necessary to display a dialogbox to choose
200     *  keywords
201     */
202    static public function dialogBoxASEKeyword()
203    {
204      global $template;
205
206      $template->set_filename('ase_keyword_choose',
207                    dirname(__FILE__).'/templates/ase_dialog_keyword_choose.tpl');
208
209      $datas=Array();
210
211      $template->assign('datas', $datas);
212
213      return($template->parse('ase_keyword_choose', true));
214    }
215
216    /**
217     *  return all HTML&JS code necessary to display a dialogbox to choose
218     *  HD picture
219     */
220    static public function dialogBoxASEHD()
221    {
222      global $template;
223
224      $template->set_filename('ase_hd_choose',
225                    dirname(__FILE__).'/templates/ase_dialog_hd_choose.tpl');
226
227      $datas=Array();
228
229      $template->assign('datas', $datas);
230
231      return($template->parse('ase_hd_choose', true));
232    }
233
234    /**
235     *  return all HTML&JS code necessary to display a dialogbox to choose
236     *  rate on picture
237     */
238    static public function dialogBoxASERate()
239    {
240      global $template;
241
242      $template->set_filename('ase_rate_choose',
243                    dirname(__FILE__).'/templates/ase_dialog_rate_choose.tpl');
244
245      $datas=Array();
246
247      $template->assign('datas', $datas);
248
249      return($template->parse('ase_rate_choose', true));
250    }
251
252  } //ASE_functions
253
254
255
256?>
Note: See TracBrowser for help on using the repository browser.