public function getRelativePathExMailDirectory()
 {
     switch ($this->getStorageType()) {
         case self::STORAGE_DATA:
             $path = ilUtil::getDataDir();
             break;
         case self::STORAGE_WEB:
             $path = ilUtil::getWebspaceDir();
             break;
     }
     $path = ilUtil::removeTrailingPathSeparators($path);
     $path .= '/';
     // Append path prefix
     $path .= $this->getPathPrefix() . '/';
     return str_replace($path, '', $this->getAbsolutePath());
 }
 function getTestOutput($active_id, $pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE)
 {
     $userdata = $this->object->getActiveUserData($active_id);
     // generate the question output
     include_once "./Services/UICore/classes/class.ilTemplate.php";
     $template = new ilTemplate("tpl.il_as_qpl_javaapplet_question_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
     $template->setCurrentBlock("appletparam");
     $template->setVariable("PARAM_NAME", "test_type");
     include_once "./Modules/Test/classes/class.ilObjTest.php";
     if (ilObjTest::_lookupAnonymity(ilObjTest::_getObjectIDFromTestID($userdata["test_id"]))) {
         $template->setVariable("PARAM_VALUE", "0");
     } else {
         $template->setVariable("PARAM_VALUE", "1");
     }
     $template->parseCurrentBlock();
     $template->setCurrentBlock("appletparam");
     $template->setVariable("PARAM_NAME", "active_id");
     $template->setVariable("PARAM_VALUE", $active_id);
     $template->parseCurrentBlock();
     $template->setCurrentBlock("appletparam");
     $template->setVariable("PARAM_NAME", "test_id");
     $template->setVariable("PARAM_VALUE", $userdata["test_id"]);
     $template->parseCurrentBlock();
     $template->setCurrentBlock("appletparam");
     $template->setVariable("PARAM_NAME", "question_id");
     $template->setVariable("PARAM_VALUE", $this->object->getId());
     $template->parseCurrentBlock();
     $template->setCurrentBlock("appletparam");
     $template->setVariable("PARAM_NAME", "user_id");
     $template->setVariable("PARAM_VALUE", $userdata["user_id"]);
     $template->parseCurrentBlock();
     $template->setCurrentBlock("appletparam");
     $template->setVariable("PARAM_NAME", "points_max");
     $template->setVariable("PARAM_VALUE", $this->object->getPoints());
     $template->parseCurrentBlock();
     $template->setCurrentBlock("appletparam");
     $template->setVariable("PARAM_NAME", "session_id");
     $template->setVariable("PARAM_VALUE", $_COOKIE["PHPSESSID"]);
     $template->parseCurrentBlock();
     $template->setCurrentBlock("appletparam");
     $template->setVariable("PARAM_NAME", "client");
     $template->setVariable("PARAM_VALUE", CLIENT_ID);
     $template->parseCurrentBlock();
     $template->setCurrentBlock("appletparam");
     $template->setVariable("PARAM_NAME", "pass");
     $actualpass = ilObjTest::_getPass($active_id);
     $template->setVariable("PARAM_VALUE", $actualpass);
     $template->parseCurrentBlock();
     $template->setCurrentBlock("appletparam");
     $template->setVariable("PARAM_NAME", "post_url");
     $template->setVariable("PARAM_VALUE", ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH) . "/Modules/TestQuestionPool/save_question_post_data.php");
     $template->parseCurrentBlock();
     // additional parameters
     for ($i = 0; $i < $this->object->getParameterCount(); $i++) {
         $parameter = $this->object->getParameter($i);
         $template->setCurrentBlock("appletparam");
         $template->setVariable("PARAM_NAME", $parameter["name"]);
         $template->setVariable("PARAM_VALUE", $parameter["value"]);
         $template->parseCurrentBlock();
     }
     if ($active_id) {
         $solutions = NULL;
         include_once "./Modules/Test/classes/class.ilObjTest.php";
         if (!ilObjTest::_getUsePreviousAnswers($active_id, true)) {
             if (is_null($pass)) {
                 $pass = ilObjTest::_getPass($active_id);
             }
         }
         $info = $this->object->getReachedInformation($active_id, $pass);
         foreach ($info as $kk => $infodata) {
             $template->setCurrentBlock("appletparam");
             $template->setVariable("PARAM_NAME", "value_" . $infodata["order"] . "_1");
             $template->setVariable("PARAM_VALUE", $infodata["value1"]);
             $template->parseCurrentBlock();
             $template->setCurrentBlock("appletparam");
             $template->setVariable("PARAM_NAME", "value_" . $infodata["order"] . "_2");
             $template->setVariable("PARAM_VALUE", $infodata["value2"]);
             $template->parseCurrentBlock();
         }
         include_once './Services/Administration/classes/class.ilSetting.php';
         $soapSetting = new ilSetting();
         if ($soapSetting->get("soap_user_administration") == 1) {
             $template->setCurrentBlock("appletparam");
             $template->setVariable("PARAM_NAME", "server");
             $template->setVariable("PARAM_VALUE", ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH) . "/webservice/soap/server.php");
         }
     }
     $questiontext = $this->object->getQuestion();
     $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
     $template->setVariable("APPLET_WIDTH", $this->object->getJavaWidth());
     $template->setVariable("APPLET_HEIGHT", $this->object->getJavaHeight());
     $template->setVariable("APPLET_CODE", $this->object->getJavaCode());
     if (strlen($this->object->getJavaArchive()) > 0) {
         $template->setVariable("APPLET_ARCHIVE", " archive=\"" . $this->object->getJavaArchive() . "\"");
     } else {
         if (strpos($this->object->getJavaAppletFilename(), ".jar") !== FALSE) {
             $template->setVariable("APPLET_ARCHIVE", " archive=\"" . $this->object->getJavaPathWeb() . $this->object->getJavaAppletFilename() . "\"");
         }
     }
     if (strlen($this->object->getJavaCodebase()) > 0) {
         $template->setVariable("APPLET_CODEBASE", " codebase=\"" . $this->object->getJavaCodebase() . "\"");
     } else {
         if (strpos($this->object->getJavaAppletFilename(), ".class") !== FALSE) {
             $template->setVariable("APPLET_CODEBASE", " codebase=\"" . $this->object->getJavaPathWeb() . "\"");
         }
     }
     $questionoutput = $template->get();
     $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
     return $pageoutput;
 }
 /**
  * Returns the web path of the background image thumbnail
  *
  * @return string The web path of the background image thumbnail
  */
 public static function getBackgroundImageThumbPathWeb()
 {
     include_once "./Services/Utilities/classes/class.ilUtil.php";
     return str_replace(ilUtil::removeTrailingPathSeparators(ILIAS_ABSOLUTE_PATH), ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH), ilObjCertificateSettingsAccess::getBackgroundImageThumbPath());
 }
