当前位置: 首页>>代码示例>>PHP>>正文


PHP steam_factory::get_object_by_name方法代码示例

本文整理汇总了PHP中steam_factory::get_object_by_name方法的典型用法代码示例。如果您正苦于以下问题:PHP steam_factory::get_object_by_name方法的具体用法?PHP steam_factory::get_object_by_name怎么用?PHP steam_factory::get_object_by_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在steam_factory的用法示例。


在下文中一共展示了steam_factory::get_object_by_name方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: enable

 /**
  * Enable an extension globally. This is done via the extensions persistent object.
  * Dependencies to other extensions are taken into account. If a required extension
  * is not active, activation will not be done.
  * @return boolean activation success or not
  */
 public function enable()
 {
     if (!$this->is_enabled()) {
         $can_be_enabled = TRUE;
         $em = lms_steam::get_extensionmanager();
         foreach ($this->requirements as $req_extension) {
             $req_extension = $em->get_extension($req_extension);
             if (!$req_extension->is_enabled()) {
                 $can_be_enabled = FALSE;
             }
         }
         if ($can_be_enabled) {
             // if no extension config object exists, then create one:
             if (!is_object($this->steam_object)) {
                 $this->steam_object = steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), "/config/koala/extensions/" . $this->get_name());
                 if (!is_object($this->steam_object)) {
                     $env = steam_factory::path_to_object($GLOBALS["STEAM"]->get_id(), "/config/koala/extensions");
                     $this->steam_object = steam_factory::create_object($GLOBALS["STEAM"]->get_id(), $this->get_name(), CLASS_OBJECT, $env);
                     $this->steam_object->set_attributes(array('OBJ_TYPE' => 'object_extension_koala', 'OBJ_DESC' => $this->description, 'EXTENSION_ENABLED' => 'TRUE'));
                 }
             }
             $this->set_attribute("EXTENSION_ENABLED", "TRUE");
             return TRUE;
         }
         return FALSE;
     }
 }
开发者ID:rolwi,项目名称:koala,代码行数:33,代码来源:koala_extension.class.php

示例2: getSidebar

 public function getSidebar()
 {
     $sidebarObject = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $this->object->get_path() . "/sidebar.html");
     if (isset($sidebarObject) && $sidebarObject instanceof \steam_document) {
         return $sidebarObject->get_content();
     } else {
         return "";
     }
 }
开发者ID:rolwi,项目名称:koala,代码行数:9,代码来源:WaveSide.class.php

示例3: __construct

 function __construct($parent_tmp, $steamObject_tmp, $type)
 {
     $this->parent = $parent_tmp;
     $this->steamObject = $steamObject_tmp;
     $this->type = $type;
     $this->myUser = lms_steam::get_current_user();
     //get meta data
     $doc = steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $this->steamObject->get_path() . "/exam.xml");
     $this->xml = simplexml_load_string($doc->get_content());
 }
开发者ID:rolwi,项目名称:koala,代码行数:10,代码来源:elearning_exam.class.php

