本文整理汇总了PHP中XoopsModule::assignVars方法的典型用法代码示例。如果您正苦于以下问题:PHP XoopsModule::assignVars方法的具体用法?PHP XoopsModule::assignVars怎么用?PHP XoopsModule::assignVars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XoopsModule
的用法示例。
在下文中一共展示了XoopsModule::assignVars方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_modules_ajax
function get_modules_ajax()
{
XoopsLogger::getInstance()->activated = false;
XoopsLogger::getInstance()->renderingEnabled = false;
$db = Database::getInstance();
$sql = "SELECT COUNT(*) FROM " . $db->prefix("modules");
$page = rmc_server_var($_POST, 'page', 1);
$limit = RMFunctions::configs('mods_number');
list($num) = $db->fetchRow($db->query($sql));
$tpages = ceil($num / $limit);
$page = $page > $tpages ? $tpages : $page;
$start = $num <= 0 ? 0 : ($page - 1) * $limit;
$nav = new RMPageNav($num, $limit, $page, 5);
$nav->target_url('javascript:;" onclick="get_mods_page({PAGE_NUM})');
$sql = 'SELECT * FROM ' . $db->prefix('modules') . " ORDER BY mid, weight LIMIT {$start},{$limit}";
$result = $db->query($sql);
$installed_mods = array();
while ($row = $db->fetchArray($result)) {
$mod = new XoopsModule();
$mod->assignVars($row);
$installed_mods[] = $mod;
}
include RMTemplate::get()->get_template('rmc_mods_installed.php', 'module', 'rmcommon');
die;
}
示例2: get_modules_list
function get_modules_list()
{
$db = XoopsDatabaseFactory::getDatabaseConnection();
$sql = 'SELECT * FROM ' . $db->prefix('modules') . " ORDER BY mid, weight";
$result = $db->query($sql);
$installed_mods = array();
while ($row = $db->fetchArray($result)) {
$mod = new XoopsModule();
$mod->assignVars($row);
$module_icon = $mod->getInfo('icon48') != '' ? XOOPS_URL . '/modules/' . $mod->getVar('dirname') . '/' . $mod->getInfo('icon48') : '';
$module_logo = XOOPS_URL . '/modules/' . $mod->getVar('dirname') . '/' . $mod->getInfo('image');
if ($mod->hasconfig()) {
$config_link = $mod->getInfo('rmnative') ? XOOPS_URL . '/modules/rmcommon/settings.php?action=configure&mod=' . $mod->mid() : XOOPS_URL . '/modules/system/admin.php?fct=preferences&op=showmod&mod=' . $mod->mid();
}
$this_module = array('name' => $mod->getVar('name'), 'dirname' => $mod->getVar('dirname'), 'real_name' => $mod->getInfo('name'), 'version' => is_array($mod->getInfo('rmversion')) ? RMModules::format_module_version($mod->getInfo('rmversion')) : $mod->getVar('version') / 100, 'icon' => $module_icon, 'logo' => $module_logo, 'admin' => $mod->getVar('hasadmin') ? XOOPS_URL . '/modules/' . $mod->getVar('dirname') . '/' . $mod->getInfo('adminindex') : '', 'main' => RMUris::anchor($mod->getVar('dirname')), 'updated' => RMTimeFormatter::get()->format($mod->getVar('last_update'), __('%d% %T% %Y%', 'rmcommon')), 'config' => isset($config_link) ? $config_link : '', 'description' => $mod->getInfo('description'));
$installed_mods[] = (object) $this_module;
}
return $installed_mods;
}
示例3: show_modules_list
function show_modules_list()
{
global $xoopsSecurity;
$installed_modules = array();
$limit = rmc_server_var($_SESSION, 'mods_limit', 4);
include_once XOOPS_ROOT_PATH . '/kernel/module.php';
$db = XoopsDatabaseFactory::getDatabaseConnection();
$sql = "SELECT * FROM " . $db->prefix("modules") . " ORDER BY `name`";
$result = $db->query($sql);
$installed_dirs = array();
while ($row = $db->fetchArray($result)) {
$mod = new XoopsModule();
$mod->assignVars($row);
$installed_dirs[] = $mod->dirname();
if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $mod->getVar('dirname') . '/class/' . strtolower($mod->getVar('dirname') . 'controller') . '.php')) {
include_once XOOPS_ROOT_PATH . '/modules/' . $mod->getVar('dirname') . '/class/' . strtolower($mod->getVar('dirname') . 'controller') . '.php';
$class = ucfirst($mod->getVar('dirname')) . 'Controller';
$class = new $class();
if (method_exists($class, 'get_main_link')) {
$main_link = $class->get_main_link();
} else {
if ($mod->getVar('hasmain')) {
$main_link = XOOPS_URL . '/modules/' . $mod->dirname();
} else {
$main_link = "#";
}
}
} else {
if ($mod->getVar('hasmain')) {
$main_link = XOOPS_URL . '/modules/' . $mod->dirname();
} else {
$main_link = "#";
}
}
// Admin section
$admin_link = $mod->getVar('hasadmin') ? XOOPS_URL . '/modules/' . $mod->dirname() . '/' . $mod->getInfo('adminindex') : '';
$modules[] = array('id' => $mod->getVar('mid'), 'name' => $mod->getVar('name'), 'realname' => $mod->getInfo('name'), 'version' => $mod->getInfo('rmnative') ? RMUtilities::format_version($mod->getInfo('rmversion')) : $mod->getInfo('version'), 'description' => $mod->getInfo('description'), 'icon' => XOOPS_URL . '/modules/' . $mod->getVar('dirname') . '/' . ($mod->getInfo('icon48') ? $mod->getInfo('icon48') : $mod->getInfo('image')), 'image' => XOOPS_URL . '/modules/' . $mod->getVar('dirname') . '/' . $mod->getInfo('image'), 'link' => $main_link, 'admin_link' => $admin_link, 'updated' => formatTimestamp($mod->getVar('last_update'), 's'), 'author' => $mod->getInfo('author'), 'author_mail' => $mod->getInfo('authormail'), 'author_web' => $mod->getInfo('authorweb'), 'author_url' => $mod->getInfo('authorurl'), 'license' => $mod->getInfo('license'), 'dirname' => $mod->getInfo('dirname'), 'active' => $mod->getVar('isactive'), 'help' => $mod->getInfo('help'));
}
// Event for installed modules
$modules = RMEvents::get()->run_event('rmcommon.installed.modules', $modules, $installed_dirs);
require_once XOOPS_ROOT_PATH . "/class/xoopslists.php";
$dirlist = XoopsLists::getModulesList();
$available_mods = array();
$module_handler = xoops_gethandler('module');
foreach ($dirlist as $file) {
clearstatcache();
$file = trim($file);
if (!in_array($file, $installed_dirs)) {
$module =& $module_handler->create();
if (!$module->loadInfo($file, false)) {
continue;
}
$available_mods[] = $module;
unset($module);
}
}
// Event for available modules
$available_mods = RMEvents::get()->run_event('rmcommon.available.modules', $available_mods);
$GLOBALS['available_mods'] = $available_mods;
RMFunctions::create_toolbar();
RMTemplate::get()->assign('xoops_pagetitle', __('Modules Management', 'rmcommon'));
RMTemplate::get()->add_style('modules.css', 'rmcommon');
RMTemplate::get()->add_local_script('modules.js', 'rmcommon', 'include');
RMTemplate::get()->set_help('http://www.redmexico.com.mx/docs/common-utilities/uso-de-common-utilities/standalone/1/#administrador-de-modulos');
xoops_cp_header();
include RMTemplate::get()->get_template('rmc_modules.php', 'module', 'rmcommon');
xoops_cp_footer();
}
示例4: trim
/**
* Load a module by its dirname
*
* @param string $dirname
*
* @return object FALSE on fail
*/
function &getByDirname($dirname)
{
static $_cachedModule_mid;
static $_cachedModule_dirname;
if (!empty($_cachedModule_dirname[$dirname])) {
return $_cachedModule_dirname[$dirname];
} else {
$sql = "SELECT * FROM " . $this->db->prefix('modules') . " WHERE dirname = '" . trim($dirname) . "'";
if (!($result = $this->db->query($sql))) {
return false;
}
$numrows = $this->db->getRowsNum($result);
if ($numrows == 1) {
$module = new XoopsModule();
$myrow = $this->db->fetchArray($result);
$module->assignVars($myrow);
$_cachedModule_dirname[$dirname] =& $module;
$_cachedModule_mid[$module->getVar('mid')] =& $module;
return $module;
}
return false;
}
}
示例5: array
/**
* Load some modules
*
* @param object $criteria {@link CriteriaElement}
* @param boolean $id_as_key Use the ID as key into the array
* @return array
**/
function &getObjects($criteria = null, $id_as_key = false)
{
$ret = array();
$limit = $start = 0;
$sql = 'SELECT * FROM ' . $this->db->prefix('modules');
if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
$sql .= ' ' . $criteria->renderWhere();
$sql .= ' ORDER BY weight ' . $criteria->getOrder() . ', mid ASC';
$limit = $criteria->getLimit();
$start = $criteria->getStart();
}
$result = $this->db->query($sql, $limit, $start);
if (!$result) {
return $ret;
}
while ($myrow = $this->db->fetchArray($result)) {
$module = new XoopsModule();
$module->assignVars($myrow);
if (!$id_as_key) {
$ret[] =& $module;
} else {
$ret[$myrow['mid']] =& $module;
}
unset($module);
}
return $ret;
}
示例6: die
$xoopsLogger->renderingEnabled = false;
$xoopsLogger->activated = false;
if(!$xoopsSecurity->check()){
die('Session token expired');
}*/
$installed_modules = array();
include_once XOOPS_ROOT_PATH . '/kernel/module.php';
$db = XoopsDatabaseFactory::getDatabaseConnection();
$sql = "SELECT * FROM " . $db->prefix("modules") . " WHERE isactive='1' ORDER BY `name`";
$result = $db->query($sql);
$installed_dirs = array();
while ($row = $db->fetchArray($result)) {
$mod = new XoopsModule();
$mod->assignVars($row);
$installed_dirs[] = $mod->dirname();
if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $mod->getVar('dirname') . '/class/' . strtolower($mod->getVar('dirname') . 'controller') . '.php')) {
include_once XOOPS_ROOT_PATH . '/modules/' . $mod->getVar('dirname') . '/class/' . strtolower($mod->getVar('dirname') . 'controller') . '.php';
$class = ucfirst($mod->getVar('dirname')) . 'Controller';
$class = new $class();
if (method_exists($class, 'get_main_link')) {
$main_link = $class->get_main_link();
} else {
if ($mod->getVar('hasmain')) {
$main_link = XOOPS_URL . '/modules/' . $mod->dirname();
} else {
$main_link = "#";
}
}
} else {
示例7: intval
/**
* Load a module from the database
*
* @param int $id ID of the module
*
* @return object FALSE on fail
*/
function &get($id)
{
static $_cachedModule_dirname;
static $_cachedModule_mid;
$id = intval($id);
if ($id > 0) {
if (!empty($_cachedModule_mid[$id])) {
return $_cachedModule_mid[$id];
} else {
$sql = 'SELECT * FROM ' . $this->db->prefix('modules') . ' WHERE mid = ' . $id;
if (!($result = $this->db->query($sql))) {
return false;
}
$numrows = $this->db->getRowsNum($result);
if ($numrows == 1) {
$module = new XoopsModule();
$myrow = $this->db->fetchArray($result);
$module->assignVars($myrow);
$_cachedModule_mid[$id] =& $module;
$_cachedModule_dirname[$module->getVar('dirname')] =& $module;
return $module;
}
}
}
return false;
}
示例8: getObjectsArray
/**
* Load some modules
*
* @param CriteriaElement|null $criteria {@link CriteriaElement}
* @param boolean $id_as_key Use the ID as key into the array
*
* @return array
*/
public function getObjectsArray(CriteriaElement $criteria = null, $id_as_key = false)
{
$ret = array();
$qb = $this->db2->createXoopsQueryBuilder();
$qb->select('*')->fromPrefix('modules', null);
if (isset($criteria) && $criteria instanceof CriteriaElement) {
$criteria->setSort('weight');
$criteria->renderQb($qb);
$qb->addOrderBy('mid', 'ASC');
}
try {
if (!($result = $qb->execute())) {
return $ret;
}
} catch (Exception $e) {
return $ret;
}
while ($myrow = $result->fetch(PDO::FETCH_ASSOC)) {
$module = new XoopsModule();
$module->assignVars($myrow);
if (!$id_as_key) {
$ret[] = $module;
} else {
$ret[$myrow['mid']] = $module;
}
unset($module);
}
return $ret;
}