/** * Return the feed options to show in RSS Center */ public function eventRmcommonGetFeedsList($feeds) { include_once XOOPS_ROOT_PATH . '/modules/mywords/class/mwfunctions.php'; load_mod_locale('mywords'); $module = RMFunctions::load_module('mywords'); $config = RMUtilities::module_config('mywords'); $data = array('title' => $module->name(), 'url' => XOOPS_URL . $config['basepath'], 'module' => 'mywords'); $options[] = array('title' => __('All Recent Posts', 'mywords'), 'params' => 'show=all', 'description' => __('Show all recent posts', 'mywords')); $categories = array(); MWFunctions::categos_list($categories); $table = '<table cellpadding="2" cellspacing="2" width="100%"><tr class="even">'; $count = 0; foreach ($categories as $cat) { if ($count >= 3) { $count = 0; $table .= '</tr><tr class="' . tpl_cycle("odd,even") . '">'; } $table .= '<td width="33%"><a href="' . XOOPS_URL . '/backend.php?action=showfeed&mod=mywords&show=cat&cat=' . $cat['id_cat'] . '">' . $cat['name'] . '</a></td>'; $count++; } $table .= '</tr></table>'; $options[] = array('title' => __('Posts by category', 'mywords'), 'description' => __('Select a category to see the posts published recently.', 'mywords') . ' <a href="javascript:;" onclick="$(\'#categories-feed\').slideToggle(\'slow\');">Show Categories</a> <div id="categories-feed" style="padding: 10px; display: none;">' . $table . '</div>'); unset($categories); $tags = MWFunctions::get_tags("*", '', '', 99); $table = '<table cellpadding="2" cellspacing="2" width="100%"><tr class="even">'; $count = 0; foreach ($tags as $tag) { if ($count >= 3) { $count = 0; $table .= '</tr><tr class="' . tpl_cycle("odd,even") . '">'; } $table .= '<td width="33%"><a href="' . XOOPS_URL . '/backend.php?action=showfeed&mod=mywords&show=tag&tag=' . $tag['id_tag'] . '">' . $tag['tag'] . '</a></td>'; $count++; } $table .= '</tr></table>'; $options[] = array('title' => __('Show posts by tag', 'mywords'), 'description' => __('Select a tag to see the posts published recently.', 'mywords') . ' <a href="javascript:;" onclick="$(\'#tags-feed\').slideToggle(\'slow\');">Show Tags</a> <div id="tags-feed" style="padding: 10px; display: none;">' . $table . '</div>'); unset($tags); $db = XoopsDatabaseFactory::getDatabaseConnection(); $sql = "SELECT * FROM " . $db->prefix("mw_editors") . " ORDER BY name"; $result = $db->query($sql); $editors = array(); while ($row = $db->fetchArray($result)) { $editors[] = $row; } asort($editors); $table = '<table cellpadding="2" cellspacing="2" width="100%"><tr class="even">'; $count = 0; foreach ($editors as $ed) { if ($count >= 3) { $count = 0; $table .= '</tr><tr class="' . tpl_cycle("odd,even") . '">'; } $table .= '<td width="33%"><a href="' . XOOPS_URL . '/backend.php?action=showfeed&mod=mywords&show=author&author=' . $ed['id_editor'] . '">' . $ed['name'] . '</a></td>'; $count++; } $table .= '</tr></table>'; $options[] = array('title' => __('Show posts by author', 'mywords'), 'description' => __('Select an author to see the posts published recently.', 'mywords') . ' <a href="javascript:;" onclick="$(\'#editor-feed\').slideToggle(\'slow\');">Show Authors</a> <div id="editor-feed" style="padding: 10px; display: none;">' . $table . '</div>'); unset($editors); unset($table); RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.min.js'); RMTemplate::get()->add_script(RMCURL . '/include/js/jquery-ui.min.js'); $feed = array('data' => $data, 'options' => $options); $feeds[] = $feed; return $feeds; }
/** * Widget that show tags selection in a post form */ function mywords_widget_addtags($post = null) { global $xoopsModuleConfig, $xoopsUser, $allowed_tags; $widget['title'] = __('Add Tags', 'admin_mywords'); RMTemplate::get()->add_script(XOOPS_URL . '/modules/mywords/include/js/scripts.php?file=tags.js'); $widget['icon'] = ''; $edit = false; if (isset($post) && is_a($post, 'MWPost')) { if ($post->isNew()) { unset($post); } else { $edit = true; } } ob_start(); ?> <div class="rmc_widget_content_reduced"> <form id="mw-post-tags-form"> <?php if ($xoopsUser->isAdmin() || $allowed_tags) { ?> <div class="tags_box"> <div class="input-group"> <input type="text" name="tagsm" id="tags-m" class="form-control"> <div class="input-group-btn"> <button type="button" name="tags-button" id="tags-button" class="btn btn-info"><?php _e('+ Add', 'admin_mywords'); ?> </button> </div> </div> <span class="help-block"><em><?php _e('Separate multiple tags with commas', 'admin_mywords'); ?> </em></span> </div> <?php } $tags = $edit ? $post->tags() : array(); ?> <div id="tags-container"> <span class="tip_legends" style="<?php echo empty($tags) ? 'display: none;' : ''; ?> "> <?php _e('Used Tags', 'admin_mywords'); ?> </span> <?php foreach ($tags as $tag) { ?> <label><input type='checkbox' name='tags[]' checked='checked' value='<?php echo $tag['tag']; ?> ' /><?php echo $tag['tag']; ?> </label> <?php } unset($tags); ?> </div> <a href="javascript:;" id="show-used-tags"><?php _e('Choose between most populars tags', 'admin_mywords'); ?> </a> <div id="popular-tags-container" style="display: none;"> <?php $tags = MWFunctions::get_tags('*', '', 'posts DESC', "0,{$xoopsModuleConfig['tags_widget_limit']}"); foreach ($tags as $tag) { ?> <a href="javascript:;" id="tag-<?php echo $tag['id_tag']; ?> " class="add_tag" style="font-size: <?php echo MWFunctions::get()->tag_font_size($tag['posts'], 2); ?> em;"><?php echo $tag['tag']; ?> </a> <?php } ?> </div> </form> </div> <?php $widget['content'] = ob_get_clean(); return $widget; }