Exemple #1
0
         $contents_handler->displayError(_AM_XOOPSFAQ_ERRORCOULDNOTDELCAT);
     } else {
         xoops_cp_header();
         //xoopsFaq_AdminMenu(0);
         $indexAdmin = new ModuleAdmin();
         echo $indexAdmin->addNavigation('main.php');
         //xoopsFaq_DisplayHeading(_AM_XOOPSFAQ_CONTENTS_HEADER, _AM_XOOPSFAQ_CATEGORY_DELETE_DSC, false);
         xoopsFaq_DisplayHeading('', _AM_XOOPSFAQ_CATEGORY_DELETE_DSC, false);
         xoops_confirm(array('op' => 'delete', 'contents_id' => $contents_id, 'ok' => 1), 'main.php', _AM_XOOPSFAQ_RUSURECAT);
     }
     break;
 case 'save':
     if (!$GLOBALS['xoopsSecurity']->check()) {
         redirect_header('main.php', 0, $GLOBALS['xoopsSecurity']->getErrors(true));
     }
     $contents_id = xoopsFaq_CleanVars($_REQUEST, 'contents_id', 0, 'int');
     $obj = $contents_id == 0 ? $contents_handler->create() : $contents_handler->get($contents_id);
     if (is_object($obj)) {
         $obj->setVars($_REQUEST);
         $obj->setVar('contents_publish', strtotime($_REQUEST['contents_publish']));
         $obj->setVar('dohtml', isset($_REQUEST['dohtml']) ? 1 : 0);
         $obj->setVar('dosmiley', isset($_REQUEST['dosmiley']) ? 1 : 0);
         $obj->setVar('doxcode', isset($_REQUEST['doxcode']) ? 1 : 0);
         $obj->setVar('doimage', isset($_REQUEST['doimage']) ? 1 : 0);
         $obj->setVar('dobr', isset($_REQUEST['dobr']) ? 1 : 0);
         $ret = $contents_handler->insert($obj, true);
         if ($ret) {
             redirect_header('main.php', 1, _AM_XOOPSFAQ_DBSUCCESS);
         }
     }
     $contents_handler->displayError($ret);
         $index_admin = new ModuleAdmin();
         echo $index_admin->addNavigation('category.php');
         //xoopsFaq_DisplayHeading(_AM_XOOPSFAQ_CATEGORY_HEADER, _AM_XOOPSFAQ_CATEGORY_DELETE_DSC, false);
         xoopsFaq_DisplayHeading('', _AM_XOOPSFAQ_CATEGORY_DELETE_DSC, false);
         xoops_confirm(array('op' => 'delete', 'category_id' => $category_id, 'ok' => 1), 'category.php', _AM_XOOPSFAQ_RUSURECAT);
     }
     break;
 case 'save':
     if (!$GLOBALS['xoopsSecurity']->check()) {
         redirect_header($this->url, 0, $GLOBALS['xoopsSecurity']->getErrors(true));
     }
     $category_id = xoopsFaq_CleanVars($_REQUEST, 'category_id', 0, 'int');
     $obj = 0 == $category_id ? $category_handler->create() : $category_handler->get($category_id);
     if (is_object($obj)) {
         $obj->setVar('category_title', xoopsFaq_CleanVars($_REQUEST, 'category_title', '', 'string'));
         $obj->setVar('category_order', xoopsFaq_CleanVars($_REQUEST, 'category_order', 0, 'int'));
         if ($category_handler->insert($obj, true)) {
             redirect_header('category.php', 1, _AM_XOOPSFAQ_DBSUCCESS);
         }
     }
     $category_handler->displayError(_AM_XOOPSFAQ_ERRORCOULDNOTADDCAT);
     break;
 case 'default':
 default:
     //    xoops_cp_header();
     //xoopsFaq_AdminMenu(1);
     $index_admin = new ModuleAdmin();
     echo $index_admin->addNavigation('category.php');
     //xoopsFaq_DisplayHeading(_AM_XOOPSFAQ_CATEGORY_HEADER, _AM_XOOPSAQ_CATEGORY_LIST_DSC);
     xoopsFaq_DisplayHeading('', _AM_XOOPSFAQ_CATEGORY_LIST_DSC);
     $category_handler->displayAdminListing();
Exemple #3
0
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
 * @license http://www.fsf.org/copyleft/gpl.html GNU public license
 * @package : XOOPS
 * @Module : Xoops FAQ
 * @subpackage : User side code
 * @since 2.3.0
 * @author John Neill
 * @version $Id: index.php 0000 10/04/2009 09:22:12 John Neill $
 */
include_once 'header.php';
$category_handler =& xoops_getModuleHandler('category');
$content_handler =& xoops_getModuleHandler('contents');
$cat_id = xoopsFaq_CleanVars($_GET, 'cat_id', 0, 'int');
if ($cat_id < 1) {
    $xoopsOption['template_main'] = 'xoopsfaq_index.html';
    include_once XOOPS_ROOT_PATH . '/header.php';
    /**
     * Display Categories and a list of Answers Max 10
     */
    $objects = $category_handler->getObj();
    if ($objects['count'] > 0) {
        foreach ($objects['list'] as $object) {
            $category = array();
            $category['id'] = $object->getVar('category_id');
            $category['name'] = $object->getVar('category_title');
            $contentsObj = $content_handler->getPublished($object->getVar('category_id'));
            if ($contentsObj['count']) {
                foreach ($contentsObj['list'] as $content) {