示例4: getHtmlForObjectId

 public function getHtmlForObjectId(\FrameResponseObject $frameResponseObject)
 {
     $mplme = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
     if (isset($this->params[1]) && !strstr($this->params[1], "?")) {
         $doc = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $mplme->get_path() . "/" . $this->params[1]);
         if (isset($doc) && $doc !== 0 && $doc instanceof \steam_document) {
             echo $doc->download();
             //echo $doc->get_content();
         } else {
             echo "404";
         }
         die;
     }
     $elements = $mplme->get_inventory();
     $html = "";
     foreach ($elements as $element) {
         if ($element->get_name() == "data.xml") {
             $xmlContent = $element->get_content();
             //$html .= "<b>".$element->get_name()."</b><br><pre>". htmlentities($element->get_content()) . "</pre><br>";
         } else {
             if ($element->get_name() == $_REQUEST["xslName"] . ".xsl") {
                 $xslContent = $element->get_content();
                 //$html .= "<b>".$element->get_name()."</b><br><pre>". htmlentities($element->get_content()) . "</pre><br>";
             } else {
                 //$html .= "<b>".$element->get_name()."</b><br>";
             }
         }
     }
     if (isset($xmlContent) && isset($xslContent)) {
         $xml = new \DOMDocument();
         $xml->loadXML($xmlContent);
         $searchstring = '/<includexslt[ 0-9a-zA-Z=\\/\\"]*url="([~\\-0-9a-zA-Z=\\:\\?\\&\\.\\/]+)"[ 0-9a-zA-Z=\\/"]*[ \\-0-9a-zA-Z=\\/"]*\\/>/i';
         $xslContent = preg_replace_callback($searchstring, array(&$this, 'cb_replace'), $xslContent);
         $xsl = new \DOMDocument();
         $xsl->loadXML($xslContent);
         $proc = new \XSLTProcessor();
         $proc->importStylesheet($xsl);
         $html .= $proc->transformToXml($xml);
     }
     if (isset($_REQUEST['output']) && $_REQUEST['output'] === "download") {
         header('Content-Disposition: attachment; filename=data.' . $_REQUEST['xslName']);
     }
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($html);
     $frameResponseObject->addWidget($rawHtml);
     $frameResponseObject->setHeadline(array(array("name" => "zurück", "link" => "javascript:history.back()"), array("name" => "Mplme")));
     return $frameResponseObject;
 }
开发者ID:rolwi,项目名称:koala,代码行数:48,代码来源:Output.class.php

示例5: frameResponse

    public function frameResponse(\FrameResponseObject $frameResponseObject)
    {
        $rapidfeedback = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
        $RapidfeedbackExtension = \Rapidfeedback::getInstance();
        $survey = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params[1]);
        $survey_object = new \Rapidfeedback\Model\Survey($rapidfeedback);
        $xml = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $survey->get_path() . "/survey.xml");
        $user = $GLOBALS["STEAM"]->get_current_steam_user();
        $RapidfeedbackExtension->addCSS();
        $RapidfeedbackExtension->addJS();
        $content = $RapidfeedbackExtension->loadTemplate("rapidfeedback_results.template.html");
        $content->setCurrentBlock("BLOCK_RESULTS");
        $content->setVariable("RESULTS_LABEL", "Auswertung");
        if ($survey->get_attribute("RAPIDFEEDBACK_RESULTS") != 1) {
            $content->setVariable("RESULTS_AMOUNT", $survey->get_attribute("RAPIDFEEDBACK_RESULTS") . " Abgaben");
        } else {
            $content->setVariable("RESULTS_AMOUNT", $survey->get_attribute("RAPIDFEEDBACK_RESULTS") . " Abgabe");
        }
        $survey_object->parseXML($xml);
        $survey_object->generateResults($survey);
        $questions = $survey_object->getQuestions();
        $question_html = '
		<script type="text/javascript" src="https://www.google.com/jsapi"></script>
    	<script type="text/javascript">
      		google.load("visualization", "1", {packages:["corechart"]});
		</script>';
        for ($count = 0; $count < count($questions); $count++) {
            $question_html = $question_html . $questions[$count]->getResultHTML($count + 1);
        }
        $content->setVariable("QUESTIONS_HTML", $question_html);
        $content->setVariable("BACK_LABEL", "Zurück");
        $content->setVariable("BACK_URL", $RapidfeedbackExtension->getExtensionUrl() . "Index/" . $this->id);
        $content->parse("BLOCK_RESULTS");
        $group = $rapidfeedback->get_attribute("RAPIDFEEDBACK_GROUP");
        if ($group->get_name() == "learners") {
            $parent = $group->get_parent_group();
            $courseOrGroup = "Kurs: " . $parent->get_attribute("OBJ_DESC") . " (" . $parent->get_name() . ")";
            $courseOrGroupUrl = PATH_URL . "semester/" . $parent->get_id();
        } else {
            $courseOrGroup = "Gruppe: " . $group->get_name();
            $courseOrGroupUrl = PATH_URL . "groups/" . $group->get_id();
        }
        $rawWidget = new \Widgets\RawHtml();
        $rawWidget->setHtml($content->get());
        $frameResponseObject->addWidget($rawWidget);
        $frameResponseObject->setHeadline(array(array("name" => $courseOrGroup, "link" => $courseOrGroupUrl), array("name" => "Rapid Feedback", "link" => $RapidfeedbackExtension->getExtensionUrl() . "Index/" . $rapidfeedback->get_id()), array("name" => "Auswertung")));
        return $frameResponseObject;
    }
