XOOPS RMCommon Utilities  2.1.8.91RC
 All Classes Namespaces Files Functions Variables
modules.php
Go to the documentation of this file.
1 <?php
2 /*
3 Theme name: Two Point Six
4 Theme URI: http://www.redmexico.com.mx
5 Version: 1.0
6 Author: bitcero
7 Author URI: http://www.bitcero.info
8 */
9 
11 
12 include_once XOOPS_ROOT_PATH.'/kernel/module.php';
13 
14 $db = XoopsDatabaseFactory::getDatabaseConnection();
15 
16 $sql = "SELECT * FROM ".$db->prefix("modules")." WHERE isactive='1' ORDER BY `name`";
17 $result = $db->query($sql);
18 $installed_dirs = array();
19 
20 while($row = $db->fetchArray($result)){
21  $mod = new XoopsModule();
22  $mod->assignVars($row);
23  $installed_dirs[] = $mod->dirname();
24 
25  if (file_exists(XOOPS_ROOT_PATH.'/modules/'.$mod->getVar('dirname').'/class/'.strtolower($mod->getVar('dirname').'controller').'.php')){
26  include_once XOOPS_ROOT_PATH.'/modules/'.$mod->getVar('dirname').'/class/'.strtolower($mod->getVar('dirname').'controller').'.php';
27  $class = ucfirst($mod->getVar('dirname')).'Controller';
28  $class = new $class();
29  if (method_exists($class, 'get_main_link')){
30  $main_link = $class->get_main_link();
31  } else {
32 
33  if ($mod->getVar('hasmain')){
34  $main_link = XOOPS_URL.'/modules/'.$mod->dirname();
35  } else {
36  $main_link = "#";
37  }
38 
39  }
40  } else {
41 
42  if ($mod->getVar('hasmain')){
43  $main_link = XOOPS_URL.'/modules/'.$mod->dirname();
44  } else {
45  $main_link = "#";
46  }
47 
48  }
49 
50  // Admin section
51  $admin_link = $mod->getVar('hasadmin') ? XOOPS_URL.'/modules/'.$mod->dirname().'/'.$mod->getInfo('adminindex') : '';
52 
53  //$deficon = XOOPS_ROOT_PATH.'/modules/rmcommon/themes/twop6/images/modules/'.$mod->dirname().'.png';
54 
55  $modules[] = array(
56  'id' => $mod->getVar('mid'),
57  'name' => $mod->getVar('name'),
58  'realname' => $mod->getInfo('name'),
59  'version' => $mod->getInfo('rmnative') ? RMUtilities::format_version($mod->getInfo('rmversion')) : $mod->getInfo('version'),
60  'description' => $mod->getInfo('description'),
61  'image' => XOOPS_URL.'/modules/'.$mod->getVar('dirname').'/'.$mod->getInfo('image'),
62  'link' => $main_link,
63  'admin_link' => $admin_link,
64  'updated' => formatTimestamp($mod->getVar('last_update'), 's'),
65  'author' => $mod->getInfo('author'),
66  'author_mail' => $mod->getInfo('authormail'),
67  'author_web' => $mod->getInfo('authorweb'),
68  'author_url' => $mod->getInfo('authorurl'),
69  'license' => $mod->getInfo('license'),
70  'dirname' => $mod->getInfo('dirname'),
71  'active' => $mod->getVar('isactive')
72  );
73 }
74 
75 // Event for installed modules
76 $modules = RMEvents::get()->run_event('rmcommon.installed.modules', $modules, $installed_dirs);
77 
78 return $modules;
79