Beispiel #1
0
function rmmfShow()
{
    global $db;
    define('RMCLOCATION', 'index');
    MFFunctions::toolbar();
    xoops_cp_header();
    RMTemplate::get()->add_head("<script type='text/javascript'>\n\t\t\t<!--\n\t\t\t\tfunction decision(message, url){\n\t\t\t\t\tif(confirm(message)) location.href = url;\n\t\t\t\t}\n\t\t\t-->\n\t\t   </script>");
    /**
     * @todo Create pagination
     */
    $result = $db->query("SELECT * FROM " . $db->prefix("rmmf_works") . " ORDER BY titulo");
    include_once '../class/catego.class.php';
    $items = array();
    while ($row = $db->fetchArray($result)) {
        $catego = new MFCategory($row['catego']);
        $items[] = array('title' => $row['titulo'], 'category' => $catego->getVar('nombre'), 'featured' => $row['resaltado'], 'id' => $row['id_w']);
    }
    /*
    	$table->setRowClass('odd,even', true);
    	$table->setCellStyle('');
    	
    	
    	$table->closeTbl();
    	rmmf_make_footer();*/
    include RMTemplate::get()->get_template('admin/mf-index.php', 'module', 'myfolder');
    xoops_cp_footer();
}
Beispiel #2
0
/** 
 * Eliminamos una categoria
 */
function rmmfDelete()
{
    global $db;
    $id = isset($_GET['id']) ? $_GET['id'] : (isset($_POST['id']) ? $_POST['id'] : 0);
    $ok = isset($_POST['ok']) ? $_POST['ok'] : 0;
    $catego = isset($_POST['catego']) ? $_POST['catego'] : 0;
    if ($id <= 0) {
        header('location: categos.php');
        die;
    }
    include_once '../class/catego.class.php';
    $catego = new MFCategory($id);
    $pass = false;
    if ($catego->getWorksNumber() <= 0) {
        $ok = 1;
        $pass = true;
    }
    if ($ok) {
        if ($catego <= 0 && !$pass) {
            redirect_header('?op=del&amp;id=' . $id, 2, _MA_RMMF_SELECTCAT);
            die;
        }
        if (!$pass) {
            $db->queryF("UPDATE " . $db->prefix("rmmf_works") . " SET catego='{$catego}' WHERE catego='{$id}'");
        }
        $db->queryF("UPDATE " . $db->prefix("rmmf_categos") . " SET parent='0' WHERE parent='{$id}'");
        $db->queryF("DELETE FROM " . $db->prefix("rmmf_categos") . " WHERE id_cat='{$id}'");
        if ($db->error() != '') {
            redirect_header('categos.php', 2, sprintf(_MA_RMMF_ERRDB, $db->error()));
            die;
        } else {
            header('location: categos.php');
            die;
        }
    } else {
        xoops_cp_header();
        rmmf_make_adminnav();
        $result = array();
        $select = "<select name='catego'>\n\t\t\t\t<option value='0'>" . _MA_RMMF_SELECT . "</option>";
        rmmf_get_categos($result);
        foreach ($result as $k => $v) {
            $select .= "<option value='{$v['id_cat']}'>{$v['nombre']}</option>";
        }
        $select .= "</select>";
        echo "<div class='confirmMsg'><form name='frmDel' method='post' action='categos.php?op=del'>\n\t\t\t\t" . _MA_RMMF_SELECTCAT . "<br /><br />{$select}\n\t\t\t\t</form></div>";
        rmmf_make_footer();
        xoops_cp_footer();
    }
}