本文整理匯總了PHP中JAXResponse類的典型用法代碼示例。如果您正苦於以下問題:PHP JAXResponse類的具體用法?PHP JAXResponse怎麽用?PHP JAXResponse使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了JAXResponse類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: aclAjaxBlock
function aclAjaxBlock($msg)
{
$objResponse = new JAXResponse();
$title = XiptText::_('CC PROFILE VIDEO');
$objResponse->addScriptCall('cWindowShow', '', $title, 430, 80);
return parent::aclAjaxBlock($msg, $objResponse);
}
示例2: ajaxAddFeatured
public function ajaxAddFeatured($memberId)
{
$filter = JFilterInput::getInstance();
$memberId = $filter->clean($memberId, 'int');
$objResponse = new JAXResponse();
CFactory::load('helpers', 'owner');
$my = CFactory::getUser();
if ($my->id == 0) {
return $this->ajaxBlockUnregister();
}
if (COwnerHelper::isCommunityAdmin()) {
$model = CFactory::getModel('Featured');
if (!$model->isExists(FEATURED_USERS, $memberId)) {
CFactory::load('libraries', 'featured');
$featured = new CFeatured(FEATURED_USERS);
$member = CFactory::getUser($memberId);
$featured->add($memberId, $my->id);
$html = JText::sprintf('COM_COMMUNITY_MEMBER_IS_FEATURED', $member->getDisplayName());
} else {
$html = JText::_('COM_COMMUNITY_USER_ALREADY_FEATURED');
}
} else {
$html = JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_ACCESS_SECTION');
}
$actions = '<input type="button" class="button" onclick="window.location.reload();" value="' . JText::_('COM_COMMUNITY_BUTTON_CLOSE_BUTTON') . '"/>';
$objResponse->addScriptCall('cWindowAddContent', $html, $actions);
$this->cacheClean(array(COMMUNITY_CACHE_TAG_FEATURED));
return $objResponse->sendResponse();
}
示例3: render
public function render()
{
// When dispatch() is called from JApplication,
// the rendered content is immediately stored
// in the component buffer, so instead of rerendering
// our component, we'll extract it out from the buffer.
$this->content = $this->_buffer['component'][''];
unset($this->_buffer);
// and send the document back within jax response.
$objResponse = new JAXResponse();
$objResponse->addScriptCall('__callback', $this);
return $objResponse->sendResponse();
}
示例4: ajaxResetPrivacy
public function ajaxResetPrivacy($photoPrivacy = 0, $profilePrivacy = 0, $friendsPrivacy = 0)
{
$response = new JAXResponse();
CFactory::load('helpers', 'owner');
if (!COwnerHelper::isCommunityAdmin()) {
$response->addScriptCall(JText::_('COM_COMMUNITY_NOT_ALLOWED'));
return $response->sendResponse();
}
$model = $this->getModel('Configuration');
$model->updatePrivacy($photoPrivacy, $profilePrivacy, $friendsPrivacy);
$response->addAssign('privacy-update-result', 'innerHTML', JText::_('COM_COMMUNITY_FRONTPAGE_ALL_PRIVACY_RESET'));
return $response->sendResponse();
}
示例5: ajaxSendMessage
public function ajaxSendMessage($title, $message, $limit = 1)
{
if (!$title || !$message) {
$response = new JAXResponse();
$response->addScriptCall("joms.jQuery('#error').remove();");
$response->addScriptCall('joms.jQuery("#messaging-form").prepend("<p id=error style=color:red>Error:Title or Message cannot be empty</p>");');
return $response->sendResponse();
}
$limitstart = $limit - 1;
$model =& $this->getModel('users');
$userId = $model->getSiteUsers($limitstart, 1);
$response = new JAXResponse();
$response->addScriptCall('joms.jQuery("#messaging-form").hide();');
$response->addScriptCall('joms.jQuery("#messaging-result").show();');
$user = CFactory::getUser($userId);
$my =& JFactory::getUser();
if (!empty($userId)) {
require_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'notification.php';
CNotificationLibrary::add('etype_system_messaging', $my->id, $user->id, $title, $message);
$response->addScriptCall('joms.jQuery("#no-progress").css("display","none");');
$response->addScriptCall('joms.jQuery("#progress-status").append("<div>' . JText::sprintf('Sending message to <strong>%1$s</strong>', str_replace(array("\r", "\n"), ' ', $user->getDisplayname())) . '<span style=\\"color: green;margin-left: 5px;\\">' . JText::_('COM_COMMUNITY_SUCCESS') . '</span></div>");');
$response->addScriptCall('sendMessage', $title, $message, $limit + 1);
} else {
$response->addScriptCall('joms.jQuery("#progress-status").append("<div style=\\"font-weight:700;\\">' . JText::_('COM_COMMUNITY_UPDATED') . '</div>");');
}
return $response->sendResponse();
}
示例6: ajaxEmailPage
public function ajaxEmailPage($uri, $emails, $message = '')
{
$filter = JFilterInput::getInstance();
$uri = $filter->clean($uri, 'string');
$emails = $filter->clean($emails, 'string');
$message = $filter->clean($message, 'string');
$message = stripslashes($message);
$mainframe =& JFactory::getApplication();
$bookmarks = CFactory::getBookmarks($uri);
$mailqModel = CFactory::getModel('mailq');
$config = CFactory::getConfig();
$response = new JAXResponse();
if (empty($emails)) {
$content = '<div>' . JText::_('COM_COMMUNITY_SHARE_INVALID_EMAIL') . '</div>';
$actions = '<input type="button" class="button" onclick="joms.bookmarks.show(\'' . $uri . '\');" value="' . JText::_('COM_COMMUNITY_GO_BACK_BUTTON') . '"/>';
} else {
$emails = explode(',', $emails);
$errors = array();
// Add notification
CFactory::load('libraries', 'notification');
foreach ($emails as $email) {
$email = JString::trim($email);
CFactory::load('helpers', 'validate');
if (!empty($email) && CValidateHelper::email($email)) {
$params = new CParameter('');
$params->set('uri', $uri);
$params->set('message', $message);
CNotificationLibrary::add('etype_system_bookmarks_email', '', $email, JText::sprintf('COM_COMMUNITY_SHARE_EMAIL_SUBJECT', $config->get('sitename')), '', 'bookmarks', $params);
} else {
// If there is errors with email, inform the user.
$errors[] = $email;
}
}
if ($errors) {
$content = '<div>' . JText::_('COM_COMMUNITY_EMAILS_ARE_INVALID') . '</div>';
foreach ($errors as $error) {
$content .= '<div style="font-weight:700;color: red;">' . $error . '</span>';
}
$actions = '<input type="button" class="button" onclick="joms.bookmarks.show(\'' . $uri . '\');" value="' . JText::_('COM_COMMUNITY_GO_BACK_BUTTON') . '"/>';
} else {
$content = '<div>' . JText::_('COM_COMMUNITY_EMAIL_SENT_TO_RECIPIENTS') . '</div>';
$actions = '<input type="button" class="button" onclick="cWindowHide();" value="' . JText::_('COM_COMMUNITY_DONE_BUTTON') . '"/>';
}
}
$response->addAssign('cwin_logo', 'innerHTML', JText::_('COM_COMMUNITY_SHARE_THIS'));
$response->addScriptCall('cWindowAddContent', $content, $actions);
return $response->sendResponse();
}
示例7: ajaxTogglePublish
function ajaxTogglePublish($id, $type)
{
$user =& JFactory::getUser();
// @rule: Disallow guests.
if ($user->get('guest')) {
JError::raiseError(403, JText::_('CC ACCESS FORBIDDEN'));
return;
}
$response = new JAXResponse();
// Load the JTable Object.
$row =& JTable::getInstance('MultiProfile', 'CTable');
$row->load($id);
$row->publish($row->id, (int) (!$row->published));
$row->load($id);
$image = $row->published ? 'publish_x.png' : 'tick.png';
$view =& $this->getView('multiprofile', 'html');
$html = $view->getPublish($row, 'published', 'multiprofile,ajaxTogglePublish');
$response->addAssign($type . $id, 'innerHTML', $html);
return $response->sendResponse();
}
示例8: ajaxAddFeatured
public function ajaxAddFeatured($memberId)
{
$objResponse = new JAXResponse();
CFactory::load('helpers', 'owner');
$my = CFactory::getUser();
if ($my->id == 0) {
return $this->ajaxBlockUnregister();
}
if (COwnerHelper::isCommunityAdmin()) {
$model = CFactory::getModel('Featured');
if (!$model->isExists(FEATURED_USERS, $memberId)) {
CFactory::load('libraries', 'featured');
$featured = new CFeatured(FEATURED_USERS);
$member = CFactory::getUser($memberId);
$featured->add($memberId, $my->id);
$objResponse->addAssign('cWindowContent', 'innerHTML', JText::sprintf('CC MEMBER IS FEATURED', $member->getDisplayName()));
} else {
$objResponse->addAssign('cWindowContent', 'innerHTML', JText::_('CC USER ALREADY FEATURED'));
}
} else {
$objResponse->addAssign('cWindowContent', 'innerHTML', JText::_('CC NOT ALLOWED TO ACCESS SECTION'));
}
$buttons = '<input type="button" class="button" onclick="window.location.reload();" value="' . JText::_('CC BUTTON CLOSE') . '"/>';
$objResponse->addScriptCall('cWindowActions', $buttons);
return $objResponse->sendResponse();
}
示例9: ajaxPerformAction
/**
* Ajax functiion to handle ajax calls
*/
public function ajaxPerformAction($actionId, $ignore = 0)
{
$objResponse = new JAXResponse();
$output = '';
// Require Jomsocial core lib
require_once JPATH_ROOT . '/components/com_community/libraries/core.php';
$language = JFactory::getLanguage();
$language->load('com_community', JPATH_ROOT);
// Get the action data
$action = JTable::getInstance('ReportsActions', 'CommunityTable');
$action->load($actionId);
// Get the report data
$report = JTable::getInstance('Reports', 'CommunityTable');
$report->load($action->reportid);
$actions = '<input type="button" class="btn btn-inverse btn-mini pull-left" onclick="cWindowHide(); location.reload();" value="' . JText::_('COM_COMMUNITY_CLOSE') . '"/>';
if ($ignore != 0) {
$report->status = 2;
$report->store();
$output = JText::_('COM_COMMUNITY_REPORTS_IGNORED_MESSAGE');
$objResponse->addAssign('cWindowContent', 'innerHTML', $output);
$objResponse->addScriptCall('cWindowActions', $actions);
return $objResponse->sendResponse();
}
$method = explode(',', $action->method);
$args = explode(',', $action->parameters);
if (is_array($method) && $method[0] != 'plugins') {
$controller = JString::strtolower($method[0]);
require_once JPATH_ROOT . '/components/com_community/controllers/controller.php';
require_once JPATH_ROOT . '/components/com_community/controllers/' . $controller . '.php';
$controller = JString::ucfirst($controller);
$controller = 'Community' . $controller . 'Controller';
$controller = new $controller();
$output = call_user_func_array(array(&$controller, $method[1]), $args);
} else {
if (is_array($method) && $method[0] == 'plugins') {
// Application method calls
$element = JString::strtolower($method[1]);
require_once CPluginHelper::getPluginPath('community', $element) . '/' . $element . '.php';
$className = 'plgCommunity' . JString::ucfirst($element);
$output = call_user_func_array(array($className, $method[2]), $args);
}
}
$objResponse->addAssign('cWindowContent', 'innerHTML', $output);
$objResponse->addScriptCall('cWindowActions', $actions);
if ($report->status == 1) {
$report->status = 0;
} else {
$report->status = 1;
}
$report->store();
return $objResponse->sendResponse();
}
示例10: ajaxEditRelations
function ajaxEditRelations($listing_id, $cat_id = '', $single_select = 0)
{
$objResponse = new JAXResponse();
if (is_numeric($listing_id)) {
JRequest::setVar('listing_id', $listing_id);
}
if ($cat_id) {
JRequest::setVar('cat', $cat_id);
}
if ($single_select) {
JRequest::setVar('ss', $single_select);
}
JRequest::setVar('view', 'edit');
JFactory::getDocument()->setType('html');
ob_start();
$this->display();
$html = ob_get_contents();
ob_end_clean();
$objResponse->addAssign('cWindowContent', 'innerHTML', $html);
$objResponse->addScriptCall('cWindowResize', 395);
$objResponse->addScriptCall('_initEditRelations', $listing_id, $cat_id, $single_select);
return $objResponse->sendResponse();
}
示例11: ajaxShowSaveForm
public function ajaxShowSaveForm()
{
CFactory::load('helpers', 'owner');
require_once JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_menus' . DS . 'helpers' . DS . 'helper.php';
if (!COwnerHelper::isCommunityAdmin()) {
echo JText::_('CC RESTRICTED ACCESS');
return;
}
$response = new JAXResponse();
$args = func_get_args();
if (!isset($args[0])) {
$response->addScriptCall('alert', 'CC INVALID ID');
return $resopnse->sendResponse();
}
$condition = $args[0];
array_shift($args);
$avatarOnly = $args[0];
array_shift($args);
$filters = $args;
$menuTypes = MenusHelper::getMenuTypeList();
$menuAccess = new stdClass();
$menuAccess->access = 0;
$tmpl = new CTemplate();
$tmpl->set('condition', $condition);
$tmpl->set('menuTypes', $menuTypes);
$tmpl->set('menuAccess', $menuAccess);
$tmpl->set('avatarOnly', $avatarOnly);
$tmpl->set('filters', $filters);
$html = $tmpl->fetch('ajax.memberlistform');
$response->addAssign('cwin_logo', 'innerHTML', JText::_('CC SEARCH FILTER'));
$response->addAssign('cWindowContent', 'innerHTML', $html);
$action = '<button class="button" onclick="cWindowHide();">' . JText::_('CC BUTTON CANCEL') . '</button>';
$action .= '<button class="button" onclick="joms.memberlist.submit();">' . JText::_('CC BUTTON SAVE') . '</button>';
$response->addScriptCall('cWindowActions', $action);
return $response->sendResponse();
}
示例12: ajaxSaveTemplateFile
function ajaxSaveTemplateFile($templateName, $fileName, $fileData, $override)
{
$response = new JAXResponse();
$filePath = COMMUNITY_BASE_PATH . DS . 'templates' . DS . JString::strtolower($templateName) . DS . JString::strtolower($fileName);
if ($override) {
$filePath = JPATH_ROOT . DS . 'templates' . DS . JString::strtolower($templateName) . DS . 'html' . DS . 'com_community' . DS . JString::strtolower($fileName);
}
jimport('joomla.filesystem.file');
if (JFile::write($filePath, $fileData)) {
$response->addScriptCall('joms.jQuery("#status").html("' . JText::sprintf('%1$s saved successfully.', $fileName) . '");');
$response->addScriptCall('joms.jQuery("#status").attr("class","info");');
} else {
$response->addScriptCall('alert', JText::_('CC ERROR WHILE SAVING FILE PLEASE CHECK PERMISSIONS OF FILE'));
}
return $response->sendResponse();
}
示例13: ajaxResetNotification
public function ajaxResetNotification($params)
{
$response = new JAXResponse();
if (!COwnerHelper::isCommunityAdmin()) {
$response->addAssign('notification-update-result', 'innerHTML', JText::_('COM_COMMUNITY_NOT_ALLOWED'));
return $response->sendResponse();
}
$model = $this->getModel('Configuration');
$model->updateNotification($params);
$response->addAssign('notification-update-result', 'innerHTML', JText::_('COM_COMMUNITY_FRONTPAGE_ALL_NOTIFICATION_RESET'));
$response->addScriptCall("joms.jQuery('#notification-update-result').parent().find('input').val('" . JText::_('COM_COMMUNITY_CONFIGURATION_PRIVACY_RESET_EXISTING_NOTIFICATION_BUTTON') . "');");
return $response->sendResponse();
}
示例14: ajaxSendMessage
function ajaxSendMessage($title, $message, $limit = 1)
{
$limitstart = $limit - 1;
$model =& $this->getModel('users');
$userId = $model->getSiteUsers($limitstart, 1);
$response = new JAXResponse();
$response->addScriptCall('joms.jQuery("#messaging-form").hide();');
$response->addScriptCall('joms.jQuery("#messaging-result").show();');
$user = CFactory::getUser($userId);
$my =& JFactory::getUser();
if (!empty($userId)) {
require_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'notification.php';
CNotificationLibrary::add('system.messaging', $my->id, $user->id, $title, $message);
$response->addScriptCall('joms.jQuery("#no-progress").css("display","none");');
$response->addScriptCall('joms.jQuery("#progress-status").append("<div>' . JText::sprintf('Sending message to <strong>%1$s</strong>', $user->getDisplayname()) . '<span style=\\"color: green;margin-left: 5px;\\">' . JText::_('CC SUCCESS') . '</span></div>");');
$response->addScriptCall('sendMessage', $title, $message, $limit + 1);
} else {
$response->addScriptCall('joms.jQuery("#progress-status").append("<div style=\\"font-weight:700;\\">' . JText::_('CC UPDATE COMPLETED') . '</div>");');
}
return $response->sendResponse();
}
示例15: ajaxGetAddressFromCoords
/**
*
* @param type $coords
*/
public function ajaxGetAddressFromCoords($coords)
{
$objResponse = new JAXResponse();
$model = CFactory::getModel('activities');
$user = CFactory::getUser();
$locations = $model->getUserVisitedLocation($user->id);
$address = array();
/**
* Get address from array of coors
*/
$coords = array_filter($coords);
foreach ($coords as $coord) {
if (isset($coord[0]) && isset($coords[1])) {
/* Get address from coords */
$geoAddress = $this->_getAddressFromCoord($coord[0], $coord[1]);
if ($geoAddress) {
/* Store array of address */
$address[] = array('lat' => $coord[0], 'lng' => $coord[1], 'name' => $geoAddress->formatted_address);
}
}
}
/**
* Get address from database
*/
if ($locations) {
foreach ($locations as $location) {
$address[] = array('lat' => $location->latitude, 'lng' => $location->longitude, 'name' => $location->location);
}
}
/**
* These address will use for auto complete
*/
$address = array_filter($address);
$objResponse->addScriptCall('joms.location.updateAddress', $address);
/**
* Do update init location
* @todo We'll need find out which address is better for init
*/
$objResponse->addScriptCall('joms.sharebox.location.initLocation', $address[0]['name'], $address[0]['lat'], $address[0]['lng']);
/* */
$objResponse->sendResponse($locations);
}