$clid = getDBCell("cluster_variations", "CLID", "CLNID = $clnid AND VARIATION_ID = $variation AND DELETED=0"); if ($clid == "") { $form2 = new YesNoForm($lang->get("cr_vr", "Create variation"), $lang->get("crclv_mes", "The cluster does not exists in this variation. Do you want to create it?")); $form2->add(new Hidden("action", "cr_cluster")); $form2->add(new Hidden("oid", $oid)); $form2->add(new Hidden("crvar", $variation)); $page->add($form2); $handled = true; $action = "foo"; $page_action = "UPDATE"; } } } if ($action == $lang->get("cl_launch") && $aclf->checkAccessToFunction("B_EXPIRE_LAUNCH")) { launchCluster($clnid, 10, $variation); } else if ($action == $lang->get("cl_expire") && $aclf->checkAccessToFunction("B_EXPIRE_LAUNCH")) { expireCluster($clnid, $variation); } if ($action == $lang->get("CL_DEL") && $aclf->checkAccessToFunction("DELETE_CL")) { //if (!isset($go)) $go = "start"; if ($go == "0" || $go == "") $go = "start"; $delhandler = new ActionHandler("deleteobject"); if (value("decision") == $lang->get("yes")) { $delhandler->addDBAction("UPDATE cluster_node SET DELETED = 1 WHERE CLNID = $oid"); $delhandler->addDBAction("UPDATE cluster_content SET FKID=0 WHERE FKID = $oid");
/** * Launch the clusters in a compound-group * @param integer $in CGID to find clusters from * @param integer ID of the level to launch to. */ function launchCompoundGroupMembers($in, $level) { global $db; $cgidTrans = translateState($in, $level, false); deleteRow("compound_group_members", "CGID = ".$cgidTrans); $sql = "SELECT * FROM compound_group_members WHERE CGID = $in"; $query = new query($db, $sql); while ($query->getrow()) { $position = $query->field("POSITION"); $cgmid = $query->field("CGMID"); $variations = createDBCArray("cluster_variations", "VARIATION_ID", "CLNID = $cgmid"); for ($i=0; $i < count($variations); $i++) { $cgmidTrans = launchCluster($cgmid, $level, $variation); } $sql = "INSERT INTO compound_group_members (CGID, CGMID, POSITION) VALUES($cgidTrans, $cgmidTrans, $position)"; $squery = new query($db, $sql); $squery->free(); } $query->free(); }
/** * Launch a Cluster-Template-Item * @param integer ID to launch * @param integer ID of the corresponding Cluster-Template * @param integer ID of the level to launch to * @param integer ID of the variation to launch. * @returns integer Translated ID after launch */ function launchClusterTemplateItem($in, $clt, $level, $variation) { global $db; if (!checkACL($in)) { $out = translateState($in, $level); $sql = "SELECT NAME, POSITION, MINCARD, MAXCARD, FKID, CLTITYPE_ID FROM cluster_template_items WHERE CLTI_ID = {$in}"; $query = new query($db, $sql); $query->getrow(); $name = addslashes($query->field("NAME")); $position = $query->field("POSITION"); $type = $query->field("CLTITYPE_ID"); $mincard = $query->field("MINCARD"); $maxcard = $query->field("MAXCARD"); $fkid = $query->field("FKID"); $foreign = $fkid; // launch static content or cluster-instance. if ($type == 1) { $foreign = launchContent($fkid, $level, $variation); } if ($type == 2) { launchPgnConfigStore($in); } if ($type == 3) { $foreign = launchCluster($fkid, $level, $variation); } if ($type == 7) { $foreign = translateState($fkid, $level, false); } $sql = "DELETE FROM cluster_template_items WHERE CLTI_ID = {$out}"; $query = new query($db, $sql); $sql = "INSERT INTO cluster_template_items (CLTI_ID, CLT_ID, NAME, POSITION, MINCARD, MAXCARD, FKID, CLTITYPE_ID, DELETED, VERSION) "; $sql .= "VALUES ({$out}, {$clt}, '{$name}', {$position}, {$mincard}, {$maxcard}, {$foreign}, {$type}, 0, {$level})"; $query = new query($db, $sql); $query->free(); return $out; } else { return translateState($in, $level); } }
/** * Launch an article * @param integer ID of the article to launch * @param integer ID of the level that will be launched * @param integer ID of the variation to launch */ function launchArticle($articleId, $level, $variation) { $articleIdTrans = launchCluster($articleId, $level, $variation); $replacements["CLT_ID"] = getDBCell("cluster_node", "CLT_ID", "CLNID = {$articleIdTrans}"); $replacements["ARTICLE_ID"] = $articleIdTrans; $replacements["VERSION"] = $level; deleteRow("channel_articles", "ARTICLE_ID = {$articleIdTrans}"); copyRow('channel_articles', "ARTICLE_ID = {$articleId}", $replacements); launchArticleURL($articleIdTrans, $variation); return $articleIdTrans; }
/** * Launch a Cluster-Content-Item * @param integer CLCID to launch * @param integer ID of the level to launch to. * @param integer ID of the variation to launch. * @return integer Translated ID after launch */ function launchClusterContent($in, $level, $variation) { global $db; if (!checkACL($in)) { $out = translateState($in, $level); $sql = "SELECT * FROM cluster_content WHERE CLCID = {$in} AND DELETED=0"; $query = new query($db, $sql); $query->getrow(); $clid = $query->field("CLID"); $clti = $query->field("CLTI_ID"); $posi = $query->field("POSITION"); $title = addslashes($query->field("TITLE")); $fkid = $query->field("FKID"); $delme = $query->field("DELETED"); // get type from clti... $sql = "SELECT CLTITYPE_ID, FKID FROM cluster_template_items WHERE CLTI_ID = {$clti}"; $query = new query($db, $sql); $query->getrow(); $type = $query->field("CLTITYPE_ID"); $clfktype = $query->field("FKID"); $fkTrans = 0; if ($fkid != 0 && ($type == 4 || $type == 6)) { $fkTrans = launchCluster($fkid, $level, $variation); } if ($type == 2) { launchPlugin($in, $clfktype, $level, $clti); } if ($fkid != 0 && $type == 5) { $fkTrans = launchContent($fkid, $level, $variation); } if ($type == 8) { $fkTrans = launchCenterstage($in, $level); } // translate ids $clid = translateState($clid, $level, false); $clti = translateState($clti, $level, false); $sql = "DELETE FROM cluster_content WHERE CLCID = {$out}"; $query = new query($db, $sql); $sql = "INSERT INTO cluster_content (CLCID, CLID, CLTI_ID, POSITION, TITLE, FKID, DELETED) VALUES "; $sql .= "({$out}, {$clid}, {$clti}, {$posi}, '{$title}', {$fkTrans}, {$delme})"; $query = new query($db, $sql); $query->free(); return $out; } else { return translateState($in, $level); } }