} } $outcomesarr = unserialize($outcomesarr); updateoutcomes($outcomesarr); $newoutcomearr = addslashes(serialize($outcomesarr)); } else { $newoutcomearr = ''; } $removewithdrawn = true; $usereplaceby = "all"; $newitems = array(); $cid = $destcid; //needed for copyiteminc require_once "includes/copyiteminc.php"; copyallsub($items, '0', $newitems, $gbcats); doaftercopy($sourcecid); $itemorder = addslashes(serialize($newitems)); $query = "UPDATE imas_courses SET itemorder='{$itemorder}',blockcnt='{$blockcnt}',ancestors='{$ancestors}',outcomes='{$newoutcomearr}',latepasshrs='{$latepasshrs}' WHERE id='{$destcid}'"; mysql_query($query) or die("Query failed : " . mysql_error()); $offlinerubrics = array(); /* //copy offline $query = "SELECT name,points,showdate,gbcategory,cntingb,tutoredit,rubric FROM imas_gbitems WHERE courseid='$sourcecid'"; $result = mysql_query($query) or die("Query failed :$query " . mysql_error()); $insarr = array(); while ($row = mysql_fetch_row($result)) { $rubric = array_pop($row); if (isset($gbcats[$row[3]])) { $row[3] = $gbcats[$row[3]]; } else { $row[3] = 0;
$blockcnt = mysql_result($result, 0, 0); $query = "SELECT itemorder FROM imas_courses WHERE id='{$_POST['ctc']}'"; $result = mysql_query($query) or die("Query failed : {$query}" . mysql_error()); $items = unserialize(mysql_result($result, 0, 0)); $newitems = array(); if (isset($_POST['copystickyposts'])) { $copystickyposts = true; } else { $copystickyposts = false; } if ($_POST['whattocopy'] == 'all') { copyallsub($items, '0', $newitems, $gbcats); } else { copysub($items, '0', $newitems, $gbcats, isset($_POST['copyhidden'])); } doaftercopy($_POST['ctc']); $query = "SELECT itemorder FROM imas_courses WHERE id='{$cid}'"; $result = mysql_query($query) or die("Query failed : {$query}" . mysql_error()); $items = unserialize(mysql_result($result, 0, 0)); if ($_POST['addto'] == "none") { array_splice($items, count($items), 0, $newitems); } else { $blocktree = explode('-', $_POST['addto']); $sub =& $items; for ($i = 1; $i < count($blocktree); $i++) { $sub =& $sub[$blocktree[$i] - 1]['items']; //-1 to adjust for 1-indexing } array_splice($sub, count($sub), 0, $newitems); } $itemorder = addslashes(serialize($items));
$arr[$k] = $outcomes[$v]; } } } $outcomesarr = unserialize($outcomesarr); updateoutcomes($outcomesarr); $newoutcomearr = addslashes(serialize($outcomesarr)); } else { $newoutcomearr = ''; } $removewithdrawn = true; $usereplaceby = "all"; $newitems = array(); require "../includes/copyiteminc.php"; copyallsub($items, '0', $newitems, $gbcats); doaftercopy($_POST['usetemplate']); $itemorder = addslashes(serialize($newitems)); $query = "UPDATE imas_courses SET itemorder='{$itemorder}',blockcnt='{$blockcnt}',ancestors='{$ancestors}',outcomes='{$newoutcomearr}',latepasshrs='{$latepasshrs}' WHERE id='{$cid}'"; //copy offline $offlinerubrics = array(); mysql_query($query) or die("Query failed : " . mysql_error()); $query = "SELECT name,points,showdate,gbcategory,cntingb,tutoredit,rubric FROM imas_gbitems WHERE courseid='{$_POST['usetemplate']}'"; $result = mysql_query($query) or die("Query failed :{$query} " . mysql_error()); $insarr = array(); while ($row = mysql_fetch_row($result)) { $rubric = array_pop($row); if (isset($gbcats[$row[3]])) { $row[3] = $gbcats[$row[3]]; } else { $row[3] = 0; }