當前位置: 首頁>>代碼示例>>PHP>>正文


PHP steam_factory::create_copy方法代碼示例

本文整理匯總了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;
}
開發者ID:rolwi,項目名稱:koala,代碼行數:27,代碼來源:copy.php

示例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);
 }
開發者ID:rolwi,項目名稱:koala,代碼行數:13,代碼來源:PortletCopy.class.php

示例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);
     }
 }
開發者ID:rolwi,項目名稱:koala,代碼行數:19,代碼來源:Copy.class.php

示例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;
 }
開發者ID:rolwi,項目名稱:koala,代碼行數:43,代碼來源:PortalCopy.class.php

示例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);
 }
開發者ID:rolwi,項目名稱:koala,代碼行數:23,代碼來源:AddSchoolBookmark.class.php

示例6: copy_appointment

function copy_appointment($steam, $source)
{
    //duplicate portlet
    $copy = steam_factory::create_copy($steam, $source);
    return $copy;
}
開發者ID:rolwi,項目名稱:koala,代碼行數:6,代碼來源:copy.php

示例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();
 }
開發者ID:rolwi,項目名稱:koala,代碼行數:31,代碼來源:steam_container.class.php

示例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"];
//.........這裏部分代碼省略.........
開發者ID:rolwi,項目名稱:koala,代碼行數:101,代碼來源:Index.class.php

示例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();
開發者ID:rolwi,項目名稱:koala,代碼行數:31,代碼來源:clipboard_handling.php

示例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;
 }
開發者ID:rolwi,項目名稱:koala,代碼行數:19,代碼來源:Worksheet.class.php

示例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);
開發者ID:rolwi,項目名稱:koala,代碼行數:31,代碼來源:bid_backpack.php

示例12: copy_headline

function copy_headline($steam, $source)
{
    //duplicate portlet
    $copy = steam_factory::create_copy($steam, $source);
    return $copy;
}
開發者ID:rolwi,項目名稱:koala,代碼行數:6,代碼來源:copy.php


注:本文中的steam_factory::create_copy方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。