本文整理汇总了PHP中steam_factory::path_to_object方法的典型用法代码示例。如果您正苦于以下问题:PHP steam_factory::path_to_object方法的具体用法?PHP steam_factory::path_to_object怎么用?PHP steam_factory::path_to_object使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类steam_factory
的用法示例。
在下文中一共展示了steam_factory::path_to_object方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
示例2: get_courses_units_boxes
function get_courses_units_boxes()
{
$room_path = $this->request['attribute'];
$room = steam_factory::path_to_object($GLOBALS["STEAM"]->get_id(), $room_path, 0);
$webparts = $room->get_attribute("box_sort_order");
if (is_string($webparts)) {
echo json_encode(unserialize($webparts));
}
}
示例3: image_render_callback
function image_render_callback($matches)
{
if (stristr($matches[1], "http://") || stristr($matches[1], "https://")) {
return $matches[0];
}
$ret = "";
$hits = array();
$t = preg_match("/.*thumb:([0-9]+)+x([0-9]+)+.*/", $matches[1], $hits);
if ($t) {
$width = $hits[1];
$height = $hits[2];
} else {
$width = -1;
$height = -1;
}
preg_match('/src="(.*?)"/', $matches[1], $title);
$wiki_path = StaticCallbackParameterBuffer::get_parameter("wiki_path");
$path = dirname($wiki_path) . '/' . $title[1];
$obj = steam_factory::path_to_object($GLOBALS["STEAM"]->get_id(), $path);
if (is_object($obj)) {
$content = $obj->get_content();
$image = imagecreatefromstring($content);
$width = imagesx($image);
$height = imagesy($image);
if ($width > 770) {
$height = (int) ($height * 770 / $width);
$width = 770;
}
$ret = '<img src="' . PATH_URL . 'get_document.php?id=' . $obj->get_id() . '&width=' . $width . '&height=' . $height . '" ';
$ret .= 'alt="' . $obj->get_attribute('OBJ_DESC') . '" ';
$ret .= 'title="' . $obj->get_attribute('OBJ_DESC') . '" ';
$ret .= '/>';
} else {
$ret = '<div class="Missing_Image">' . str_replace('%IMAGE%', $title[1], gettext('Image <br> "%IMAGE%" <br> no longer available')) . '</div>';
}
return $ret;
}
示例4: _get_texthtml
/**
* Get text content with all links in src="..." and href="..." set to the adequat link according to the bid system
* @access private
**/
function _get_texthtml($config_webserver_ip, $content)
{
//get current path
$current_path = substr($this->object->get_path(), 0, strrpos($this->object->get_path(), "/")) . "/";
//initiate variables
$html_org = eregi_replace("<head>", '<head><base target="_top">', $content);
$html = $html_org;
$url_org = array();
$url_new = array();
$url_map = array("src" => $config_webserver_ip . "/tools/get.php?object=", "data" => $config_webserver_ip . "/tools/get.php?object=", "code" => $config_webserver_ip . "/tools/get.php?object=", "link href" => $config_webserver_ip . "/tools/get.php?object=", "href" => $config_webserver_ip . "/index.php?object=", "action" => $config_webserver_ip . "/index.php?object=");
//work through the whole html sourcecode until no href="..." or src="..." are left
$transaction_key = 0;
// hack
while ($tag_open = strpos($html, '<') !== false) {
$tag_close = strpos($html, '>', $tag_open);
//get html entity
$entity = substr($html, $tag_open, $tag_close - $tag_open + 1);
//save entity that has a href or src in it
if (eregi("(^link href|^href|^src|^action|^data|^code)*(link href|href|src|action|data|code)=[\"\\']([^\"^\\']*)", $entity, $regs)) {
$scheme = $regs[2];
$url = $regs[3];
$split = parse_url($url);
//only derive path if its a relative link
if (!isset($split["scheme"]) && isset($split["path"])) {
$path = $this->_real_path($current_path . $split["path"]);
$transaction[$transaction_key] = steam_factory::path_to_object($this->steam->get_id(), $path);
//only save data if its a new one
if (!isset($url_org[$entity])) {
$url_org[$entity] = $entity;
$url_id[] = array("transaction" => $transaction[$transaction_key], "entity" => $entity, "scheme" => $scheme, "url" => $url);
}
$transaction_key++;
}
}
//get html from the tag_close on to make sure the while stops sometime
$html = substr($html, $tag_close);
}
if (!isset($url_id)) {
return $html_org;
}
//build array for string replacment
foreach ($url_id as $key => $data) {
$object = $transaction[$key];
// hack
//if there is a valid object for that path build replace array field
if (is_object($object)) {
$path = $url_map[strtolower($data["scheme"])] . $object->get_id();
$url_new[] = str_replace($data["url"], $path, $data["entity"]);
} else {
unset($url_org[$data["entity"]]);
unset($url_id[$key]);
}
}
//replace all links in html sourcecode
$new_html = str_replace($url_org, $url_new, $html_org);
if (mb_detect_encoding($new_html, 'UTF-8, ISO-8859-1') !== 'UTF-8') {
$new_html = utf8_encode($new_html);
}
return $new_html;
}
示例5: lms_user
<?php
require_once "../../etc/koala.conf.php";
echo "**************** reset sync script ****************" . $newline;
try {
echo "check root access to server";
$steam_user = new lms_user(STEAM_ROOT_LOGIN, STEAM_ROOT_PW);
//TODO: use phpsteam here. this fails if wrong login data for root
$steam_user->login();
echo "\t\t\t\t\t\t\t\t\t[OK]" . $newline;
echo "reset lock flag";
$paulsync_folder = steam_factory::path_to_object($GLOBALS["STEAM"]->get_id(), "/home/root/documents/paulsync");
if (is_object($paulsync_folder)) {
$paulsync_folder->set_attribute("PAUL_SYNC_RUNNING", "FALSE");
echo "\t\t\t\t\t\t\t\t\t\t\t[OK]" . $newline;
} else {
echo "\t\t\t\t\t\t[FAIL]" . $newline;
echo "--> ERROR: is server should not be synced with paul" . $newline;
}
} catch (Exception $e) {
echo "\t\t\t\t\t\t[FAIL]" . $newline;
echo "--> ERROR: failed to connect to steam:" . $ex->getMessage() . $newline;
}
exit;
示例6: get_object_by_name
/**
* function get_object_by_name:
*
* Alias for public static function path_to_object
*
* @param steam_connector $pSteamConnector connection to sTeam-Server
* @param string $pPath Full path to object
* @return steam_object an instance of the object
*/
public static function get_object_by_name($pSteamConnectorID, $pPath, $pBuffer = 0)
{
if (!is_string($pSteamConnectorID)) {
throw new ParameterException("pSteamConnectorID", "string");
}
return steam_factory::path_to_object($pSteamConnectorID, $pPath, $pBuffer);
}
示例7: json_encode
<?php
include_once "../../etc/koala.conf.php";
$portal = lms_portal::get_instance();
$portal->initialize(GUEST_NOT_ALLOWED);
if (isset($_REQUEST["node"])) {
$objects = steam_factory::path_to_object($GLOBALS['STEAM']->get_id(), $_REQUEST["node"])->get_inventory();
} else {
$objects = $GLOBALS['STEAM']->get_current_steam_user()->get_workroom()->get_inventory();
}
$result = array();
foreach ($objects as $object) {
if ($object instanceof steam_container) {
$leaf = false;
} else {
$leaf = true;
}
$result[] = array("text" => $object->get_name(), "leaf" => $leaf, "id" => $object->get_path());
}
echo json_encode($result);
示例8: get_exam_cert_preview
function get_exam_cert_preview()
{
$cert_preview_path = $this->container_try[$this->current_try]->get_path() . "/zertifikat_preview.jpg";
$cert_preview = steam_factory::path_to_object($GLOBALS["STEAM"]->get_id(), $cert_preview_path);
if (!is_object($cert_preview) || is_object($cert_preview) && !$cert_preview instanceof steam_document) {
$cert_preview = steam_factory::create_document($GLOBALS["STEAM"]->get_id(), "zertifikat_preview.jpg", "", "image/jpeg", $this->container_try[$this->current_try]);
$elearning_course = elearning_mediathek::get_elearning_course_for_course($this->course_group);
$cert_preview->set_attribute("OBJ_DESC", "Zertifikat-Vorschau der Schulung \"" . $elearning_course->get_name() . "\"");
$cert_preview->set_attribute("OBJ_TYPE", "elearning_course_cert_perview");
}
return $cert_preview;
}
示例9: Exception
if (!$course->is_admin($user)) {
throw new Exception("No course admin!", E_ACCESS);
}
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["values"])) {
$values = $_POST["values"];
// ABFRAGEN
$problems = "";
$hints = "";
if (!is_object($GLOBALS["STEAM"]->get_module("package:routeplan"))) {
$problems = "The required package 'package:routeplan' was not found on the sTeam server. Please install the required package to be able to use the routeplaner.";
} else {
$unit_xsl = steam_factory::path_to_object($GLOBALS["STEAM"]->get_id(), "/styles/routeplan/routeplan.xsl");
if (!is_object($unit_xsl)) {
$problems = "The required file '/styles/routeplan/routeplan.xsl' was not found on the sTeam server. Please make sure that the routeplan package was installed properly in order to be able to use the routeplan.";
}
$content_xsl = steam_factory::path_to_object($GLOBALS["STEAM"]->get_id(), "/stylesheets/content.xsl");
if (!is_object($content_xsl)) {
$problems = "The required file '/stylesheets/content.xsl' was not found on the sTeam server. Please make sure that the webinterface package was installed properly in order to be able to use the routeplan.";
}
}
if (!$values["name"] || !$values["project_name"] || !$values["startgate_name"] || !$values["endgate_name"]) {
$problems .= gettext("One of the required fields is missing.");
}
$hints .= gettext("Please provide a name for the unit, a name for the projekt and names for startgate and endgate.");
if (empty($problems)) {
$all_users = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), STEAM_ALL_USER);
$staff = $course->steam_group_staff;
$learners = $course->steam_group_learners;
if (!isset($unit)) {
$env = $course->get_workroom();
$new_unit = steam_factory::create_room($GLOBALS["STEAM"]->get_id(), $values["name"], $env, $values["dsc"]);
示例10: substr
****************************************************************************/
require_once "./config/config.php";
require_once "{$steamapi_doc_root}/steam_connector.class.php";
require_once "./classes/template.inc";
// require_once("./classes/debugHelper.php");
require_once "./includes/sessiondata.php";
if (isset($_SERVER["REQUEST_URI"]) || $_SERVER["REQUEST_URI"] != "") {
$path = $_SERVER["REQUEST_URI"] == "index.html" ? "" : substr($_SERVER["REQUEST_URI"], strlen($pre_tmp));
if ($path == "" && (!isset($login_name) || $login_name == "" || !isset($login_pwd) || $login_pwd == "")) {
header("Location: {$config_webserver_ip}/index.html" . $object->get_id());
exit;
}
//******************************************************
//** sTeam Stuff
//******************************************************
//login und $steam def. in "./includes/login.php"
$steam = new steam_connector($config_server_ip, $config_server_port, $login_name, $login_pwd);
if (!$steam || !$steam->get_login_status()) {
header("Location: {$config_webserver_ip}/index.html");
exit;
}
$object = steam_factory::path_to_object($steam, $path);
//Logout & Disconnect
$steam->disconnect();
//compute request
if ($object) {
header("Location: {$config_webserver_ip}/index.php?object=" . $object->get_id());
exit;
}
}
header("HTTP/1.0 404 Not Found");
示例11: array
$wi_version = $GLOBALS["STEAM"]->predefined_command($webinterface, "get_version", array(), 0);
} else {
$wi_version = "not installed";
}
$steam_version = $GLOBALS["STEAM"]->get_server_version();
$pike_version = $GLOBALS["STEAM"]->get_pike_version();
$koala_support = $GLOBALS["STEAM"]->get_module("package:koala_support");
if (is_object($koala_support)) {
$koala_support_version = $GLOBALS["STEAM"]->predefined_command($koala_support, "get_version", array(), 0);
} else {
$koala_support_version = gettext("not installed");
}
$content->setVariable("LABEL_VERSION_INFORMATION", gettext("Version information"));
$loglevel = array(0 => "None", 1 => "Error", 2 => "Warning", 3 => "Debug");
$connector = $GLOBALS["STEAM"];
$admin_pike = steam_factory::path_to_object($connector->get_id(), "/scripts/admin.pike");
$tnr = array();
$logmodule = $connector->get_module("log");
$xmlconvertermodule = $connector->get_module("Converter:XML");
$tnr_smtp = $connector->predefined_command($logmodule, "get_log_level", array("smtp"), TRUE);
$tnr_http = $connector->predefined_command($logmodule, "get_log_level", array("http"), TRUE);
$tnr_events = $connector->predefined_command($logmodule, "get_log_level", array("events"), TRUE);
$tnr_security = $connector->predefined_command($logmodule, "get_log_level", array("security"), TRUE);
$tnr_servertime = $connector->predefined_command($xmlconvertermodule, "gettime", array(), TRUE);
$result = $connector->buffer_flush();
$uptime = $result[$tnr_servertime] - $connector->get_last_reboot();
$content->setCurrentBlock("BLOCK_BLOCK");
$content->setVariable("LABEL_BLOCK", "sTeam Server Backend");
$content->setCurrentBlock("ENTRY");
$content->setVariable("LABEL", "Server Name");
$content->setVariable("VALUE", STEAM_SERVER);