开发者ID:rolwi,项目名称:koala,代码行数:48,代码来源:Results.class.php

示例6: frameResponse

 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $portal = \lms_portal::get_instance();
     $content = \Wave::getInstance()->loadTemplate("wave.template.html");
     if (strtolower($this->calledNamespace) === "wave" && strtolower($this->calledCommand) === "index") {
         $sideId = $this->params[0];
         $internalPath = $this->params;
         array_shift($internalPath);
         $sideUrl = $this->getExtension()->getExtensionUrl() . "Index/" . $sideId . "/";
     } else {
         $sideObject = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), WAVE_PATH_INTERN);
         if ($sideObject instanceof \steam_object) {
             $sideId = $sideObject->get_id();
             $internalPath = $this->params;
             $sideUrl = PATH_URL;
         } else {
             die("WAVE config broken (WAVE_PATH_INTERN: " . WAVE_PATH_INTERN . ")");
         }
     }
     if (!isset($internalPath)) {
         $internalPath = array();
     }
     $waveEngine = new \Wave\Model\WaveEngine($sideId, $internalPath, $sideUrl);
     $waveSide = $waveEngine->getSide();
     $waveObject = $waveEngine->getCurrentObject();
     if ($waveObject instanceof \Wave\Model\WavePage) {
         $content->setVariable("CONTENT", $waveObject->getHtml());
         $rawHtml = new \Widgets\RawHtml();
         $rawHtml->setHtml($content->get());
         $frameResponseObject->addWidget($rawHtml);
         return $frameResponseObject;
     } else {
         if ($waveObject instanceof \Wave\Model\WaveDownload) {
             $waveObject->download();
             die;
         } else {
             die("Not Wave-Object detected.");
         }
     }
 }
开发者ID:rolwi,项目名称:koala,代码行数:40,代码来源:Index.class.php

示例7: frameResponse

 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $mplme = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
     $frameResponseObject->setTitle("Mplme");
     if (isset($_REQUEST["xmlData"])) {
         $xmlDoc = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $mplme->get_path() . "/data.xml");
         if ($xmlDoc === 0 || !$xmlDoc instanceof \steam_document) {
             $xml = simplexml_load_string("<datasets></datasets>");
             $xmlDoc = \steam_factory::create_document($GLOBALS["STEAM"]->get_id(), "data.xml", $xml->asXML(), "text/xml");
             $xmlDoc->move($mplme);
         } else {
             $xmlRaw = $xmlDoc->get_content();
             $xml = simplexml_load_string($xmlRaw);
         }
         $xmlRequest = simplexml_load_string($_REQUEST["xmlData"]);
         $xmlRequestDom = new \domDocument();
         $xmlRequestDom->loadXML($xmlRequest->asXML());
         $xmlDom = new \domDocument();
         $xmlDom->loadXML($xml->asXML());
         $xmlDom->documentElement->appendChild($xmlDom->importNode($xmlRequestDom->documentElement, true));
         if ($_FILES && is_array($_FILES)) {
             foreach ($_FILES as $file) {
                 $content = file_get_contents($file["tmp_name"]);
                 $doc = \steam_factory::create_document($GLOBALS["STEAM"]->get_id(), $file["name"], $content, $file["type"]);
                 $doc->move($mplme);
             }
         }
         $xmlDoc->set_content($xmlDom->saveXML());
         //echo "<pre>" . htmlentities($xmlDom->saveXML()) . "</pre>";
         echo "ok";
     } else {
         echo "nix";
     }
     die;
     //echo "done";
     //$frameResponseObject->addWidget(new \Widgets\Blank());
     //return $frameResponseObject;
 }
开发者ID:rolwi,项目名称:koala,代码行数:38,代码来源:Upload.class.php

