/** * @param type $commune_id * @param type $subscr_value * @param type $mode * @param bool $fromCommune Если вызов из сообщества * * @return \xajaxResponse */ function SubscribeCommune($commune_id, $subscr_value, $mode = false, $fromCommune = false) { session_start(); if (!isset($_SESSION['uid'])) { return; } $cm = new commune(); $comm = $cm->getCommune($commune_id, $_SESSION['uid']); $objResponse = new xajaxResponse(); $res = commune::setCommuneSubscription($commune_id, $_SESSION['uid'], (bool) $subscr_value); if ($fromCommune) { $html = __commPrntSubmitButtonFromCommune($comm, $_SESSION['uid'], NULL, $mode); } else { $html = __commPrntSubmitButton($comm, $_SESSION['uid'], NULL, $mode); } $objResponse->assign('commSubscrButton_' . $commune_id, 'innerHTML', $html); return $objResponse; }