當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CGroups::joinApproved方法代碼示例

本文整理匯總了PHP中CGroups::joinApproved方法的典型用法代碼示例。如果您正苦於以下問題:PHP CGroups::joinApproved方法的具體用法?PHP CGroups::joinApproved怎麽用?PHP CGroups::joinApproved使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CGroups的用法示例。


在下文中一共展示了CGroups::joinApproved方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _saveMember

 private function _saveMember($groupId)
 {
     $group =& JTable::getInstance('Group', 'CTable');
     $member =& JTable::getInstance('GroupMembers', 'CTable');
     $group->load($groupId);
     $params = $group->getParams();
     $my = CFactory::getUser();
     // Set the properties for the members table
     $member->groupid = $group->id;
     $member->memberid = $my->id;
     CFactory::load('helpers', 'owner');
     // @rule: If approvals is required, set the approved status accordingly.
     $member->approved = $group->approvals == COMMUNITY_PRIVATE_GROUP ? '0' : 1;
     // @rule: Special users should be able to join the group regardless if it requires approval or not
     $member->approved = COwnerHelper::isCommunityAdmin() ? 1 : $member->approved;
     // @rule: Invited users should be able to join the group immediately.
     $groupInvite = JTable::getInstance('GroupInvite', 'CTable');
     if ($groupInvite->load($groupId, $my->id)) {
         $member->approved = 1;
     }
     //@todo: need to set the privileges
     $member->permissions = '0';
     $member->store();
     $owner = CFactory::getUser($group->ownerid);
     //trigger for onGroupJoin
     $this->triggerGroupEvents('onGroupJoin', $group, $my->id);
     // Update user group list
     $my->updateGroupList();
     // Test if member is approved, then we add logging to the activities.
     if ($member->approved) {
         CFactory::load('libraries', 'groups');
         CGroups::joinApproved($groupId, $my->id);
     }
     return $member;
 }
開發者ID:Simarpreet05,項目名稱:joomla,代碼行數:35,代碼來源:groups.php

示例2: ajaxGroupJoinInvitation

 /**
  * Ajax function to join an group invitation
  *
  **/
 public function ajaxGroupJoinInvitation($groupId)
 {
     $filter = JFilterInput::getInstance();
     $groupId = $filter->clean($groupId, 'int');
     if (!COwnerHelper::isRegisteredUser()) {
         return $this->ajaxBlockUnregister();
     }
     $json = array();
     $my = CFactory::getUser();
     // Get groups table
     $table = JTable::getInstance('GroupInvite', 'CTable');
     $keys = array('groupid' => $groupId, 'userid' => $my->id);
     $table->load($keys);
     if ($table->isOwner()) {
         $group = JTable::getInstance('Group', 'CTable');
         $member = JTable::getInstance('GroupMembers', 'CTable');
         $group->load($groupId);
         $params = $group->getParams();
         // Set the properties for the members table
         $member->groupid = $group->id;
         $member->memberid = $my->id;
         // @rule: If approvals is required, set the approved status accordingly.
         $member->approved = $group->approvals == COMMUNITY_PRIVATE_GROUP ? '0' : 1;
         // @rule: Special users should be able to join the group regardless if it requires approval or not
         $member->approved = COwnerHelper::isCommunityAdmin() ? 1 : $member->approved;
         $groupModel = CFactory::getModel('groups');
         // @rule: If the Invitation is sent by group admin, do not need futher approval
         if ($groupModel->isAdmin($table->creator, $groupId)) {
             $member->approved = 1;
         }
         //@todo: need to set the privileges
         $member->permissions = '0';
         $member->store();
         //trigger for onGroupJoin
         $this->triggerEvents('onGroupJoin', $group, $my->id);
         // Update user group list
         $my->updateGroupList();
         // Test if member is approved, then we add logging to the activities.
         if ($member->approved) {
             // remove the notication count
             $table = JTable::getInstance('GroupInvite', 'CTable');
             $keys = array('groupid' => $groupId, 'userid' => $my->id);
             $table->load($keys);
             $table->delete();
             CGroups::joinApproved($groupId, $my->id);
             $url = CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id);
             $json['success'] = true;
             $json['message'] = JText::sprintf('COM_COMMUNITY_GROUPS_ACCEPTED_INVIT', $group->name, $url);
         }
     } else {
         $json['error'] = JText::_('COM_COMMUNITY_GROUPS_NOT_INVITED_NOTIFICATION');
     }
     die(json_encode($json));
 }