示例8: install_package

 /**
  * function install_package:
  *
  * Installs an SPM package on the server. The package needs to be a valid
  * steam_document, so you will have to upload the package file first
  * before you pass it to this function.
  *
  * @param steam_document $spm_package the package object to install
  * @return boolean TRUE if the package was installed, FALSE on failure
  */
 public function install_package($spm_package)
 {
     if (!is_object($spm_package) || !$spm_package instanceof steam_document) {
         throw new Exception("No valid SPM package provided.");
     }
     $spm_module = $this->get_module("SPM");
     if (!is_object($spm_module)) {
         throw new Exception("Could not get the SPM module.\n");
     }
     $root_room = steam_factory::get_object_by_name($this->get_id(), "/");
     if (!is_object($root_room)) {
         throw new Exception("Could not find the root-room.\n");
     }
     $result = $this->predefined_command($spm_module, "install_spm", array($spm_package, $root_room), 0);
     return is_array($result);
 }
开发者ID:rolwi,项目名称:koala,代码行数:26,代码来源:steam_connector.class.php

示例9: frameResponse


//.........这里部分代码省略.........
             $content->setVariable("DEADLINE_VALUE", "Aktuelle Phase wurde trotz der Verwendung von Deadlines manuell gesetzt. Die Deadlines werden im Moment nicht berücksichtigt.");
             $content->setVariable("DEADLINE_OVERRIDE_LABEL", "Deadlines aktivieren");
             $params = "{ id : " . $pyramidRoom->get_id() . ", action : 'deadlines' }";
             $content->setVariable("DEADLINE_OVERRIDE_ACTION", "sendRequest('Index', " . $params . ", '" . $pyramidRoom->get_id() . "', 'reload');");
         } else {
             $content->setVariable("DEADLINE_VALUE", "keine");
             $content->setVariable("DISPLAY_OVERRIDE", "none");
         }
     }
     $content->setVariable("INFO_LABEL", "Infotext:");
     $content->setVariable("INFO_VALUE", nl2br($pyramidRoom->get_attribute("OBJ_DESC")));
     $content->parse("BEGIN BLOCK_PYRAMID_INFORMATION");
     // display pyramid
     $content->setCurrentBlock("BLOCK_PYRAMID");
     // create array to store the users for all positions
     $users = array();
     for ($count = 1; $count <= $maxcol; $count++) {
         for ($count2 = 1; $count2 <= $startElements / pow(2, $count - 1); $count2++) {
             $users[$count . $count2] = array();
         }
     }
     // for every phase
     $maxuser = 1;
     for ($count = 1; $count <= $maxcol; $count++) {
         // if deadlines are used, display deadline of every phase on the top of the phase
         if ($pyramidRoom->get_attribute("PYRAMIDDISCUSSION_USEDEADLINES") == "yes" && $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_OVERRIDE_DEADLINES") == 0 && $phase <= $maxcol) {
             $content->setCurrentBlock("BLOCK_PYRAMID_DEADLINE");
             $content->setVariable("DEADLINE_ID", "deadline" . $count);
             $content->setVariable("DEADLINE_DATE", date("d.m.Y H:i", (int) $deadlines[$count]));
             $content->parse("BLOCK_PYRAMID_DEADLINE");
         }
         // create user array
         for ($count2 = 1; $count2 <= $startElements / pow(2, $count - 1); $count2++) {
             $position = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $pyramidRoom->get_path() . "/Position_" . $count . "_" . $count2);
             $positionGroup = $position->get_attribute("PYRAMIDDISCUSSION_RELGROUP");
             $positionMembers = $positionGroup->get_members();
             // add the users from the positions in the first phase to their corresponding arrays
             if ($count == 1) {
                 if ($positionMembers instanceof \steam_user) {
                     $users[$count . $count2] = $positionMembers->get_id();
                     if ($positionMembers->get_id() == $userID) {
                         $currentUserGroup = $positionGroup->get_id();
                     }
                 } else {
                     foreach ($positionMembers as $positionMember) {
                         array_push($users[$count . $count2], $positionMember->get_id());
                         if ($positionMember->get_id() == $userID) {
                             $currentUserGroup = $positionGroup->get_id();
                         }
                     }
                 }
                 if (count($users[$count . $count2]) > $maxuser) {
                     $maxuser = count($users[$count . $count2]);
                 }
                 // add users to the arrays of the positions for all other phases
             } else {
                 $users[$count . $count2] = array_merge($users[$count - 1 . ($count2 * 2 - 1)], $users[$count - 1 . $count2 * 2]);
             }
         }
         // for every position in a phase
         for ($count2 = 1; $count2 <= $startElements / pow(2, $count - 1); $count2++) {
             $position = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $pyramidRoom->get_path() . "/Position_" . $count . "_" . $count2);
             $positionGroup = $position->get_attribute("PYRAMIDDISCUSSION_RELGROUP");
             $positionMembers = $positionGroup->get_members();
             // get the names from all users of the current position (that still take part in the discussion)
             $participants = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_PARTICIPANT_MANAGEMENT");
