本文整理汇总了PHP中steam_factory::create_object方法的典型用法代码示例。如果您正苦于以下问题:PHP steam_factory::create_object方法的具体用法?PHP steam_factory::create_object怎么用?PHP steam_factory::create_object使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类steam_factory
的用法示例。
在下文中一共展示了steam_factory::create_object方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: initialize
public function initialize()
{
$profile_object = steam_factory::create_object($GLOBALS["STEAM"]->get_id(), "networking profile", CLASS_OBJECT);
$all_user = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), STEAM_ALL_USER);
$profile_object->set_sanction_all($all_user);
$guestbook = steam_factory::create_messageboard($GLOBALS["STEAM"]->get_id(), "guestbook", FALSE, "guestbook of " . $this->steam_user->get_attribute("USER_FIRSTNAME") . " " . $this->steam_user->get_attribute("USER_FULLNAME"));
$guestbook->set_read_access($all_user);
$guestbook->set_annotate_access($all_user, TRUE);
$profile_object->set_attribute("LLMS_GUESTBOOK", $guestbook);
$this->steam_user->set_attribute("LLMS_NETWORKING_PROFILE", $profile_object);
$this->profile_object = $profile_object;
}
示例3: create_user
/**
* function create_user:
*
* Creates a new user and returns its activation code
*
* Please keep in mind, that you will need extended rights
* to execute this function, that means a steam_connector
* with an administrator login.
*
* Suggestion: Divide the registration and activation
* process, if you want to be sure about the existence
* of the user's e-mail-address; send the activation-code
* via e-mail...
*
* Example for registration and activation:
* <code>
* $activation_code = steam_factory::create_user(
* $steam_con,
* "nbates",
* "mother",
* "norman@bates-motel.com",
* "Norman",
* "Bates",
* "english"
* );
* if ( $activation_code )
* {
* $new_user = steam_factory::username_to_object( "nbates" );
* $new_user->set_attributes(
* array(
* "country" => "United States",
* "occupation" => "motel keeper"
* )
* );
* if ( $new_user->activate( $activation_code ) )
* {
* print( "Bates, you can login now!" );
* }
* }
* else
* {
* print( "Login name exists. Choose another one." );
* }
* </code>
*
* @see steam_user->activate()
* @param steam_connector $pSteamConnector connection to sTeam-server, for creating new users you will need extended rights
* @param string $pLogin user's login name
* @param string $pPassword user's password
* @param string $pEMail user's email
* @param string $pFullname user's surname
* @param string $pFirstname user's firstname
* @param string $pLanguage user's prefered language (optional)
* @return string activation code; needed to activate this login
*/
public static function create_user($pSteamConnectorID, $pLogin, $pPassword, $pEMail, $pFullname, $pFirstname, $pLanguage = "english")
{
if (!is_string($pSteamConnectorID)) {
throw new ParameterException("pSteamConnectorID", "string");
}
$new_user = steam_factory::create_object($pSteamConnectorID, $pLogin, CLASS_USER, FALSE, array("name" => (string) $pLogin, "pw" => (string) $pPassword, "email" => (string) $pEMail, "fullname" => (string) $pFullname, "firstname" => (string) $pFirstname, "language" => (string) $pLanguage));
if ($new_user) {
$factories = steam_connector::get_instance($pSteamConnectorID)->get_login_data()->get_arguments();
$user_factory = $factories[9][CLASS_USER];
$activation_code = steam_connector::get_instance($pSteamConnectorID)->predefined_command($user_factory, "get_activation", array(), 0);
return $activation_code;
} else {
return FALSE;
}
}
示例4: gettext
if ($participants->get_id() !== $learners->get_id()) {
$pl = $participants->get_attribute("UNIT_POINTLIST");
if (is_object($pl)) {
$problems .= gettext("Cannot create Pointlist");
$hints .= str_replace("%TUTORIAL_NAME", $participants->get_name() . "(" . $participants->get_attribute(OBJ_DESC) . ")", str_replace("%UNIT_NAME", $pl->get_name(), gettext("The tutorial group '%TUTORIAL_NAME' is already linked with the pointlist unit '%UNIT_NAME'")));
}
}
if (empty($problems)) {
$env = $course->get_workroom();
$new_unit = steam_factory::create_room($GLOBALS["STEAM"]->get_id(), $values["name"], $env, $values["dsc"]);
$new_unit->set_attributes(array('UNIT_TYPE' => "units_pointlist", 'OBJ_TYPE' => "container_pointlist_unit_koala", 'UNIT_DISPLAY_TYPE' => gettext("Pointlist"), 'OBJ_LONG_DESC' => $values["long_dsc"], 'UNIT_POINTLIST_COUNT' => $count));
$participants->set_attribute("UNIT_POINTLIST", $new_unit);
if ($participants->get_id() !== $learners->get_id()) {
$new_unit->set_attribute("UNIT_POINTLIST_TUTORIALGROUP", $participants);
}
$proxy = steam_factory::create_object($GLOBALS["STEAM"]->get_id(), "Pointlist Proxy", CLASS_OBJECT, 0);
// Rechte an der Unit
$new_unit->set_sanction_all($staff);
$new_unit->sanction_meta(SANCTION_ALL, $staff);
$new_unit->set_sanction($participants, SANCTION_READ);
$new_unit->sanction_meta(0, $participants);
$new_unit->set_acquire(0);
// Rechte am Proxy
$proxy->set_attribute("UNIT_POINTLIST_MAXPOINTS", $maxpoints);
$proxy->set_sanction_all($staff);
$proxy->sanction_meta(SANCTION_ALL, $staff);
$proxy->set_sanction($participants, SANCTION_READ);
$proxy->sanction_meta(0, $participants);
$proxy->set_acquire(0);
$akt_unit->initialize_pointlist($values, $new_unit, $learners);
$new_unit->set_attribute('OBJ_TYPE', "container_pointlist_unit_kola");
示例5: state_to_binary
$binary_values["PRIVACY_LANGUAGES"] = state_to_binary($_POST["languages"]);
$binary_values["PRIVACY_CONTACTS"] = state_to_binary($_POST["contacts"]);
$binary_values["PRIVACY_GROUPS"] = state_to_binary($_POST["groups"]);
$binary_values["PRIVACY_EMAIL"] = state_to_binary($_POST["email"]);
$binary_values["PRIVACY_ADDRESS"] = state_to_binary($_POST["address"]);
$binary_values["PRIVACY_TELEPHONE"] = state_to_binary($_POST["telephone"]);
$binary_values["PRIVACY_PHONE_MOBILE"] = state_to_binary($_POST["phone_mobile"]);
$binary_values["PRIVACY_WEBSITE"] = state_to_binary($_POST["website"]);
$binary_values["PRIVACY_ICQ_NUMBER"] = state_to_binary($_POST["icq_number"]);
$binary_values["PRIVACY_MSN_IDENTIFICATION"] = state_to_binary($_POST["msn_identification"]);
$binary_values["PRIVACY_AIM_ALIAS"] = state_to_binary($_POST["aim_alias"]);
$binary_values["PRIVACY_YAHOO_ID"] = state_to_binary($_POST["yahoo_id"]);
$binary_values["PRIVACY_SKYPE_NAME"] = state_to_binary($_POST["skype_name"]);
$privacy_object = $user->get_attribute("KOALA_PRIVACY");
if (!$privacy_object instanceof steam_object) {
$privacy_object = steam_factory::create_object($GLOBALS["STEAM"]->get_id(), "privacy profile", CLASS_OBJECT);
if (!$privacy_object instanceof steam_object) {
throw new exception("Error creating Privacy-Proxy-Object", E_USER_NO_PRIVACYPROFILE);
}
$user->set_attribute("KOALA_PRIVACY", $privacy_object);
$privacy_object->set_acquire($user);
}
$privacy_object->set_attributes($binary_values);
/*
require_once( "Cache/Lite.php" );
$cache = new Cache_Lite( array( "cacheDir" => PATH_CACHE ) );
$cache->clean( $user->get_name() );
$cache->clean( $user->get_id() );
*/
$cache = get_cache_function(lms_steam::get_current_user()->get_name());
$cache->drop("lms_portal::get_menu_html", lms_steam::get_current_user()->get_name(), TRUE);
示例6: execute
public function execute(\FrameResponseObject $frameResponseObject)
{
//$portal = \lms_portal::get_instance();
//$portal->initialize( GUEST_NOT_ALLOWED );
//$portal->set_page_title( gettext( "Profile Privacy" ) );
$user = \lms_steam::get_current_user();
$cache = get_cache_function($user->get_name(), 86400);
$user_privacy = $cache->call("\\lms_steam::user_get_profile_privacy", $user->get_name(), TRUE);
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$binary_values = array();
$binary_values["PRIVACY_STATUS"] = $this->state_to_binary($_POST["status"]);
$binary_values["PRIVACY_GENDER"] = $this->state_to_binary($_POST["gender"]);
$binary_values["PRIVACY_FACULTY"] = $this->state_to_binary($_POST["faculty"]);
$binary_values["PRIVACY_MAIN_FOCUS"] = $this->state_to_binary($_POST["main_focus"]);
$binary_values["PRIVACY_WANTS"] = $this->state_to_binary($_POST["wants"]);
$binary_values["PRIVACY_HAVES"] = $this->state_to_binary($_POST["haves"]);
$binary_values["PRIVACY_ORGANIZATIONS"] = $this->state_to_binary($_POST["organizations"]);
$binary_values["PRIVACY_HOMETOWN"] = $this->state_to_binary($_POST["hometown"]);
$binary_values["PRIVACY_OTHER_INTERESTS"] = $this->state_to_binary($_POST["other_interests"]);
$binary_values["PRIVACY_LANGUAGES"] = $this->state_to_binary($_POST["languages"]);
$binary_values["PRIVACY_CONTACTS"] = $this->state_to_binary($_POST["contacts"]);
$binary_values["PRIVACY_GROUPS"] = $this->state_to_binary($_POST["groups"]);
$binary_values["PRIVACY_EMAIL"] = $this->state_to_binary($_POST["email"]);
$binary_values["PRIVACY_ADDRESS"] = $this->state_to_binary($_POST["address"]);
$binary_values["PRIVACY_TELEPHONE"] = $this->state_to_binary($_POST["telephone"]);
$binary_values["PRIVACY_PHONE_MOBILE"] = $this->state_to_binary($_POST["phone_mobile"]);
$binary_values["PRIVACY_WEBSITE"] = $this->state_to_binary($_POST["website"]);
$binary_values["PRIVACY_ICQ_NUMBER"] = $this->state_to_binary($_POST["icq_number"]);
$binary_values["PRIVACY_MSN_IDENTIFICATION"] = $this->state_to_binary($_POST["msn_identification"]);
$binary_values["PRIVACY_AIM_ALIAS"] = $this->state_to_binary($_POST["aim_alias"]);
$binary_values["PRIVACY_YAHOO_ID"] = $this->state_to_binary($_POST["yahoo_id"]);
$binary_values["PRIVACY_SKYPE_NAME"] = $this->state_to_binary($_POST["skype_name"]);
$privacy_object = $user->get_attribute("KOALA_PRIVACY");
if (!$privacy_object instanceof \steam_object) {
$privacy_object = \steam_factory::create_object($GLOBALS["STEAM"]->get_id(), "privacy profile", CLASS_OBJECT);
if (!$privacy_object instanceof \steam_object) {
throw new \Exception("Error creating Privacy-Proxy-Object", E_USER_NO_PRIVACYPROFILE);
}
$user->set_attribute("KOALA_PRIVACY", $privacy_object);
$privacy_object->set_acquire($user);
}
$privacy_object->set_attributes($binary_values);
/*
require_once( "Cache/Lite.php" );
$cache = new Cache_Lite( array( "cacheDir" => PATH_CACHE ) );
$cache->clean( $user->get_name() );
$cache->clean( $user->get_id() );
*/
$cache = get_cache_function(\lms_steam::get_current_user()->get_name());
$cache->drop("\\lms_portal::get_menu_html", \lms_steam::get_current_user()->get_name(), TRUE);
$cache = get_cache_function($user->get_name());
$cache->drop("\\lms_steam::user_get_profile_privacy", $user->get_name(), TRUE);
$_SESSION["confirmation"] = gettext("Your profile data has been saved.");
header("Location: " . PATH_URL . "profile/privacy/" . $user->get_name());
}
$content = \Profile::getInstance()->loadTemplate("profile_privacy.template.html");
//$content = new HTML_TEMPLATE_IT();
//$content->loadTemplateFile( PATH_TEMPLATES . "profile_privacy.template.html" );
if (ENABLED_CONTACTS_GROUPS_TITLE) {
$content->setVariable("HEADER_CONTACTS_AND_GROUPS", gettext("Contacts and Groups"));
}
if (ENABLED_CONTACTS_TITLE) {
$content->setVariable("HEADER_CONTACT_DATA", gettext("Contact Data"));
}
$content->setVariable("INFO_TEXT", gettext("Here you can set which persons can see what information on your profile page."));
$content->setVariable("LABEL_ALLUSERS", gettext("All Users"));
if (PLATFORM_ID == "bid") {
$content->setVariable("LABEL_CONTACTS", "Favoriten");
}
if (ENABLED_CONTACTS) {
//$labelContacts = gettext( "Contacts" );
if (ENABLED_PROFILE_TITLE) {
$content->setVariable("LABEL_CONTACTS", gettext("Contacts"));
}
}
//$content->setVariable( "LABEL_COURSEMATES", gettext( "Course Mates" ) );
//$content->setVariable( "LABEL_GROUPMATES", gettext( "Group Mates" ) );
if (ENABLED_STATUS) {
//$labelStatus = gettext("Status");
$content->setVariable("LABEL_STATUS", gettext("Status"));
}
if (ENABLED_BID_DESCIPTION) {
$content->setVariable("LABEL_STATUS", "Beschreibung");
}
if (ENABLED_GENDER) {
//$labelGender = gettext( "Gender" );
$content->setVariable("LABEL_GENDER", gettext("Gender"));
}
if (ENABLED_FACULTY) {
//$labelFaculty = gettext( "Origin" );
$content->setVariable("LABEL_FACULTY", gettext("Origin"));
}
if (ENABLED_MAIN_FOCUS) {
//$labelMainFocus = gettext( "Main focus" );
$content->setVariable("LABEL_MAIN_FOCUS", gettext("Main focus"));
}
if (ENABLED_WANTS) {
//$labelWants = gettext( "Wants" );
$content->setVariable("LABEL_WANTS", gettext("Wants"));
}
//.........这里部分代码省略.........