Merge branch 'master' of github.com:civicrm/civicrm-core into code-cleanup-batch-15
[civicrm-core.git] / CRM / Utils / System / Soap.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
26 */
27
28 /**
29 *
30 * @package CRM
31 * @copyright CiviCRM LLC (c) 2004-2014
32 * $Id$
33 *
34 */
35
36 /**
37 * Soap specific stuff goes here
38 */
39 class CRM_Utils_System_Soap extends CRM_Utils_System_Base {
40
41 /**
42 * UF container variables
43 */
44 static $uf = NULL;
45 static $ufClass = NULL;
46
47 /**
48 * Sets the title of the page
49 *
50 * @param string $title
51 * Title for page.
52 * @param $pageTitle
53 *
54 * @paqram string $pageTitle
55 *
56 * @return void
57 */
58 public function setTitle($title, $pageTitle) {
59 return NULL;
60 }
61
62 /**
63 * Given a permission string, check for access requirements
64 *
65 * @param string $str
66 * The permission to check.
67 *
68 * @return bool
69 * true if yes, else false
70 */
71 public function checkPermission($str) {
72 return TRUE;
73 }
74
75 /**
76 * Append an additional breadcrumb tag to the existing breadcrumb
77 *
78 * @param string $title
79 * @param string $url
80 *
81 * @return void
82 */
83 public function appendBreadCrumb($title, $url) {
84 return NULL;
85 }
86
87 /**
88 * Append a string to the head of the html file
89 *
90 * @param string $head
91 * The new string to be appended.
92 *
93 * @return void
94 */
95 public function addHTMLHead($head) {
96 return NULL;
97 }
98
99 /**
100 * Generate an internal CiviCRM URL
101 *
102 * @param string $path
103 * The path being linked to, such as "civicrm/add".
104 * @param string $query
105 * A query string to append to the link.
106 * @param bool $absolute
107 * Whether to force the output to be an absolute link (beginning with http:).
108 * Useful for links that will be displayed outside the site, such as in an
109 * RSS feed.
110 * @param string $fragment
111 * A fragment identifier (named anchor) to append to the link.
112 *
113 * @return string
114 * an HTML string containing a link to the given path.
115 */
116 public function url($path = NULL, $query = NULL, $absolute = TRUE, $fragment = NULL) {
117 if (isset(self::$ufClass)) {
118 $className = self::$ufClass;
119 $url = $className::url($path, $query, $absolute, $fragment);
120 return $url;
121 }
122 else {
123 return NULL;
124 }
125 }
126
127 /**
128 * Figure out the post url for the form
129 *
130 * @return string
131 * the url to post the form
132 */
133 public function postURL($action) {
134 return NULL;
135 }
136
137 /**
138 * Set the email address of the user
139 *
140 * @param object $user
141 * Handle to the user object.
142 *
143 * @return void
144 */
145 public function setEmail(&$user) {
146 }
147
148 /**
149 * Authenticate a user against the real UF
150 *
151 * @param string $name
152 * Login name.
153 * @param string $pass
154 * Login password.
155 *
156 * @return array
157 * Result array
158 */
159 public function &authenticate($name, $pass) {
160 if (isset(self::$ufClass)) {
161 $className = self::$ufClass;
162 $result =& $className::authenticate($name, $pass);
163 return $result;
164 }
165 else {
166 return NULL;
167 }
168 }
169
170 /**
171 * Swap the current UF for soap
172 */
173 public function swapUF() {
174 $config = CRM_Core_Config::singleton();
175
176 self::$uf = $config->userFramework;
177 $config->userFramework = 'Soap';
178
179 self::$ufClass = $config->userFrameworkClass;
180 $config->userFrameworkClass = 'CRM_Utils_System_Soap';
181 }
182
183 /**
184 * Get the locale set in the hosting CMS
185 *
186 * @return null
187 * as the language is set elsewhere
188 */
189 public function getUFLocale() {
190 return NULL;
191 }
192
193 /**
194 * Get user login URL for hosting CMS (method declared in each CMS system class)
195 *
196 * @param string $destination
197 * If present, add destination to querystring (works for Drupal only).
198 *
199 * @throws Exception
200 * @return;
201 * loginURL for the current CMS
202 */
203 public function getLoginURL($destination = '') {
204 throw new Exception("Method not implemented: getLoginURL");
205 }
206 }