开发者ID:rolwi,项目名称:koala,代码行数:67,代码来源:Index.class.php

示例10: 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

示例11: frameResponse

 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $TCR = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
     $user = $GLOBALS["STEAM"]->get_current_steam_user();
     $TCRExtension = \TCR::getInstance();
     $TCRExtension->addCSS();
     // determine kind of documents of the current user to display (0 = theses, 1 = reviews, 2 = responses)
     $kindOfDocument = 0;
     if (isset($this->params[1])) {
         $kindOfDocument = $this->params[1];
     }
     // release document dialog was submitted
     if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["release_element"])) {
         $element = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $_POST["element_id"]);
         if ($_POST["kind"] == 0) {
             $critics = array();
             $critics[$_POST["critic"]] = 0;
             $element->set_attribute("TCR_REVIEWS", $critics);
             $element->set_attribute("TCR_RELEASED", time());
         } else {
             $element->set_attribute("TCR_RELEASED", time());
         }
     }
     // edit document dialog was submitted
     if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["edit_element"])) {
         $old_element = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $_POST["old_id"]);
         // old element was plain text
         if ($old_element->get_attribute("DOC_MIME_TYPE") == "text/plain") {
             // new element is plain text
             if ($_POST["new_upload_text"] == 0) {
                 $old_element->set_name($_POST["title"]);
                 $old_element->set_attribute("OBJ_DESC", $_POST["desc"]);
                 $old_element->set_content($_POST["content"]);
                 // new element is an upload
             } else {
                 $old_element->delete();
                 $radio = 1;
             }
             // old element was an upload
         } else {
             // new element is the same
             if ($_POST["new_upload"] == 0) {
                 $old_element->set_name($_POST["title"]);
                 $old_element->set_attribute("OBJ_DESC", $_POST["desc"]);
                 // new element is a new upload
             } else {
                 if ($_POST["new_upload"] == 1) {
                     $old_element->delete();
                     $radio = 1;
                     // new element is plain text
                 } else {
                     $old_element->set_attribute("DOC_MIME_TYPE", "text/plain");
                     $old_element->set_name($_POST["title"]);
                     $old_element->set_attribute("OBJ_DESC", $_POST["desc"]);
                     $old_element->set_content($_POST["new_content"]);
                 }
             }
         }
     }
     // if a new element got created or already existing element gets a new upload
     if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["create_element"]) || isset($radio)) {
         $problems = "";
         $hints = "";
         if (!isset($radio)) {
             $radio = $_POST["radio"];
         }
         if ($radio == 1) {
             // handle upload
             require_once PATH_LIB . "format_handling.inc.php";
             $max_file_size = parse_filesize(ini_get('upload_max_filesize'));
             $max_post_size = parse_filesize(ini_get('post_max_size'));
             if ($max_post_size > 0 && $max_post_size < $max_file_size) {
                 $max_file_size = $max_post_size;
             }
             if (empty($_FILES) || !empty($_FILES["file"]["error"]) && $_FILES["file"]["error"] > 0) {
                 if (!empty($_FILES) && empty($_FILES["file"]["name"])) {
                     $problems = gettext("No file chosen.") . " ";
                     $hints = gettext("Please choose a local file to upload.") . " ";
                 } else {
                     $problems = gettext("Could not upload document.") . " ";
                     $hints = str_replace(array("%SIZE", "%TIME"), array(readable_filesize($max_file_size), (string) ini_get('max_execution_time')), gettext("Maybe your document exceeded the allowed file size (max. %SIZE) or the upload might have taken too long (max. %TIME seconds).")) . " ";
                 }
             }
             if (empty($problems)) {
                 $content = file_get_contents($_FILES["file"]["tmp_name"]);
                 $type = $_FILES["file"]["type"];
             }
         } else {
             $content = $_POST["content"];
             $type = "text/plain";
         }
         if ($_POST["kind"] == 0) {
             $container = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $TCR->get_path() . "/theses");
         } else {
             if ($_POST["kind"] == 1) {
                 $container = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $TCR->get_path() . "/reviews");
             } else {
                 $container = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $TCR->get_path() . "/responses");
             }
         }
