<?php
/**
 * 
 * @file article_edit.php
 * @copyright (c) 2005 - 2007 eifr.com
 * @license http://www.gnu.org/copyleft/gpl.html gnu/gpl
 * eifr is free software
 */

require_once('../../includes/inc_admin.php');
require_once(EIFR_ROOT . 'admin/mod_article/class_article.php');

$url = 'mod_article/info_edit.php';
Common::checkAdminFileAuth($url); //check file authority
$clComArticle = new ComArticle($cfgarr_article_type['info']);

$act = kGet('act');
switch ($act) {
    case 'save_add':
        $extra_session = $clComArticle -> _CLASSNAME . '_' . $cfgarr_article_type['info'];
        Common::checkSubmit($title, $extra_session);
        $clComArticle -> addRecords();
        break;

    case 'save_add_content':
        $clComArticle -> addArticleContentRecords();
        break;

    case 'save_edit_base':
        $clComArticle -> editArticleRecords();
        break;

    case 'save_edit_content':
        $clComArticle -> editArticleContentRecords();
        break;

    case 'add_content':
    case 'edit_content':
        $layout = $clComArticle -> get_layout_article_content_edit();
        require_once(getAdminTemplatePath('info_edit_content', $url));
        break;

    case 'comeback_content':
        $clComArticle -> comebackArticleContentRecords();
        break;

    case 'delete':
        $clComArticle -> recycleArticleRecords();
        break;

    case 'delete_content':
        $clComArticle -> recycleArticleContentRecords();
        break;

    case 'delete_forever':
        $clComArticle -> deleteArticleRecords();
        break;

    case 'delete_forever_content':
        $clComArticle -> deleteArticleContentRecords();
        break;

    case 'add':
    case 'edit_base':
    default :
        $layout = $clComArticle -> get_layout_article_edit();
        require_once(getAdminTemplatePath('info_edit', $url));
        break;
} 

?>