開發者ID:Jougito,項目名稱:DynWeb,代碼行數:58,代碼來源:notification.php

示例3: ajaxGroupJoinInvitation

 /**
  * Ajax function to join an group invitation
  *
  **/
 public function ajaxGroupJoinInvitation($groupId)
 {
     $filter = JFilterInput::getInstance();
     $groupId = $filter->clean($groupId, 'int');
     if (!COwnerHelper::isRegisteredUser()) {
         return $this->ajaxBlockUnregister();
     }
     $objResponse = new JAXResponse();
     $my = CFactory::getUser();
     // Get groups table
     $table =& JTable::getInstance('GroupInvite', 'CTable');
     $table->load($groupId, $my->id);
     if ($table->isOwner()) {
         $group =& JTable::getInstance('Group', 'CTable');
         $member =& JTable::getInstance('GroupMembers', 'CTable');
         $group->load($groupId);
         $params = $group->getParams();
         // Set the properties for the members table
         $member->groupid = $group->id;
         $member->memberid = $my->id;
         CFactory::load('helpers', 'owner');
         // @rule: If approvals is required, set the approved status accordingly.
         $member->approved = $group->approvals == COMMUNITY_PRIVATE_GROUP ? '0' : 1;
         // @rule: Special users should be able to join the group regardless if it requires approval or not
         $member->approved = COwnerHelper::isCommunityAdmin() ? 1 : $member->approved;
         $groupModel = CFactory::getModel('groups');
         // @rule: If the Invitation is sent by group admin, do not need futher approval
         if ($groupModel->isAdmin($table->creator, $groupId)) {
             $member->approved = 1;
         }
         //@todo: need to set the privileges
         $member->permissions = '0';
         $member->store();
         //trigger for onGroupJoin
         $this->triggerEvents('onGroupJoin', $group, $my->id);
         // Test if member is approved, then we add logging to the activities.
         if ($member->approved) {
             CFactory::load('libraries', 'groups');
             CGroups::joinApproved($groupId, $my->id);
             $url = CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id);
             $objResponse->addScriptCall('joms.jQuery("#msg-pending-' . $group->id . '").html("' . addslashes(JText::sprintf('COM_COMMUNITY_GROUPS_ACCEPTED_INVIT', $group->name, $url)) . '");');
             $objResponse->addScriptCall('joms.notifications.updateNotifyCount();');
             $objResponse->addScriptCall('joms.jQuery("#noti-pending-group-' . $group->id . '").fadeOut(1000, function() { joms.jQuery("#noti-pending-group' . $group->id . '").remove();} );');
             $objResponse->addScriptCall('aspan = joms.jQuery("#jsMenu .jsMenuIcon span"); aspan.html(parseInt(aspan.html())-1);');
         }
     } else {
         $objResponse->addScriptCall('joms.jQuery("#error-pending-' . $group->id . '").html("' . JText::_('COM_COMMUNITY_GROUPS_NOT_INVITED_NOTIFICATION') . '");');
         $objResponse->addScriptCall('joms.jQuery("#error-pending-' . $group->id . '").attr("class", "error");');
     }
     return $objResponse->sendResponse();
 }
開發者ID:Simarpreet05,項目名稱:joomla,代碼行數:55,代碼來源:notification.php


注:本文中的CGroups::joinApproved方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。