//.........这里部分代码省略.........
开发者ID:rolwi,项目名称:koala,代码行数:101,代码来源:PrivateDocuments.class.php

示例12: die

<?php

include_once "../../etc/koala.conf.php";
$portal = lms_portal::get_instance();
$portal->initialize(GUEST_NOT_ALLOWED);
$object = steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), "/home/root/");
if (!is_object($object)) {
    die("Kein Object gefunden.");
}
$clientsupport = $GLOBALS['STEAM']->get_module("package:clientsupport");
if (is_object($clientsupport)) {
    $result = $GLOBALS['STEAM']->predefined_command($clientsupport, "query_object_data", array($object, 1, 1), false);
} else {
    die("package:clientsupport nicht installiert");
}
echo "<h1>clientsupport PHP test</h1>";
echo "<pre>";
print_r($result);
// JSON encoded result
print_r(json_encode($result));
开发者ID:rolwi,项目名称:koala,代码行数:20,代码来源:testclientsupport.php

示例13: frameResponse

 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $TCR = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
     $user = $GLOBALS["STEAM"]->get_current_steam_user();
     $TCRExtension = \TCR::getInstance();
     $TCRExtension->addCSS();
     $content = $TCRExtension->loadTemplate("tcr_index.template.html");
     // display actionbar
     $actionbar = new \Widgets\Actionbar();
     $admins = $TCR->get_attribute("TCR_ADMINS");
     if (in_array($user->get_id(), $admins)) {
         $actions = array(array("name" => "Konfiguration", "link" => $TCRExtension->getExtensionUrl() . "configuration/" . $this->id), array("name" => "Private Dokumente", "link" => $TCRExtension->getExtensionUrl() . "privateDocuments/" . $this->id), array("name" => "Übersicht", "link" => $TCRExtension->getExtensionUrl() . "Index/" . $this->id), array("name" => "Alle Dokumente", "link" => $TCRExtension->getExtensionUrl() . "documents/" . $this->id));
     } else {
         $actions = array(array("name" => "Private Dokumente", "link" => $TCRExtension->getExtensionUrl() . "privateDocuments/" . $this->id), array("name" => "Übersicht", "link" => $TCRExtension->getExtensionUrl() . "Index/" . $this->id), array("name" => "Alle Dokumente", "link" => $TCRExtension->getExtensionUrl() . "documents/" . $this->id));
     }
     $actionbar->setActions($actions);
     $frameResponseObject->addWidget($actionbar);
     // create array data structure of the theses (identified by writer of the thesis and writer of the review)
     $theses_container = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $TCR->get_path() . "/theses");
     $theses_inventory = $theses_container->get_inventory();
     $theses = array();
     $rounds = $TCR->get_attribute("TCR_ROUNDS");
     $members = $TCR->get_attribute("TCR_USERS");
     sort($members);
     foreach ($members as $member) {
         $theses[$member] = array();
         foreach ($members as $member2) {
             $theses[$member][$member2] = array();
         }
     }
     $group = $TCR->get_attribute("TCR_GROUP");
     if ($group->get_name() == "learners") {
         $parent = $group->get_parent_group();
         $courseOrGroup = "Kurs: " . $parent->get_attribute("OBJ_DESC") . " (" . $parent->get_name() . ")";
         $courseOrGroupUrl = PATH_URL . "semester/" . $parent->get_id();
     } else {
         $courseOrGroup = "Gruppe: " . $group->get_name();
         $courseOrGroupUrl = PATH_URL . "groups/" . $group->get_id();
     }
     // display message if there are no members specified
     if (count($members) == 0) {
         $content->setCurrentBlock("BLOCK_OVERVIEW_TABLE");
         $content->setVariable("TCR_TITLE", $TCR->get_attribute("OBJ_DESC"));
         $content->setVariable("TCR_NO_USERS", "Keine Teilnehmer festgelegt. Bitte in der Konfiguration die teilnehmenden Personen auswählen.");
         $content->setVariable("DISPLAY_MANY", "none");
         $content->setVariable("DISPLAY_TABLE", "none");
         $content->parse("BLOCK_OVERVIEW_TABLE");
         $rawWidget = new \Widgets\RawHtml();
         $rawWidget->setHtml($content->get());
         $frameResponseObject->addWidget($rawWidget);
         $frameResponseObject->setHeadline(array(array("name" => $courseOrGroup, "link" => $courseOrGroupUrl), array("name" => "Thesen-Kritik-Replik-Verfahren")));
         return $frameResponseObject;
     }
     // shortform of the table is displayed if amount of members is > 4
     $shortform = 0;
     if (count($members) > 4 && count($members) < 9) {
         $shortform = 1;
     } else {
         if (count($members) >= 9) {
             $help = round(count($members) / 8);
             if (count($members) / 8 > $help) {
                 $shortform = $help + 1;
             } else {
                 $shortform = $help;
             }
         }
     }
     if ($shortform > 1) {
         $divide = $shortform;
     } else {
         $divide = 1;
     }
     $area = 0;
     if (isset($this->params[1])) {
         $area = $this->params[1];
     }
     // fill array data structure
     foreach ($theses_inventory as $thesis) {
         $creator = $thesis->get_creator();
         $released = $thesis->get_attribute("TCR_RELEASED");
         $round = $thesis->get_attribute("TCR_ROUND");
         if ($released != 0) {
             $critic_array = $thesis->get_attribute("TCR_REVIEWS");
             foreach ($critic_array as $critic => $review) {
                 $theses[$creator->get_id()][$critic][$round] = $thesis->get_id();
             }
         }
     }
     // display document table
     $content->setCurrentBlock("BLOCK_OVERVIEW_TABLE");
     $content->setVariable("TCR_TITLE", $TCR->get_attribute("OBJ_DESC"));
     if ($divide == 1) {
         $content->setVariable("DISPLAY_MANY", "none");
     } else {
         // if there are > 8 members only display 8 on a page and create navigation for the rest
         if ($area != 0) {
             $content->setVariable("PREVIOUS_CRITICS", "Zeige " . (($area - 1) * 8 + 1) . " bis " . (($area - 1) * 8 + 8));
             $content->setVariable("PREVIOUS_URL", $TCRExtension->getExtensionUrl() . "Index/" . $this->id . "/" . ($area - 1));
         }
         if (count($members) <= $area * 8 + 8) {
//.........这里部分代码省略.........
开发者ID:rolwi,项目名称:koala,代码行数:101,代码来源:Index.class.php

示例14: check_steam_container

function check_steam_container($container_path, $description = "", $fix = FALSE)
{
    $container = steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $container_path);
    if (!is_object($container)) {
        if (!$fix) {
            return FALSE;
        }
        if (!is_object($container_environment = steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), dirname($container_path)))) {
            output("Error: could not get parent directory for container: '" . dirname($container_path) . "'\n");
            return FALSE;
        }
        if (!is_object($container = steam_factory::create_container($GLOBALS["STEAM"]->get_id(), basename($container_path), $container_environment, $description))) {
            output("Error: could not create container: '" . $container_path . "'.\n");
            return FALSE;
        }
        output("Created container: '" . $container_path . "'.\n");
    }
    return $container;
}
开发者ID:rolwi,项目名称:koala,代码行数:19,代码来源:setup.php

