> ------------------------------------------------------------------------------ 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 = 'ASearch'; protected $sectionPage; public function __construct($prefixeTable, $filelocation) { global $template; parent::__construct($prefixeTable, $filelocation); $this->loadConfig(); $this->load_lang(); if($this->config['ase_publicAccess_active']) { $this->sectionPage=new GPCPublicIntegration(self::SEARCH_SECTION); $this->sectionPage->setCallbackPageFunction(array(&$this, 'managePage')); $this->sectionPage->initEvents(); $this->initEvents(); } } public function __destruct() { unset($section_page); parent::__destruct(); } /* load language file */ public function load_lang() { load_language('plugin.lang', ASE_PATH); load_language('rbuilder.lang', GPC_PATH); } /* initialize events call for the plugin */ public function initEvents() { parent::initEvents(); add_event_handler('blockmanager_apply', array(&$this, 'blockManagerApply'), 40); // call ASE before AMM if($this->sectionPage->pageIsSection()) { GPCRequestBuilder::loadJSandCSS(); add_event_handler('init', array(&$this, 'applyJS')); add_event_handler('user_init', array(&$this, 'load_lang')); } } public function loadCSS() { GPCCore::addHeaderCSS('ase.css2', 'plugins/'.$this->getDirectory().'/'.$this->getPluginNameFiles()."2.css",9); // have to be loaded before other css file (event level from GPCCore=10) } /* ------------------------------------------------------------------------- FUNCTIONS TO MANAGE ASE ------------------------------------------------------------------------- */ public function applyJS() { global $template; $theme=$template->get_themeconf('name'); // css file for piwigo's default themes (provided by ASE) $file='plugins/ASearchEngine/themes/'.$theme.'/ASE'.$theme.'.css'; if(($theme=='Sylvia' or $theme=='clear' or $theme=='dark' or $theme=='elegant') and file_exists(GPCCore::getPiwigoSystemPath().'/'.$file)) GPCCore::addHeaderCSS('ASE0', $file, 35); // css file for ASE provided by themes $file='themes/'.$theme.'/css/ASE'.$theme.'.css'; if(file_exists(GPCCore::getPiwigoSystemPath().'/'.$file)) GPCCore::addHeaderCSS('ASE1', $file, 40); // css file for ASE provided in local directory $file=PHPWG_ROOT_PATH.PWG_LOCAL_DIR.'local/css/ASE'.$theme.'.css'; if(file_exists(GPCCore::getPiwigoSystemPath().'/'.$file)) GPCCore::addHeaderCSS('ASE2', $file, 45); /* $template->set_filename('ASEheader', dirname(__FILE__)."/templates/search_page_header.tpl"); $template->block_html_head(null, $template->parse('ASEheader', true), null, null); */ } 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']); GPCCore::AddUI('inputTag,categorySelector'); $template->clear_assign(array('U_MODE_CREATED', 'U_MODE_POSTED')); /* * display empty template * (all content are managed with ajax) */ $template->assign( array( 'derivative_params' =>trigger_event('get_index_derivative_params', ImageStdParams::get_by_type( pwg_get_session_var('index_deriv', IMG_THUMB) ) ) ) ); $template->set_filename('ASEmain', 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', 'ASEmain'); } /** * 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'); if(!is_null($block)) $block->data['search']['URL']='./?/'.self::SEARCH_SECTION; } } } //class ?>