[7196] | 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 | /* |
---|
[7207] | 63 | initialize default values |
---|
[7196] | 64 | */ |
---|
| 65 | public function initConfig() |
---|
| 66 | { |
---|
| 67 | //global $user; |
---|
| 68 | $this->config=array( |
---|
[7207] | 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() |
---|
[7196] | 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 | |
---|
| 126 | class 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 | |
---|
| 145 | /** |
---|
| 146 | * return all HTML&JS code necessary to display a dialogbox to choose |
---|
| 147 | * categories |
---|
| 148 | */ |
---|
| 149 | static public function dialogBoxASECategory() |
---|
| 150 | { |
---|
| 151 | global $template; |
---|
| 152 | |
---|
| 153 | $template->set_filename('ase_category_choose', |
---|
| 154 | dirname(__FILE__).'/templates/ase_dialog_category_choose.tpl'); |
---|
| 155 | |
---|
| 156 | return($template->parse('ase_category_choose', true)); |
---|
| 157 | } |
---|
| 158 | |
---|
| 159 | /** |
---|
| 160 | * return all HTML&JS code necessary to display a dialogbox to choose |
---|
| 161 | * dates |
---|
| 162 | */ |
---|
| 163 | static public function dialogBoxASEDate() |
---|
| 164 | { |
---|
| 165 | global $template; |
---|
| 166 | |
---|
| 167 | $template->set_filename('ase_date_choose', |
---|
| 168 | dirname(__FILE__).'/templates/ase_dialog_date_choose.tpl'); |
---|
| 169 | |
---|
| 170 | return($template->parse('ase_date_choose', true)); |
---|
| 171 | } |
---|
| 172 | |
---|
| 173 | /** |
---|
| 174 | * return all HTML&JS code necessary to display a dialogbox to choose |
---|
| 175 | * keywords |
---|
| 176 | */ |
---|
| 177 | static public function dialogBoxASEKeyword() |
---|
| 178 | { |
---|
| 179 | global $template; |
---|
| 180 | |
---|
| 181 | $template->set_filename('ase_keyword_choose', |
---|
| 182 | dirname(__FILE__).'/templates/ase_dialog_keyword_choose.tpl'); |
---|
| 183 | |
---|
[7318] | 184 | $config=array(); |
---|
| 185 | GPCCore::loadConfig('ase', $config); |
---|
| 186 | $template->assign('aseConfig', $config); |
---|
[7196] | 187 | |
---|
| 188 | return($template->parse('ase_keyword_choose', true)); |
---|
| 189 | } |
---|
| 190 | |
---|
| 191 | /** |
---|
| 192 | * return all HTML&JS code necessary to display a dialogbox to choose |
---|
| 193 | * HD picture |
---|
| 194 | */ |
---|
| 195 | static public function dialogBoxASEHD() |
---|
| 196 | { |
---|
| 197 | global $template; |
---|
| 198 | |
---|
| 199 | $template->set_filename('ase_hd_choose', |
---|
| 200 | dirname(__FILE__).'/templates/ase_dialog_hd_choose.tpl'); |
---|
| 201 | |
---|
| 202 | return($template->parse('ase_hd_choose', true)); |
---|
| 203 | } |
---|
| 204 | |
---|
| 205 | /** |
---|
| 206 | * return all HTML&JS code necessary to display a dialogbox to choose |
---|
| 207 | * rate on picture |
---|
| 208 | */ |
---|
| 209 | static public function dialogBoxASERate() |
---|
| 210 | { |
---|
| 211 | global $template; |
---|
| 212 | |
---|
| 213 | $template->set_filename('ase_rate_choose', |
---|
| 214 | dirname(__FILE__).'/templates/ase_dialog_rate_choose.tpl'); |
---|
| 215 | |
---|
| 216 | return($template->parse('ase_rate_choose', true)); |
---|
| 217 | } |
---|
| 218 | |
---|
[7374] | 219 | /** |
---|
| 220 | * return all HTML&JS code necessary to display a dialogbox to choose |
---|
| 221 | * tags on picture |
---|
| 222 | */ |
---|
| 223 | static public function dialogBoxASETag() |
---|
| 224 | { |
---|
| 225 | global $template; |
---|
| 226 | |
---|
| 227 | $template->set_filename('ase_tag_choose', |
---|
| 228 | dirname(__FILE__).'/templates/ase_dialog_tag_choose.tpl'); |
---|
| 229 | |
---|
| 230 | return($template->parse('ase_tag_choose', true)); |
---|
| 231 | } |
---|
| 232 | |
---|
[7196] | 233 | } //ASE_functions |
---|
| 234 | |
---|
| 235 | |
---|
| 236 | |
---|
| 237 | ?> |
---|