示例15: frameResponse

 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     if (isset($this->id)) {
         $object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
         if ($object instanceof \steam_document) {
             $mimetype = $object->get_attribute(DOC_MIME_TYPE);
             $objName = $object->get_name();
             $objDesc = trim($object->get_attribute(OBJ_DESC));
             if ($objDesc === 0 || $objDesc === "") {
                 $name = $objName;
             } else {
                 $name = $objDesc . " (" . $objName . ")";
             }
             $actionBar = new \Widgets\ActionBar();
             if ($mimetype == "text/html") {
                 $actionBar->setActions(array(array("name" => "Anzeigen", "link" => PATH_URL . "Explorer/ViewDocument/" . $this->id . "/"), array("name" => "Quelltext", "link" => PATH_URL . "Explorer/CodeEditDocument/" . $this->id . "/"), array("name" => "Eigenschaften", "ajax" => array("onclick" => array("command" => "properties", "params" => array("id" => $this->id), "requestType" => "popup"))), array("name" => "Rechte", "ajax" => array("onclick" => array("command" => "Sanctions", "params" => array("id" => $this->id), "requestType" => "popup")))));
             } else {
                 $actionBar->setActions(array(array("name" => "Anzeigen", "link" => PATH_URL . "Explorer/ViewDocument/" . $this->id . "/"), array("name" => "Eigenschaften", "ajax" => array("onclick" => array("command" => "properties", "params" => array("id" => $this->id), "requestType" => "popup"))), array("name" => "Rechte", "ajax" => array("onclick" => array("command" => "Sanctions", "params" => array("id" => $this->id), "requestType" => "popup")))));
             }
             $contentText = new \Widgets\Textarea();
             $contentText->setWidth(945);
             $contentText->setheight(400);
             $contentText->setData($object);
             $contentText->setTextareaClass("mce-full");
             if ($mimetype !== "text/html") {
                 $contentText->setTextareaClass("plain");
             }
             $html = cleanHTML($object->get_content());
             $dirname = dirname($object->get_path()) . "/";
             preg_match_all('/src="([%a-z0-9.\\-_\\/]*)"/iU', $html, $matches);
             $orig_matches = $matches[0];
             $path_matches = $matches[1];
             foreach ($path_matches as $key => $path) {
                 $path = urldecode($path);
                 if (parse_url($path, PHP_URL_SCHEME) != null) {
                     continue;
                 }
                 $ref_object = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $dirname . $path);
                 if ($ref_object instanceof \steam_object) {
                     $new_path = PATH_URL . "Download/Document/" . $ref_object->get_id();
                 } else {
                     $new_path = PATH_URL . "styles/standard/images/404.jpg";
                 }
                 $html = str_replace($orig_matches[$key], "src=\"{$new_path}\" data-mce-src=\"{$path}\"", $html);
             }
             $contentText->setContentProvider(\Widgets\DataProvider::contentProvider($html));
             $clearer = new \Widgets\Clearer();
             // 				$html = "";
             // 				if ($mimetype == "image/png" || $mimetype == "image/jpeg" || $mimetype == "image/gif") {  // Image
             // 					$html = "<div style=\"text-align:center\"><img style=\"max-width:100%\" title=\"{$name}\" alt=\"Bild: {$name}\" src=\"" . PATH_URL . "Download/Document/" . $this->id . "/\"></div>";
             // 				} else if ($mimetype == "text/html") {
             // 					$html = strip_tags($object->get_content(),"<h1><h2><h3><h4><h5><p><a><div><style><b><i><strong><img>");
             // 				} else if (strstr($mimetype, "text")) {
             // 					$html = "<pre>{$object->get_content()}</pre>";
             // 				} else {
             // 					header("location: " . PATH_URL . "Download/Document/" . $this->id . "/");
             // 				}
             // 				$rawHtml = new \Widgets\RawHtml();
             // 				$rawHtml->setHtml($html);
             //$rawHtml->addWidget($breadcrumb);
             //$rawHtml->addWidget($environment);
             //$rawHtml->addWidget($loader);
             $frameResponseObject->setTitle($name);
             $frameResponseObject->addWidget($actionBar);
             //$frameResponseObject->addWidget($rawHtml);
             $frameResponseObject->addWidget($contentText);
             $frameResponseObject->addWidget($clearer);
             return $frameResponseObject;
         }
     } else {
         ExtensionMaster::getInstance()->send404Error();
     }
 }
开发者ID:rolwi,项目名称:koala,代码行数:73,代码来源:EditDocument.class.php


注:本文中的steam_factory::get_object_by_name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。