Example #4
0
 /**
 * Returns the web image path for web accessable images of a test
 * The image path is under the web accessable data dir in assessment/REFERENCE_ID_OF_TEST/images
 *
 * @access public
 */
 function getImagePathWeb()
 {
     include_once "./Services/Utilities/classes/class.ilUtil.php";
     $webdir = ilUtil::removeTrailingPathSeparators(CLIENT_WEB_DIR) . "/assessment/" . $this->getId() . "/images/";
     return str_replace(ilUtil::removeTrailingPathSeparators(ILIAS_ABSOLUTE_PATH), ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH), $webdir);
 }
Example #5
0
 /**
  * Gets the absolute file path for preview images that contains a placeholder
  * in the file name ('%02d') to be formatted with the preview number (use 'sprintf' for that).
  * 
  * @return string The format of the absolute file path.
  */
 public function getFilePathFormat()
 {
     $path = ilUtil::removeTrailingPathSeparators($this->getAbsoluteStoragePath());
     return $path . "/" . self::FILENAME_FORMAT;
 }
 /**
  * builds http path
  */
 protected static function buildHTTPPath()
 {
     include_once './Services/Http/classes/class.ilHTTPS.php';
     $https = new ilHTTPS();
     if ($https->isDetected()) {
         $protocol = 'https://';
     } else {
         // START PATCH CPKN HTTPS
         $protocol = 'https://';
         //$protocol = 'http://';
         // END PATCH CPKN HTTPS
     }
     $host = $_SERVER['HTTP_HOST'];
     $rq_uri = $_SERVER['REQUEST_URI'];
     // security fix: this failed, if the URI contained "?" and following "/"
     // -> we remove everything after "?"
     if (is_int($pos = strpos($rq_uri, "?"))) {
         $rq_uri = substr($rq_uri, 0, $pos);
     }
     if (!defined('ILIAS_MODULE')) {
         $path = pathinfo($rq_uri);
         if (!$path['extension']) {
             $uri = $rq_uri;
         } else {
             $uri = dirname($rq_uri);
         }
     } else {
         // if in module remove module name from HTTP_PATH
         $path = dirname($rq_uri);
         // dirname cuts the last directory from a directory path e.g content/classes return content
         $module = ilUtil::removeTrailingPathSeparators(ILIAS_MODULE);
         $dirs = explode('/', $module);
         $uri = $path;
         foreach ($dirs as $dir) {
             $uri = dirname($uri);
         }
     }
     return define('ILIAS_HTTP_PATH', ilUtil::removeTrailingPathSeparators($protocol . $host . $uri));
 }
 /**
  * builds http path if no client is available
  *
  * @return string
  */
 public static function buildHTTPPath()
 {
     if ($_SERVER["HTTPS"] == "on") {
         $protocol = 'https://';
     } else {
         $protocol = 'http://';
     }
     $host = $_SERVER['HTTP_HOST'];
     $path = dirname($_SERVER['REQUEST_URI']);
     //dirname cuts the last directory from a directory path e.g content/classes return content
     include_once 'Services/Utilities/classes/class.ilUtil.php';
     $module = ilUtil::removeTrailingPathSeparators(ILIAS_MODULE);
     $dirs = explode('/', $module);
     $uri = $path;
     foreach ($dirs as $dir) {
         $uri = dirname($uri);
     }
     return ilUtil::removeTrailingPathSeparators($protocol . $host . $uri);
 }
