Esempio n. 1
0
/**
* @desc Formulario de licencias
**/
function formLicences($edit = 0)
{
    global $xoopsModule;
    $id = rmc_server_var($_REQUEST, 'id', 0);
    if ($edit) {
        //Verificamos si la licencia es válida
        if ($id <= 0) {
            redirectMsg('licenses.php', __('You must provide a valid licencse ID!', 'dtransport'), 1);
            die;
        }
        //Verificamos si la licencia existe
        $lc = new DTLicense($id);
        if ($lc->isNew()) {
            redirectMsg('licenses.php', __('Specified licence ID does not exists!', 'dtransport'), 1);
            die;
        }
    }
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; " . ($edit ? __('Edit Licence', 'dtransport') : __('New Licence', 'dtransport')));
    xoops_cp_header();
    $form = new RMForm($edit ? __('Edit Licence', 'dtransport') : __('New Licence', 'dtransport'), 'frmlic', 'licenses.php');
    $form->addElement(new RMFormText(__('Licence name', 'dtransport'), 'name', 50, 150, $edit ? $lc->name() : ''), true);
    $form->addElement(new RMFormText(__('Licence reference URL', 'dtransport'), 'url', 50, 255, $edit ? $lc->link() : ''));
    $ele = new RMFormSelect(__('Licence type', 'dtranport'), 'type');
    $ele->addOption(0, __('Open source licence', 'dtransport'), $edit ? $lc->type() == 0 ? 1 : 0 : 0);
    $ele->addOption(1, __('Restrictive licence', 'dtranport'), $edit ? $lc->type() == 1 ? 1 : 0 : 0);
    $form->addElement($ele);
    $form->addElement(new RMFormHidden('action', $edit ? 'saveedit' : 'save'));
    $form->addElement(new RMFormHidden('id', $id));
    $buttons = new RMFormButtonGroup();
    $buttons->addButton('sbt', __('Save Changes', 'dtransport'), 'submit');
    $buttons->addButton('cancel', __('Cancel', 'stransport'), 'button', 'onclick="window.location=\'licenses.php\';"');
    $form->addElement($buttons);
    $form->display();
    xoops_cp_footer();
}
Esempio n. 2
0
/**
* @desc Muestra el formulario para agregar un nuevo sitio
*/
function edit_bookmark()
{
    global $xoopsModule, $xoopsConfig, $xoopsSecurity;
    $id = rmc_server_var($_GET, 'id', 0);
    if ($id <= 0) {
        redirectMsg('bookmarks.php', __('Site ID not provided!', 'mywords'), 1);
        die;
    }
    $book = new MWBookmark($id);
    if ($book->isNew()) {
        redirectMsg('bookmarks.php', __('Social site not exists!', 'mywords'), 1);
        die;
    }
    $temp = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . '/modules/mywords/images/icons');
    foreach ($temp as $icon) {
        $icons[] = array('url' => XOOPS_URL . "/modules/mywords/images/icons/{$icon}", 'name' => $icon);
    }
    MWFunctions::include_required_files();
    xoops_cp_location('<a href="./">' . $xoopsModule->name() . '</a> &raquo; <a href="bookmarks.php">' . __('Social Sites', 'mywords') . '</a> &raquo; ' . __('Editing Social Site', 'mywords'));
    xoops_cp_header();
    $show_edit = true;
    include RMTemplate::get()->get_template('admin/mywords_bookmarks.php', 'module', 'mywords');
    RMTemplate::get()->assign('xoops_pagetitle', __('Bookmarks Management', 'mywords'));
    RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.checkboxes.js');
    RMTemplate::get()->add_script('../include/js/scripts.php?file=bookmarks.js');
    xoops_cp_footer();
}
Esempio n. 3
0
function categoriesForm($edit = 0)
{
    global $db, $xoopsModule;
    if ($edit) {
        $id = TCFunctions::get('id');
        if ($id <= 0) {
            redirectMsg('cats.php', __('¡El ID proporcionado no es válido!'), 1);
            die;
        }
        $cat = new TCCategory($id);
        if ($cat->isNew()) {
            redirectMsg('cats.php', __('No existe la categoría especificada'), 1);
            die;
        }
    }
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; <a href='./cats.php'>" . __('Administración de Categorías', 'admin_team') . "</a> &raquo; " . ($edit ? __('Editar Categoría', 'admin_team') : __('Crear Categoría', 'admin_team')));
    xoops_cp_header();
    $form = new RMForm($edit ? __('Editar Categoría', 'admin_team') : __('Crear Categoría', 'admin_team'), 'frmNew', 'cats.php');
    $form->oddClass('oddForm');
    $form->addElement(new RMFormText(__('Nombre', 'admin_team'), 'name', 50, 100, $edit ? $cat->name() : ''), true);
    if ($edit) {
        $form->addElement(new RMFormText(__('Nombre corto', 'admin_team'), 'nameid', 50, 100, $cat->nameId()));
    }
    $form->addElement(new RMFormTextArea(__('Descripción', 'admin_team'), 'desc', 5, 45, $edit ? $cat->getVar('desc') : ''));
    $ele = new RMFormButtonGroup();
    $ele->addButton('sbt', $edit ? __('Guardar Cambios', 'admin_team') : __('Crear Categoría', 'admin_team'), 'submit');
    $ele->addButton('cancel', __('Cancelar', 'admin_team'), 'button', 'onclick="window.location=\'cats.php\';"');
    $form->addElement($ele);
    $form->addElement(new RMFormHidden('op', $edit ? 'saveedit' : 'save'));
    if ($edit) {
        $form->addElement(new RMFormHidden('id', $id));
    }
    $form->display();
    xoops_cp_footer();
}
Esempio n. 4
0
function formCoachs($edit = 0)
{
    global $xoopsModule, $db, $mc, $xoopsConfig;
    if ($edit) {
        $id = TCFunctions::get('id');
        if ($id <= 0) {
            redirectMsg('coachs.php', __('Id no válido', 'admin_team'), 1);
            die;
        }
        $coach = new TCCoach($id);
        if ($coach->isNew()) {
            redirectMsg('coachs.php', __('El entrenador especificado no existe', 'admin_team'), 1);
            die;
        }
    }
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; <a href='./coachs.php'>" . __('Entrenadores', 'admin_team') . "</a> &raquo; " . ($edit ? __('Editar entrenador', 'admin_team') : __('Crear entrenador', 'admin_team')));
    $cHead = '<link href="' . TC_URL . '/styles/admin.css" media="all" rel="stylesheet" type="text/css" />';
    xoops_cp_header($cHead);
    $form = new RMForm($edit ? __('Editar Entrenador', 'admin_team') : __('Crear Entrenador', 'admin_team'), 'frmNew', 'coachs.php', 'post');
    $form->oddClass('oddForm');
    $form->setExtra('enctype="multipart/form-data"');
    $form->addElement(new RMFormText(__('Nombre', 'admin_team'), 'name', 50, 150, $edit ? $coach->name() : ''), true);
    if ($edit) {
        $form->addElement(new RMFormText(__('Nombre corto', 'admin_team'), 'nameid', 50, 150, $coach->nameId()));
    }
    $form->addElement(new RMFormText(__('Cargo', 'admin_team'), 'role', 50, 150, $edit ? $coach->role() : ''), true);
    $form->addElement(new RMFormFile(__('Imagen', 'admin_team'), 'image', 45, $mc['filesize'] * 1024));
    if ($edit && $coach->image() != '') {
        $form->addElement(new RMFormLabel(__('Imagen actual', 'admin_team'), "<img src='" . XOOPS_URL . "/uploads/teams/coachs/ths/" . $coach->image() . "' alt='' />"));
    }
    $form->addElement(new RMFormEditor(__('Biografía', 'admin_team'), 'bio', '90%', '300px', $edit ? $coach->bio('e') : ''));
    $form->addElement(new RMFormSubTitle(__('Equipos', 'admin_team'), 1));
    $ele = new RMFormCheck(__('Seleccionar equipos', 'admin_team'));
    $ele->asTable(3);
    $sql = "SELECT * FROM " . $db->prefix("coach_teams") . " ORDER BY name";
    $result = $db->query($sql);
    if ($edit) {
        $teams = $coach->teams(false);
    }
    while ($row = $db->fetchArray($result)) {
        $team = new TCTeam();
        $team->assignVars($row);
        $cat =& $team->category(true);
        $ele->addOption($team->name() . " <span class='coachNameCat'>(" . $cat->name() . ")</span>", 'teams[]', $team->id(), $edit ? in_array($team->id(), $teams) ? 1 : 0 : 0);
    }
    $form->addElement($ele);
    $ele = new RMFormButtonGroup();
    $ele->addButton('sbt', __('Enviar', 'admin_team'), 'submit');
    $ele->addButton('cancel', __('Cancelar', 'admin_team'), 'button', 'onclick="window.location=\'coachs.php\';"');
    $form->addElement($ele);
    $form->addElement(new RMFormHidden('op', $edit ? 'saveedit' : 'save'));
    if ($edit) {
        $form->addElement(new RMFormHidden('id', $id));
    }
    $form->display();
    xoops_cp_footer();
}
Esempio n. 5
0
/**
* Formulario para crear publicaciones
**/
function rd_show_form($edit = 0)
{
    global $xoopsModule, $xoopsConfig, $xoopsModuleConfig;
    RDFunctions::toolbar();
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; " . ($edit ? __('Editing Document', 'docs') : __('Create Document', 'docs')));
    xoops_cp_header();
    $id = rmc_server_var($_GET, 'id', 0);
    $page = rmc_server_var($_GET, 'page', 1);
    if ($edit) {
        //Comprueba si la publicación es válida
        if ($id <= 0) {
            redirectMsg('./resources.php?page=' . $page, __('You must provide an ID from some Document to edit!', 'docs'), 1);
            die;
        }
        //Comprueba si la publicación existe
        $res = new RDResource($id);
        if ($res->isNew()) {
            redirectMsg('./resources.php?page=' . $page, __('Specified Document does not exists!', 'docs'), 1);
            die;
        }
    }
    $form = new RMForm($edit ? sprintf(__('Edit Document: %s', 'docs'), $res->getVar('title')) : __('New Document', 'docs'), 'frmres', 'resources.php');
    $form->addElement(new RMFormText(__('Document title', 'docs'), 'title', 50, 150, $edit ? $res->getVar('title') : ''), true);
    if ($edit) {
        $form->addElement(new RMFormText(__('Document slug', 'docs'), 'nameid', 50, 150, $res->getVar('nameid')));
    }
    $form->addElement(new RMFormTextArea(__('Description', 'docs'), 'desc', 5, 50, $edit ? $res->getVar('description', 'e') : ''), true);
    $form->addElement(new RMFormUser(__('Editors', 'docs'), 'editors', 1, $edit ? $res->getVar('editors') : '', 30));
    //Propietario de la publicacion
    if ($edit) {
        $form->addElement(new RMFormUser(__('Document owner', 'docs'), 'owner', 0, $edit ? array($res->getVar('owner')) : '', 30));
    }
    $form->addElement(new RMFormYesno(__('Approve content and changes by editors', 'docs'), 'approvededit', $edit ? $res->getVar('editor_approve') : 0));
    $form->addElement(new RMFormGroups(__('Groups that can see this Document', 'docs'), 'groups', 1, 1, 5, $edit ? $res->getVar('groups') : array(1, 2)), true);
    $form->addElement(new RMFormYesno(__('Set as public', 'docs', 'docs'), 'public', $edit ? $res->getVar('public') : 0));
    $form->addElement(new RMFormYesNo(__('Quick index', 'docs'), 'quick', $edit ? $res->getVar('quick') : 0));
    //Mostrar índice a usuarios sin permiso de publicación
    $form->addElement(new RMFormYesno(__('Show index to restricted users', 'docs'), 'showindex', $edit ? $res->getVar('show_index') : 0));
    $form->addElement(new RMFormYesno(__('Featured', 'docs'), 'featured', $edit ? $res->getVar('featured') : 0));
    $form->addElement(new RMFormYesno(__('Approve inmediatly', 'docs'), 'approvedres', $edit ? $res->getVar('approved') : 1));
    $form->addElement(new RMFormYesno(__('Show content in a single page', 'docs'), 'single', $edit ? $res->getVar('single') : 0));
    $form->element('single')->setDescription(__('When you enable this option the Document content will show in a single page.', 'docs'));
    $buttons = new RMFormButtonGroup();
    $buttons->addButton('sbt', $edit ? __('Update Document', 'docs') : __('Create Document', 'docs'), 'submit');
    $buttons->addButton('cancel', __('Cancel', 'docs'), 'button', 'onclick="window.location=\'resources.php\';"');
    $form->addElement($buttons);
    $form->addElement(new RMFormHidden('action', $edit ? 'saveedit' : 'save'));
    if ($edit) {
        $form->addElement(new RMFormHidden('id', $id));
    }
    $form->addElement(new RMFormHidden('page', $page));
    $form->addElement(new RMFormHidden('app', $edit ? $res->getVar('approved') : 0));
    $form->display();
    xoops_cp_footer();
}
Esempio n. 6
0
function m_teams_form($edit = 0)
{
    global $mc, $xoopsModule, $db;
    MCHFunctions::toolbar();
    RMTemplate::get()->assign('xoops_pagetitle', $edit ? __('Edit Team', 'match') : __('Add Team', 'match'));
    xoops_cp_location('<a href="./">' . $xoopsModule->name() . "</a> &raquo; \n        <a href='teams.php'>" . __('Teams', 'match') . '</a> &raquo; ' . ($edit ? __('Edit Team', 'match') : __('Add Team', 'match')));
    xoops_cp_header();
    $id = rmc_server_var($_REQUEST, 'id', 0);
    if ($edit) {
        //Verificamos si la categoría es válida
        if ($id <= 0) {
            redirectMsg('./teams.php', __('Provide a team ID!', 'match'), 1);
            die;
        }
        //Verificamos si la categoría existe
        $team = new MCHTeam($id);
        if ($team->isNew()) {
            redirectMsg('./teams.php', __('Specified team was not found!', 'match'), 1);
            die;
        }
    }
    $form = new RMForm($edit ? __('Edit Team', 'match') : __('Add Team', 'match'), 'frmNew', 'teams.php');
    $form->setExtra('enctype="multipart/form-data"');
    $form->addElement(new RMFormText(__('Name', 'match'), 'name', 50, 150, $edit ? $team->getVar('name') : ''), true);
    if ($edit) {
        $form->addElement(new RMFormText(__('Short name', 'match'), 'nameid', 50, 150, $team->getVar('nameid')), true);
    }
    $form->addElement(new RMFormEditor(__('Team Information', 'match'), 'info', '100%', '250px', $edit ? $team->getVar('info', 'e') : ''));
    $sel_cats = new RMFormSelect(__('Category:', 'match'), 'category', 0, $edit ? array($team->getVar('category')) : 0);
    $categories = array();
    MCHFunctions::categories_tree($categories, 0, 0, true, 0, '`name` ASC');
    $sel_cats->addOption(0, __('Select category...', 'match'), $edit ? $team->getVar('category') == 0 ? 1 : 0 : 1);
    foreach ($categories as $catego) {
        $sel_cats->addOption($catego['id'], str_repeat('&#151;', $catego['indent']) . ' ' . $catego['name']);
    }
    $form->addElement($sel_cats, true);
    $form->addElement(new RMFormYesNo(__('Active', 'match'), 'active', $edit ? $team->getVar('active') : 1));
    $form->addElement(new RMFormDate(__('Registered on', 'match'), 'created', $edit ? $team->getVar('created') : time(), false));
    $form->addElement(new RMFormFile(__('Team logo', 'match'), 'logo', 45));
    if ($edit) {
        $form->addElement(new RMFormLabel(__('Current logo', 'match'), '<img src="' . MCH_UP_URL . '/' . $team->getVar('logo') . '" alt="' . $team->getVar('name') . '" />'));
    }
    $form->addElement(new RMFormHidden('action', $edit ? 'saveedit' : 'save'));
    if ($edit) {
        $form->addElement(new RMFormHidden('id', $team->id()));
    }
    $ele = new RMFormButtonGroup();
    $ele->addButton('sbt', $edit ? __('Save Changes!', 'match') : __('Add Now!', 'match'), 'submit');
    $ele->addButton('cancel', _CANCEL, 'button', 'onclick="window.location=\'teams.php\';"');
    $form->addElement($ele);
    $form = RMEvents::get()->run_event('match.form.teams', $form);
    $form->display();
    xoops_cp_footer();
}
Esempio n. 7
0
/**
* @desc Formulario de creación/edición de clientes
**/
function formClients($edit = 0)
{
    global $xoopsModule, $db;
    $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
    $page = isset($_REQUEST['pag']) ? $_REQUEST['pag'] : '';
    $limit = isset($_REQUEST['limit']) ? intval($_REQUEST['limit']) : 15;
    $ruta = "pag={$page}&limit={$limit}";
    if ($edit) {
        //Verificamos si el cliente es válido
        if ($id <= 0) {
            redirectMsg('./clients.php?' . $ruta, __('You must provide a customer ID', 'works'), 1);
            die;
        }
        //Verificamos si el cliente existe
        $client = new PWClient($id);
        if ($client->isNew()) {
            redirectMsg('./clients.php?' . $ruta, __('Specified customer does not exists!', 'works'), 1);
            die;
        }
    }
    xoops_cp_location('<a href="./">' . $xoopsModule->name() . "</a> &raquo; <a href='./clients.php'>" . __('Customers', 'works') . "</a> &raquo;" . ($edit ? __('Edit Customer', 'works') : __('New Customer', 'works')));
    RMTemplate::get()->assign('xoops_pagetitle', __('Customers', 'works'));
    PWFunctions::toolbar();
    xoops_cp_header();
    $form = new RMForm($edit ? __('Edit Customer', 'works') : __('New Customer', 'works'), 'frmClient', 'clients.php');
    $form->addElement(new RMFormText(__('Name', 'works'), 'name', 50, 200, $edit ? $client->name() : ''), true);
    $form->addElement(new RMFormText(__('Company', 'works'), 'business', 50, 200, $edit ? $client->businessName() : ''));
    $form->addElement(new RMFormText(__('Email address', 'works'), 'mail', 50, 100, $edit ? $client->email() : ''));
    $form->addElement(new RMFormTextArea(__('Description', 'works'), 'desc', 4, 50, $edit ? $client->desc() : ''), true);
    //Tipos de Cliente
    $ele = new RMFormSelect(__('Type', 'works'), 'type');
    $ele->addOption(0, _SELECT);
    $result = $db->query("SELECT * FROM " . $db->prefix('pw_types'));
    while ($row = $db->fetchArray($result)) {
        $ele->addOption($row['id_type'], $row['type'], $edit ? $row['id_type'] == $client->type() ? 1 : 0 : 0);
    }
    $form->addElement($ele, true, 'noselect:0');
    $form->addElement(new RMFormHidden('op', $edit ? 'saveedit' : 'save'));
    $form->addElement(new RMFormHidden('id', $id));
    $form->addElement(new RMFormHidden('page', $page));
    $form->addElement(new RMFormHidden('limit', $limit));
    $ele = new RMFormButtonGroup();
    $ele->addButton('sbt', $edit ? __('Save Changes', 'works') : __('Create Customer', 'works'), 'submit');
    $ele->addButton('cancel', __('Cancel', 'works'), 'button', 'onclick="window.location=\'clients.php?' . $ruta . '\';"');
    $form->addElement($ele);
    //Event
    $form = RMEvents::get()->run_event('works.form.customers', $form);
    $form->display();
    xoops_cp_footer();
}
Esempio n. 8
0
function show_rm_blocks()
{
    global $xoopsModule, $xoopsConfig, $wid_globals, $xoopsSecurity;
    $db = Database::getInstance();
    $modules = RMFunctions::get_modules_list(1);
    // ** API Event **
    // Allows other methods to add o modify the list of available widgets
    $modules = RMEvents::get()->run_event('rmcommon.blocks.modules', $modules);
    // Cargamos los grupos
    $sql = "SELECT groupid, name FROM " . $db->prefix("groups") . " ORDER BY name";
    $result = $db->query($sql);
    $groups = array();
    while ($row = $db->fetchArray($result)) {
        $groups[] = array('id' => $row['groupid'], 'name' => $row['name']);
    }
    // Cargamos las posiciones de bloques
    $bpos = RMBlocksFunctions::block_positions();
    $sql = createSQL();
    $result = $db->query($sql);
    $blocks = array();
    $used_blocks = array();
    while ($row = $db->fetchArray($result)) {
        $mod = RMFunctions::load_module($row['element']);
        if (!$mod) {
            continue;
        }
        $used_blocks[] = array('id' => $row['bid'], 'title' => $row['name'], 'module' => array('id' => $mod->mid(), 'dir' => $mod->dirname(), 'name' => $mod->name()), 'canvas' => $bpos[$row['canvas']], 'weight' => $row['weight'], 'visible' => $row['visible'], 'type' => $row['type'], 'options' => $row['edit_func'] != '' ? 1 : 0, 'description' => $row['description']);
    }
    // ** API **
    // Event for manege the used widgets list
    $used_blocks = RMEvents::get()->run_event('rmcommon.used.blocks.list', $used_blocks);
    $positions = array();
    foreach ($bpos as $row) {
        $positions[] = array('id' => $row['id_position'], 'name' => $row['name']);
    }
    $positions = RMEvents::get()->run_event('rmcommon.block.positions.list', $positions);
    xoops_cp_location('<a href="./">' . $xoopsModule->getVar('name') . '</a> &raquo; ' . __('Blocks', 'rmcommon'));
    RMTemplate::get()->add_style('blocks.css', 'rmcommon');
    RMTemplate::get()->add_local_script('blocks.js', 'rmcommon', 'include');
    RMTemplate::get()->add_local_script('jkmenu.js', 'rmcommon', 'include');
    RMTemplate::get()->add_style('forms.css', 'rmcommon');
    RMTemplate::get()->add_local_script('jquery-ui.min.js', 'rmcommon', 'include');
    xoops_cp_header();
    // Available Widgets
    $blocks = RMBlocksFunctions::get_available_list($modules);
    // Position
    $the_position = isset($_GET['pos']) ? intval($_GET['pos']) : '';
    include RMTemplate::get()->get_template("rmc_blocks.php", 'module', 'rmcommon');
    xoops_cp_footer();
}
Esempio n. 9
0
/**
* Show the form to edit or create a category
* @param int edit
*/
function m_categories_form($edit = 0)
{
    global $mc, $xoopsModule, $db;
    MCHFunctions::toolbar();
    RMTemplate::get()->assign('xoops_pagetitle', $edit ? __('Edit Category', 'match') : __('Add Category', 'match'));
    xoops_cp_location('<a href="./">' . $xoopsModule->name() . "</a> &raquo; \n        <a href='categories.php'>" . __('Categories', 'match') . '</a> &raquo; ' . ($edit ? __('Edit Category', 'match') : __('Add Category', 'match')));
    xoops_cp_header();
    $id = rmc_server_var($_REQUEST, 'id', 0);
    if ($edit) {
        //Verificamos si la categoría es válida
        if ($id <= 0) {
            redirectMsg('./categories.php', __('Provide a category ID!', 'match'), 1);
            die;
        }
        //Verificamos si la categoría existe
        $cat = new MCHCategory($id);
        if ($cat->isNew()) {
            redirectMsg('./categories.php', __('Specified category was not found!', 'match'), 1);
            die;
        }
    }
    $form = new RMForm($edit ? __('Edit Category', 'match') : __('Add Category', 'match'), 'frmNew', 'categories.php');
    $form->addElement(new RMFormText(__('Name', 'match'), 'name', 50, 150, $edit ? $cat->getVar('name') : ''), true);
    if ($edit) {
        $form->addElement(new RMFormText(__('Short name', 'match'), 'nameid', 50, 150, $cat->getVar('nameid')), true);
    }
    $form->addElement(new RMFormEditor(__('Description', 'match'), 'desc', '100%', '250px', $edit ? $cat->getVar('description', 'e') : ''));
    $sel_cats = new RMFormSelect(__('Parent category:', 'match'), 'parent', 0, $edit ? $cat->getVar('parent') : 0);
    $categories = array();
    MCHFunctions::categories_tree($categories, 0, 0, true, $edit ? $cat->id() : 0, '`name` ASC');
    $sel_cats->addOption(0, __('Select category...', 'match'), $edit ? $cat->getVar('parent') == 0 ? 1 : 0 : 1);
    foreach ($categories as $catego) {
        $sel_cats->addOption($catego['id'], str_repeat('&#151;', $catego['indent']) . ' ' . $catego['name']);
    }
    $form->addElement($sel_cats);
    $form->addElement(new RMFormYesNo(__('Enable category', 'match'), 'active', $edit ? $cat->getVar('active') : 1));
    $form->addElement(new RMFormHidden('action', $edit ? 'saveedit' : 'save'));
    if ($edit) {
        $form->addElement(new RMFormHidden('id', $cat->id()));
    }
    $ele = new RMFormButtonGroup();
    $ele->addButton('sbt', $edit ? __('Save Changes!', 'match') : __('Add Now!', 'match'), 'submit');
    $ele->addButton('cancel', _CANCEL, 'button', 'onclick="window.location=\'categos.php\';"');
    $form->addElement($ele);
    $form = RMEvents::get()->run_event('match.form.categories', $form);
    $form->display();
    xoops_cp_footer();
}
Esempio n. 10
0
/**
* @desc Formulario de creación/edición de Tipos de cliente
**/
function formTypes($edit = 0)
{
    global $tpl, $xoopsModule;
    $ids = isset($_REQUEST['ids']) ? $_REQUEST['ids'] : 0;
    if ($edit) {
        //Verificamos si nos proporcionaron al menos un tipo para editar
        if (!is_array($ids)) {
            redirectMsg('./types.php', __('You must provide a type ID at least', 'works'), 1);
            die;
        }
        if (!is_array($ids)) {
            $ids = array($ids);
        }
    }
    PWFunctions::toolbar();
    xoops_cp_location('<a href="./">' . $xoopsModule->name() . "</a> &raquo; <a href='./types.php'>" . __('Customer types', 'works') . "</a> &raquo; " . ($edit ? __('Edit type', 'works') : __('New type', 'works')));
    RMTemplate::get()->assign('xoops_pagetitle', __('Add Customers types', 'works'));
    xoops_cp_header();
    $form = new RMForm($edit ? __('Edit Type', 'works') : __('New Type', 'works'), 'frmtype', 'types.php');
    $num = 10;
    if ($edit) {
        foreach ($ids as $k) {
            //Verificamos si el tipo es válido
            if ($k <= 0) {
                continue;
            }
            //Verificamos si el tipo existe
            $type = new PWType($k);
            if ($type->isNew()) {
                continue;
            }
            $form->addElement(new RMFormText(__('Type name', 'works'), 'type[' . $type->id() . ']', 50, 100, $edit ? $type->type() : ''));
        }
    } else {
        for ($i = 1; $i <= $num; $i++) {
            $form->addElement(new RMFormText(__('Type name', 'works'), 'type[' . $i . ']', 50, 100, $edit ? '' : ''));
        }
    }
    $form->addElement(new RMFormHidden('op', $edit ? 'saveedit' : 'save'));
    $ele = new RMFormButtonGroup();
    $ele->addButton('sbt', $edit ? __('Save Changes', 'works') : __('Save Customer Types', 'works'), 'submit');
    $ele->addButton('cancel', __('Cancel', 'works'), 'button', 'onclick="window.location=\'types.php\';"');
    $form->addElement($ele);
    $form->display();
    xoops_cp_footer();
}
Esempio n. 11
0
/**
* @desc Formulario de Logs
**/
function dt_form_logs($edit = 0)
{
    global $xoopsModule, $xoopsConfig;
    define('RMCSUBLOCATION', 'newlog');
    $id = rmc_server_var($_GET, 'id', 0);
    $item = rmc_server_var($_GET, 'item', 0);
    //Verificamos si el software es válido
    if ($item <= 0) {
        redirectMsg('items.php', __('Download item ID has not been provided!', 'dtransport'), RMMSG_WARN);
    }
    //Verificamos si existe el software
    $sw = new DTSoftware($item);
    if ($sw->isNew()) {
        redirectMsg('items.php', __('Specified download item does not exists!', 'dtransport'), 1);
    }
    if ($edit) {
        //Verificamos si log es válido
        if ($id <= 0) {
            redirectMsg('logs.php?item=' . $item, __('Log item ID has not been provided!', 'dtransport'), RMMSG_WARN);
        }
        //Verificamos si log existe
        $log = new DTLog($id);
        if ($log->isNew()) {
            redirectMsg('logs.php?item=' . $item, __('Specified item log does not exists!', 'dtranport'), 1);
        }
    }
    $dtf = new DTFunctions();
    $dtf->toolbar();
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; <a href='./items.php'>" . sprintf(__('"%s" Logs', 'dtransport'), $sw->getVar('name')) . "</a> &raquo; " . ($edit ? __('Edit Log', 'dtransport') : __('New Log', 'dtransport')));
    xoops_cp_header();
    $form = new RMForm($edit ? sprintf(__('Edit Change Log of "%s"', 'dtransport'), $sw->getVar('name')) : sprintf(__('New Log for "%s"', 'dtransport'), $sw->getVar('name')), 'frmlog', 'logs.php');
    $form->addElement(new RMFormLabel(__('Download Item', 'dtransport'), $sw->getVar('name')));
    $form->addElement(new RMFormText(__('Log title', 'dtransport'), 'title', 50, 100, $edit ? $log->title() : ''), true);
    $form->addElement(new RMFormEditor(__('Log content', 'dtransport'), 'log', '90%', '350px', $edit ? $log->getVar('log', 'e') : ''), true);
    $form->addElement(new RMFormHidden('action', $edit ? 'saveedit' : 'save'));
    $form->addElement(new RMFormHidden('item', $item));
    $form->addElement(new RMFormHidden('id', $id));
    $buttons = new RMFormButtonGroup();
    $buttons->addButton('sbt', _SUBMIT, 'submit');
    $buttons->addButton('cancel', _CANCEL, 'button', 'onclick="window.location=\'logs.php?item=' . $item . '\';"');
    $form->addElement($buttons);
    $form->display();
    xoops_cp_footer();
}
Esempio n. 12
0
/**
* @desc Formulario de creación/edición de usuarios
**/
function formUsers($edit = 0)
{
    global $xoopsModule, $xoopsModuleConfig;
    $mc =& $xoopsModuleConfig;
    $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
    $page = isset($_REQUEST['pag']) ? $_REQUEST['pag'] : '';
    $limit = isset($_REQUEST['limit']) ? intval($_REQUEST['limit']) : 15;
    $search = isset($_REQUEST['search']) ? $_REQUEST['search'] : '';
    $ruta = "pag={$page}&search={$search}";
    if ($edit) {
        //Verificamos que el usuario sea válido
        if ($id <= 0) {
            redirectMsg('./users.php?' . $ruta, __('User id is not valid!', 'galleries'), 1);
            die;
        }
        //Verificamos que el usuario exista
        $user = new GSUser($id);
        if ($user->isNew()) {
            redirectMsg('./users.php?' . $ruta, __('Specified user does not exists!', 'galleries'), 1);
            die;
        }
    }
    GSFunctions::toolbar();
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; <a href='./users.php'>" . __('Users management', 'galleries') . "</a> &raquo; " . ($edit ? __('Edit User', 'galleries') : __('New User', 'galleries')));
    RMTemplate::get()->assign('xoops_pagetitle', $edit ? __('Edit User', 'galleries') : __('New User', 'galleries'));
    xoops_cp_header();
    $form = new RMForm($edit ? __('Edit User', 'galleries') : __('New User', 'galleries'), 'frmuser', 'users.php');
    $form->addElement(new RMFormUser(__('Xoops User', 'galleries'), 'uid', 0, $edit ? array($user->uid()) : '', 30));
    $ele = new RMFormText(__('Max Quota', 'galleries'), 'quota', 10, 10, $edit ? $user->quota() / 1024 / 1024 : $mc['quota']);
    $ele->setDescription(__('This value determines the total disc quota to be used for user and must be specified in megabytes.', 'galleries'));
    $form->addElement($ele, true);
    $form->addElement(new RMFormYesno(__('Blocked', 'galleries'), 'block', $edit ? $user->blocked() : 0));
    $form->addElement(new RMFormHidden('op', $edit ? 'saveedit' : 'save'));
    $form->addElement(new RMFormHidden('id', $id));
    $form->addElement(new RMFormHidden('page', $page));
    $form->addElement(new RMFormHidden('search', $search));
    $buttons = new RMFormButtonGroup();
    $buttons->addButton('sbt', $edit ? __('Save Changes', 'galleries') : __('Create User', 'galleries'), 'submit');
    $buttons->addButton('cancel', __('Cancel', 'galleries'), 'button', 'onclick="window.location=\'users.php?' . $ruta . '\'"');
    $form->addElement($buttons);
    $form->display();
    xoops_cp_footer();
}
Esempio n. 13
0
/**
* @desc Formulario de creación/edición de categorías
**/
function formCategos($edit = 0)
{
    global $xoopsModule, $db;
    $id = rmc_server_var($_GET, 'id', 0);
    if ($edit) {
        //Verificamos si categoría es válida
        if ($id <= 0) {
            redirectMsg('categories.php', __('Specified category is not valid!', 'dtransport'), 1);
        }
        //Verificamos si la categoría existe
        $cat = new DTCategory($id);
        if ($cat->isNew()) {
            redirectMsg('categories.php', __('Specified category does not exists!', 'dtransport'), 1);
        }
    }
    DTFunctions::toolbar();
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; " . ($edit ? __('Edit category', 'dtransport') : __('New category', 'dtransport')));
    xoops_cp_header();
    $form = new RMForm($edit ? __('Edit Category', 'dtransport') : __('New Category', 'dtransport'), 'frmcat', 'categories.php');
    $form->addElement(new RMFormText(__('Category name', 'dtransport'), 'name', 50, 150, $edit ? $cat->name() : ''), true);
    if ($edit) {
        $form->addElement(new RMFormText(__('Category short name', 'dtransport'), 'nameid', 50, 150, $edit ? $cat->nameId() : ''));
    }
    $form->addElement(new RMFormTextArea(__('Description', 'dtransport'), 'desc', 5, 40, $edit ? $cat->desc('e') : ''));
    //Lista de categorías
    $ele = new RMFormSelect(__('Root category', 'dtransport'), 'parent');
    $ele->addOption(0, __('Select category...', 'dtransport'));
    $categos = array();
    DTFunctions::getCategos($categos, 0, 0, $edit ? $cat->id() : array());
    foreach ($categos as $catego) {
        $ele->addOption($catego['id_cat'], str_repeat('--', $catego['jumps']) . ' ' . $catego['name'], $edit ? $catego['id_cat'] == $cat->parent() ? 1 : 0 : 0);
    }
    $form->addElement($ele);
    $form->addElement(new RMFormYesno(__('Active category', 'dtransport'), 'active', $edit ? $cat->active() : 1));
    $form->addElement(new RMFormHidden('action', $edit ? 'saveedit' : 'save'));
    $form->addElement(new RMFormHidden('id', $id));
    $buttons = new RMFormButtonGroup();
    $buttons->addButton('sbt', __('Submit', 'dtransport'), 'submit');
    $buttons->addButton('cancel', __('Cancel', 'dtransport'), 'button', 'onclick="window.location=\'categories.php\';"');
    $form->addElement($buttons);
    $form->display();
    xoops_cp_footer();
}
Esempio n. 14
0
/**
 * Presenta un formulario para la creación de una nueva
 * categoría para los artículos
 */
