function rd_block_index($options) { global $xoopsModule, $xoopsModuleConfig, $res, $sec; if (!$xoopsModule || $xoopsModule->dirname() != 'docs') { return; } if (!defined('RD_LOCATION') || RD_LOCATION != 'content' && RD_LOCATION != 'resource_content') { return; } // get the sections $sections = array(); RDFunctions::sections_tree_index(0, 0, $res, '', '', false, $sections, false); $block['sections'] = $sections; $block['section'] = $sec; $block['resource'] = $res->getVar('nameid'); return $block; }
function rd_show_sections() { global $xoopsModule, $xoopsSecurity; $id = rmc_server_var($_GET, 'id', 0); if ($id <= 0) { redirectMsg('resources.php', __('Select a Document to see the sections inside this', 'docs'), 0); die; } $res = new RDResource($id); if ($res->isNew()) { redirectMsg('resources.php', __('The specified Document does not exists!', 'docs'), 1); die; } $db = XoopsDatabaseFactory::getDatabaseConnection(); //Lista de Publicaciones $sql = "SELECT id_res,title FROM " . $db->prefix('rd_resources'); $result = $db->queryF($sql); $resources = array(); while ($rows = $db->fetchArray($result)) { $r = new RDResource(); $r->assignVars($rows); $resources[] = array('id' => $r->id(), 'title' => $r->getVar('title')); unset($r); } //Secciones $sections = array(); RDFunctions::sections_tree_index(0, 0, $res, '', '', false, $sections, false, true); // Event $sections = RMEvents::get()->run_event('docs.loading.sections', $sections); RDFunctions::toolbar(); xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » " . __('Sections Management', 'docs')); RMTemplate::get()->assign('xoops_pagetitle', __('Sections Management', 'docs')); RMTemplate::get()->add_style('admin.css', 'docs'); RMTemplate::get()->add_style('sections.css', 'docs'); RMTemplate::get()->add_local_script('sections.js', 'docs', 'include'); RMTemplate::get()->add_local_script('jquery.ui.nestedSortable.js', 'docs', 'include'); xoops_cp_header(); include RMEvents::get()->run_event('docs.get.sections.template', RMTemplate::get()->get_template('admin/rd_sections.php', 'module', 'docs')); xoops_cp_footer(); }
/** * This function create a page to print or pdf. */ function rd_section_forprint($all = 0) { global $section, $res, $xoopsConfig; include 'header.php'; $xoops_langcode = $xoopsTpl->get_template_vars('xoops_langcode'); $xoops_charset = $xoopsTpl->get_template_vars('xoops_charset'); $xoops_pagetitle = $xoopsTpl->get_template_vars('xoops_pagetitle'); $xoops_sitename = $xoopsTpl->get_template_vars('xoops_sitename'); $xoops_css = $xoopsTpl->get_template_vars('xoops_themecss'); if ($all) { $toc = array(); RDFunctions::sections_tree_index(0, 0, $res, '', '', false, $toc, true); include RMEvents::get()->run_event('docs.print.template', RMTemplate::get()->get_template('rd_printsection.php', 'module', 'docs')); } else { $toc = RDFunctions::get_section_tree($section->id(), $res, '1', true); include RMEvents::get()->run_event('docs.print.template', RMTemplate::get()->get_template('rd_printsection.php', 'module', 'docs')); } }
/** * @desc Formulario para crear nueva sección **/ function formSection($edit = 0) { global $xoopsConfig, $xoopsUser, $xoopsModuleConfig, $id, $res; $res = rmc_server_var($_GET, 'id', $res); //Verifica si se proporcionó una publicación para la sección if ($res <= 0) { RDFunctions::error_404(); } $res = new RDResource($res); if ($res->isNew()) { RDFunctions::error_404(); } //Verificamos si es una publicación aprobada if (!$res->getVar('approved')) { redirect_header(RDURL, 2, __('Specified section does not exists!', 'docs')); die; } //Verificamos si el usuario tiene permisos de edicion if (!$xoopsUser->uid() == $res->getVar('owner') && !$res->isEditor($xoopsUser->uid()) && !$xoopsUser->isAdmin()) { redirect_header($section->permalink(), 1, __('Operation not allowed!', 'docs')); die; } if ($edit) { $id = rmc_server_var($_GET, 'id', $id); //Verifica si la sección es válida if ($id == '') { RDfunctions::error_404(); } //Comprueba si la sección es existente $section = new RDSection($id); if ($section->isNew()) { RDFunctions::error_404(); } } include 'header.php'; include_once RMCPATH . '/class/form.class.php'; define('RD_NO_FIGURES', 1); $rmc_config = RMFunctions::configs(); $editor = new RMFormEditor('', 'content', '100%', '300px', $edit ? $section->getVar('content', $rmc_config['editor_type'] == 'tiny' ? 's' : 'e') : '', '', false); if ($rmc_config['editor_type'] == 'tiny') { $tiny = TinyEditor::getInstance(); $tiny->configuration['content_css'] .= ',' . XOOPS_URL . '/modules/docs/css/figures.css'; $tiny->add_config('theme_advanced_buttons1', 'rd_refs'); $tiny->add_config('theme_advanced_buttons1', 'rd_figures'); $tiny->add_config('theme_advanced_buttons1', 'rd_toc'); } // Arbol de Secciones $sections = array(); RDFunctions::sections_tree_index(0, 0, $res, '', '', false, $sections, false); // Breadcrumb RDFunctions::breadcrumb(); $res_edit = RDFunctions::url() . ($xoopsModuleConfig['permalinks'] ? '/list/' . $res->id() . '/' : '?action=list&id=' . $res->id()); RMBreadCrumb::get()->add_crumb($res->getVar('title'), $res_edit); if ($edit) { RMBreadCrumb::get()->add_crumb(sprintf(__('Editing "%s"', 'docs'), $section->getVar('title'))); } else { RMBreadCrumb::get()->add_crumb(__('Create new section', 'docs')); } RMTemplate::get()->add_jquery(true); RMTemplate::get()->add_style('forms.css', 'docs'); RMTemplate::get()->add_script(XOOPS_URL . '/modules/docs/include/js/scripts.php?file=metas.js'); include RMEvents::get()->run_event('docs.template.formsections.front', RMTemplate::get()->get_template('rd_sec.php', 'module', 'docs')); include 'footer.php'; }
function showFormEdits() { global $xoopsModule, $xoopsConfig; $id = rmc_server_var($_GET, 'id', 0); if ($id <= 0) { redirectMsg('edits.php', __('You have not specified any waiting section!', 'docs'), 1); die; } $edit = new RDEdit($id); if ($edit->isNew()) { redirectMsg('edits.php', __('Specified content does not exists!', 'docs'), 1); die; } $sec = new RDSection($edit->getVar('id_sec')); if ($sec->isNew()) { redirectMsg('edits.php', __('This waiting content does not have any section assigned!', 'docs'), 1); die; } $res = new RDResource($sec->getVar('id_res')); $form = new RMForm(__('Editing Waiting Content', 'docs'), 'frmsec', 'edits.php'); $form->addElement(new RMFormLabel(__('Belong to', 'docs'), $res->getVar('title'))); $form->addElement(new RMFormText(__('Title', 'docs'), 'title', 50, 200, $edit->getVar('title')), true); $form->addElement(new RMFormEditor(__('Contenido', 'docs'), 'content', '90%', '300px', $edit->getVar('content', 'e')), true); // Arbol de Secciones $ele = new RMFormSelect(__('Parent Section', 'docs'), 'parent'); $ele->addOption(0, __('Select section...', 'docs')); $tree = array(); RDFunctions::sections_tree_index(0, 0, $res, '', '', false, $tree, false); foreach ($tree as $k) { $ele->addOption($k['id'], str_repeat('—', $k['jump']) . ' ' . $k['title'], $edit->getVar('parent') == $k['id'] ? 1 : 0); } $form->addElement($ele); $form->addElement(new RMFormText(__('Display order', 'docs'), 'order', 5, 5, $edit->getVar('order')), true); // Usuario $form->addElement(new RMFormUser(__('Owner', 'docs'), 'uid', 0, array($edit->getVar('uid')), 30)); $buttons = new RMFormButtonGroup(); $buttons->addButton('sbt', __('Save Now', 'docs'), 'submit'); $buttons->addButton('cancel', __('Cancel', 'docs'), 'button', 'onclick="window.location=\'edits.php\';"'); $form->addElement($buttons); $form->addElement(new RMFormHidden('action', 'save')); $form->addElement(new RMFormHidden('id', $edit->id())); xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » <a href='./edits.php'>" . __('Waiting Content', 'docs') . "</a> » " . sprintf(__('Editing %s', 'docs'), $edit->getVar('title'))); xoops_cp_header(); RMTemplate::get()->assign('xoops_pagetitle', __('Editing Waiting Content', 'docs')); $form->display(); xoops_cp_footer(); }
include RMTemplate::get()->get_template('rd_resall.php', 'module', 'docs'); } elseif ($res->getVar('quick')) { // Show Quick Index to User $content = false; //Obtiene índice $db = XoopsDatabaseFactory::getDatabaseConnection(); $sql = "SELECT * FROM " . $db->prefix('rd_sections') . " WHERE id_res='" . $res->id() . "' AND parent=0 ORDER BY `order`"; $result = $db->queryF($sql); // Quick index array $qindex_sections = array(); while ($rows = $db->fetchArray($result)) { $sec = new RDSection(); $sec->assignVars($rows); $qindex_sections[] = array('id' => $id, 'title' => $sec->getVar('title'), 'desc' => TextCleaner::getInstance()->clean_disabled_tags(TextCleaner::truncate($sec->getVar('content'), 255)), 'link' => $sec->permalink()); } include RMTemplate::get()->get_template('rd_quickindex.php', 'module', 'docs'); } else { if (!$allowed) { RDFunctions::error_404(); } $toc = array(); RDFunctions::sections_tree_index(0, 0, $res, '', '', false, $toc); include RMTemplate::get()->get_template('rd_resindextoc.php', 'module', 'docs'); } RMTemplate::get()->add_style('docs.css', 'docs'); RMTemplate::get()->add_jquery(); RMTemplate::get()->add_script(RDURL . '/include/js/docs.js'); if ($standalone) { RDFunctions::standalone(); } include 'footer.php';