本文整理汇总了PHP中steam_factory::create_copy方法的典型用法代码示例。如果您正苦于以下问题:PHP steam_factory::create_copy方法的具体用法?PHP steam_factory::create_copy怎么用?PHP steam_factory::create_copy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类steam_factory
的用法示例。
在下文中一共展示了steam_factory::create_copy方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: copy_msg
function copy_msg($steam, $source)
{
//create container
$copy = steam_factory::create_container($steam, $source->get_attribute(OBJ_NAME), $steam->get_login_user());
$copy->set_attribute("bid:doctype", "portlet");
$copy->set_attribute("bid:portlet", "msg");
//copy pictures if available
$old_content = $source->get_attribute("bid:portlet:content");
$copy_content = array();
foreach ($old_content as $msg_id) {
$message = steam_factory::get_object($steam, $msg_id);
$new_message = steam_factory::create_copy($steam, $message);
$new_message->move($copy);
array_push($copy_content, $new_message->get_id());
$picture_id = $message->get_attribute("bid:portlet:msg:picture_id");
if ($picture_id != null || $picture_id != "") {
//duplicate picture
$new_picture = steam_factory::create_copy($steam, steam_factory::get_object($steam, $picture_id));
$new_picture->move($copy);
//update portlet content
$new_message->set_attribute("bid:portlet:msg:picture_id", $new_picture->get_id());
}
}
//set correct content
$copy->set_attribute("bid:portlet:content", $copy_content);
return $copy;
}
示例2: processData
public function processData(\IRequestObject $requestObject)
{
$this->params = $requestObject->getParams();
$this->id = $this->params["id"];
$this->user = $GLOBALS["STEAM"]->get_current_steam_user();
$object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
if ($object instanceof \steam_link) {
$copy = \steam_factory::create_link($GLOBALS["STEAM"]->get_id(), $object->get_link_object());
} else {
$copy = \steam_factory::create_copy($GLOBALS["STEAM"]->get_id(), $object);
}
$copy->move($this->user);
}
示例3: processData
public function processData(\IRequestObject $requestObject)
{
$this->params = $requestObject->getParams();
$this->id = $this->params["id"];
$this->user = $GLOBALS["STEAM"]->get_current_steam_user();
$object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
if (getObjectType($object) === "portal") {
$portalInstance = \PortletTopic::getInstance();
$portalObjectId = $object->get_id();
\ExtensionMaster::getInstance()->callCommand("PortalCopy", "Portal", array("id" => $portalObjectId));
} else {
if ($object instanceof \steam_link) {
$copy = \steam_factory::create_link($GLOBALS["STEAM"]->get_id(), $object->get_link_object());
} else {
$copy = \steam_factory::create_copy($GLOBALS["STEAM"]->get_id(), $object);
}
$copy->move($this->user);
}
}
示例4: processData
public function processData(\IRequestObject $requestObject)
{
$this->params = $requestObject->getParams();
$objectId = $this->params["id"];
$portalObject = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $objectId);
$currentUser = $GLOBALS["STEAM"]->get_current_steam_user();
//copy portal
$portalCopy = \steam_factory::create_copy($GLOBALS["STEAM"]->get_id(), $portalObject);
//remove broken messages: works!
foreach ($portalCopy->get_inventory() as $columnObject) {
foreach ($columnObject->get_inventory() as $portletObject) {
if ($portletObject->get_attribute("bid:portlet") === "msg") {
//get ids in attrbute
$oldIds = $portletObject->get_attribute("bid:portlet:content");
$newIds = array();
//delete wrong references messages
foreach ($portletObject->get_inventory() as $oldMessageObject) {
$oldMessageObject->delete();
}
foreach ($oldIds as $messageId) {
//copy to here
//make new id list
$msgObject = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $messageId);
$msgCopy = \steam_factory::create_copy($GLOBALS["STEAM"]->get_id(), $msgObject);
$msgCopy->move($portletObject);
$newIds[] = $msgCopy->get_id();
//handle included pics
$pictrueId = $msgObject->get_attribute("bid:portlet:msg:picture_id");
if ($pictrueId != "") {
$pictureObject = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $pictrueId);
$pictuteCopy = \steam_factory::create_copy($GLOBALS["STEAM"]->get_id(), $pictureObject);
$msgCopy->set_attribute("bid:portlet:msg:picture_id", $pictuteCopy->get_id());
$msgCopy->move($portletObject);
}
}
//save in attrubute
$portletObject->set_attribute("bid:portlet:content", $newIds);
}
}
}
$portalCopy->move($currentUser);
return;
}
示例5: processData
public function processData(\IRequestObject $requestObject)
{
$this->params = $requestObject->getParams();
$this->id = $this->params["id"];
$bookmarks = $GLOBALS["STEAM"]->get_current_steam_user()->get_attribute(USER_BOOKMARKROOM);
$object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
if ($object instanceof \steam_link) {
$link = \steam_factory::create_link($GLOBALS["STEAM"]->get_id(), $object->get_link_object());
} else {
if ($object instanceof \steam_docextern) {
$link = \steam_factory::create_copy($GLOBALS["STEAM"]->get_id(), $object);
} else {
if ($object instanceof \steam_exit) {
$link = \steam_factory::create_link($GLOBALS["STEAM"]->get_id(), $object->get_exit());
} else {
$link = \steam_factory::create_link($GLOBALS["STEAM"]->get_id(), $object);
}
}
}
$link->set_attribute(OBJ_DESC, $object->get_attribute(OBJ_DESC));
$link->set_attribute(DOC_MIME_TYPE, $object->get_attribute(DOC_MIME_TYPE));
$link->move($bookmarks);
}
示例6: copy_appointment
function copy_appointment($steam, $source)
{
//duplicate portlet
$copy = steam_factory::create_copy($steam, $source);
return $copy;
}
示例7: insert
/**
* function insert:
*
* @param mixed $pSteamObjects Array of steam_objects
* @param integer $pType 0 = take originals, 1 = create links, 2 = take copies
**/
public function insert($pSteamObjects, $pType = 0)
{
$objects_to_insert = array();
if (!is_array($pSteamObjects)) {
$pSteamObjects = array(0 => $pSteamObjects);
}
if ($pType == 1) {
foreach ($pSteamObjects as $steam_object) {
steam_factory::create_link($this->steam_connectorID, $steam_object, 1);
}
$objects_to_insert = $this->steam_buffer_flush();
} elseif ($pType == 2) {
foreach ($pSteamObjects as $steam_object) {
steam_factory::create_copy($this->steam_connectorID, $steam_object, 1);
}
$objects_to_insert = $this->steam_buffer_flush();
} else {
$objects_to_insert = $pSteamObjects;
}
foreach ($objects_to_insert as $object) {
$steam_object = get_class($object) == "steam_request" ? $object->arguments : $object;
$steam_object->move($this, 1);
}
return $this->steam_buffer_flush();
}
示例8: frameResponse
public function frameResponse(\FrameResponseObject $frameResponseObject)
{
$rapidfeedback = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
$user = $GLOBALS["STEAM"]->get_current_steam_user();
$RapidfeedbackExtension = \Rapidfeedback::getInstance();
$RapidfeedbackExtension->addJS();
// admin action (start, stop, copy, delete) got submitted
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["admin_action"])) {
$element = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $_POST["element_id"]);
if ($element instanceof \steam_object) {
switch ($_POST["admin_action"]) {
case 1:
$element->set_attribute("RAPIDFEEDBACK_STATE", 1);
break;
case 2:
$element->set_attribute("RAPIDFEEDBACK_STATE", 2);
break;
case 3:
$copy = \steam_factory::create_copy($GLOBALS["STEAM"]->get_id(), $element);
$copy->move($rapidfeedback);
$copy->set_attribute("RAPIDFEEDBACK_PARTICIPANTS", array());
$copy->set_attribute("RAPIDFEEDBACK_STATE", 0);
$copy->set_attribute("RAPIDFEEDBACK_RESULTS", 0);
$copy->set_attribute("RAPIDFEEDBACK_STARTTYPE", 0);
$resultContainer = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $copy->get_path() . "/results");
$results = $resultContainer->get_inventory();
foreach ($results as $result) {
$result->delete();
}
break;
case 4:
$element->delete();
break;
}
}
}
// edit configuration got submitted
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["edit_rapidfeedback"])) {
$rapidfeedback->set_name($_POST["title"]);
$rapidfeedback->set_attribute("OBJ_DESC", $_POST["desc"]);
if (isset($_POST["adminsurvey"]) && $_POST["adminsurvey"] == "on") {
$rapidfeedback->set_attribute("RAPIDFEEDBACK_ADMIN_SURVEY", 1);
} else {
$rapidfeedback->set_attribute("RAPIDFEEDBACK_ADMIN_SURVEY", 0);
}
}
// create/edit survey got submitted
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["create_survey"])) {
$survey_object = new \Rapidfeedback\Model\Survey($rapidfeedback);
$survey_object->setName($_POST["title"]);
$survey_object->setBeginText($_POST["begintext"]);
$survey_object->setEndText($_POST["endtext"]);
$questioncounter = 0;
$sortedQuestions = $_POST["sortable_array"];
$sortedQuestions != '' ? $sortedQuestions = explode(',', $sortedQuestions) : '';
foreach ($sortedQuestions as $question) {
if ($question != "newquestion" && $question != "newlayout" && $question != "") {
$questionValues = $_POST[$question];
$questionValues != '' ? $questionValues = explode(',', $questionValues) : '';
switch ($questionValues[0]) {
case 0:
$newquestion = new \Rapidfeedback\Model\TextQuestion();
break;
case 1:
$newquestion = new \Rapidfeedback\Model\TextareaQuestion();
break;
case 2:
$newquestion = new \Rapidfeedback\Model\SingleChoiceQuestion();
$options = $_POST[$question . "_options"];
$options != '' ? $options = explode(',', $options) : '';
foreach ($options as $option) {
$newquestion->addOption(rawurldecode($option));
}
$newquestion->setArrangement($questionValues[4]);
break;
case 3:
$newquestion = new \Rapidfeedback\Model\MultipleChoiceQuestion();
$options = $_POST[$question . "_options"];
$options != '' ? $options = explode(',', $options) : '';
foreach ($options as $option) {
$newquestion->addOption(rawurldecode($option));
}
$newquestion->setArrangement($questionValues[4]);
break;
case 4:
$newquestion = new \Rapidfeedback\Model\MatrixQuestion();
$columns = $_POST[$question . "_columns"];
$columns != '' ? $columns = explode(',', $columns) : '';
foreach ($columns as $column) {
$newquestion->addcolumn(rawurldecode($column));
}
$rows = $_POST[$question . "_rows"];
$rows != '' ? $rows = explode(',', $rows) : '';
foreach ($rows as $row) {
$newquestion->addRow(rawurldecode($row));
}
break;
case 5:
$newquestion = new \Rapidfeedback\Model\GradingQuestion();
$options = $_POST[$question . "_rows"];
//.........这里部分代码省略.........
示例9: gettext
} else {
$msg = gettext("Could not pick up '%OBJECT' from '%CONTAINER' and place it into your clipboard.");
$_SESSION["problem"] = str_replace(array("%OBJECT", "%CONTAINER"), array($koala_obj->get_display_name(), $koala_container->get_display_name()), $msg);
header("Location: " . $_SERVER["HTTP_REFERER"]);
exit;
}
break;
case 'take-copy':
$obj = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $_GET["id"]);
$koala_obj = koala_object::get_koala_object($obj);
$container = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $_GET["where"], CLASS_CONTAINER);
$koala_container = new koala_container($container);
if ($_GET["modifier"] != "from" || !is_object($obj) || !is_object($container)) {
break;
}
$copy = steam_factory::create_copy($GLOBALS["STEAM"]->get_id(), $obj);
if (!is_object($copy)) {
$msg = gettext("Could not obtain a copy of '%OBJECT'.");
$_SESSION["confirmation"] = str_replace(array("%OBJECT", "%CONTAINER"), array($koala_obj->get_display_name(), $koala_container->get_display_name()), $msg);
header("Location: " . $_SERVER["HTTP_REFERER"]);
exit;
}
if ($copy->move($user)) {
$msg = gettext("A copy of '%OBJECT' has been placed into your clipboard.");
$_SESSION["confirmation"] = str_replace(array("%OBJECT", "%CONTAINER"), array($koala_obj->get_display_name(), $koala_container->get_display_name()), $msg);
header("Location: " . $_SERVER["HTTP_REFERER"]);
exit;
} else {
try {
if (is_object($copy)) {
$copy->delete();
示例10: startEdit
public function startEdit()
{
if ($this->getRole() != "view") {
throw new Exception("only worksheets with role 'view' can be edited!");
}
$currentUser = $GLOBALS["STEAM"]->get_current_steam_user();
$userWorkroom = $currentUser->get_workroom();
$newObj = \steam_factory::create_copy($GLOBALS["STEAM"]->get_id(), $this->steamObj);
$newObj->move($userWorkroom);
$newWorksheet = new self($newObj->get_id());
$newWorksheet->setRole("edit");
$name = $newWorksheet->getName();
$name = preg_replace('!(\\ )*\\(Vorlage\\)!isU', '', $name);
$name = preg_replace('!(\\ )*\\(Verteilkopie\\)!isU', '', $name);
$name = $name . " (Arbeitskopie)";
$newWorksheet->setName($name);
$this->addEditCopy($currentUser->get_id(), $newWorksheet->getId());
return $newWorksheet;
}
示例11: foreach
case "reference":
//get object names
foreach ($objects as $obj) {
$link = steam_factory::create_link($steam, $obj);
$link->set_attributes(array(OBJ_DESC => $obj->get_attribute(OBJ_DESC)));
$link->move($steam->get_login_user());
}
break;
case "bookmark":
//get object names
foreach ($objects as $obj) {
if ($obj instanceof steam_link) {
$link = steam_factory::create_link($steam, $obj->get_link_object());
} else {
if ($obj instanceof steam_docextern) {
$link = steam_factory::create_copy($steam, $obj);
} else {
$link = steam_factory::create_link($steam, $obj);
}
}
$link->set_attribute(OBJ_DESC, $obj->get_attribute(OBJ_DESC));
$link->set_attribute(DOC_MIME_TYPE, $obj->get_attribute(DOC_MIME_TYPE));
$link->move($steam->get_login_user()->get_attribute(USER_BOOKMARKROOM));
}
break;
case "drop":
//move objects to current room
$inventory = $steam->get_login_user()->get_inventory();
foreach ($inventory as $item) {
if ($item->get_attribute("bid:portlet") === 0) {
$item->move($object);
示例12: copy_headline
function copy_headline($steam, $source)
{
//duplicate portlet
$copy = steam_factory::create_copy($steam, $source);
return $copy;
}