本文整理汇总了PHP中Legacy_Utils::createModule方法的典型用法代码示例。如果您正苦于以下问题:PHP Legacy_Utils::createModule方法的具体用法?PHP Legacy_Utils::createModule怎么用?PHP Legacy_Utils::createModule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Legacy_Utils
的用法示例。
在下文中一共展示了Legacy_Utils::createModule方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
function execute()
{
$root =& XCube_Root::getSingleton();
// load message catalog of legacy for _AD_LEGACY_LANG_NO_SETTING, even if the current module is not Legacy.
$root->mLanguageManager->loadModuleAdminMessageCatalog('legacy');
//
$root->mLanguageManager->loadModinfoMessageCatalog('legacy');
$controller =& $root->mController;
$user =& $root->mController->mRoot->mContext->mXoopsUser;
$render =& $this->getRenderTarget();
$render->setAttribute('legacy_module', 'legacy');
$this->mCurrentModule =& $controller->mRoot->mContext->mXoopsModule;
if ($this->mCurrentModule->get('dirname') == 'legacy') {
if (xoops_getrequest('action') == "help") {
$moduleHandler =& xoops_gethandler('module');
$t_module =& $moduleHandler->getByDirname(xoops_gethandler('dirname'));
if (is_object($t_module)) {
$this->mCurrentModule =& $t_module;
}
}
}
$db =& $controller->getDB();
$mod = $db->prefix("modules");
$perm = $db->prefix("group_permission");
$groups = implode(",", $user->getGroups());
//
// Users who are belong to ADMIN GROUP have every permissions, so we have to prepare two kinds of SQL.
//
if ($root->mContext->mUser->isInRole('Site.Owner')) {
$sql = "SELECT DISTINCT mid FROM {$mod} WHERE isactive=1 AND hasadmin=1 ORDER BY weight, mid";
} else {
$sql = "SELECT DISTINCT {$mod}.mid FROM {$mod},{$perm} " . "WHERE {$mod}.isactive=1 AND {$mod}.mid={$perm}.gperm_itemid AND {$perm}.gperm_name='module_admin' AND {$perm}.gperm_groupid IN ({$groups}) " . "AND {$mod}.hasadmin=1 " . "ORDER BY {$mod}.weight, {$mod}.mid";
}
$result = $db->query($sql);
$handler =& xoops_gethandler('module');
while ($row = $db->fetchArray($result)) {
$xoopsModule =& $handler->get($row['mid']);
$module =& Legacy_Utils::createModule($xoopsModule);
$this->mModules[] =& $module;
unset($module);
}
//
$tpl = $db->prefix("tplfile");
$tpl_modules = array();
$sql = "SELECT DISTINCT tpl_module FROM {$tpl}";
$result = $db->query($sql);
while ($row = $db->fetchArray($result)) {
$tpl_modules[] = $row['tpl_module'];
}
$render->setAttribute('tplmodules', $tpl_modules);
//
$render->setTemplateName('legacy_admin_block_sidemenu.html');
$render->setAttribute('modules', $this->mModules);
$render->setAttribute('currentModule', $this->mCurrentModule);
$renderSystem =& $root->getRenderSystem($this->getRenderSystemName());
$renderSystem->renderBlock($render);
}
示例2: executeViewCancel
function executeViewCancel(&$controller, &$xoopsUser, &$render)
{
$module = Legacy_Utils::createModule($this->_mMaster->mModule);
$controller->executeForward($module->getAdminIndex());
}
示例3: xoops_gethandler
function &getVirtualCurrentModule()
{
static $ret_module;
if (is_object($ret_module)) {
return $ret_module;
}
if ($this->mController->mRoot->mContext->mModule != null) {
$module =& $this->mController->mRoot->mContext->mXoopsModule;
if ($module->get('dirname') == "legacy" && isset($_REQUEST['dirname'])) {
if (in_array(xoops_getrequest('action'), $this->_mSpecialActions)) {
$handler =& xoops_gethandler('module');
$t_xoopsModule =& $handler->getByDirname(xoops_getrequest('dirname'));
$ret_module =& Legacy_Utils::createModule($t_xoopsModule);
}
} elseif ($module->get('dirname') == "legacy" && xoops_getrequest('action') == 'PreferenceEdit' && isset($_REQUEST['confmod_id'])) {
$handler =& xoops_gethandler('module');
$t_xoopsModule =& $handler->get(intval(xoops_getrequest('confmod_id')));
$ret_module =& Legacy_Utils::createModule($t_xoopsModule);
}
if (!is_object($ret_module)) {
$ret_module =& Legacy_Utils::createModule($module);
}
}
return $ret_module;
}
示例4: setupModuleContext
/**
* Create some instances for the module process.
* Because Legacy_ModuleContext needs XoopsModule instance, this function
* kills the process if XoopsModule instance can't be found. Plus, in the
* case, raises 'Legacy.Event.Exception.XoopsModuleNotFound'.
*
* @param Legacy_HttpContext $context
* @param string $dirname
*/
function setupModuleContext(&$context, $dirname)
{
$handler =& xoops_gethandler('module');
$module =& $handler->getByDirname($dirname);
if (!is_object($module)) {
XCube_DelegateUtils::call('Legacy.Event.Exception.XoopsModuleNotFound', $dirname);
$this->mController->executeRedirect(XOOPS_URL . '/', 1, "You can't access this URL.");
// TODO need message catalog.
die;
}
$context->mModule =& Legacy_Utils::createModule($module);
$context->mXoopsModule =& $context->mModule->getXoopsModule();
$context->mModuleConfig = $context->mModule->getModuleConfig();
//
// Load Roles
//
$this->mController->mRoot->mRoleManager->loadRolesByMid($context->mXoopsModule->get('mid'));
}
示例5: _searchItems
/**
* @access private
*/
private function _searchItems($mid, $queries, $andor, $max_hit, $start, $uid)
{
$ret = array();
static $moduleArr;
if (!isset($moduleArr)) {
$moduleArr = array();
foreach ($this->getActiveModules() as $mod) {
$moduleArr[$mod['mid']] = $mod['name'];
}
}
if (!isset($moduleArr[$mid])) {
return $ret;
}
static $timezone;
if (!isset($timezone)) {
$root =& XCube_Root::getSingleton();
$timezone = $root->mContext->getXoopsConfig('server_TZ') * 3600;
}
$handler =& xoops_gethandler('module');
$xoopsModule =& $handler->get($mid);
if (!is_object($xoopsModule)) {
return $ret;
}
if (!$xoopsModule->get('isactive') || !$xoopsModule->get('hassearch')) {
return $ret;
}
$module =& Legacy_Utils::createModule($xoopsModule, false);
$results = $module->doLegacyGlobalSearch($queries, $andor, $max_hit, $start, $uid);
if (is_array($results) && count($results) > 0) {
foreach (array_keys($results) as $key) {
$timeval =& $results[$key]['time'];
//
// TODO If this service will come to web service, we should
// change format from unixtime to string by timeoffset.
//
if ($timeval) {
$timeval -= $timezone;
}
}
}
return $results;
}
示例6: executeViewSuccess
function executeViewSuccess(&$controller, &$xoopsUser, &$renderer)
{
$renderer->setTemplateName("help.html");
$module =& Legacy_Utils::createModule($this->mModuleObject);
$renderer->setAttribute('module', $module);
$renderer->setAttribute('contents', $this->mContents);
}
示例7: b_altsys_admin_menu_show
function b_altsys_admin_menu_show($options)
{
global $xoopsUser;
$mydirname = empty($options[0]) ? 'altsys' : $options[0];
$this_template = empty($options[1]) ? 'db:' . $mydirname . '_block_admin_menu.html' : trim($options[1]);
if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) {
die('Invalid mydirname');
}
if (!is_object(@$xoopsUser)) {
return array();
}
// coretype
$coretype = altsys_get_core_type();
// mid_selected
if (is_object(@$GLOBALS["xoopsModule"])) {
$mid_selected = $GLOBALS["xoopsModule"]->getVar("mid");
// for system->preferences
if ($mid_selected == 1 && @$_GET["fct"] == "preferences" && @$_GET["op"] == "showmod" && !empty($_GET["mod"])) {
$mid_selected = intval($_GET["mod"]);
}
} else {
$mid_selected = 0;
}
$db =& Database::getInstance();
$myts =& MyTextSanitizer::getInstance();
$module_handler =& xoops_gethandler('module');
$current_module =& $module_handler->getByDirname($mydirname);
$config_handler =& xoops_gethandler('config');
$current_configs = $config_handler->getConfigList($current_module->mid());
$moduleperm_handler =& xoops_gethandler('groupperm');
$admin_mids = $moduleperm_handler->getItemIds('module_admin', $xoopsUser->getGroups());
$modules = $module_handler->getObjects(new Criteria('mid', '(' . implode(',', $admin_mids) . ')', 'IN'), true);
$block = array('mydirname' => $mydirname, 'mod_url' => XOOPS_URL . '/modules/' . $mydirname, 'mod_imageurl' => XOOPS_URL . '/modules/' . $mydirname . '/' . $current_configs['images_dir'], 'mod_config' => $current_configs);
foreach ($modules as $mod) {
$mid = intval($mod->getVar('mid'));
$dirname = $mod->getVar('dirname');
$modinfo = $mod->getInfo();
$submenus4assign = array();
$adminmenu = array();
$adminmenu4altsys = array();
unset($adminmenu_use_altsys);
@(include XOOPS_ROOT_PATH . '/modules/' . $dirname . '/' . @$modinfo['adminmenu']);
// from admin_menu.php etc.
$adminmenu = array_merge($adminmenu, $adminmenu4altsys);
foreach ($adminmenu as $sub) {
$link = empty($sub['altsys_link']) ? $sub['link'] : $sub['altsys_link'];
if (isset($sub['show']) && $sub['show'] === false) {
continue;
}
$submenus4assign[] = array('title' => $myts->makeTboxData4Show($sub['title']), 'url' => XOOPS_URL . '/modules/' . $dirname . '/' . htmlspecialchars($link, ENT_QUOTES));
}
// for modules overriding Module.class.php (eg. Analyzer for XC)
if (empty($submenus4assign) && defined('XOOPS_CUBE_LEGACY') && !empty($modinfo['cube_style'])) {
$module_handler =& xoops_gethandler('module');
$module =& $module_handler->get($mid);
$moduleObj =& Legacy_Utils::createModule($module);
$modinfo['adminindex'] = $moduleObj->getAdminIndex();
$modinfo['adminindex_absolute'] = true;
foreach ($moduleObj->getAdminMenu() as $sub) {
if (@$sub['show'] === false) {
continue;
}
$submenus4assign[] = array('title' => $myts->makeTboxData4Show($sub['title']), 'url' => strncmp($sub['link'], 'http', 4) === 0 ? htmlspecialchars($sub['link'], ENT_QUOTES) : XOOPS_URL . '/modules/' . $dirname . '/' . htmlspecialchars($sub['link'], ENT_QUOTES));
}
} else {
if (empty($adminmenu4altsys)) {
// add preferences
if ($mod->getVar('hasconfig') && !in_array($mod->getVar('dirname'), array('system', 'legacy'))) {
$submenus4assign[] = array('title' => _PREFERENCES, 'url' => htmlspecialchars(altsys_get_link2modpreferences($mid, $coretype), ENT_QUOTES));
}
// add help
if (defined('XOOPS_CUBE_LEGACY') && !empty($modinfo['help'])) {
$submenus4assign[] = array('title' => _HELP, 'url' => XOOPS_URL . '/modules/legacy/admin/index.php?action=Help&dirname=' . $dirname);
}
}
}
$module4assign = array('mid' => $mid, 'dirname' => $dirname, 'name' => $mod->getVar('name'), 'version_in_db' => sprintf('%.2f', $mod->getVar('version') / 100.0), 'version_in_file' => sprintf('%.2f', $modinfo['version']), 'description' => htmlspecialchars(@$modinfo['description'], ENT_QUOTES), 'image' => htmlspecialchars($modinfo['image'], ENT_QUOTES), 'isactive' => $mod->getVar('isactive'), 'hasmain' => $mod->getVar('hasmain'), 'hasadmin' => $mod->getVar('hasadmin'), 'hasconfig' => $mod->getVar('hasconfig'), 'weight' => $mod->getVar('weight'), 'adminindex' => htmlspecialchars(@$modinfo['adminindex'], ENT_QUOTES), 'adminindex_absolute' => @$modinfo['adminindex_absolute'], 'submenu' => $submenus4assign, 'selected' => $mid == $mid_selected ? true : false, 'dot_suffix' => $mid == $mid_selected ? 'selected_opened' : 'closed');
$block['modules'][] = $module4assign;
}
require_once XOOPS_TRUST_PATH . '/libs/altsys/class/D3Tpl.class.php';
$tpl =& new D3Tpl();
$tpl->assign('block', $block);
$ret['content'] = $tpl->fetch($this_template);
return $ret;
}