示例#1
0
/**
* @desc Muestra una lista con los elementos editados esperando aprovación
*/
function showEdits()
{
    global $xoopsModule, $db, $adminTemplate, $tpl, $mc;
    $sql = "SELECT * FROM " . $db->prefix("rd_edits");
    list($num) = $db->fetchRow($db->query($sql));
    $page = rmc_server_var($_REQUEST, 'page', 1);
    $limit = 15;
    $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('edits.php?page={PAGE_NUM}');
    $sql = "SELECT * FROM " . $db->prefix("rd_edits") . " ORDER BY `modified` DESC LIMIT {$start},{$limit}";
    $result = $db->query($sql);
    $sections = array();
    while ($row = $db->fetchArray($result)) {
        $edit = new RDEdit();
        $edit->assignVars($row);
        $sec = new RDSection($edit->getVar('id_sec'));
        $sections[] = array('id' => $edit->id(), 'section' => array('id' => $sec->id(), 'title' => $sec->getVar('title'), 'link' => $sec->permalink()), 'title' => $edit->getVar('title'), 'date' => RMTimeFormatter::get()->format($edit->getVar('modified'), __('%M% %d%, %Y%', 'docs')), 'uname' => $edit->getVar('uname'));
    }
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; " . __('Waiting Content', 'docs'));
    xoops_cp_header();
    RMTemplate::get()->add_local_script('jquery.checkboxes.js', 'rmcommon', 'include');
    RMTemplate::get()->add_local_script('admin.js', 'docs', 'include');
    RMTemplate::get()->add_style('admin.css', 'docs');
    include RMEvents::get()->run_event("docs.waiting.template", RMTemplate::get()->get_template("admin/rd_waiting.php", 'module', 'docs'));
    xoops_cp_footer();
}
示例#2
0
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&amp;mod=' . $mod->mid() : XOOPS_URL . '/modules/system/admin.php?fct=preferences&amp;op=showmod&amp;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
0
?>

<?php 
foreach ($resources as $res) {
    ?>
<div class="rd_search_item">
    <h4><a href="<?php 
    echo $res['link'];
    ?>
"><?php 
    echo $res['title'];
    ?>
</a></h4>
    <?php 
    echo $res['desc'];
    ?>
    <span class="rd_info">
    <?php 
    echo sprintf(__('%s by %s.', 'docs'), RMTimeFormatter::get()->format($res['created'], __('Created on %M% %d%, %Y%.', 'docs')), '<a href="' . XOOPS_URL . '/userinfo.php?uid=' . $res['owner'] . '">' . $res['uname'] . '</a>');
    ?>
    <?php 
    echo sprintf(__('Viewed %s times.', 'docs'), '<strong>' . $res['reads'] . '</strong>');
    ?>
    </span>
</div>
<?php 
}
?>

<?php 
$nav->display(true);
示例#4
0
 /**
  * Crea un índice numerado de las seccione existentes
  * 
  * @param int Parent ID of the section
  * @param int Number of spaces for indentation
  * @param RDResource Resource object
  * @param string Var name to assign in {@link RMTemplate}
  * @param string Contains the number for current section
  * @param bool Indicates that the index must be assigned to {@link RMTemplate} 
  * @param array Refernce to an array that will be filled with index (when $assign = false)
  * @param bool Indicates if function must be return also the content for section
  * @return true;
  */
 function sections_tree_index($parent = 0, $jumps = 0, RDResource $res, $var = 'rd_sections_index', $number = '', $assign = true, &$array = null, $text = false, $nested = false)
 {
     global $xoopsUser;
     $db = XoopsDatabaseFactory::getDatabaseConnection();
     if ($var == '' && $assign) {
         return false;
     }
     if (get_class($res) != 'RDResource') {
         return;
     }
     $sql = "SELECT * FROM " . $db->prefix("rd_sections") . " WHERE " . ($res->id() > 0 ? "id_res='" . $res->id() . "' AND" : '') . "\n                parent='{$parent}' ORDER BY `order`";
     $result = $db->query($sql);
     $sec = new RDSection();
     $i = 1;
     // Counter
     $num = 1;
     while ($row = $db->fetchArray($result)) {
         $sec->assignVars($row);
         $section = array('id' => $sec->id(), 'title' => $sec->getVar('title'), 'nameid' => $sec->getVar('nameid'), 'jump' => $jumps, 'link' => $sec->permalink(), 'order' => $sec->getVar('order'), 'author' => $sec->getVar('uid'), 'author_name' => $sec->getVar('uname'), 'created' => RMTimeFormatter::get()->format($sec->getVar('created'), '%M% %d%, %Y%'), 'modified' => RMTimeFormatter::get()->format($sec->getVar('modified'), '%M% %d%, %Y%'), 'number' => $jumps == 0 ? $num : ($number != '' ? $number . '.' : '') . $i, 'comments' => $sec->getVar('comments'), 'edit' => !$xoopsUser ? 0 : ($xoopsUser->isAdmin() ? true : $res->isEditor($xoopsUser->uid())), 'resource' => $sec->getVar('id_res'), 'metas' => $sec->metas(), 'parent' => $sec->getVar('parent'));
         if ($text) {
             $section['content'] = $sec->getVar('content');
         }
         $sec->clear_metas();
         if ($nested) {
             $secs = array();
             self::sections_tree_index($sec->id(), $jumps + 1, $res, $var, ($number != '' ? $number . '.' : '') . $i, $assign, $secs, $text, true);
             $section['sections'] = $secs;
             $array[] = $section;
         } else {
             if ($assign) {
                 RMTemplate::get()->assign($var, $section);
             } else {
                 $array[] = $section;
             }
             self::sections_tree_index($sec->id(), $jumps + 1, $res, $var, ($number != '' ? $number . '.' : '') . $i, $assign, $array, $text);
         }
         $i++;
         if ($jumps == 0) {
             $num++;
         }
     }
     return true;
 }