本文整理汇总了PHP中CUserPoints类的典型用法代码示例。如果您正苦于以下问题:PHP CUserPoints类的具体用法?PHP CUserPoints怎么用?PHP CUserPoints使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CUserPoints类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMembersData
function getMembersData(&$params)
{
$model = CFactory::getModel('user');
$db = JFactory::getDBO();
$limit = $params->get('count', '5');
$query = 'SELECT ' . $db->quoteName('userid') . ' FROM ' . $db->quoteName('#__community_users') . ' AS a ' . ' INNER JOIN ' . $db->quoteName('#__users') . ' AS b ON a.' . $db->quoteName('userid') . '=b.' . $db->quoteName('id') . ' WHERE ' . $db->quoteName('thumb') . '!=' . $db->Quote('components/com_community/assets/default_thumb.jpg') . ' ' . ' AND ' . $db->quoteName('block') . '=' . $db->Quote(0) . ' ' . ' ORDER BY ' . $db->quoteName('points') . ' DESC ' . ' LIMIT ' . $limit;
$db->setQuery($query);
$row = $db->loadObjectList();
if ($db->getErrorNum()) {
JError::raiseError(500, $db->stderr());
}
$_members = array();
if (!empty($row)) {
foreach ($row as $data) {
$user = CFactory::getUser($data->userid);
$_obj = new stdClass();
$_obj->id = $data->userid;
$_obj->name = $user->getDisplayName();
$_obj->avatar = $user->getThumbAvatar();
$CUserPoints = new CUserPoints();
$_obj->karma = $CUserPoints->getPointsImage($user);
$_obj->userpoints = $user->_points;
$_obj->link = CRoute::_('index.php?option=com_community&view=profile&userid=' . $data->userid);
$_members[] = $_obj;
}
}
return $_members;
}
示例2: deletegroupmembers
function deletegroupmembers($data)
{
require_once JPATH_SITE . '/components/com_community/libraries/core.php';
CFactory::load('libraries', 'apps');
$error_messages = array();
$success_messages = array();
$response = NULL;
$validated = true;
if ("" == $data['groupid'] || 0 == $data['groupid']) {
$validated = false;
$error_messages[] = array("id" => 1, "fieldname" => "groupid", "message" => "Groupid cannot be blank");
}
if (false == array_key_exists('memberids', $data) || 0 == sizeof($data['memberids'])) {
$validated = false;
$error_messages[] = array("id" => 1, "fieldname" => "memberids", "message" => "Memberids cannot be blank");
}
if (true == $validated) {
$model =& CFactory::getModel('groups');
$group =& JTable::getInstance('Group', 'CTable');
$group->id = $data['groupid'];
$group->ownerid = $data['ownerid'];
}
if ($data['ownerid'] == $data['memberids']) {
$validated = false;
$error_messages[] = array("id" => 1, "fieldname" => "ownerid/memberid", "message" => "owner id and member id are same.please update 'ownwrid or memberid' fields in request");
} else {
$groupMember =& JTable::getInstance('GroupMembers', 'CTable');
$memberId = $data['memberids'];
$groupId = $data['groupid'];
$groupMember->load($memberId, $groupId);
$data = new stdClass();
$data->groupid = $groupId;
$data->memberid = $memberId;
$data = new stdClass();
$data->groupid = $groupId;
$data->memberid = $memberId;
$model->removeMember($data);
$db =& JFactory::getDBO();
$query = 'SELECT COUNT(1) FROM ' . $db->nameQuote('#__community_groups_members') . ' ' . 'WHERE groupid=' . $db->Quote($groupId) . ' ' . 'AND approved=' . $db->Quote('1');
$db->setQuery($query);
$membercount = $db->loadResult();
$members = new stdClass();
$members->id = $groupId;
$members->membercount = $membercount;
$db->updateObject('#__community_groups', $members, 'id');
//add user points
CFactory::load('libraries', 'userpoints');
CUserPoints::assignPoint('group.member.remove', $memberId);
}
if (true == isset($error_messages) && 0 < sizeof($error_messages)) {
$res = array();
foreach ($error_messages as $key => $error_message) {
$res[] = $error_message;
}
$response = array("id" => 0, 'errors' => $res);
} else {
$response = array('id' => $memberId);
}
return $response;
}
示例3: removeFriend
/**
* remove friend
*/
public function removeFriend($friendid)
{
$mainframe =& JFactory::getApplication();
$model = CFactory::getModel('friends');
$my = CFactory::getUser();
$viewName = JRequest::getVar('view', '', 'GET');
$view = CFactory::getView($viewName);
if ($model->deleteFriend($my->id, $friendid)) {
// Substract the friend count
$model->updateFriendCount($my->id);
$model->updateFriendCount($friendid);
//add user points
// we deduct poinst to both parties
CFactory::load('libraries', 'userpoints');
CUserPoints::assignPoint('friends.remove');
CUserPoints::assignPoint('friends.remove', $friendid);
$friend = CFactory::getUser($friendId);
$view->addInfo(JText::sprintf('COM_COMMUNITY_FRIENDS_REMOVED', $friend->getDisplayName()));
//@todo notify friend after remove them from our friend list
//trigger for onFriendRemove
$eventObject = new stdClass();
$eventObject->profileOwnerId = $my->id;
$eventObject->friendId = $friendid;
$this->_triggerFriendEvents('onFriendRemove', $eventObject);
unset($eventObject);
} else {
$view->addinfo(JText::_('COM_COMMUNITY_FRIENDS_REMOVING_FRIEND_ERROR'));
}
}
示例4: deletewallpost
function deletewallpost($data)
{
require_once JPATH_SITE . '/components/com_community/libraries/core.php';
$error_messages = array();
$response = NULL;
$validated = true;
$db =& JFactory::getDBO();
if ($data['wall_id'] == "" || $data['wall_id'] == "0") {
$validated = false;
$error_messages[] = array("id" => 1, "fieldname" => "wallid", "message" => "Wall id cannot be blank");
}
//@rule: Check if user is really allowed to remove the current wall
$my = CFactory::getUser();
$model =& CFactory::getModel('wall');
$wall = $model->get($data['wall_id']);
$groupModel =& CFactory::getModel('groups');
$group =& JTable::getInstance('Group', 'CTable');
$group->load($wall->contentid);
$query = "SELECT contentid FROM #__community_wall WHERE id ='" . $data['wall_id'] . "' AND type = 'groups'";
$db->setQuery($query);
$contentid = $db->LoadResult();
CFactory::load('helpers', 'owner');
$query = "SELECT id FROM #__community_wall WHERE id ='" . $data['wall_id'] . "' AND type = 'groups'";
$db->setQuery($query);
$isdiscussion = $db->LoadResult();
if (!$isdiscussion) {
$error_messages[] = array("id" => 1, "fieldname" => "wallid", "message" => "wall id for type groups does not exists. Modify the wall_id field");
} else {
if (!$model->deletePost($data['wall_id'])) {
$validated = false;
//$error_messages[] = 'wall id does not exists. Modify the wall_id fields in request';
$error_messages[] = array("id" => 1, "fieldname" => "wallid", "message" => "wall id does not exists. Modify the wall_id field");
} else {
if ($wall->post_by != 0) {
//add user points
CFactory::load('libraries', 'userpoints');
CUserPoints::assignPoint('wall.remove', $wall->post_by);
}
}
//$groupModel->substractWallCount( $data['wall_id'] );
// Substract the count
$query = 'SELECT COUNT(*) FROM ' . $db->nameQuote('#__community_wall') . ' ' . 'WHERE contentid=' . $db->Quote($contentid) . ' ' . 'AND type="groups"';
$db->setQuery($query);
$wall_count = $db->loadResult();
$wallcount = new stdClass();
$wallcount->id = $contentid;
$wallcount->wallcount = $wall_count;
$db->updateObject('#__community_groups', $wallcount, 'id');
}
if (true == isset($error_messages) && 0 < sizeof($error_messages)) {
$res = array();
foreach ($error_messages as $key => $error_message) {
$res[] = $error_message;
}
$response = array("id" => 0, 'errors' => $res);
} else {
$response = array('id' => $wall->id);
}
return $response;
}
示例5: onAfterThankyou
public function onAfterThankyou($target, $actor, $message)
{
CFactory::load('libraries', 'userpoints');
CUserPoints::assignPoint('com_kunena.thread.thankyou', $target);
$username = KunenaFactory::getUser($actor)->username;
$act = new stdClass();
$act->cmd = 'wall.write';
$act->actor = JFactory::getUser()->id;
$act->target = $target;
$act->title = JText::_('{single}{actor}{/single}{multiple}{actors}{/multiple} ' . JText::sprintf('PLG_KUNENA_COMMUNITY_ACTIVITY_THANKYOU_TITLE', $username));
$act->content = NULL;
$act->app = 'kunena.thankyou';
$act->cid = $target;
$act->access = $this->getAccess($message->getCategory());
// Comments and like support
$act->comment_id = $target;
$act->comment_type = 'kunena.thankyou';
$act->like_id = $target;
$act->like_type = 'kunena.thankyou';
// Do not add private activities
if ($act->access > 20) {
return;
}
CFactory::load('libraries', 'activities');
CActivityStream::add($act);
}
示例6: onAfterVote
function onAfterVote($poll, $option_id)
{
$user =& JFactory::getUser();
$points = JPATH_ROOT . '/components/com_community/libraries/core.php';
$activity = JPATH_ROOT . '/components/com_community/libraries/core.php';
if ($this->params->get('points', '0') == '1' && file_exists($points)) {
require_once $points;
CUserPoints::assignPoint('com_acepolls.vote');
}
if ($this->params->get('activity', '0') == '1' && file_exists($activity)) {
require_once $activity;
$text = JText::_('COM_ACEPOLLS_ACTIVITY_TEXT');
$link = JRoute::_('index.php?option=com_acepolls&view=poll&id=' . $poll->id . ":" . $poll->alias . self::getItemid($poll->id));
$act = new stdClass();
$act->cmd = 'wall.write';
$act->actor = $user->id;
$act->target = 0;
$act->title = JText::_('{actor} ' . $text . ' <a href="' . $link . '">' . $poll->title . '</a>');
$act->content = '';
$act->app = 'wall';
$act->cid = 0;
CFactory::load('libraries', 'activities');
CActivityStream::add($act);
}
}
示例7: assignPoint
/**
* add points to user based on the action.
*/
function assignPoint($action, $userId = null)
{
//get the rule points
//must use the JFactory::getUser to get the aid
$juser =& JFactory::getUser($userId);
if ($juser->id != 0) {
$aid = $juser->aid;
// if the aid is null, means this is not the current logged-in user.
// so we need to manually get this aid for this user.
if (is_null($aid)) {
$aid = 0;
//defautl to 0
// Get an ACL object
$acl =& JFactory::getACL();
$grp = $acl->getAroGroup($juser->id);
$group = 'USERS';
if ($acl->is_group_child_of($grp->name, $group)) {
$aid = 1;
// Fudge Authors, Editors, Publishers and Super Administrators into the special access group
if ($acl->is_group_child_of($grp->name, 'Registered') || $acl->is_group_child_of($grp->name, 'Public Backend')) {
$aid = 2;
}
}
}
$points = CUserPoints::_getActionPoint($action, $aid);
$user = CFactory::getUser($userId);
$points += $user->getKarmaPoint();
$user->_points = $points;
$user->save();
}
}
示例8: deletegroupannouncement
function deletegroupannouncement($data)
{
require_once JPATH_SITE . '/components/com_community/libraries/core.php';
require_once JPATH_SITE . '/libraries/joomla/filesystem/folder.php';
CFactory::load('libraries', 'apps');
$error_messages = array();
$response = NULL;
$validated = true;
if ("" == $data['groupid'] || 0 == $data['groupid']) {
$validated = false;
$error_messages[] = array("id" => 1, "fieldname" => "groupid", "message" => "Groupid cannot be blank");
}
if ($data['bulletinid'] == "" || 0 == $data['bulletinid']) {
$validated = false;
$error_messages[] = array("id" => 1, "fieldname" => "bulletinid", "message" => "Bulletinid cannot be blank");
}
$user =& JFactory::getUser();
$group =& JTable::getInstance('Group', 'CTable');
$group->id = $data['groupid'];
if (true == $validated) {
$bulletin =& JTable::getInstance('Bulletin', 'CTable');
$bulletin->id = $data['bulletinid'];
$bulletin->groupid = $data['groupid'];
$validated = true;
if (true == empty($bulletin->id)) {
$validated = false;
$error_messages[] = array("id" => 1, "fieldname" => "bulletinid", "message" => "Invalid bulletin id. Check 'bulletinid' field in request");
}
CFactory::load('helpers', 'owner');
CFactory::load('models', 'bulletins');
$groupsModel =& CFactory::getModel('groups');
$bulletin =& JTable::getInstance('Bulletin', 'CTable');
$group =& JTable::getInstance('Group', 'CTable');
$group->load($groupid);
$bulletin->id = $data['bulletinid'];
$bulletin->groupid = $data['groupid'];
if ($bulletin->delete()) {
//add user points
CFactory::load('libraries', 'userpoints');
CUserPoints::assignPoint('group.news.remove');
}
}
if (true == isset($error_messages) && 0 < sizeof($error_messages)) {
$res = array();
foreach ($error_messages as $key => $error_message) {
$res[] = $error_message;
}
$response = array("id" => 0, 'errors' => $res);
} else {
$response = array('id' => $bulletin->id);
}
return $response;
}
示例9: assignPoint
/**
* add points to user based on the action.
* @param $action
* @param null $userId
*/
public static function assignPoint($action, $userId = null)
{
//get the rule points
//must use the JFactory::getUser to get the aid
$juser = JFactory::getUser($userId);
//since 4.0, check if this action is published, else return false (boolean)
$userPointModel = CFactory::getModel('Userpoints');
$point = $userPointModel->getPointData($action);
if (!isset($point->published) || !$point->published) {
return false;
}
if ($juser->id != 0) {
if (!method_exists($juser, 'getAuthorisedViewLevels')) {
$aid = $juser->aid;
// if the aid is null, means this is not the current logged-in user.
// so we need to manually get this aid for this user.
if (is_null($aid)) {
$aid = 0;
//defautl to 0
// Get an ACL object
$acl = JFactory::getACL();
$grp = $acl->getAroGroup($juser->id);
$group = 'USERS';
if ($acl->is_group_child_of($grp->name, $group)) {
$aid = 1;
// Fudge Authors, Editors, Publishers and Super Administrators into the special access group
if ($acl->is_group_child_of($grp->name, 'Registered') || $acl->is_group_child_of($grp->name, 'Public Backend')) {
$aid = 2;
}
}
}
} else {
//joomla 1.6
$aid = $juser->getAuthorisedViewLevels();
}
$points = CUserPoints::_getActionPoint($action, $aid);
$user = CFactory::getUser($userId);
$points += $user->getKarmaPoint();
$user->_points = $points;
$profile = JTable::getInstance('Profile', 'CTable');
$profile->load($user->id);
$user->_thumb = $profile->thumb;
$user->_avatar = $profile->avatar;
$user->save();
//Event trigger
$appsLib = CAppPlugins::getInstance();
$appsLib->loadApplications();
$params = array('action' => $action, 'points' => $points, 'userId' => $user->id);
$appsLib->triggerEvent('onAfterAssignPoint', $params);
return true;
}
}
示例10: onAfterThankyou
public function onAfterThankyou($thankyoutargetid, $username , $message) {
CFactory::load ( 'libraries', 'userpoints' );
CUserPoints::assignPoint ( 'com_kunena.thread.thankyou', $thankyoutargetid );
$act = new stdClass ();
$act->cmd = 'wall.write';
$act->actor = JFactory::getUser()->id;
$act->target = $thankyoutargetid;
$act->title = JText::_ ( '{single}{actor}{/single}{multiple}{actors}{/multiple} ' . JText::_( 'COM_KUNENA_JS_ACTIVITYSTREAM_THANKYOU' ).' <a href="' . $message->getTopic()->getUrl() . '">' . $message->subject . '</a> ' . JText::_ ( 'COM_KUNENA_JS_ACTIVITYSTREAM_REPLY_MSG2' ) );
$act->content = NULL;
$act->app = 'kunena.thankyou';
$act->cid = $thankyoutargetid;
$act->access = $this->getAccess($message->getCategory());
CFactory::load ( 'libraries', 'activities' );
CActivityStream::add ( $act );
}
示例11: mapStatus
/**
* Maps a user status with JomSocial's user status
*
* @param Array User values
**/
public function mapStatus($userId)
{
$result = $this->facebook->api('/me/statuses');
$status = isset($result['data'][0]) ? $result['data'][0] : '';
if (empty($status)) {
return;
}
CFactory::load('helpers', 'linkgenerator');
$connectModel = CFactory::getModel('Connect');
$status = $status['message'];
$rawStatus = $status;
// @rule: Do not strip html tags but escape them.
CFactory::load('helpers', 'string');
$status = CStringHelper::escape($status);
// @rule: Autolink hyperlinks
$status = CLinkGeneratorHelper::replaceURL($status);
// @rule: Autolink to users profile when message contains @username
$status = CLinkGeneratorHelper::replaceAliasURL($status);
// Reload $my from CUser so we can use some of the methods there.
$my = CFactory::getUser($userId);
$params = $my->getParams();
// @rule: For existing statuses, do not set them.
if ($connectModel->statusExists($status, $userId)) {
return;
}
CFactory::load('libraries', 'activities');
$act = new stdClass();
$act->cmd = 'profile.status.update';
$act->actor = $userId;
$act->target = $userId;
$act->title = '{actor} ' . $status;
$act->content = '';
$act->app = 'profile';
$act->cid = $userId;
$act->access = $params->get('privacyProfileView');
$act->comment_id = CActivities::COMMENT_SELF;
$act->comment_type = 'profile.status';
$act->like_id = CActivities::LIKE_SELF;
$act->like_type = 'profile.status';
CActivityStream::add($act);
//add user points
CFactory::load('libraries', 'userpoints');
CUserPoints::assignPoint('profile.status.update');
// Update status from facebook.
$my->setStatus($rawStatus);
}
示例12: ajaxStreamAdd
//.........这里部分代码省略.........
$activityParams = new CParameter('');
/* Save cords if exists */
if (isset($attachment['location'])) {
/* Save geo name */
$act->location = $attachment['location'][0];
$act->latitude = $attachment['location'][1];
$act->longitude = $attachment['location'][2];
}
$headMeta = new CParameter('');
if (isset($attachment['fetch'])) {
$headMeta->set('title', $attachment['fetch'][2]);
$headMeta->set('description', $attachment['fetch'][3]);
$headMeta->set('image', $attachment['fetch'][1]);
$headMeta->set('link', $attachment['fetch'][0]);
//do checking if this is a video link
$video = JTable::getInstance('Video', 'CTable');
$isValidVideo = @$video->init($attachment['fetch'][0]);
if ($isValidVideo) {
$headMeta->set('type', 'video');
$headMeta->set('video_provider', $video->type);
$headMeta->set('video_id', $video->getVideoId());
$headMeta->set('height', $video->getHeight());
$headMeta->set('width', $video->getWidth());
}
$activityParams->set('headMetas', $headMeta->toString());
}
//Store mood in paramm
if (isset($attachment['mood']) && $attachment['mood'] != 'Mood') {
$activityParams->set('mood', $attachment['mood']);
}
$act->params = $activityParams->toString();
//CActivityStream::add($act);
//check if the user points is enabled
if (CUserPoints::assignPoint('profile.status.update')) {
/* Let use our new CApiStream */
$activityData = CApiActivities::add($act);
CTags::add($activityData);
$recipient = CFactory::getUser($attachment['target']);
$params = new CParameter('');
$params->set('actorName', $my->getDisplayName());
$params->set('recipientName', $recipient->getDisplayName());
$params->set('url', CUrlHelper::userLink($act->target, false));
$params->set('message', $message);
$params->set('stream', JText::_('COM_COMMUNITY_SINGULAR_STREAM'));
$params->set('stream_url', CRoute::_('index.php?option=com_community&view=profile&userid=' . $activityData->actor . '&actid=' . $activityData->id));
CNotificationLibrary::add('profile_status_update', $my->id, $attachment['target'], JText::sprintf('COM_COMMUNITY_FRIEND_WALL_POST', $my->getDisplayName()), '', 'wall.post', $params);
//email and add notification if user are tagged
CUserHelper::parseTaggedUserNotification($message, $my, $activityData, array('type' => 'post-comment'));
}
break;
// Message posted from Group page
// Message posted from Group page
case 'groups':
//
$groupLib = new CGroups();
$group = JTable::getInstance('Group', 'CTable');
$group->load($attachment['target']);
// Permission check, only site admin and those who has
// mark their attendance can post message
if (!COwnerHelper::isCommunityAdmin() && !$group->isMember($my->id) && $config->get('lockgroupwalls')) {
$objResponse->addScriptCall("alert('permission denied');");
return $objResponse->sendResponse();
}
$act = new stdClass();
$act->cmd = 'groups.wall';
$act->actor = $my->id;
示例13: ajaxDeleteActivity
public function ajaxDeleteActivity($app, $activityId)
{
$my = CFactory::getUser();
$objResponse = new JAXResponse();
$filter = JFilterInput::getInstance();
$app = $filter->clean($app, 'string');
$activityId = $filter->clean($activityId, 'int');
$activity = JTable::getInstance('Activity', 'CTable');
$activity->load($activityId);
$json = array();
// @todo: do permission checking within the ACL
if ($my->authorise('community.delete', 'activities.' . $activityId, $activity)) {
$activity->delete($app);
if ($activity->app == 'profile') {
$model = $this->getModel('activities');
$data = $model->getAppActivities(array('app' => 'profile', 'cid' => $activity->cid, 'limit' => 1));
$status = $this->getModel('status');
$status->update($activity->cid, $data[0]->title, $activity->access);
$user = CFactory::getUser($activity->cid);
$today = JFactory::getDate();
$user->set('_status', $data[0]->title);
$user->set('_posted_on', $today->toSql());
}
$json = array('success' => true);
CUserPoints::assignPoint('wall.remove');
} else {
$json = array('error' => true);
}
$this->cacheClean(array(COMMUNITY_CACHE_TAG_ACTIVITIES));
die(json_encode($json));
}
示例14: ajaxRemoveWall
/**
* Delete post message
*
* @param response An ajax Response object
* @param id A unique identifier for the wall row
*
* returns response
*/
function ajaxRemoveWall($response, $id, $cache_id = "")
{
$my = CFactory::getUser();
$wallModel = CFactory::getModel('wall');
$wall = $wallModel->get($id);
CError::assert($id, '', '!empty', __FILE__, __LINE__);
CFactory::load('helpers', 'owner');
// Make sure the current user actually has the correct permission
// Only the original writer and the person the wall is meant for (and admin of course)
// can delete the wall
if ($my->id == $wall->post_by || $my->id == $wall->contentid || COwnerHelper::isCommunityAdmin()) {
if ($wallModel->deletePost($id)) {
// @rule: Remove the wall activity from the database as well
CFactory::load('libraries', 'activities');
CActivityStream::remove('walls', $id);
//add user points
if ($wall->post_by != 0) {
CFactory::load('libraries', 'userpoints');
CUserPoints::assignPoint('wall.remove', $wall->post_by);
}
} else {
$html = JText::_('Error while removing wall. Line:' . __LINE__);
$response->addAlert($html);
}
$cache =& JFactory::getCache('plgCommunityWalls');
$cache->remove($cache_id);
$cache =& JFactory::getCache('plgCommunityWalls_fullview');
$cache->remove($cache_id);
} else {
$html = JText::_('COM_COMMUNITY_PERMISSION_DENIED_WARNING');
$response->addAlert($html);
}
return $response;
}
示例15: ajaxAddApp
public function ajaxAddApp($name, $position)
{
// Check permissions
$my =& JFactory::getUser();
if ($my->id == 0) {
return $this->ajaxBlockUnregister();
}
$filter = JFilterInput::getInstance();
$name = $filter->clean($name, 'string');
$position = $filter->clean($position, 'string');
// Add application
$appModel = CFactory::getModel('apps');
$appModel->addApp($my->id, $name, $position);
// Activity stream
$act = new stdClass();
$act->cmd = 'application.add';
$act->actor = $my->id;
$act->target = 0;
$act->title = JText::_('COM_COMMUNITY_ACTIVITIES_APPLICATIONS_ADDED');
$act->content = '';
$act->app = $name;
$act->cid = $my->id;
CFactory::load('libraries', 'activities');
CActivityStream::add($act);
// User points
CFactory::load('libraries', 'userpoints');
CUserPoints::assignPoint('application.add');
// Get application
$id = $appModel->getUserApplicationId($name, $my->id);
$appInfo = $appModel->getAppInfo($name);
$params = new CParameter($appModel->getPluginParams($id, null));
$isCoreApp = $params->get('coreapp');
$app->id = $id;
$app->title = isset($appInfo->title) ? $appInfo->title : '';
$app->description = isset($appInfo->description) ? $appInfo->description : '';
$app->isCoreApp = $isCoreApp;
$app->name = $name;
if (JFile::exists(CPluginHelper::getPluginPath('community', $name) . DS . $name . DS . 'favicon.png')) {
$app->favicon['16'] = rtrim(JURI::root(), '/') . CPluginHelper::getPluginURI('community', $name) . '/' . $name . '/favicon.png';
} else {
$app->favicon['16'] = rtrim(JURI::root(), '/') . '/components/com_community/assets/app_favicon.png';
}
$tmpl = new CTemplate();
$tmpl->set('apps', array($app));
$tmpl->set('itemType', 'edit');
$html = $tmpl->fetch('application.item');
$objResponse = new JAXResponse();
$objResponse->addScriptCall('joms.apps.showSettingsWindow', $app->id, $app->name);
$objResponse->addScriptCall('joms.editLayout.addAppToLayout', $position, $html);
// $objResponse->addScriptCall('cWindowHide();');
return $objResponse->sendResponse();
}