> ------------------------------------------------------------------------------ See main.inc.php for release information ASE_PIP : classe to manage plugin public pages --------------------------------------------------------------------------- */ include_once('ase_root.class.inc.php'); include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCPublicIntegration.class.inc.php'); include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCRequestBuilder.class.inc.php'); class ASE_PIP extends ASE_root { const SEARCH_SECTION = 'Search'; protected $sectionPage; protected $css2; public function __construct($prefixeTable, $filelocation) { parent::__construct($prefixeTable, $filelocation); $this->css2 = new GPCCss(dirname($this->getFileLocation()).'/'.$this->getPluginNameFiles()."2.css"); $this->loadConfig(); $this->initEvents(); $this->load_lang(); $this->sectionPage=new GPCPublicIntegration(self::SEARCH_SECTION); $this->sectionPage->setCallbackPageFunction(array(&$this, 'managePage')); $this->sectionPage->initEvents(); } public function __destruct() { unset($section_page); parent::__destruct(); } /* load language file */ public function load_lang() { global $lang; load_language('plugin.lang', ASE_PATH); } /* initialize events call for the plugin */ public function initEvents() { parent::initEvents(); GPCRequestBuilder::loadJSandCSS(); add_event_handler('init', array(&$this, 'applyJS')); add_event_handler('loc_begin_page_header', array(&$this->css2, 'applyCSS'), 9); // have to be loaded before other css file (event level from GPCCore=10) add_event_handler('blockmanager_apply', array(&$this, 'blockmanagerApply'), 55); } /* ------------------------------------------------------------------------- FUNCTIONS TO MANAGE ASE ------------------------------------------------------------------------- */ public function applyJS() { global $template; GPCCore::addHeaderJS('jquery', 'themes/default/js/jquery.packed.js'); $theme=$template->get_themeconf('name'); $file='plugins/ASearchEngine/themes/'.$theme.'/ASE'.$theme.'.css'; if(($theme=='Sylvia' or $theme=='clear' or $theme=='dark') and file_exists(GPCCore::getPiwigoSystemPath().'/'.$file)) GPCCore::addHeaderCSS('ASE0', $file); $file='themes/'.$theme.'/css/ASE'.$theme.'.css'; if(file_exists(GPCCore::getPiwigoSystemPath().'/'.$file)) GPCCore::addHeaderCSS('ASE1', $file); $file='local/css/ASE'.$theme.'.css'; if(file_exists(GPCCore::getPiwigoSystemPath().'/'.$file)) GPCCore::addHeaderCSS('ASE2', $file); } public function managePage() { global $page, $conf, $template; /* * make the title bar */ $page['title'].=$conf['level_separator'].l10n('ase_search_with_multiple_criteria'); $template->assign('TITLE', $page['title']); $template->clear_assign(array('U_MODE_CREATED', 'U_MODE_POSTED')); /* * display empty template * (all content are managed with ajax) */ $template->set_filename('main', dirname(__FILE__)."/templates/search_page.tpl"); $template->assign('ase_search_page', GPCRequestBuilder::displaySearchPage($this->config['ase_publicAccess_allowedPlugins'])); $template->assign_var_from_handle('PLUGIN_INDEX_CONTENT_BEGIN', 'main'); } /** * replace the piwigo search.php url by ?/aSearch url */ public function blockmanagerApply($menu_ref_arr) { global $user, $page; $menu = & $menu_ref_arr[0]; if($this->config['ase_publicAccess_active']) { $block=$menu->get_block('mbMenu'); $block->data['search']['URL']=get_root_url().'?/'.self::SEARCH_SECTION; } } } //class ?>