Example #8
0
 /**
  * Returns the filesystem path for file uploads
  */
 protected function getPreviewFileUploadPathWeb($userId)
 {
     include_once "./Services/Utilities/classes/class.ilUtil.php";
     $webdir = ilUtil::removeTrailingPathSeparators(CLIENT_WEB_DIR) . "/assessment/qst_preview/{$userId}/{$this->getId()}/fileuploads/";
     return str_replace(ilUtil::removeTrailingPathSeparators(ILIAS_ABSOLUTE_PATH), ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH), $webdir);
 }
 function getTestOutput($active_id, $pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE, $show_feedback = FALSE)
 {
     // generate the question output
     $template = new ilTemplate("tpl.il_as_qpl_flash_question_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
     $params = array();
     if (is_array($this->object->getParameters())) {
         foreach ($this->object->getParameters() as $name => $value) {
             array_push($params, urlencode($name) . "=" . urlencode($value));
         }
     }
     array_push($params, "session_id=" . urlencode($_COOKIE["PHPSESSID"]));
     array_push($params, "client=" . urlencode(CLIENT_ID));
     array_push($params, "points_max=" . urlencode($this->object->getPoints()));
     array_push($params, "server=" . urlencode(ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH) . "/webservice/soap/server.php?wsdl"));
     if (strlen($pass)) {
         array_push($params, "pass="******"./Modules/Test/classes/class.ilObjTest.php";
         array_push($params, "pass="******"active_id=" . $active_id);
     }
     array_push($params, "question_id=" . $this->object->getId());
     if (count($params)) {
         $template->setCurrentBlock("flash_vars");
         $template->setVariable("FLASH_VARS", join($params, "&"));
         $template->parseCurrentBlock();
         $template->setCurrentBlock("applet_parameters");
         $template->setVariable("PARAM_VALUE", join($params, "&"));
         $template->parseCurrentBlock();
     }
     $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
     $template->setVariable("APPLET_WIDTH", $this->object->getWidth());
     $template->setVariable("APPLET_HEIGHT", $this->object->getHeight());
     $template->setVariable("ID", $this->object->getId());
     $template->setVariable("APPLET_PATH", $this->object->getFlashPathWeb() . $this->object->getApplet());
     $template->setVariable("APPLET_FILE", $this->object->getFlashPathWeb() . $this->object->getApplet());
     $questionoutput = $template->get();
     $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
     return $pageoutput;
 }
Example #10
0
 function _getInternalLinkHref($target = "", $a_parent_ref_id = null)
 {
     global $ilDB;
     $linktypes = array("lm" => "LearningModule", "pg" => "PageObject", "st" => "StructureObject", "git" => "GlossaryItem", "mob" => "MediaObject");
     $href = "";
     if (preg_match("/il__(\\w+)_(\\d+)/", $target, $matches)) {
         $type = $matches[1];
         $target_id = $matches[2];
         include_once "./Services/Utilities/classes/class.ilUtil.php";
         switch ($linktypes[$matches[1]]) {
             case "LearningModule":
                 $href = ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH) . "/goto.php?target=" . $type . "_" . $target_id;
                 break;
             case "PageObject":
             case "StructureObject":
                 $href = ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH) . "/goto.php?target=" . $type . "_" . $target_id;
                 break;
             case "GlossaryItem":
                 $href = ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH) . "/goto.php?target=" . $type . "_" . $target_id;
                 break;
             case "MediaObject":
                 $href = ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH) . "/ilias.php?baseClass=ilLMPresentationGUI&obj_type=" . $linktypes[$type] . "&cmd=media&ref_id=" . $a_parent_ref_id . "&mob_id=" . $target_id;
                 break;
         }
     }
     return $href;
 }
