protected function sendResponse() { global $linkList; $this->addResponseData('linkList', $linkList); $this->addResponseData('clearUri', current(explode('#', current(explode('?', $_SERVER['REQUEST_URI'], 2)), 2))); $categoryList = $this->repositoryFactory->getCategoryRepository()->query()->addSortField('order')->addSortField('title')->getEntity(); $this->addResponseData('categoryList', $categoryList); $this->addResponseData('cache_id', Params::get(Params::KEY_CACHE_ID, '1')); $this->addResponseData('userData', array('id' => $this->user->data()->id, 'login' => $this->user->data()->login, 'email' => $this->user->data()->email, 'role' => $this->user->data()->role)); parent::sendResponse(); }
/** * Постинг сообщения ВКонтакте * * @param $message Текст сообщения * @param array $attachments Массив вложений к сообщению */ protected function vkPostMessage($message, array $attachments) { /** * API syntax: * http://vk.com/dev/wall.post */ $result = $this->vkCallMethod("wall.post", array('message' => $message, 'attachments' => implode(',', $attachments), 'owner_id' => Params::get('vk_wallpost_owner_id'), 'friends_only' => Params::get('vk_wallpost_friends_only', 0), 'from_group' => Params::get('vk_wallpost_from_group', 1), 'signed' => Params::get('vk_wallpost_signed', 0), 'v' => 5.21)); if ($result !== false) { if (isset($result->response->post_id) && !empty($result->response->post_id)) { $this->addResponseMessage('Message posted to VK.COM successfully!'); } else { $this->setResponseCode(HttpResponseCode::INTERNAL_SERVER_ERROR); $this->addResponseMessage("Error occured on posting message to VK.COM!", self::MESS_ERROR); } } else { $this->setResponseCode(HttpResponseCode::INTERNAL_SERVER_ERROR); $this->addResponseMessage('Error occured when send request to VK.COM!', self::MESS_ERROR); } }