Exemple #1
0
// no acls present yet.
$page = new Page("Edit Channels");
require_once $c["path"] . "modules/channels/article_select_form.php";
$oid = value("oid", "NUMERIC");
$clnid = $oid;
$action = value("action");
if (value("setch", "NUMERIC") != "0") {
    pushVar("chsel", value("setch", "NUMERIC"));
}
$chid = getVar("chsel");
$variation = variation();
if (value("laction") == $lang->get("ar_launch") && $auth->checkAccessToFunction("CHANNEL_LAUNCH")) {
    launchArticle($oid, 10, $variation);
} else {
    if (value("laction") == $lang->get("ar_expire") && $auth->checkAccessToFunction("CHANNEL_LAUNCH")) {
        expireArticle($oid, 10, $variation);
    }
}
if ($action == "createarticle") {
    $go = "CREATE";
    $page_action = "INSERT";
    $form = new stdEDForm($lang->get("create_article", "Create new Article in channel") . " " . getDBCell("channels", "NAME", "CHID = " . $chid), "");
    $cond = $form->setPK("channel_articles", "ARTICLE_ID");
    $oname = new TextInput($lang->get("name"), "channel_articles", "TITLE", $cond, "type:text,width:300,size:64", "MANDATORY");
    $form->add($oname);
    $form->add(new SelectOneInput($lang->get("template"), "channel_articles", "CLT_ID", "cluster_templates, channel_cluster_templates", "NAME", "channel_cluster_templates.CLT_ID AS CLT", "cluster_templates.CLT_ID = channel_cluster_templates.CLT_ID AND channel_cluster_templates.CHID = {$chid} ORDER BY POSITION ASC", $cond, "TYPE:DROPDOWN", "MANDATORY"));
    $form->add(new SelectOneInput($lang->get("category"), "channel_articles", "CH_CAT_ID", "channel_categories", "NAME", "CH_CAT_ID", "CHID = {$chid}", $cond, "type:dropdown", "MANDATORY"));
    $form->add(new PositionInput($lang->get("position", "Position"), "channel_articles", "POSITION", $cond, "CHID={$chid} AND VERSION=0", "size:4,width:50"));
    $form->add(new Hidden("action", "createarticle"));
    $form->add(new NonDisplayedValueOnInsert("channel_articles", "CHID", $cond, $chid, "NUMBER"));
    $form->add(new NonDisplayedValueOnInsert("channel_articles", "ARTICLE_DATE", $cond, "NOW()", "NUMBER"));
/**
 * Delete an article
 * param integer Article-ID
 */
function deleteArticle($articleId)
{
    $variations = createDBCArray("variations", "VARIATION_ID", "1");
    foreach ($variations as $variation) {
        expireArticle($articleId, 10, $variation);
    }
    deleteClusterNode($articleId);
    deleteRow("channel_articles", "ARTICLE_ID = {$articleId}");
}
require_once "../../config.inc.php";
$auth = new auth("CHANNEL_EDIT");
$page = new Page("Edit Channels");
require_once $c["path"] . "modules/channels/article_select_form.php";
if (value("action") == "deletearticle" && $auth->checkAccessToFunction("CHANNEL_DELETE")) {
    $article = value("article", "NUMERIC");
    deleteArticle($article);
}
if (value("action") == "launcharticle" && $auth->checkAccessToFunction("CHANNEL_LAUNCH")) {
    $article = value("article", "NUMERIC");
    launchArticle($article, 10, variation());
}
if (value("action") == "expirearticle" && $auth->checkAccessToFunction("CHANNEL_LAUNCH")) {
    $article = value("article", "NUMERIC");
    expireArticle($article, 10, variation());
}
$selch = new SelectMenu($lang->get("channel_select", "Select Channel"), "chsel", "channels", "NAME", "CHID", "1");
$lang->delete("help_articles");
$selch->tipp = $lang->get("help_articles", "The form displays articles.<br><br>The color codes are:<li>red: article not published<li>grey: article not translated<li>green: article published");
$rowOrderFilter = "VERSION=0 AND CHID=" . $selch->selected;
if (value("action") == "up") {
    $article = value("article", "NUMERIC");
    moveRowUp("channel_articles", "ARTICLE_ID", $article, "POSITION", $rowOrderFilter);
} else {
    if (value("action") == "down") {
        $article = value("article", "NUMERIC");
        moveRowDown("channel_articles", "ARTICLE_ID", $article, "POSITION", $rowOrderFilter);
    }
}
$filtermenu = new StdMenu("");