/** * Editamos un trabajo */ function rmmfEdit() { global $db, $mc, $myts; $id = isset($_GET['id']) ? $_GET['id'] : 0; if ($id <= 0) { header('location: index.php'); die; } define('_RMMF_LOCATION', 'WORKS'); include_once '../class/work.class.php'; xoops_cp_header(); rmmf_make_adminnav(); include_once '../common/form.class.php'; $work = new MFWork($id); $form = new RMForm(_MA_RMMF_NEWWORK, 'frmMod', 'index.php?op=saveedit'); $form->setExtra("enctype='multipart/form-data'"); $form->addElement(new RMText(_MA_RMMF_TITLE, 'titulo', 50, 150, $work->getVar('titulo'))); $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['id_cat'] == $work->getVar('catego') ? " selected='selected'" : '') . ">" . str_repeat('-', $v['saltos']) . " {$v['nombre']}</option>"; } $select .= "</select>"; $form->addElement(new RMLabel(_MA_RMMF_CATEGO, $select)); $form->addElement(new RMText(_MA_RMMF_CLIENT, 'cliente', 50, 255, $work->getVar('cliente'))); $form->addElement(new RMText(_MA_RMMF_URL, 'url', 50, 255, $work->getVar('url'))); $form->addElement(new RMTextArea(_MA_RMMF_SHORT, 'short', 4, 45, $myts->makeTareaData4Edit($work->getVar('short'), 0, 0))); $form->addElement(new RMLabel(_MA_RMMF_DESC, rmmf_select_editor('desc', $mc['editor'], $myts->makeTareaData4Edit($work->getVar('desc')), '100%', '250px'))); $form->addElement(new RMTextArea(_MA_RMMF_COMMENT, 'comentario', 4, 45, $work->getVar('comentario'))); $ele = new RMFile(_MA_RMMF_IMG, 'imagen', 45); $ele->setDescription(_MA_RMMF_IMG_INFO); $form->addElement($ele); if ($work->getVar('imagen') != '') { $form->addElement(new RMLabel(_MA_RMMF_CURRIMG, "<img src='" . rmmf_add_slash(rmmf_web_dir($mc['storedir'])) . 'ths/' . $work->getVar('imagen') . "' border='0' />")); } $form->addElement(new RMYesNo(_MA_RMMF_FEATURED, 'resaltado', $work->getVar('resaltado') == 1 ? 1 : 0)); $form->addElement(new RMButton('sbt', _MA_RMMF_SEND)); $form->addElement(new RMHidden('id', $work->getVar('id_w'))); $form->display(); rmmf_make_footer(); xoops_cp_footer(); }
/** * 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&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(); } }