function getPluginFiles($dirname, $ext, $asArray = false) { $files = array(); $dir = XOOPS_ROOT_PATH . '/modules/' . $dirname . '/plugins/'; if (is_dir($dir)) { $files1 = glob($dir . 'myGmapPlugin*.' . $ext); if (is_array($files1)) { if ($asArray) { $files1 = MyGmapUtils::_divideFile($files1, 'module'); } $files = array_merge($files, $files1); } } if (defined('XOOPS_TRUST_PATH')) { $dir = XOOPS_TRUST_PATH . '/modules/mygmap/plugins/'; if (is_dir($dir)) { $files1 = glob($dir . 'myGmapPlugin*.' . $ext); if (is_array($files1)) { if ($asArray) { $files1 = MyGmapUtils::_divideFile($files1, 'trust'); } $files = array_merge($files, $files1); } } } return $files; }
function executeDefaultOp() { error_reporting(E_ERROR); NBFrame::using('MyGmapUtils', $this->mEnvironment); header('Content-type: application/x-javascript;charset="EUC-JP"'); echo "if (mygmap_js_src == undefined) {\n"; echo " var mygmap_map;\n"; echo " var mygmap_js_src = \"http://maps.google.co.jp/maps?file=api&v=2.x&key=\" + mygmap_API;\n"; echo " document.write('<'+'script src=\"'+mygmap_js_src+'\"'+' type=\"text/javascript\" charset=\"utf-8\"><'+'/script>');\n"; echo "\n"; echo " mygmap_js_src = mygmappath + \"?action=MyGmapLoadJscipt&op=load\";\n"; echo " document.write('<'+'script src=\"'+mygmap_js_src+'\"'+' type=\"text/javascript\"><'+'/script>');\n"; echo "\n"; foreach (MyGmapUtils::getPluginFiles($this->mEnvironment->getDirName(), 'js', true) as $file) { echo " mygmap_plugin_js_src = mygmappath + \"?action=MyGmapLoadJscipt&op=plugin&file=" . $file['name'] . "&place=" . $file['place'] . "\";\n"; echo " document.write('<'+'script src=\"'+mygmap_plugin_js_src+'\"'+' type=\"text/javascript\"><'+'/script>');\n"; } echo " var iconpath = mygmappath + '?action=NBFrame.GetImage&file=';\n"; echo "\n"; echo " var myGmapMiniMaps = new Array();\n"; echo " var myGmapMiniMap_idx = 0;\n"; echo "}\n"; }
function viewDefaultOp() { //---------------------------------------------- $this->mXoopsTpl->assign('mygmap_API', $GLOBALS['xoopsModuleConfig']['mygmap_api']); $this->mXoopsTpl->assign('mygmap_dirname', $this->mDirName); $this->mXoopsTpl->assign('mygmap_center_lat', $this->elements['center_lat']); $this->mXoopsTpl->assign('mygmap_center_lng', $this->elements['center_lng']); $this->mXoopsTpl->assign('mygmap_zoom', $this->elements['zoom']); $this->mXoopsTpl->assign('mygmap_maptype', $this->elements['maptype']); $this->mXoopsTpl->assign('mygmap_category', $this->elements['category']); $this->mXoopsTpl->assign('mygmap_catlist', $this->elements['catlist']); $this->mXoopsTpl->assign('mygmap_markers', $this->elements['markers']); $this->mXoopsTpl->assign('mygmap_areas', $this->elements['areas']); $this->mXoopsTpl->assign('mygmap_overlays', $this->elements['overlay']); $this->mXoopsTpl->assign('mygmap_search', $GLOBALS['xoopsModuleConfig']['mygmap_search']); $this->mXoopsTpl->assign('mygmap_addr', $this->elements['addr']); $this->mXoopsTpl->assign('mygmap_station', $this->elements['station']); $this->mXoopsTpl->assign('mygmap_invgeo', $GLOBALS['xoopsModuleConfig']['mygmap_invgeo']); $this->mXoopsTpl->assign('mygmap_link', $GLOBALS['xoopsModuleConfig']['mygmap_link']); $this->mXoopsTpl->assign('mygmap_wiki', $GLOBALS['xoopsModuleConfig']['mygmap_wiki']); $this->mXoopsTpl->assign('mygmap_blog', $GLOBALS['xoopsModuleConfig']['mygmap_blog']); $this->mXoopsTpl->assign('mygmap_width', $GLOBALS['xoopsModuleConfig']['mygmap_width']); $this->mXoopsTpl->assign('mygmap_height', $GLOBALS['xoopsModuleConfig']['mygmap_height']); $this->mXoopsTpl->assign('mygmap_setdef_show', $GLOBALS['xoopsModuleConfig']['mygmap_setdef_show']); $this->mXoopsTpl->assign('mygmap_debug', $GLOBALS['xoopsModuleConfig']['mygmap_debug']); $credit = $GLOBALS['mygmap_credit']; if ($GLOBALS['xoopsModuleConfig']['mygmap_search']) { $credit .= '<br />' . $GLOBALS['mygmap_csis_credit']; } if ($GLOBALS['xoopsModuleConfig']['mygmap_invgeo']) { $credit .= '<br />' . $GLOBALS['mygmap_invgeo_credit']; } $this->mXoopsTpl->assign('xoopsUserIsAdmin', $GLOBALS['xoopsUserIsAdmin']); $this->mXoopsTpl->assign('mygmap_can_edit_area', NBFrame::checkRight('area_edit')); $this->mXoopsTpl->assign('mygmap_can_edit_category', NBFrame::checkRight('category_edit')); if (!empty($this->elements['category']) && $this->elements['category']['id'] > 0) { $this->mXoopsTpl->assign('mygmap_can_add_marker', NBFrame::checkRight('marker_edit') && $this->elements['category']['can_edit']); } else { $this->mXoopsTpl->assign('mygmap_can_add_marker', $GLOBALS['xoopsUserIsAdmin']); } $this->mXoopsTpl->assign('mygmap_setdef_show', $GLOBALS['xoopsModuleConfig']['mygmap_setdef_show']); NBFrame::using('MyGmapUtils', $this->mEnvironment); foreach (MyGmapUtils::getPluginFiles($this->mDirName, 'php') as $file) { require_once $file; $class = basename($file); $class = substr($class, 0, strlen($class) - 4); if (class_exists($class)) { call_user_func_array(array($class, 'viewDefaultOp'), array(&$this)); } } $extra = ''; foreach (MyGmapUtils::getPluginFiles($this->mDirName, 'html') as $file) { $extra .= $this->mXoopsTpl->fetch($file); } $this->mXoopsTpl->assign('mygmap_extra_info', $extra); if (!empty($GLOBALS['mygmap_plugin_credit'])) { $credit .= $GLOBALS['mygmap_plugin_credit']; } $this->mXoopsTpl->assign('mygmap_credit', $credit); }