XOOPS RMCommon Utilities  2.1.8.91RC
 All Classes Namespaces Files Functions Variables
emotions.php
Go to the documentation of this file.
1 <?php
2 // $Id: emotions.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 
14 include '../../../mainfile.php';
15 XoopsLogger::getInstance()->activated = false;
16 XoopsLogger::getInstance()->renderingEnabled = false;
17 
18 load_mod_locale('rmcommon','emots-');
19 
20 $db = XoopsDatabaseFactory::getDatabaseConnection();
21 $result = $db->query("SELECT * FROM ".$db->prefix("smiles")." ORDER BY id");
22 while ($row = $db->fetchArray($result)){
23  $emotions[] = array(
24  'id'=>$row['id'],
25  'file'=>XOOPS_UPLOAD_URL.'/'.$row['smile_url'],
26  'desc'=>$row['emotion'],
27  'code'=>$row['code']
28  );
29 }
30 
31 // Load new icons from plugins
32 RMEvents::get()->run_event('rmcommon.load_emotions',$emotions,'tiny');
33 
34 ?>
35 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
36 <html>
37 <head>
38 <meta http-equiv="Expires" content="Fri, Jan 01 1900 00:00:00 GMT">
39 <meta http-equiv="Pragma" content="no-cache">
40 <meta http-equiv="Cache-Control" content="no-cache">
41 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
42 <script type="text/javascript" src="<?php echo XOOPS_URL; ?>/modules/rmcommon/api/editors/tinymce/tiny_mce_popup.js"></script>
43 <script type="text/javascript" src="<?php echo XOOPS_URL; ?>/modules/rmcommon/include/js/jquery.min.js"></script>
44 <link rel="stylesheet" type="text/css" href="<?php echo XOOPS_URL; ?>/modules/rmcommon/api/editors/exmcode/plugins/emotions/css/emotions.css" />
45 <script type="text/javascript">
46  $(document).ready(function(){
47  $("img").click(function(){
48  ed = tinyMCEPopup.editor;
49  var icon = '<img src="'+$(this).attr("src")+'" alt="" />';
50  ed.execCommand("mceInsertContent", true, icon);
51  tinyMCEPopup.close();
52  });
53  });
54 </script>
55 </head>
56 <body>
57 <table width="100%" cellpadding="2" cellspacing="0">
58 <tr align="center">
59 <?php $i = 0; ?>
60 <?php foreach($emotions as $icon): ?>
61 <?php if($i>=6): ?>
62  </tr><tr>
63 <?php
64  $i=0;
65  endif; ?>
66 <td><img src="<?php echo $icon['file']; ?>" title="<?php echo $icon['desc']; ?>" alt="<?php echo $icon['code']; ?>" /><br /><?php echo $icon['code']; ?></td>
67 <?php
68  $i++;
70 </tr>
71 </table>
72 </body>
73 </html>