Class ilBuddySystemGUI.
More...
◆ __construct()
ilBuddySystemGUI::__construct |
( |
| ) |
|
◆ executeCommand()
ilBuddySystemGUI::executeCommand |
( |
| ) |
|
- Exceptions
-
Definition at line 99 of file class.ilBuddySystemGUI.php.
References $cmd, and user().
101 if($this->
user->isAnonymous())
103 throw new RuntimeException(
'This controller only accepts requests of logged in users');
106 $next_class = $this->ctrl->getNextClass($this);
107 $cmd = $this->ctrl->getCmd();
◆ ignoreCommand()
ilBuddySystemGUI::ignoreCommand |
( |
| ) |
|
|
private |
◆ initializeFrontend()
static ilBuddySystemGUI::initializeFrontend |
( |
| ) |
|
|
static |
Definition at line 69 of file class.ilBuddySystemGUI.php.
References $config, $DIC, array, and ilJsonUtil\encode().
Referenced by ilBuddySystemLinkButton\getHtml(), and ilMainMenuGUI\populateWithBuddySystem().
73 if(!self::$frontend_initialized)
75 $DIC->language()->loadLanguageModule(
'buddysystem');
77 require_once
'Services/JSON/classes/class.ilJsonUtil.php';
79 $DIC[
'tpl']->addJavascript(
'./Services/Contact/BuddySystem/js/buddy_system.js');
82 $config->http_post_url = $DIC->ctrl()->getFormActionByClass(
array(
'ilUIPluginRouterGUI',
'ilBuddySystemGUI'),
'',
'',
true,
false);
83 $config->transition_state_cmd =
'transitionAsync';
86 $btn_config =
new stdClass();
87 $btn_config->bnt_class =
'ilBuddySystemLinkWidget';
89 $DIC[
'tpl']->addOnLoadCode(
"il.BuddySystemButton.setConfig(".
ilJsonUtil::encode($btn_config).
");");
90 $DIC[
'tpl']->addOnLoadCode(
"il.BuddySystemButton.init();");
92 self::$frontend_initialized =
true;
static encode($mixed, $suppress_native=false)
Create styles array
The data for the language used.
◆ isRequestParameterGiven()
ilBuddySystemGUI::isRequestParameterGiven |
( |
|
$key, |
|
|
|
$type |
|
) |
| |
|
protected |
◆ linkCommand()
ilBuddySystemGUI::linkCommand |
( |
| ) |
|
|
private |
◆ requestCommand()
ilBuddySystemGUI::requestCommand |
( |
| ) |
|
|
private |
◆ transitionAsyncCommand()
ilBuddySystemGUI::transitionAsyncCommand |
( |
| ) |
|
|
private |
Performs a state transition based on the request action.
Definition at line 213 of file class.ilBuddySystemGUI.php.
References $_POST, ilObjUser\_isAnonymous(), ilObjUser\_lookupLogin(), ilObjUser\_lookupPref(), exit, ilUtil\stripSlashes(), and ilUtil\yn2tf().
215 if(!$this->ctrl->isAsynch())
220 if(!isset(
$_POST[
'usr_id']) || !is_numeric(
$_POST[
'usr_id']))
225 if(!isset(
$_POST[
'action']) || !strlen(
$_POST[
'action']))
230 $response =
new stdClass();
231 $response->success =
false;
235 $usr_id = (int)
$_POST[
'usr_id'];
240 throw new ilBuddySystemException(sprintf(
"You cannot perform a state transition for the anonymous user (id: %s)", $usr_id));
245 throw new ilBuddySystemException(sprintf(
"You cannot perform a state transition for a non existing user (id: %s)", $usr_id));
248 $relation = $this->buddylist->getRelationByUserId($usr_id);
253 throw new ilException(
"The requested user does not want to get contact requests");
258 $this->buddylist->{$action}($relation);
259 $response->success =
true;
271 $response->message = $this->lng->txt(
'buddy_bs_action_not_possible');
274 $response->state = get_class($relation->getState());
275 $response->state_html = $this->statefactory->getRendererByOwnerAndRelation($this->buddylist->getOwnerId(), $relation)->getHtml();
279 $response->message = $this->lng->txt(
'buddy_bs_action_not_possible');
282 echo json_encode($response);
static _lookupLogin($a_user_id)
lookup login
Base class for ILIAS Exception handling.
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 |
( |
|
$cmd, |
|
|
|
$positive_feedback_lng_id, |
|
|
callable |
$onBeforeExecute = null |
|
) |
| |
|
private |
- Parameters
-
string | $cmd | |
string | $positive_feedback_lng_id | |
callable | null | $onBeforeExecute | |
Definition at line 172 of file class.ilBuddySystemGUI.php.
References $_GET, ilObjUser\_lookupLogin(), ilBuddyList\getInstanceByGlobalUser(), isRequestParameterGiven(), ilUtil\sendInfo(), and ilUtil\sendSuccess().
Referenced by ignoreCommand(), linkCommand(), and requestCommand().
177 $this->ctrl->returnToParent($this);
182 require_once
'Services/Contact/BuddySystem/classes/class.ilBuddyList.php';
185 if(null !== $onBeforeExecute)
187 $onBeforeExecute($relation);
207 $this->ctrl->returnToParent($this);
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static _lookupLogin($a_user_id)
lookup login
Base class for ILIAS Exception handling.
static getInstanceByGlobalUser()
isRequestParameterGiven($key, $type)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
◆ $buddylist
ilBuddySystemGUI::$buddylist |
|
protected |
◆ $ctrl
◆ $frontend_initialized
ilBuddySystemGUI::$frontend_initialized = 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: