本文整理汇总了PHP中lms_steam类的典型用法代码示例。如果您正苦于以下问题:PHP lms_steam类的具体用法?PHP lms_steam怎么用?PHP lms_steam使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了lms_steam类的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;
}
}
示例2: recommend_contact
function recommend_contact($receiver, $contact, $message)
{
$user = lms_steam::get_current_user();
$subject = str_replace("%NAME", $contact->get_attribute("USER_FIRSTNAME") . " " . $contact->get_attribute("USER_FULLNAME"), gettext("Recommendation of %NAME as contact"));
$message .= "\n\n--\n\n" . gettext("This message was created via the introduce contact function.") . " " . str_replace(array("%NAME1", "%NAME2"), array($user->get_attribute("USER_FIRSTNAME") . " " . $user->get_attribute("USER_FULLNAME"), $contact->get_attribute("USER_FIRSTNAME") . " " . $contact->get_attribute("USER_FULLNAME")), gettext("%NAME1 wants to recommend %NAME2 to you.")) . "\n\n" . gettext("Name") . ": " . $contact->get_attribute("USER_FIRSTNAME") . " " . $contact->get_attribute("USER_FULLNAME") . "\n" . gettext("Contact page") . ": " . PATH_URL . "user/" . $contact->get_name() . "/\n";
lms_steam::mail($receiver, $user, $subject, $message);
}
示例3: http_auth
function http_auth()
{
// Abfragen ob man bereits über das koaLA Interface eingeloggt ist
// Wenn ja, kein HTTP_AUTH notwendig
if (isset($_SESSION["LMS_USER"]) && $_SESSION["LMS_USER"] instanceof lms_user && $_SESSION["LMS_USER"]->is_logged_in()) {
$lms_user = $_SESSION["LMS_USER"];
lms_steam::connect(STEAM_SERVER, STEAM_PORT, $lms_user->get_login(), $lms_user->get_password());
return true;
} else {
// Wenn nicht, untenstehende checks durchführen
if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']) || $_SERVER['PHP_AUTH_USER'] === "" || $_SERVER['PHP_AUTH_PW'] === "") {
// User abort
header('WWW-Authenticate: Basic realm="koaLA"');
header('HTTP/1.0 401 Unauthorized');
return false;
} else {
// Correct Login
$lms_user_new = new lms_user($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
if (!$lms_user_new->login()) {
header('WWW-Authenticate: Basic realm="koaLA"');
header('HTTP/1.0 401 Unauthorized');
return false;
}
$_SESSION["LMS_USER"] = $lms_user_new;
return true;
}
}
}
示例4: createObject
public static function createObject($name, $description = "", $content = "", $mimeType = "application/x-msdownload", $artefactClass, $user = null)
{
self::init();
if ($user == null) {
$user = lms_steam::get_current_user();
}
$newArtefact = steam_factory::create_room($GLOBALS["STEAM"]->get_id(), $name, Artefacts::getArtefactsContainer($user), "Artefact: " + $name);
$newArtefact->set_attribute(PORTFOLIO_PREFIX . "TYPE", "ARTEFACT");
$newArtefact->set_attribute(PORTFOLIO_PREFIX . "ARTEFACTCLASS", $artefactClass);
$dataPresent = $content == "" ? false : true;
$newArtefact->set_attribute(PORTFOLIO_PREFIX . "DATAPRESENT", $dataPresent);
$newArtefact->set_attribute(PORTFOLIO_PREFIX . "LINKED_LOCATIONS", array());
$newArtefact->set_attribute("OBJ_TYPE", PORTFOLIO_PREFIX . "ARTEFACT");
if ($dataPresent) {
$data = steam_factory::create_document($GLOBALS["STEAM"]->get_id(), "data", $content, $mimeType, $newArtefact);
}
$newArtefactObject = Artefacts::getArtefactByRoom($newArtefact);
$newArtefactObject->checkActivity();
$newArtefactObject->checkCompetence();
//Create Forum
$newArtefactObject->createForum();
//create and assign groups
// $newArtefact->createGroups();
return $newArtefactObject;
}
示例5: get_link_path_internal
protected function get_link_path_internal($top_object)
{
$koala_creator = koala_object::get_koala_object(lms_steam::get_root_creator($this->steam_object));
$link_path = $koala_creator->get_link_path($top_object);
$link_path[] = array("name" => $this->get_display_name(), "link" => $koala_creator->get_url() . "units/" . $this->get_id() . "/", "koala_obj" => $this, "obj" => $this->steam_object);
return $link_path;
}
示例6: subscribe
public function subscribe($password = "", $message = "")
{
$user = lms_steam::get_current_user();
$group_name = $this->get_display_name();
if ($this->is_password_protected()) {
if ($this->check_group_pw($password)) {
$this->add_member($user, $password);
$result = array("succeeds" => TRUE, "confirmation" => str_replace("%GROUP", $group_name, str_replace("%GROUP", $this->get_name(), gettext("You have been added to '%GROUP'."))));
} else {
$result = array("succeeds" => FALSE, "problem" => gettext("Wrong password."), "hint" => gettext("If you want to join and do not know the password, please contact a group moderator."), "confirmation" => "");
}
} else {
if ($this->is_moderated()) {
$user = lms_steam::get_current_user();
$username = $user->get_full_name();
$this->add_membership_request($user);
$admins = $this->get_admins();
if (!is_array($admins)) {
$admins = array($admins);
}
$link = $this instanceof koala_group_course ? PATH_URL . SEMESTER_URL . "/" . $this->get_semester()->get_name() . "/" . $this->get_name() . "/requests/" : PATH_URL . "groups/" . $this->get_id() . "/requests/";
foreach ($admins as $admin) {
$adminname = $admin->get_full_name();
$mailbody = str_replace("%NAME", $adminname, gettext("Dear %NAME,")) . "\n\n" . str_replace(array("%NAME", "%GROUP"), array($username, $group_name), gettext("The user %NAME has requested membership for '%GROUP':")) . "\n\n<b>{$message}</b>\n\n" . gettext("Since you are a moderator for this group, you can affirm the membership or decline.") . "\n\n" . str_replace("%PAGE", "<a href=\"{$link}\">" . gettext("open membership requests") . "</a>", gettext("Please see %PAGE for further instructions."));
//$admin->mail( "LLMS: Membership Request" , $message, $user->get_attribute( "USER_EMAIL" ) );
lms_steam::mail($admin, $user, gettext("koaLA: Membership Request"), $mailbody);
}
$result = array("succeeds" => TRUE, "confirmation" => str_replace("%GROUP", $group_name, str_replace("%GROUP", $group_name, gettext("Membership request for '%GROUP' has been sent."))));
} else {
$this->add_member($user);
$result = array("succeeds" => TRUE, "confirmation" => str_replace("%GROUP", $group_name, gettext("You have been added to '%GROUP'.")));
}
}
return $result;
}
示例7: init
public static function init()
{
$user = lms_steam::get_current_user();
$workroom = $user->get_workroom();
$portfolio_main_room = steam_factory::create_room($GLOBALS["STEAM"]->get_id(), "portfolio", $workroom, "room for portfolio module");
$artefacts_room = steam_factory::create_room($GLOBALS["STEAM"]->get_id(), "artefacts", $portfolio_main_room, "room for artefacts for portfolios");
$portfolios_room = steam_factory::create_room($GLOBALS["STEAM"]->get_id(), "portfolios", $portfolio_main_room, "room for portfolios");
}
示例8: is_moderated
public function is_moderated()
{
if ($this->is_password_protected()) {
return FALSE;
}
$user = lms_steam::get_current_user();
return !$this->steam_object->check_access(SANCTION_INSERT, $user);
}
示例9: get_url
public function get_url()
{
if (lms_steam::get_current_user()->get_id() == $this->get_id()) {
return PATH_URL . "desktop/";
} else {
return PATH_URL . "user/" . $this->get_name() . "/";
}
}
示例10: __construct
public function __construct($steam_user)
{
$this->steam_user = $steam_user;
$profile_object = $steam_user->get_attribute("LLMS_NETWORKING_PROFILE");
if (!$profile_object instanceof steam_object && lms_steam::get_current_user()->get_id() != $steam_user->get_id()) {
throw new Exception("Networking profile not initialized", E_USER_NO_NETWORKINGPROFILE);
}
$this->profile_object = $profile_object;
}
示例11: get_display_name
function get_display_name()
{
$creator = $this->steam_object->get_creator();
if ($creator instanceof steam_user && $creator->get_id() == lms_steam::get_current_user()->get_id()) {
return gettext("Your workroom");
}
$koala_creator = koala_object::get_koala_object($creator);
return str_replace("%NAME", $koala_creator->get_display_name(), gettext("%NAME's workroom"));
}
示例12: ajaxResponse
public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
{
$ajaxResponseObject->setStatus("ok");
$user = \lms_steam::get_current_user();
$description = strip_tags($this->params["desc"]);
$name = strip_tags($this->params["name"]);
$newArtefact = \ArtefactCertificate::create($name, $description);
return parent::ajaxResponseNew($ajaxResponseObject, $newArtefact);
}
示例13: processData
public function processData(\IRequestObject $requestObject)
{
$params = $requestObject->getParams();
if (isset($params) && isset($params[0])) {
$this->user = \steam_factory::get_user($GLOBALS["STEAM"]->get_id(), $params[0]);
}
if (!isset($this->user) || !$this->user instanceof \steam_user) {
$this->user = \lms_steam::get_current_user();
}
}
示例14: __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());
}
示例15: get_context_menu
public function get_context_menu($context, $params = array())
{
$user = lms_steam::get_current_user();
$menu = array();
if ($this->steam_object->check_access_insert($user)) {
$menu[] = array("name" => gettext("Create folder"), "link" => $this->get_link_base() . "new-folder");
$menu[] = array("name" => gettext("Upload document"), "link" => PATH_URL . "upload.php?env=" . $this->get_id());
$menu[] = array("name" => gettext("Create Weblink"), "link" => PATH_URL . "docextern_create.php?env=" . $this->get_id());
}
return $menu;
}