]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/cancelgroupform.php
[CORE] MySQL 5.5 support fully restored
[quix0rs-gnu-social.git] / lib / cancelgroupform.php
index e71144f0edfcf9d9e06c5922ce7a758e5232b763..cfab7550c0b5a0d8698565c07f5aad24c46a8c18 100644 (file)
  * @link      http://status.net/
  */
 
-if (!defined('STATUSNET') && !defined('LACONICA')) {
-    exit(1);
-}
-
-require_once INSTALLDIR.'/lib/form.php';
+if (!defined('GNUSOCIAL')) { exit(1); }
 
 /**
  * Form for leaving a group
@@ -46,7 +42,6 @@ require_once INSTALLDIR.'/lib/form.php';
  *
  * @see      UnsubscribeForm
  */
-
 class CancelGroupForm extends Form
 {
     /**
@@ -54,19 +49,21 @@ class CancelGroupForm extends Form
      */
 
     var $group = null;
+    var $profile = null;
 
     /**
      * Constructor
      *
-     * @param HTMLOutputter $out   output channel
-     * @param group         $group group to leave
+     * @param HTMLOutputter $out        output channel
+     * @param User_group    $group      group to leave
+     * @param Profile       $profile    User profile this is meant for
      */
-
-    function __construct($out=null, $group=null)
+    function __construct(HTMLOutputter $out=null, User_group $group=null, Profile $profile=null)
     {
         parent::__construct($out);
 
         $this->group = $group;
+        $this->profile = $profile;
     }
 
     /**
@@ -74,10 +71,9 @@ class CancelGroupForm extends Form
      *
      * @return string ID of the form
      */
-
     function id()
     {
-        return 'group-cancel-' . $this->group->id;
+        return 'group-cancel-' . $this->group->getID();
     }
 
     /**
@@ -85,7 +81,6 @@ class CancelGroupForm extends Form
      *
      * @return string of the form class
      */
-
     function formClass()
     {
         return 'form_group_leave ajax';
@@ -96,11 +91,13 @@ class CancelGroupForm extends Form
      *
      * @return string URL of the action
      */
-
     function action()
     {
-        return common_local_url('cancelgroup',
-                                array('id' => $this->group->id));
+        $params = array();
+        if ($this->profile instanceof Profile) {
+            $params['profile_id'] = $this->profile->getID();
+        }
+        return common_local_url('cancelgroup', array('id' => $this->group->getID()), $params);
     }
 
     /**
@@ -108,9 +105,9 @@ class CancelGroupForm extends Form
      *
      * @return void
      */
-
     function formActions()
     {
-        $this->out->submit('submit', _('Cancel join request'));
+        // TRANS: Submit button text on form to cancel group join request.
+        $this->out->submit('submit', _m('BUTTON','Cancel join request'));
     }
 }