Class ilBuddySystemGUI.
More...
◆ __construct()
ilBuddySystemGUI::__construct |
( |
| ) |
|
◆ executeCommand()
ilBuddySystemGUI::executeCommand |
( |
| ) |
|
- Exceptions
-
Definition at line 93 of file class.ilBuddySystemGUI.php.
References user().
95 if ($this->
user->isAnonymous()) {
96 throw new RuntimeException(
'This controller only accepts requests of logged in users');
99 $nextClass = $this->ctrl->getNextClass($this);
100 $cmd = $this->ctrl->getCmd();
102 switch ($nextClass) {
◆ ignoreCommand()
ilBuddySystemGUI::ignoreCommand |
( |
| ) |
|
|
private |
◆ initializeFrontend()
- Parameters
-
Definition at line 59 of file class.ilBuddySystemGUI.php.
References $config, $DIC, ilGlobalTemplateInterface\addOnLoadCode(), and ilBuddySystem\getInstance().
Referenced by ilGlobalPageTemplate\prepareBasicJS().
65 !$DIC->user()->isAnonymous() &&
66 !self::$isFrontendInitialized
68 $DIC->language()->loadLanguageModule(
'buddysystem');
70 $page->addJavascript(
'./Services/Contact/BuddySystem/js/buddy_system.js');
73 $config->http_post_url = $DIC->ctrl()->getFormActionByClass([
74 'ilUIPluginRouterGUI',
76 ],
'',
'',
true,
false);
77 $config->transition_state_cmd =
'transitionAsync';
80 $btn_config =
new stdClass();
81 $btn_config->bnt_class =
'ilBuddySystemLinkWidget';
83 $page->
addOnLoadCode(
"il.BuddySystemButton.setConfig(" . json_encode($btn_config) .
");");
86 self::$isFrontendInitialized =
true;
addOnLoadCode($a_code, $a_batch=2)
Add on load code.
◆ isRequestParameterGiven()
ilBuddySystemGUI::isRequestParameterGiven |
( |
string |
$key, |
|
|
int |
$type |
|
) |
| |
|
protected |
◆ linkCommand()
ilBuddySystemGUI::linkCommand |
( |
| ) |
|
|
private |
◆ redirectToReferer()
ilBuddySystemGUI::redirectToReferer |
( |
| ) |
|
|
private |
Definition at line 273 of file class.ilBuddySystemGUI.php.
References ILIAS\FileDelivery\http().
Referenced by transitionCommand().
275 if (isset($this->
http->request()->getServerParams()[
'HTTP_REFERER'])) {
276 $redirectUrl = $this->
http->request()->getServerParams()[
'HTTP_REFERER'];
277 $urlParts = parse_url($redirectUrl);
279 if (isset($urlParts[
'path'])) {
280 $script = basename($urlParts[
'path'],
'.php');
281 if ($script ===
'login') {
282 $this->ctrl->returnToParent($this);
284 $redirectUrl = ltrim(basename($urlParts[
'path']),
'/');
285 if (isset($urlParts[
'query'])) {
286 $redirectUrl .=
'?' . $urlParts[
'query'];
291 if ($redirectUrl !==
'') {
292 $this->ctrl->redirectToURL($redirectUrl);
296 $this->ctrl->returnToParent($this);
static http()
Fetches the global http state from ILIAS.
◆ requestCommand()
ilBuddySystemGUI::requestCommand |
( |
| ) |
|
|
private |
◆ transitionAsyncCommand()
ilBuddySystemGUI::transitionAsyncCommand |
( |
| ) |
|
|
private |
Performs a state transition based on the request action.
Definition at line 204 of file class.ilBuddySystemGUI.php.
References $_POST, Vendor\Package\$e, $response, ilObjUser\_isAnonymous(), ilObjUser\_lookupLogin(), ilObjUser\_lookupPref(), exit, ilUtil\stripSlashes(), and ilUtil\yn2tf().
206 if (!$this->ctrl->isAsynch()) {
210 if (!isset(
$_POST[
'usr_id']) || !is_numeric(
$_POST[
'usr_id'])) {
214 if (!isset(
$_POST[
'action']) || !strlen(
$_POST[
'action'])) {
222 $usr_id = (int)
$_POST[
'usr_id'];
227 "You cannot perform a state transition for the anonymous user (id: %s)",
234 "You cannot perform a state transition for a non existing user (id: %s)",
239 $relation = $this->buddyList->getRelationByUserId($usr_id);
243 $relation->isUnlinked() &&
246 throw new ilException(
"The requested user does not want to get contact requests");
250 $this->buddyList->{$action}($relation);
257 $response->message = $this->lng->txt(
'buddy_bs_action_not_possible');
260 $response->state = get_class($relation->getState());
261 $response->state_html = $this->stateFactory->getStateButtonRendererByOwnerAndRelation(
262 $this->buddyList->getOwnerId(),
266 $response->message = $this->lng->txt(
'buddy_bs_action_not_possible');
static _lookupLogin($a_user_id)
lookup login
Class ilBuddySystemException.
Class ilBuddySystemRelationStateTransitionException.
Class ilBuddySystemRelationStateAlreadyGivenException.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static _isAnonymous($usr_id)
static _lookupPref($a_usr_id, $a_keyword)
static yn2tf($a_yn)
convert "y"/"n" to true/false
◆ transitionCommand()
ilBuddySystemGUI::transitionCommand |
( |
string |
$cmd, |
|
|
string |
$positiveFeedbackLanguageId, |
|
|
callable |
$onBeforeExecute = null |
|
) |
| |
|
private |
- Parameters
-
string | $cmd | |
string | $positiveFeedbackLanguageId | |
callable | null | $onBeforeExecute | |
Definition at line 165 of file class.ilBuddySystemGUI.php.
References $_GET, Vendor\Package\$e, ilObjUser\_lookupLogin(), ilBuddyList\getInstanceByGlobalUser(), isRequestParameterGiven(), redirectToReferer(), and ilUtil\sendInfo().
Referenced by ignoreCommand(), linkCommand(), and requestCommand().
172 $this->ctrl->returnToParent($this);
178 if (null !== $onBeforeExecute) {
179 $onBeforeExecute($relation);
183 ilUtil::sendSuccess($this->lng->txt($positiveFeedbackLanguageId),
true);
186 $this->lng->txt($e->getMessage()),
191 $this->lng->txt($e->getMessage()),
static _lookupLogin($a_user_id)
lookup login
static getInstanceByGlobalUser()
Class ilBuddySystemRelationStateTransitionException.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Class ilBuddySystemRelationStateAlreadyGivenException.
isRequestParameterGiven(string $key, int $type)
◆ $buddyList
ilBuddySystemGUI::$buddyList |
|
protected |
◆ $ctrl
◆ $http
◆ $isFrontendInitialized
ilBuddySystemGUI::$isFrontendInitialized = false |
|
staticprotected |
◆ $lng
◆ $stateFactory
ilBuddySystemGUI::$stateFactory |
|
protected |
◆ $user
◆ BS_REQUEST_HTTP_GET
const ilBuddySystemGUI::BS_REQUEST_HTTP_GET = 1 |
◆ BS_REQUEST_HTTP_POST
const ilBuddySystemGUI::BS_REQUEST_HTTP_POST = 2 |
The documentation for this class was generated from the following file: