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

Last change on this file since 31936 was 16008, checked in by grum, 12 years ago

feature:2635- compatibility with Piwigo 2.4

  • Property svn:executable set to *
File size: 4.9 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
17  class ASE_root extends CommonPlugin
18  {
19    public function __construct($prefixeTable, $filelocation)
20    {
21      $this->setPluginName('Advanced Search Engine');
22      $this->setPluginNameFiles("ase");
23      parent::__construct($prefixeTable, $filelocation);
24      $this->section_name=$this->getPluginNameFiles();
25    }
26
27    public function __destruct()
28    {
29      parent::__destruct();
30    }
31
32
33
34    /*
35      surchage of CommonPlugin->saveConfig function
36    */
37    public function saveConfig()
38    {
39      if(parent::saveConfig())
40      {
41        return(true);
42      }
43      return(false);
44    }
45
46    /*
47      surchage of CommonPlugin->saveConfig function
48    */
49    public function loadConfig()
50    {
51      parent::loadConfig();
52    }
53
54    /*
55      initialize default values
56    */
57    public function initConfig()
58    {
59      //global $user;
60      $this->config=array(
61        'ase_keyword_minLength' => 3,
62        'ase_publicAccess_active' => false,
63        'ase_publicAccess_applyLimits' => true,
64        'ase_publicAccess_limits' => 1000,
65        'ase_publicAccess_allowedPlugins' => array()
66      );
67    }
68
69
70    /**
71     *
72     */
73    protected function configForTemplate()
74    {
75      global $template;
76
77      $template->assign('aseConfig', $this->config);
78    }
79
80
81    public function getAdminLink($mode='')
82    {
83      if($mode=='ajax')
84      {
85        return('plugins/'.basename(dirname($this->getFileLocation())).'/ase_ajax.php');
86      }
87      else
88      {
89        return(parent::getAdminLink());
90      }
91    }
92
93    protected function displayResult($action_msg, $result)
94    {
95      global $page;
96
97      if($result)
98      {
99        array_push($page['infos'], $action_msg);
100      }
101      else
102      {
103        array_push($page['errors'], $action_msg);
104      }
105    }
106
107
108    /* ---------------------------------------------------------------------------
109
110    --------------------------------------------------------------------------- */
111
112
113
114  } //class
115
116
117
118class ASE_functions
119  {
120    static private $tables = Array();
121    static private $config = Array();
122
123    /**
124     * initialise the class
125     *
126     * @param String $prefixeTable : the piwigo prefixe used on tables name
127     * @param String $pluginNameFile : the plugin name used for tables name
128     */
129    static public function init($prefixeTable)
130    {
131      // no tables for this plugin
132    }
133
134
135
136
137    /**
138     *  return all HTML&JS code necessary to display a dialogbox to choose
139     *  categories
140     */
141    static public function dialogBoxASECategory()
142    {
143      global $template;
144
145      $template->set_filename('ase_category_choose',
146                    dirname(__FILE__).'/templates/ase_dialog_category_choose.tpl');
147
148      return($template->parse('ase_category_choose', true));
149    }
150
151    /**
152     *  return all HTML&JS code necessary to display a dialogbox to choose
153     *  dates
154     */
155    static public function dialogBoxASEDate()
156    {
157      global $template;
158
159      $template->set_filename('ase_date_choose',
160                    dirname(__FILE__).'/templates/ase_dialog_date_choose.tpl');
161
162      return($template->parse('ase_date_choose', true));
163    }
164
165    /**
166     *  return all HTML&JS code necessary to display a dialogbox to choose
167     *  keywords
168     */
169    static public function dialogBoxASEKeyword()
170    {
171      global $template;
172
173      $template->set_filename('ase_keyword_choose',
174                    dirname(__FILE__).'/templates/ase_dialog_keyword_choose.tpl');
175
176      $config=array();
177      GPCCore::loadConfig('ase', $config);
178      $template->assign('aseConfig', $config);
179
180      return($template->parse('ase_keyword_choose', true));
181    }
182
183    /**
184     *  return all HTML&JS code necessary to display a dialogbox to choose
185     *  rate on picture
186     */
187    static public function dialogBoxASERate()
188    {
189      global $template;
190
191      $template->set_filename('ase_rate_choose',
192                    dirname(__FILE__).'/templates/ase_dialog_rate_choose.tpl');
193
194      return($template->parse('ase_rate_choose', true));
195    }
196
197    /**
198     *  return all HTML&JS code necessary to display a dialogbox to choose
199     *  tags on picture
200     */
201    static public function dialogBoxASETag()
202    {
203      global $template;
204
205      $template->set_filename('ase_tag_choose',
206                    dirname(__FILE__).'/templates/ase_dialog_tag_choose.tpl');
207
208      return($template->parse('ase_tag_choose', true));
209    }
210
211  } //ASE_functions
212
213
214
215?>
Note: See TracBrowser for help on using the repository browser.