public function copy($old_portfolio_id) { $old_folders = Models_Eportfolio_Folder::fetchAll($old_portfolio_id); if ($old_folders) { foreach ($old_folders as $folder) { $old_folder_artifacts = $folder->getArtifacts(); $folder->fromArray(array("pfolder_id" => NULL, "portfolio_id" => $this->portfolio_id)); if ($folder->insert()) { if ($old_folder_artifacts) { foreach ($old_folder_artifacts as $artifact) { $artifact->fromArray(array("pfartifact_id" => NULL, "pfolder_id" => $folder->getID())); if (!$artifact->insert()) { $error; } } } } } } if (!$error) { return true; } else { return false; } }
public function getFolder() { $folder = Models_Eportfolio_Folder::fetchRow($this->pfolder_id); return $folder; }
$f_data[$folder->getID()] = $folder->toArray(); } echo json_encode(array("status" => "success", "data" => $f_data)); } else { echo json_encode(array("status" => "error", "data" => "No folders attached to this portfolio ID.")); } } else { echo json_encode(array("status" => "error", "data" => "Invalid portfolio ID.")); } break; case "get-folder": if (${$request_var}["pfolder_id"] && ($tmp_input = clean_input(${$request_var}["pfolder_id"], "int"))) { $PROCESSED["pfolder_id"] = $tmp_input; } if ($PROCESSED["pfolder_id"]) { $folder = Models_Eportfolio_Folder::fetchRow($PROCESSED["pfolder_id"]); if ($folder) { $f_data = $folder->toArray(); echo json_encode(array("status" => "success", "data" => $f_data)); } else { echo json_encode(array("status" => "error", "data" => "No folder found with this ID.")); } } else { echo json_encode(array("status" => "error", "data" => "No portfolio folder ID or invalid portfolio folder ID.")); } break; case "get-folder-artifacts": if (${$request_var}["pfolder_id"] && ($tmp_input = clean_input(${$request_var}["pfolder_id"], "int"))) { $PROCESSED["pfolder_id"] = $tmp_input; } if ($PROCESSED["pfolder_id"]) {