Source for file group.php

Documentation is available at group.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Platform
  4.  * @subpackage  Facebook
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE
  8.  */
  9.  
  10.  
  11. defined('JPATH_PLATFORM'or die();
  12.  
  13.  
  14. /**
  15.  * Facebook API Group class for the Joomla Platform.
  16.  *
  17.  * @package     Joomla.Platform
  18.  * @subpackage  Facebook
  19.  *
  20.  * @see         http://developers.facebook.com/docs/reference/api/group/
  21.  * @since       13.1
  22.  */
  23. {
  24.     /**
  25.      * Method to read a group. Requires authentication and user_groups or friends_groups permission for non-public groups.
  26.      *
  27.      * @param   string  $group  The group id.
  28.      *
  29.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  30.      *
  31.      * @since   13.1
  32.      */
  33.     public function getGroup($group)
  34.     {
  35.         return $this->get($group);
  36.     }
  37.  
  38.     /**
  39.      * Method to get the group's wall. Requires authentication and user_groups or friends_groups permission for non-public groups.
  40.      *
  41.      * @param   string   $group   The group id.
  42.      * @param   integer  $limit   The number of objects per page.
  43.      * @param   integer  $offset  The object's number on the page.
  44.      * @param   string   $until   A unix timestamp or any date accepted by strtotime.
  45.      * @param   string   $since   A unix timestamp or any date accepted by strtotime.
  46.      *
  47.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  48.      *
  49.      * @since   13.1
  50.      */
  51.     public function getFeed($group$limit 0$offset 0$until null$since null)
  52.     {
  53.         return $this->getConnection($group'feed'''$limit$offset$until$since);
  54.     }
  55.  
  56.     /**
  57.      * Method to get the group's members. Requires authentication and user_groups or friends_groups permission for non-public groups.
  58.      *
  59.      * @param   string   $group   The group id.
  60.      * @param   integer  $limit   The number of objects per page.
  61.      * @param   integer  $offset  The object's number on the page.
  62.      *
  63.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  64.      *
  65.      * @since   13.1
  66.      */
  67.     public function getMembers($group$limit 0$offset 0)
  68.     {
  69.         return $this->getConnection($group'members'''$limit$offset);
  70.     }
  71.  
  72.     /**
  73.      * Method to get the group's docs. Requires authentication and user_groups or friends_groups permission for non-public groups.
  74.      *
  75.      * @param   string   $group   The group id.
  76.      * @param   integer  $limit   The number of objects per page.
  77.      * @param   integer  $offset  The object's number on the page.
  78.      * @param   string   $until   A unix timestamp or any date accepted by strtotime.
  79.      * @param   string   $since   A unix timestamp or any date accepted by strtotime.
  80.      *
  81.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  82.      *
  83.      * @since   13.1
  84.      */
  85.     public function getDocs($group$limit 0$offset 0$until null$since null)
  86.     {
  87.         return $this->getConnection($group'docs'''$limit$offset$until$since);
  88.     }
  89.  
  90.     /**
  91.      * Method to get the groups's picture. Requires authentication and user_groups or friends_groups permission.
  92.      *
  93.      * @param   string  $group  The group id.
  94.      * @param   string  $type   To request a different photo use square | small | normal | large.
  95.      *
  96.      * @return  string   The URL to the group's picture.
  97.      *
  98.      * @since   13.1
  99.      */
  100.     public function getPicture($group$type null)
  101.     {
  102.         if ($type)
  103.         {
  104.             $type '?type=' $type;
  105.         }
  106.  
  107.         return $this->getConnection($group'picture'$type);
  108.     }
  109.  
  110.     /**
  111.      * Method to post a link on group's wall. Requires authentication and publish_stream permission.
  112.      *
  113.      * @param   string  $group    The group id.
  114.      * @param   string  $link     Link URL.
  115.      * @param   strin   $message  Link message.
  116.      *
  117.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  118.      *
  119.      * @since   13.1
  120.      */
  121.     public function createLink($group$link$message null)
  122.     {
  123.         // Set POST request parameters.
  124.         $data array();
  125.         $data['link'$link;
  126.  
  127.         if ($message)
  128.         {
  129.             $data['message'$message;
  130.         }
  131.  
  132.         return $this->createConnection($group'feed'$data);
  133.     }
  134.  
  135.     /**
  136.      * Method to delete a link. Requires authentication.
  137.      *
  138.      * @param   mixed  $link  The Link ID.
  139.      *
  140.      * @return  boolean   Returns true if successful, and false otherwise.
  141.      *
  142.      * @since   13.1
  143.      */
  144.     public function deleteLink($link)
  145.     {
  146.         return $this->deleteConnection($link);
  147.     }
  148.  
  149.     /**
  150.      * Method to post on group's wall. Message or link parameter is required. Requires authentication and publish_stream permission.
  151.      *
  152.      * @param   string  $group        The group id.
  153.      * @param   string  $message      Post message.
  154.      * @param   string  $link         Post URL.
  155.      * @param   string  $picture      Post thumbnail image (can only be used if link is specified)
  156.      * @param   string  $name         Post name (can only be used if link is specified).
  157.      * @param   string  $caption      Post caption (can only be used if link is specified).
  158.      * @param   string  $description  Post description (can only be used if link is specified).
  159.      * @param   array   $actions      Post actions array of objects containing name and link.
  160.      *
  161.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  162.      *
  163.      * @since   13.1
  164.      */
  165.     public function createPost($group$message null$link null$picture null$name null$caption null,
  166.         $description null$actions null)
  167.     {
  168.         // Set POST request parameters.
  169.         if ($message)
  170.         {
  171.             $data['message'$message;
  172.         }
  173.  
  174.         if ($link)
  175.         {
  176.             $data['link'$link;
  177.         }
  178.  
  179.         if ($name)
  180.         {
  181.             $data['name'$name;
  182.         }
  183.  
  184.         if ($caption)
  185.         {
  186.             $data['caption'$caption;
  187.         }
  188.  
  189.         if ($description)
  190.         {
  191.             $data['description'$description;
  192.         }
  193.  
  194.         if ($actions)
  195.         {
  196.             $data['actions'$actions;
  197.         }
  198.  
  199.         if ($picture)
  200.         {
  201.             $data['picture'$picture;
  202.         }
  203.  
  204.         return $this->createConnection($group'feed'$data);
  205.     }
  206.  
  207.     /**
  208.      * Method to delete a post. Note: you can only delete the post if it was created by the current user. Requires authentication.
  209.      *
  210.      * @param   string  $post  The Post ID.
  211.      *
  212.      * @return  boolean   Returns true if successful, and false otherwise.
  213.      *
  214.      * @since   13.1
  215.      */
  216.     public function deletePost($post)
  217.     {
  218.         return $this->deleteConnection($post);
  219.     }
  220.  
  221.     /**
  222.      * Method to post a status message on behalf of the user on the group's wall. Requires authentication and publish_stream permission.
  223.      *
  224.      * @param   string  $group    The group id.
  225.      * @param   string  $message  Status message content.
  226.      *
  227.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  228.      *
  229.      * @since   13.1
  230.      */
  231.     public function createStatus($group$message)
  232.     {
  233.         // Set POST request parameters.
  234.         $data array();
  235.         $data['message'$message;
  236.  
  237.         return $this->createConnection($group'feed'$data);
  238.     }
  239.  
  240.     /**
  241.      * Method to delete a status. Note: you can only delete the status if it was created by the current user. Requires authentication.
  242.      *
  243.      * @param   string  $status  The Status ID.
  244.      *
  245.      * @return  boolean Returns true if successful, and false otherwise.
  246.      *
  247.      * @since   13.1
  248.      */
  249.     public function deleteStatus($status)
  250.     {
  251.         return $this->deleteConnection($status);
  252.     }
  253. }

Documentation generated on Tue, 19 Nov 2013 15:04:04 +0100 by phpDocumentor 1.4.3