XOOPS RMCommon Utilities  2.1.8.91RC
 All Classes Namespaces Files Functions Variables
right_widgets.php
Go to the documentation of this file.
1 <?php
2 // $Id: right_widgets.php 902 2012-01-03 07:09:16Z i.bitcero $
3 // --------------------------------------------------------------
4 // Red México Common Utilities
5 // A framework for Red México Modules
6 // Author: Eduardo Cortés <i.bitcero@gmail.com>
7 // Email: i.bitcero@gmail.com
8 // License: GPL 2.0
9 // --------------------------------------------------------------
10 
11 function rmc_available_mods(){
12  global $available_mods, $xoopsSecurity;
13 
14  $ret['title'] = __('Available Modules','rmcommon');
15  $ret['icon'] = RMCURL.'/images/modules.png';
16 
17  $limit = 10;
18  $tpages = ceil(count($available_mods)/$limit);
19 
20  $nav = new RMPageNav(count($available_mods), $limit, 1, 3);
21  $nav->target_url('javascript:;" onclick="load_page({PAGE_NUM});');
22 
23  ob_start();
24  $i = 0;
25 ?>
26  <div class="rmc_widget_content_reduced rmc_modules_widget">
27  <img id="img-load" src="images/loading.gif" style="display: none; margin: 15px auto;" />
28  <div id="mods-widget-container">
29  <?php foreach($available_mods as $mod): ?>
30  <?php if($i==$limit) break; ?>
31  <div class="<?php echo tpl_cycle("even,odd"); ?>">
32  <a href="modules.php?action=install&amp;dir=<?php echo $mod->getInfo('dirname'); ?>" class="rmc_mod_img" style="background: url(<?php echo XOOPS_URL; ?>/modules/<?php echo $mod->getInfo('dirname'); ?>/<?php echo $mod->getInfo('image'); ?>) no-repeat center;"><span>&nbsp;</span></a>
33  <strong><a href="modules.php?action=install&amp;dir=<?php echo $mod->getInfo('dirname'); ?>"><?php echo $mod->getInfo('name'); ?></a></strong>
34  <span class="rmc_available_options">
35  <a href="modules.php?action=install&amp;dir=<?php echo $mod->getInfo('dirname'); ?>"><?php _e('Install','rmcommon'); ?></a> |
36  <a href="javascript:;" onclick="show_module_info('<?php echo $mod->getInfo('dirname'); ?>');"><?php _e('More info','rmcommon'); ?></a>
37  </span>
38  <span class="rmc_mod_info" id="mod-<?php echo $mod->getInfo('dirname'); ?>">
39  <?php _e('Version:','rmcommon'); ?>
40  <?php if($mod->getInfo('rmnative')): ?>
41  <?php echo RMUtilities::format_version($mod->getInfo('rmversion')); ?>
42  <?php else: ?>
43  <?php echo $mod->getInfo('version'); ?>
44  <?php endif; ?><br />
45  <?php _e('Author:', 'rmcommon'); ?> <?php echo substr(strip_tags($mod->getInfo('author')), 0, 12); ?>
46  </span>
47  </div>
48  <?php $i++; endforeach; ?>
49  <?php $nav->display(false); ?>
50  </div>
51  </div>
52  <input type="hidden" id="token" value="<?php echo $xoopsSecurity->createToken(); ?>" />
53 <?php
54  $ret['content'] = ob_get_clean();
55  return $ret;
56  //print_r($available_mods);
57 
58 }
59 
63 function rmc_blocks_new(){
64  $db = XoopsDatabaseFactory::getDatabaseConnection();
65 
67 
68  // Get intalled modules
69  $result = $db->query("SELECT * FROM ".$db->prefix("modules")." WHERE isactive=1 ORDER BY `name`");
70  while($row = $db->fetchArray($result)){
71  $modules[] = array('dir'=>$row['dirname'], 'name'=>$row['name']);
72  }
73 
74  // Cargamos los grupos
75  $sql = "SELECT groupid, name FROM " . $db->prefix("groups") . " ORDER BY name";
76  $result = $db->query($sql);
77  $groups = array();
78  while ($row = $db->fetchArray($result)) {
79  $groups[] = array('id' => $row['groupid'], 'name' => $row['name']);
80  }
81 
82  $widget['title'] = 'Add Block';
83  $widget['icon'] = '';
84  ob_start();
85  include RMTemplate::get()->get_template('widgets/rmc_aw_bknew.php');
86  $widget['content'] = ob_get_clean();
87  return $widget;
88 }
89 
93 function rmc_blocks_addpos(){
94  global $xoopsSecurity;
95 
96  $widget['title'] = 'Add Position';
97  $widget['icon'] = '';
98 
100 
101  ob_start();
102  include RMTemplate::get()->get_template('widgets/rmc_aw_posnew.php','module','rmcommon');
103  $widget['content'] = ob_get_clean();
104  return $widget;
105 
106 }