function newForm($edit = 0)
{
    global $xoopsModule;
    if ($edit) {
        $id = isset($_GET['id']) ? $_GET['id'] : 0;
        if ($id <= 0) {
            redirectMsg('cats.php', __('You must provide a category ID to edit!', 'qpages'), 1);
            die;
        }
        // Cargamos la categoría
        $catego = new QPCategory($id);
        // Si no existe entonces devolvemos un error
        if ($catego->isNew()) {
            redirectMsg('cats.php', __('Specified category does not exists!', 'qpages'), 1);
            die;
        }
    }
    xoops_cp_location('<a href="./">' . $xoopsModule->name() . '</a> &raquo; ' . ($edit ? __('Edit Category', 'qpages') : __('New Category', 'qpages')));
    xoops_cp_header();
    $cats = array();
    qpArrayCategos($cats, 0, 0, $edit ? array($id) : 0);
    $form = new RMForm($edit ? __('Edit Category', 'qpages') : __('New Category', 'qpages'), 'frmNew', 'cats.php');
    $form->addElement(new RMFormText(__('Category name', 'qpages'), 'nombre', 50, 150, $edit ? $catego->getName() : ''), true);
    $form->addElement(new RMFormTextArea(__('Description', 'qpages'), 'descripcion', 5, 45, $edit ? $catego->getVar('descripcion', 'e') : ''));
    $ele = new RMFormSelect(__('Category parent', 'qpages'), 'parent');
    $ele->addOption(0, _SELECT, $edit ? $catego->getParent() == 0 ? 1 : 0 : 1);
    foreach ($cats as $k) {
        $ele->addOption($k['id_cat'], str_repeat("-", $k['saltos']) . ' ' . $k['nombre'], $edit ? $catego->getParent() == $k['id_cat'] ? 1 : 0 : 0);
    }
    $form->addElement($ele);
    $form->addElement(new RMFormHidden('op', $edit ? 'saveedit' : 'save'));
    if ($edit) {
        $form->addElement(new RMFormHidden('id', $id));
    }
    $ele = new RMFormButtonGroup('', ' ');
    $ele->addButton('sbt', $edit ? __('Update Category', 'qpages') : __('Create Category', 'qpages'), 'submit');
    $ele->addButton('cancel', __('Cancel', 'qpages'), 'button');
    $ele->setExtra('cancel', "onclick='history.go(-1);'");
    $form->addElement($ele);
    $form->display();
    xoops_cp_footer();
}
Esempio n. 15
0
/**
* @desc Permite la edición de figuras
**/
function rd_figures_form($edit = 0)
{
    global $xoopsModule, $xoopsConfig;
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; " . $edit ? __('Edit Figure', 'docs') : __('Create Figure'));
    xoops_cp_header();
    $id = rmc_server_var($_GET, 'id', 0);
    $id_res = rmc_server_var($_GET, 'res', 0);
    if ($id_res <= 0) {
        redirectMsg('resources.php', __('First select a Document to manage the figures.', 'docs'), 1);
    }
    $res = new RDResource($id_res);
    if ($res->isNew()) {
        redirectMsg('resources.php', __('Specified Document does not exists!', 'docs'), 1);
    }
    if ($edit) {
        if ($id <= 0) {
            redirectMsg('figures.php?res=' . $id_res, __('You have not specified a figure to edit!', 'docs'));
            break;
        }
        $fig = new RDFigure($id);
        if ($fig->isNew()) {
            redirectMsg('figures.php?res=' . $id_res, __('Specified figure does not exists!', 'docs'));
            break;
        }
    }
    $form = new RMForm($edit ? __('Editing Figure', 'docs') : __('Create Figure', 'docs'), 'frmfig', 'figures.php');
    $form->addElement(new RMFormText(__('Title', 'docs'), 'title', 50, 255, $edit ? $fig->getVar('title') : ''), true);
    $form->addElement(new RMFormText(__('Description', 'docs'), 'desc', 50, 255, $edit ? $fig->getVar('desc') : ''), true);
    $form->addElement(new RMFormEditor(__('Content', 'docs'), 'figure', '100%', '300px', $edit ? $fig->getVar('content', 'e') : ''), true);
    $form->addElement(new RMFormText(__('Attributes', 'docs'), 'attrs', 50, 150, $edit ? $fig->getVar('attrs') : ''));
    $buttons = new RMFormButtonGroup();
    $buttons->addButton('sbt', $edit ? __('Save Changes', 'docs') : __('Save Figure', 'docs'), 'submit');
    $buttons->addButton('cancel', __('Cancel', 'docs'), 'button', 'onclick="window.location=\'figures.php?res=' . $id_res . '\';"');
    $form->addElement($buttons);
    $form->addElement(new RMFormHidden('action', $edit ? 'saveedit' : 'save'));
    if ($edit) {
        $form->addElement(new RMFormHidden('id', $id));
    }
    $form->addElement(new RMFormHidden('res', $id_res));
    $form->display();
    xoops_cp_footer();
}
Esempio n. 16
0
function formCategory($edit = 0)
{
    global $mc, $xoopsModule, $db;
    PWFunctions::toolbar();
    RMTemplate::get()->assign('xoops_pagetitle', $edit ? __('Edit Category', 'works') : __('Add Category', 'works'));
    xoops_cp_location('<a href="./">' . $xoopsModule->name() . "</a> &raquo; \n\t\t<a href='categos.php'>" . __('Categories', 'works') . '</a> &raquo; ' . ($edit ? __('Edit Category', 'works') : __('Add Category', 'works')));
    xoops_cp_header();
    $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
    if ($edit) {
        //Verificamos si la categoría es válida
        if ($id <= 0) {
            redirectMsg('./categos.php?op=edit&id=' . $id, __('Provide a category ID!', 'works'), 1);
            die;
        }
        //Verificamos si la categoría existe
        $cat = new PWCategory($id);
        if ($cat->isNew()) {
            redirectMsg('./categos.php?op=edit&id=' . $id, __('Specified category was not found!', 'works'), 1);
            die;
        }
    }
    $form = new RMForm($edit ? __('Edit Category', 'works') : __('Add Category', 'works'), 'frmNew', 'categos.php');
    $form->addElement(new RMFormText(__('Name', 'works'), 'name', 50, 150, $edit ? $cat->name() : ''), true);
    if ($edit) {
        $form->addElement(new RMFormText(__('Short name', 'works'), 'nameid', 50, 150, $cat->nameId()), true);
    }
    $form->addElement(new RMFormEditor(__('Description', 'works'), 'desc', '100%', '250px', $edit ? $cat->desc('e') : ''));
    $form->addElement(new RMFormYesNo(__('Enable category', 'works'), 'active', $edit ? $cat->active() : 1));
    $form->addElement(new RMFormText(__('Display order', 'works'), 'order', 8, 3, $edit ? $cat->order() : 0), true, 'num');
    $form->addElement(new RMFormHidden('op', $edit ? 'saveedit' : 'save'));
    if ($edit) {
        $form->addElement(new RMFormHidden('id', $cat->id()));
    }
    $ele = new RMFormButtonGroup();
    $ele->addButton('sbt', $edit ? __('Save Changes!', 'works') : __('Add Now!', 'works'), 'submit');
    $ele->addButton('cancel', _CANCEL, 'button', 'onclick="window.location=\'categos.php\';"');
    $form->addElement($ele);
    $form = RMEvents::get()->run_event('works.form.categories', $form);
    $form->display();
    xoops_cp_footer();
}
Esempio n. 17
0
/**
* desc Edita Referencias
**/
function rd_edit_note()
{
    global $xoopsModule;
    RMTemplate::get()->assign('xoops_pagetitle', __('Editing Note', 'docs'));
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; " . __('Editing Note', 'docs'));
    xoops_cp_header();
    $id = rmc_server_var($_GET, 'id', 0);
    $id_res = rmc_server_var($_GET, 'res', 0);
    if ($id_res <= 0) {
        redirectMsg('./notes.php', __('Document not specified', 'docs'), 1);
        die;
    }
    $res = new RDResource($id_res);
    if ($res->isNew()) {
        redirectMsg('./notes.php', __('Specified Document does not exists!', 'docs'), 1);
        die;
    }
    if ($id <= 0) {
        redirectMsg('./notes.php?res=' . $res, __('Note not specified', 'docs'), 1);
        die;
    }
    //Verifica que referencia exista
    $ref = new RDReference($id);
    if ($ref->isNew()) {
        redirectMsg('./notes.php?res=' . $res, __('Specified note does not exists!', 'docs'), 1);
        die;
    }
    //Formulario
    $form = new RMForm(__('Edit Note', 'docs'), 'frmref', 'notes.php');
    $form->addElement(new RMFormText(__('Title', 'docs'), 'title', 50, 150, $ref->getVar('title')), true);
    $form->addElement(new RMFormTextArea(__('Content', 'docs'), 'reference', 5, 50, $ref->getVar('text', 'e')), true);
    $buttons = new RMFormButtonGroup();
    $buttons->addButton('sbt', __('Save Changes', 'docs'), 'submit');
    $buttons->addButton('cancel', __('Cancel', 'docs'), 'button', 'onclick="window.location=\'notes.php?res=' . $res . '\';"');
    $form->addElement($buttons);
    $form->addElement(new RMFormHidden('action', 'saveedit'));
    $form->addElement(new RMFormHidden('id', $id));
    $form->addElement(new RMFormHidden('res', $id_res));
    $form->display();
    xoops_cp_footer();
}
Esempio n. 18
0
/**
* @desc Visualiza las plataformas existentes y muestra formulario de plataformas
**/
function showPlatforms($edit = 0)
{
    global $xoopsSecurity, $xoopsModule;
    $id = rmc_server_var($_REQUEST, 'id', 0);
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $sql = "SELECT * FROM " . $db->prefix('dtrans_platforms');
    $result = $db->queryF($sql);
    $platforms = array();
    while ($rows = $db->fetchArray($result)) {
        $plat = new DTPlatform();
        $plat->assignVars($rows);
        $platforms[] = array('id' => $plat->id(), 'name' => $plat->name());
    }
    if ($edit) {
        //Verificamos si plataforma es válida
        if ($id <= 0) {
            redirectMsg('platforms.php', __('You must specified a valid platform ID!', 'dtransport'), 1);
            die;
        }
        //Verificamos si plataforma existe
        $plat = new DTPlatform($id);
        if ($plat->isNew()) {
            redirectMsg('platforms.php', __('Sepecified platform does not exists!', 'dtransport'), 1);
            die;
        }
    }
    RMTemplate::get()->add_xoops_style('admin.css', 'dtransport');
    RMTemplate::get()->add_local_script('jquery.validate.min.js', 'rmcommon', 'include');
    RMTemplate::get()->add_local_script('jquery.checkboxes.js', 'rmcommon', 'include');
    RMTemplate::get()->add_local_script('admin.js', 'dtransport');
    RMTemplate::get()->add_head('<script type="text/javascript">
            var dt_message = "' . __('Do you really want to delete selected platforms', 'dtransport') . '";
            var dt_select_message = "' . __('Select at least one platform to delete!', 'dtransport') . '";
        </script>');
    DTFunctions::toolbar();
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; " . ($edit ? __('Edit Platform', 'dtransport') : __('New Platform', 'dtransport')));
    xoops_cp_header();
    include RMTemplate::get()->get_template('admin/dtrans_platforms.php', 'module', 'dtransport');
    xoops_cp_footer();
}
Esempio n. 19
0
function show_mw_trackbacks()
{
    global $xoopsModule, $xoopsSecurity;
    $id = rmc_server_var($_GET, 'id', 0);
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $sql = "SELECT COUNT(*) FROM " . $db->prefix("mw_trackbacks");
    if ($id > 0) {
        $sql .= "WHERE post={$id}";
    }
    list($num) = $db->fetchRow($db->query($sql));
    $page = rmc_server_var($_GET, 'page', 1);
    $limit = isset($limit) && $limit > 0 ? $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('trackbacks.php?page={PAGE_NUM}' . ($id > 0 ? '&amp;id=' . $id : ''));
    $sql = str_replace("COUNT(*)", '*', $sql);
    $sql .= " ORDER BY `date` LIMIT {$start},{$limit}";
    $result = $db->query($sql);
    $posts = array();
    // posts cache
    $trackbacks = array();
    // Get trackbacks data
    while ($row = $db->fetchArray($result)) {
        $trac = new MWTrackbackObject();
        $trac->assignVars($row);
        $posts[$trac->getVar('post')] = isset($posts[$trac->getVar('post')]) ? $posts[$trac->getVar('post')] : new MWPost($trac->getVar('post'));
        $trackbacks[] = array('tb' => $trac, 'post' => array('title' => $posts[$trac->getVar('post')]->getVar('title'), 'link' => $posts[$trac->getVar('post')]->isNew() ? '' : $posts[$trac->getVar('post')]->permalink()));
    }
    // Event
    $trackbacks = RMEvents::get()->run_event("mywords.trackbacks.list", $trackbacks);
    MWFunctions::include_required_files();
    RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.checkboxes.js');
    RMTemplate::get()->add_script(XOOPS_URL . '/modules/mywords/include/js/scripts.php?file=trackbacks.js');
    xoops_cp_header();
    xoops_cp_location('<a href="' . XOOPS_URL . '/modules/mywords/admin/">' . $xoopsModule->getVar('name') . '</a> &raquo; ' . __('Trackbacks', 'mywords'));
    include RMTemplate::get()->get_template('admin/mywords_trackbacks.php', 'module', 'mywords');
    xoops_cp_footer();
}
Esempio n. 20
0
/**
* @desc Muestra el formulario para edición/creación de categorías
*/
function showForm($edit = 0)
{
    global $xoopsModule, $xoopsConfig, $xoopsModuleConfig;
    define('RMSUBLOCATION', 'newcategory');
    if ($edit) {
        $id = rmc_server_var($_GET, 'id', 0);
        if ($id <= 0) {
            redirectMsg('categos.php', __('You had not provided a category ID', 'bxpress'), 1);
            die;
        }
        $catego = new bXCategory($id);
        if ($catego->isNew()) {
            redirectMsg('categos.php', __('Specified category does not exists!', 'bxpress'), 1);
            die;
        }
    }
    bXFunctions::menu_bar();
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; " . ($edit ? __('Edit Category', 'bxpress') : __('New Category', 'bxpress')));
    xoops_cp_header();
    $form = new RMForm($edit ? __('Edit Category', 'bxpress') : __('New Category', 'bxpress'), 'frmCat', 'categos.php');
    $form->addElement(new RMFormText(__('Name', 'bxpress'), 'title', 50, 100, $edit ? $catego->title() : ''), true);
    if ($edit) {
        $form->addElement(new RMFormText(__('Short name', 'bxpress'), 'friendname', 50, 100, $catego->friendName()));
    }
    $form->addElement(new RMFormEditor(__('Description', 'bxpress'), 'desc', '90%', '300px', $edit ? $catego->description() : ''));
    $form->addElement(new RMFormYesNo(__('Show description', 'bxpress'), 'showdesc', $edit ? $catego->showDesc() : 1));
    $form->addElement(new RMFormYesNo(__('Activate', 'bxpress'), 'status', $edit ? $catego->status() : 1));
    $form->addElement(new RMFormGroups(__('Groups', 'bxpress'), 'groups', 1, 1, 4, $edit ? $catego->groups() : array(0)), true, 'checked');
    $form->addElement(new RMFormHidden('action', $edit ? 'saveedit' : 'save'));
    if ($edit) {
        $form->addElement(new RMFormHidden('id', $catego->id()));
    }
    $buttons = new RMFormButtonGroup();
    $buttons->addButton('sbt', __('Submit', 'bxpress'), 'submit', '', true);
    $buttons->addButton('cancel', __('Cancel', 'bxpress'), 'button', 'onclick="window.location=\'categos.php\';"');
    $form->addElement($buttons);
    $form->display();
    xoops_cp_footer();
}
Esempio n. 21
0
/**
* @desc Permitirá al administrador elegir los temas que serán 
* eliminados despues de un cierto período
**/
function prune()
{
    global $xoopsModule;
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; " . __('Prune Posts', 'bxpress'));
    xoops_cp_header();
    bXFunctions::menu_bar();
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $form = new RMForm(__('Prune Posts', 'bxpress'), 'frmprune', 'prune.php');
    //Lista de foros
    $ele = new RMFormSelect(__('Prune from forum', 'bxpress'), 'forums');
    $ele->addOption('', __('Select option...', 'bxpress'));
    $ele->addOption(0, __('All forums', 'bxpress'));
    $sql = "SELECT id_forum,name FROM " . $db->prefix('bxpress_forums');
    $result = $db->queryF($sql);
    while ($row = $db->fetchArray($result)) {
        $ele->addOption($row['id_forum'], $row['name']);
    }
    $form->addElement($ele, true);
    //Dias de antigüedad de temas
    $days = new RMFormText(__('Days old', 'bxpress'), 'days', 3, 3, 30);
    $days->setDescription(__('Delete topics older than these days', 'bxpress'));
    $form->addElement($days, true);
    //Lista de opciones para purgar temas
    $opc = new RMFormSelect(__('Topics to delete', 'bxpress'), 'option');
    $opc->addOption('', __('Select option', 'bxpress'));
    $opc->addOption(1, __('All topics', 'bxpress'));
    $opc->addOption(2, __('Unanswered Topics', 'bxpress'));
    $form->addElement($opc, true);
    //Temas fijos
    $form->addElement(new RMFormYesno(__('Delete Sticky Topics', 'bxpress'), 'fixed'));
    $buttons = new RMFormButtonGroup();
    $buttons->addButton('sbt', __('Prune Now!'), 'submit', 'onclick="return confirm(\'' . __('Do you really wish to delete the topics? \\nThis action will delete the data permanently.', 'bxpress') . '\');"');
    $buttons->addButton('cancel', __('Cancel', 'bxpress'), 'button', 'onclick="history.go(-1);"');
    $form->addElement($buttons);
    $form->addElement(new RMFormHidden('action', 'deltopics'));
    $form->display();
    xoops_cp_footer();
}
Esempio n. 22
0
function m_show_ranking()
{
    global $xoopsModule;
    $champ = rmc_server_var($_REQUEST, 'champ', 0);
    $category = rmc_server_var($_REQUEST, 'category', 0);
    $champs = MCHFunctions::all_championships();
    $categories = array();
    MCHFunctions::categories_tree($categories);
    if ($champ > 0 && $category > 0) {
        $ranking = MCHFunctions::get_ranking($champ, $category);
    }
    MCHFunctions::toolbar();
    xoops_cp_location('<a href="./">' . $xoopsModule->name() . "</a> &raquo; " . __('Coaches', 'match'));
    RMTemplate::get()->assign('xoops_pagetitle', __('Coaches', 'match'));
    RMTemplate::get()->add_style('admin.css', 'match');
    RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.checkboxes.js');
    RMTemplate::get()->add_local_script('admin_match.js', 'match');
    RMTemplate::get()->add_head("<script type='text/javascript'>\nvar mch_message='" . __('Do you really want to delete selected coaches?', 'match') . "';\n\n        var mch_select_message = '" . __('You must select some coach before to execute this action!', 'match') . "';</script>");
    xoops_cp_header();
    $match_extra_options = RMEvents::get()->run_event('match.more.options');
    include RMTemplate::get()->get_template("admin/mch_ranking.php", 'module', 'match');
    xoops_cp_footer();
}
Esempio n. 23
0
function edit_editor()
{
    global $xoopsModule, $xoopsSecurity;
    $id = rmc_server_var($_GET, 'id', 0);
    $page = rmc_server_var($_GET, 'page', 1);
    if ($id <= 0) {
        redirectMsg('editors.php?page=' . $page, __('Editor ID not provided!.', 'mywords'), 1);
        die;
    }
    $editor = new MWEditor($id);
    if ($editor->isNew()) {
        redirectMsg('editors.php?page=' . $page, __('Editor does not exists!', 'mywords'), 1);
        die;
    }
    include_once RMCPATH . '/class/form.class.php';
    MWFunctions::include_required_files();
    xoops_cp_location('<a href="./">' . $xoopsModule->name() . '</a> &raquo; <a href="editors.php">' . __('Editors', 'mywords') . '</a> &raquo; ' . __('Editing Editor', 'mywords'));
    RMTemplate::get()->assign('xoops_pagetitle', __('Editing Editor', 'mywords'));
    xoops_cp_header();
    $show_edit = true;
    include RMTemplate::get()->get_template('admin/mywords_editors.php', 'module', 'mywords');
    xoops_cp_footer();
}
Esempio n. 24
0
function showReports()
{
    global $xoopsModule, $xoopsConfig, $xoopsSecurity;
    //Indica la lista a mostrar
    $show = isset($_REQUEST['show']) ? intval($_REQUEST['show']) : '0';
    //$show = 0 Muestra todos los reportes
    //$show = 1 Muestra los reportes revisados
    //$show = 2 Muestra los reportes no revisados
    define('RMCSUBLOCATION', $show == 0 ? 'allreps' : ($show == 1 ? 'reviews' : 'noreviewd'));
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    //Lista de Todos los reportes
    $sql = "SELECT * FROM " . $db->prefix('bxpress_report') . ($show ? $show == 1 ? " WHERE zapped=1" : " WHERE zapped=0 " : '') . " ORDER BY report_time DESC";
    $result = $db->queryF($sql);
    $reports = array();
    $tf = new RMTimeFormatter(0, '%T% %d%, %Y% %h%:%i%:%s%');
    while ($rows = $db->fetchArray($result)) {
        $report = new bXReport();
        $report->assignVars($rows);
        $user = new XoopsUser($report->user());
        $post = new bXPost($report->post());
        $topic = new bXTopic($post->topic());
        $forum = new bXForum($post->forum());
        if ($report->zappedBy() > 0) {
            $zuser = new XoopsUser($report->zappedBy());
        }
        $reports[] = array('id' => $report->id(), 'post' => array('link' => $post->permalink(), 'id' => $report->post()), 'user' => $user->uname(), 'uid' => $user->uid(), 'date' => $tf->format($report->time()), 'report' => $report->report(), 'forum' => array('link' => $forum->permalink(), 'name' => $forum->name()), 'topic' => array('link' => $topic->permalink(), 'title' => $topic->title()), 'zapped' => $report->zapped(), 'zappedby' => $report->zappedby() > 0 ? array('uid' => $zuser->uid(), 'name' => $zuser->uname()) : '', 'zappedtime' => $report->zappedtime() > 0 ? $tf->format($report->zappedtime()) : '');
    }
    RMTemplate::get()->add_local_script('jquery.checkboxes.js', 'rmcommon', 'include');
    RMTemplate::get()->add_local_script('admin.js', 'bxpress');
    RMTemplate::get()->set_help('http://www.redmexico.com.mx/docs/bxpress-forums/introduccion/standalone/1/');
    bXFunctions::menu_bar();
    RMTemplate::get()->assign('xoops_pagetitle', __('Reports Management', 'bxpress'));
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; " . __('Reports Management', 'bxpress'));
    xoops_cp_header();
    include RMTemplate::get()->get_template('admin/forums_reports.php', 'module', 'bxpress');
    xoops_cp_footer();
}
Esempio n. 25
0
/**
* @desc Visualiza todas las postales existentes
**/
function showPostCards()
{
    global $xoopsModule, $tpl, $xoopsModuleConfig, $xoopsSecurity;
    $mc =& $xoopsModuleConfig;
    $page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 1;
    $limit = isset($_REQUEST['limit']) ? intval($_REQUEST['limit']) : 15;
    $limit = $limit <= 0 ? 15 : $limit;
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    //Barra de Navegación
    $sql = "SELECT COUNT(*) FROM " . $db->prefix('gs_postcards');
    list($num) = $db->fetchRow($db->query($sql));
    list($num) = $db->fetchRow($db->query($sql));
    $start = $num <= 0 ? 0 : ($page - 1) * $limit;
    $tpages = ceil($num / $limit);
    $nav = new RMPageNav($num, $limit, $page, 5);
    $nav->target_url("postcards.php?page={PAGE_NUM}&limit={$limit}");
    //Fin de barra de navegación
    $sql = "SELECT * FROM " . $db->prefix('gs_postcards');
    $sql .= " LIMIT {$start},{$limit}";
    $result = $db->query($sql);
    $posts = array();
    $tf = new RMTimeFormatter(0, __('%M% %d%, %Y% - %h%:%i%:%s%', 'galleries'));
    while ($rows = $db->fetchArray($result)) {
        $post = new GSPostcard();
        $post->assignVars($rows);
        $link = GSFunctions::get_url() . ($mc['urlmode'] ? 'postcard/view/id/' . $post->code() . '/' : '?postcard=view&amp;id=' . $post->code());
        $posts[] = array('id' => $post->id(), 'title' => $post->title(), 'date' => $tf->format($post->date()), 'toname' => $post->toName(), 'name' => $post->email(), 'view' => $post->viewed(), 'link' => $link);
    }
    GSFunctions::toolbar();
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; " . __('E-cards', 'galleries'));
    xoops_cp_header();
    RMTemplate::get()->add_local_script('gsscripts.php?file=sets&form=frm-postcards&', 'galleries');
    RMTemplate::get()->add_head("<script type='text/javascript'>\nvar delete_warning='" . __('Do you really wish to delete selected e-cards?', 'galleries') . "';\n</script>");
    include RMTemplate::get()->get_template('admin/gs_postcards.php', 'module', 'galleries');
    xoops_cp_footer();
}
Esempio n. 26
0
/**
* @desc Formulario de creación/edición de albums
**/
function formAlbums($edit = 0)
{
    global $xoopsModule, $xoopsUser;
    define('RMSUBLOCATION', 'newalbum');
    $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
    $page = isset($_REQUEST['pag']) ? $_REQUEST['pag'] : '';
    $limit = isset($_REQUEST['limit']) ? intval($_REQUEST['limit']) : 15;
    $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'id_set';
    $mode = isset($_REQUEST['mode']) ? $_REQUEST['mode'] : 0;
    $search = isset($_REQUEST['search']) ? $_REQUEST['search'] : '';
    $ruta = "pag={$page}&sort={$sort}&mode={$mode}&search={$search}";
    if ($edit) {
        //Verificamos que el album sea válido
        if ($id <= 0) {
            redirectMsg('./sets.php?' . $ruta, __('Please provide a valid ID!', 'galleries'), 1);
            die;
        }
        //Verificamos que el album exista
        $set = new GSSet($id);
        if ($set->isNew()) {
            redirectMsg('./sets.php?' . $ruta, __('Specified album does not exists!', 'galleries'), 1);
            die;
        }
    }
    GSFunctions::toolbar();
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; <a href='./sets.php'>" . __('Albums management', 'galleries') . "</a> &raquo; " . ($edit ? __('Edit album', 'galleries') : __('New album', 'galleries')));
    xoops_cp_header();
    $form = new RMForm($edit ? __('Edit album', 'galleries') : __('New Album', 'galleries'), 'frmsets', 'sets.php');
    $form->addElement(new RMFormText(__('Album title', 'galleries'), 'title', 50, 100, $edit ? $set->title() : ''), true);
    $form->addElement(new RMFormEditor(__('Description', 'galleries'), 'description', '99%', '250px', $edit ? $set->getVar('description', 'e') : ''));
    $ele = new RMFormSelect(__('Privacy level', 'galleries'), 'public');
    $ele->addOption(0, __('Private', 'galleries'), $edit ? $set->isPublic() == 0 ? 1 : 0 : 0);
    $ele->addOption(1, __('Public for friends', 'galleries'), $edit ? $set->isPublic() == 1 ? 1 : 0 : 0);
    $ele->addOption(2, __('Public', 'galleries'), $edit ? $set->isPublic() == 2 ? 1 : ($set->isPublic() == 0 ? 1 : 0) : 1);
    $form->addElement($ele, true);
    $form->addElement(new RMFormUser(__('Owner', 'galleries'), 'owner', 0, $edit ? array($set->owner()) : array($xoopsUser->uid()), 30));
    $form->addElement(new RMFormHidden('op', $edit ? 'saveedit' : 'save'));
    $form->addElement(new RMFormHidden('id', $id));
    $form->addElement(new RMFormHidden('page', $page));
    $form->addElement(new RMFormHidden('limit', $limit));
    $form->addElement(new RMFormHidden('sort', $sort));
    $form->addElement(new RMFormHidden('mode', $mode));
    $form->addElement(new RMFormHidden('search', $search));
    $buttons = new RMFormButtonGroup();
    $buttons->addButton('sbt', $edit ? __('Save Changes!', 'galleries') : __('Create Album!', 'galleries'), 'submit');
    $buttons->addButton('cancel', __('Cancel', 'galleries'), 'button', 'onclick="window.location=\'sets.php?' . $ruta . '\'"');
    $form->addElement($buttons);
    $form->display();
    xoops_cp_footer();
}
Esempio n. 27
0
/**
 * Muestra el formulario para la creación de una nueva página enlazada
 */
function newLinkForm($edit = 0)
{
    global $db, $mc, $xoopsModule, $myts;
    foreach ($_REQUEST as $k => $v) {
        ${$k} = $v;
    }
    $pag = isset($page) ? $page : 1;
    if ($edit) {
        $id = isset($_REQUEST['id']) ? $_REQUEST['id'] : 0;
        if ($id <= 0) {
            redirectMsg("pages.php&cat={$cat}&page={$pag}", __('You must provide a page ID to edit', 'qpages'), 1);
            die;
        }
        $page = new QPPage($id);
    }
    xoops_cp_location('<a href="./">' . $xoopsModule->name() . '</a> &raquo; ' . ($edit ? __('Edit linked page', 'qpages') : __('New linked page', 'qpages')));
    RMTemplate::get()->add_script('../include/js/forms_pages.js');
    xoops_cp_header();
    $form = new RMForm($edit ? __('Edit Linked Page', 'qpages') : __('New Linked Page', 'qpages'), 'frmNew', 'pages.php');
    $form->addElement(new RMFormText(__('Page title', 'qpages'), 'titulo', 50, 255, $edit ? $page->getTitle() : ''), true);
    if ($edit) {
        $ele = new RMFormText(__('Friendly title', 'qpages'), 'titulo_amigo', 50, 255, $page->getFriendTitle());
        $ele->setDescription(__('This title will be used in friendly url.', 'qpages'));
        $form->addElement($ele);
        $form->addElement(new RMFormHidden('id', $page->getID()));
    }
    $ele = new RMFormSelect(__('Category', 'qpages'), 'catego', 0);
    $categos = array();
    qpArrayCategos($categos);
    $ele->addOption('0', _SELECT, $edit ? 0 : 1);
    foreach ($categos as $k) {
        $ele->addOption($k['id_cat'], str_repeat("-", $k['saltos']) . " " . $k['nombre'], $edit ? $k['id_cat'] == $page->getCategory() ? 1 : 0 : 0);
    }
    $form->addElement($ele, true, "Select:0");
    $form->addElement(new RMFormTextArea(__('Introduction', 'qpages'), 'desc', 5, 60, $edit ? $page->getDescription() : ''));
    // URL
    $form->addElement(new RMFormText(__('Target URL', 'qpages'), 'url', 50, 255, $edit ? $page->url() : ''), true);
    // Grupos
    $ele = new RMFormGroups(__('Allowed groups', 'qpages'), 'grupos', 1, 1, 3, $edit ? $page->getGroups() : array(0));
    $ele->setDescription(__('Only selected groups can access to this document.', 'qpages'));
    $form->addElement($ele);
    $ele = new RMFormRadio(__('Status', 'qpages'), 'acceso', 1);
    $ele->addOption(__('Public', 'qpages'), '1', $edit ? $page->getAccess() ? 1 : 0 : 0);
    $ele->addOption(__('Draft', 'qpages'), '0', $edit ? $page->getAccess() ? 0 : 1 : 1);
    $form->addElement($ele);
    $page_metas = $edit ? $page->get_meta() : array();
    $available_metas = qp_get_metas();
    include 'metas.php';
    $form->addElement(new RMFormLabel('', $meta_data));
    $ele = new RMFormButtonGroup();
    $ele->addButton('save', $edit ? __('Update Page', 'qpages') : __('Save Page', 'qpages'), 'submit');
    $ele->addButton('cancel', __('Cancel', 'qpages'), 'button', 'onclick="history.go(-1);"');
    $form->addElement($ele);
    $form->addElement(new RMFormHidden('op', $edit ? 'saveedit' : 'save'));
    $form->addElement(new RMFormHidden('type', 1));
    $form->addElement(new RMFormHidden('cat', $cat));
    $form->addElement(new RMFormHidden('page', $pag));
    $form->display();
    xoops_cp_footer();
}
Esempio n. 28
0
/**
* @desc Formulario de creación y edición de sección
**/
function rd_show_form($edit = 0)
{
    global $xoopsModule, $xoopsConfig, $xoopsSecurity, $xoopsUser, $xoopsModuleConfig, $rmc_config;
    define('RMCSUBLOCATION', 'newresource');
    $id = rmc_server_var($_GET, 'id', 0);
    $parent = rmc_server_var($_GET, 'parent', 0);
    if ($id <= 0) {
        redirectMsg('sections.php?id=' . $id, __('You must select a Document in order to create a new section', 'docs'), 1);
        die;
    }
    // Check if provided Document exists
    global $res;
    $res = new RDResource($id);
    if ($res->isNew()) {
        redirectMsg('sections.php?id=' . $id, __('Specified Document does not exists!', 'docs'), 1);
        die;
    }
    if ($edit) {
        $id_sec = rmc_server_var($_GET, 'sec', 0);
        //Verifica si la sección es válida
        if ($id_sec <= 0) {
            redirectMsg('sections.php?id=' . $id, __('Specify a section to edit', 'docs'), 1);
            die;
        }
        //Comprueba si la sección es existente
        $sec = new RDSection($id_sec);
        if ($sec->isNew()) {
            redirectMsg('sections.php?id=' . $id, __('Specified section does not exists', 'docs'), 1);
            die;
        }
    }
    // Get order
    $order = RDFunctions::order('MAX', $parent, $res->id());
    $order++;
    $rmc_config = RMFunctions::configs();
    $form = new RMForm('', 'frmsec', 'sections.php');
    if ($rmc_config['editor_type'] == 'tiny') {
        $tiny = TinyEditor::getInstance();
        $tiny->add_config('theme_advanced_buttons1', 'rd_refs');
        $tiny->add_config('theme_advanced_buttons1', 'rd_figures');
        $tiny->add_config('theme_advanced_buttons1', 'rd_toc');
    }
    $editor = new RMFormEditor('', 'content', '100%', '300px', $edit ? $rmc_config['editor_type'] == 'tiny' ? $sec->getVar('content') : $sec->getVar('content', 'e') : '', '', 0);
    $usrfield = new RMFormUser('', 'uid', false, $edit ? array($sec->getVar('uid')) : $xoopsUser->getVar('uid'));
    RMTemplate::get()->add_style('admin.css', 'docs');
    RMTemplate::get()->add_script('../include/js/scripts.php?file=metas.js');
    RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.validate.min.js');
    RMTemplate::get()->add_head('<script type="text/javascript">var docsurl = "' . XOOPS_URL . '/modules/docs";</script>');
    RDFunctions::toolbar();
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; " . ($edit ? __('Edit Section', 'docs') : __('Create Section', 'docs')));
    RMTemplate::get()->assign('xoops_pagetitle', $edit ? __('Edit Section', 'docs') : __('Create Section', 'docs'));
    xoops_cp_header();
    $sections = array();
    RDFunctions::getSectionTree($sections, 0, 0, $id, 'id_sec, title', isset($sec) ? $sec->id() : 0);
    include RMEvents::get()->run_event('docs.get.secform.template', RMTemplate::get()->get_template('admin/rd_sections_form.php', 'module', 'docs'));
    xoops_cp_footer();
}
Esempio n. 29
0
function edit_form()
{
    global $xoopsModule, $xoopsSecurity;
    $id = rmc_server_var($_GET, 'id', 0);
    $page = rmc_server_var($_GET, 'page', 1);
    if ($id <= 0) {
        redirectMsg('tags.php?page=' . $page, __('Tag ID not provided!.', 'mywords'), 1);
        die;
    }
    $tag = new MWTag($id);
    if ($tag->isNew()) {
        redirectMsg('tags.php?page=' . $page, __('Tag does not exists!', 'mywords'), 1);
        die;
    }
    MWFunctions::include_required_files();
    xoops_cp_location('<a href="./">' . $xoopsModule->name() . '</a> &raquo; <a href="tags.php">' . __('Tags', 'mywords') . '</a> &raquo; ' . __('Edit Tag', 'mywords'));
    RMTemplate::get()->assign('xoops_pagetitle', __('Editing Tag', 'mywords'));
    xoops_cp_header();
    $show_edit = true;
    include RMTemplate::get()->get_template('admin/mywords_tags.php', 'module', 'mywords');
    xoops_cp_footer();
}
Esempio n. 30
0
/**
* @desc Elimina pantallas de la base de datos
**/
function deleteScreens()
{
    global $xoopsModule, $util;
    $ids = isset($_REQUEST['id']) ? $_REQUEST['id'] : 0;
    $item = isset($_REQUEST['item']) ? intval($_REQUEST['item']) : 0;
    $ok = isset($_POST['ok']) ? intval($_POST['ok']) : 0;
    //Verificamos que el software sea válido
    if ($item <= 0) {
        redirectMsg('./screens.php', _AS_DT_ERR_ITEMVALID, 1);
        die;
    }
    //Verificamos que el software exista
    $sw = new DTSoftware($item);
    if ($sw->isNew()) {
        redirectMsg('./screens.php', _AS_DT_ERR_ITEMEXIST, 1);
        die;
    }
    //Verificamos si nos proporcionaron alguna pantalla
    if (!is_array($ids) && $ids <= 0) {
        redirectMsg('./screens.php?item=' . $item, _AS_DT_NOTSCREEN, 1);
        die;
    }
    $num = 0;
    if (!is_array($ids)) {
        $scr = new DTScreenshot($ids);
        $ids = array($ids);
        $num = 1;
    }
    if ($ok) {
        if (!$util->validateToken()) {
            redirectMsg('./screens.php?item=' . $item, _AS_DT_SESSINVALID, 1);
            die;
        }
        $errors = '';
        foreach ($ids as $k) {
            //Verificamos si pantalla es válida
            if ($k <= 0) {
                $errors .= sprintf(_AS_DT_ERRSCVAL, $k);
                continue;
            }
            //Verificamos que la pantalla exista
            $sc = new DTScreenshot($k);
            if ($sc->isNew()) {
                $errors .= sprintf(_AS_DT_ERRSCEX, $k);
                continue;
            }
            if (!$sc->delete()) {
                $errors .= sprintf(_AS_DT_ERRSCDEL, $k);
            }
        }
        if ($errors != '') {
            redirectMsg('./screens.php?item=' . $item, _AS_DT_ERRORS . $errors, 1);
            die;
        } else {
            redirectMsg('./screens.php?item=' . $item, _AS_DT_DBOK, 0);
            die;
        }
    } else {
        optionsBar($sw);
        xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; <a href='./items.php'>" . _AS_DT_SW . "</a> &raquo; " . _AS_DT_DELETESCREEN);
        xoops_cp_header();
        $hiddens['ok'] = 1;
        $hiddens['id[]'] = $ids;
        $hiddens['item'] = $item;
        $hiddens['op'] = 'delete';
        $buttons['sbt']['type'] = 'submit';
        $buttons['sbt']['value'] = _DELETE;
        $buttons['cancel']['type'] = 'button';
        $buttons['cancel']['value'] = _CANCEL;
        $buttons['cancel']['extra'] = 'onclick="window.location=\'screens.php?item=' . $item . '\';"';
        $util->msgBox($hiddens, 'screens.php', ($num ? sprintf(_AS_DT_DELETECONF, $scr->title()) : _AS_DT_DELCONF) . '<br /><br />' . _AS_DT_ALLPERM, XOOPS_ALERT_ICON, $buttons, true, '400px');
        xoops_cp_footer();
    }
}