Example #11
0
 /**
  * Returns the web path of the background image thumbnail
  *
  * @return string The web path of the background image thumbnail
  */
 public function getBackgroundImageThumbPathWeb()
 {
     // TODO: this is generic now -> provide better solution
     include_once "./Services/Utilities/classes/class.ilUtil.php";
     return str_replace(ilUtil::removeTrailingPathSeparators(ILIAS_ABSOLUTE_PATH), ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH), $this->getBackgroundImageThumbPath());
 }
 /**
  * Returns the file upload path for web accessible files of a question
  *
  * @access public
  */
 function getFileUploadPathWeb($test_id, $active_id, $question_id = null)
 {
     if (is_null($question_id)) {
         $question_id = $this->getId();
     }
     include_once "./Services/Utilities/classes/class.ilUtil.php";
     $webdir = ilUtil::removeTrailingPathSeparators(CLIENT_WEB_DIR) . "/assessment/tst_{$test_id}/{$active_id}/{$question_id}/files/";
     return str_replace(ilUtil::removeTrailingPathSeparators(ILIAS_ABSOLUTE_PATH), ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH), $webdir);
 }
 /**
  * Read path info
  *
  * @access private
  */
 protected function init()
 {
     switch ($this->storage_type) {
         case self::STORAGE_DATA:
             $this->path = ilUtil::getDataDir();
             break;
         case self::STORAGE_WEB:
             $this->path = ilUtil::getWebspaceDir();
             break;
         case self::STORAGE_SECURED:
             $this->path = ilUtil::getWebspaceDir();
             $this->path = ilUtil::removeTrailingPathSeparators($this->path);
             $this->path .= '/' . self::SECURED_DIRECTORY;
             break;
     }
     $this->path = ilUtil::removeTrailingPathSeparators($this->path);
     $this->path .= '/';
     // Append path prefix
     $this->path .= $this->getPathPrefix() . '/';
     if ($this->path_conversion) {
         $this->path .= self::_createPathFromId($this->container_id, $this->getPathPostfix());
     } else {
         $this->path .= $this->getPathPostfix() . '_' . $this->container_id;
     }
     return true;
 }
 /**
  * Get direct link to group managment
  */
 public function getGroupFolderLink()
 {
     $group_url = str_replace('services', '', $this->getServerUrl());
     $group_url = ilUtil::removeTrailingPathSeparators($group_url);
     return $group_url . '/user/cms/groupfolder.htm';
 }