/**
  * Copy this record and all its data to new id.
  * @param integer id which is used as PK for new record.
  */
 function copyRecord($newid)
 {
     global $db;
     $change[$this->pk_name] = $newid;
     copyRow($this->management_table, "{$this->pk_name} = {$this->fkid}", $change);
     return '';
 }
Example #2
0
/**
 * 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 the configstore of a plugin
 * @id integer GUID od the CLTI_ID
 */
function launchPgnConfigStore($id)
{
    $out = translateState($id, 10, false);
    deleteRow("pgn_config_store", "CLTI_ID = {$out}");
    $replace["CLTI_ID"] = $out;
    copyRow("pgn_config_store", "CLTI_ID = {$id}", $replace);
}
/**
 * Makes copy of cluster's content
 * 
 * @param integer Old CLID ID
 * @param integer New CLID ID
 */
function copyClusterContent($oldClid, $newClid)
{
    global $db;
    $clcid = createDBCArray("cluster_content", "CLCID", "CLID = {$oldClid}");
    for ($i = 0; $i < count($clcid); $i++) {
        $values["CLCID"] = nextGUID();
        $values["CLID"] = $newClid;
        copyRow("cluster_content", "CLCID=" . $clcid[$i], $values);
        // now do it for the plugin :-)
        $clti = getDBCell("cluster_content", "CLTI_ID", "CLCID =" . $clcid[$i]);
        $cltitype = getDBCell("cluster_template_items", "CLTITYPE_ID", "CLTI_ID={$clti}");
        if ($cltitype == 2) {
            $mod = getDBCell("cluster_template_items", "FKID", "CLTI_ID={$clti}");
            $classname = getDBCell("modules", "CLASS", "MODULE_ID = {$mod}");
            if ($classname != "") {
                $ref = new $classname($clcid[$i]);
                $sql = $ref->copyRecord($values["CLCID"]);
                $query = new query($db, $sql);
                $query->free();
            }
        }
    }
}
		function copyRecord($newId) {
			global $db;
			$change['FKID'] = $newid;
			copyRow($this->management_table, "$this->pk_name = $this->fkid", $change);								
			return '';
		}