예제 #1
0
 /**
  * Displays the join group dialog
  *
  * @since	1.2
  * @access	public
  * @param	string
  * @return
  */
 public function joinGroup()
 {
     // Only logged in users are allowed here.
     FD::requireLogin();
     // Get the group id from request
     $id = $this->input->get('id', 0, 'int');
     // Determines if this is an api request
     $api = $this->input->get('api', false, 'bool');
     // Load up the group
     $group = ES::group($id);
     if (!$id || !$group) {
         return $this->ajax->reject();
     }
     // Try to load the member object
     $member = ES::table('GroupMember');
     $member->load(array('uid' => $this->my->id, 'type' => SOCIAL_TYPE_USER, 'cluster_id' => $group->id));
     // Determines which namespace we should be using
     $namespace = 'site/groups/dialog.join.open';
     // Check if the group is open or closed
     if ($group->isClosed()) {
         if ($member->state == SOCIAL_GROUPS_MEMBER_PUBLISHED) {
             $namespace = 'site/groups/dialog.join.invited';
         } else {
             $namespace = 'site/groups/dialog.join.closed';
         }
     }
     $theme = ES::themes();
     $theme->set('group', $group);
     $contents = $theme->output($namespace);
     return $this->ajax->resolve($contents);
 }
예제 #2
0
 /**
  * Retrieves the group template
  *
  * @since	1.3
  * @access	public
  * @param	string
  * @return	
  */
 public function getGroupTemplate()
 {
     $ids = $this->input->get('groups', array(), 'array');
     if (!$ids) {
         return $this->ajax->reject();
     }
     $groups = array();
     foreach ($ids as $id) {
         $group = ES::group($id);
         $groups[] = $group;
     }
     $theme = ES::themes();
     $theme->set('groups', $groups);
     $html = $theme->output('admin/profiles/form.groups.item');
     return $this->ajax->resolve($html);
 }
예제 #3
0
 /**
  * Displays the switch profile form
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function switchProfileForm()
 {
     // Get the id's of the user that we are trying to modify
     $ids = $this->input->get('ids', array(), 'array');
     $ids = ES::makeArray($ids);
     $theme = ES::themes();
     $theme->set('ids', $ids);
     $output = $theme->output('admin/users/dialog.switch.profile');
     return $this->ajax->resolve($output);
 }