function CopyProblem(&$arg) { global $app_config; // Write data to file $newcid = 3; $problem_prefix = sprintf("%s/c%02d/%d", $app_config['contest_testdata_path'], $arg['cid'], $arg['pid']); $new_prefix = sprintf("%s/c%02d/%d", $app_config['contest_testdata_path'], $newcid, $arg['pid']); _makedir($new_prefix, 0777); exec("copy " . $problem_prefix . "/* " . $new_prefix . "/"); $problem = new ContestProblem($arg['cid']); $problem->Get($arg['pid']); die; unset($arg['add_problem']); unset($arg['input_data']); unset($arg['standard_output']); $problem->detail = $arg; $problem->Add(); MsgAndRedirect("problem_create.php"); }
/** * Registering problem into contest * @param type $pid * @param type $cid * @param type $cpid */ function set_problem_cid($pid, $cid, $cpid) { $problem = new ProblemTbl($pid); $problem->Get() or error('Error setting problem cid'); $problem->update['cid'] = $cid; $problem->Update(); $contest_problem = new ContestProblem($cid); $contest_problem->detail = array("cpid" => $cpid, "cid" => $cid, "pid" => $pid); $contest_problem->Add(); }