This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * Copyright (c) Enalean, 2011. All Rights Reserved. |
||
4 | * |
||
5 | * This file is a part of Tuleap. |
||
6 | * |
||
7 | * Tuleap is free software; you can redistribute it and/or modify |
||
8 | * it under the terms of the GNU General Public License as published by |
||
9 | * the Free Software Foundation; either version 2 of the License, or |
||
10 | * (at your option) any later version. |
||
11 | * |
||
12 | * Tuleap is distributed in the hope that it will be useful, |
||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
15 | * GNU General Public License for more details. |
||
16 | * |
||
17 | * You should have received a copy of the GNU General Public License |
||
18 | * along with Tuleap. If not, see <http://www.gnu.org/licenses/>. |
||
19 | */ |
||
20 | |||
21 | require_once 'common/plugin/Plugin.class.php'; |
||
22 | require_once 'constants.php'; |
||
23 | require_once 'autoload.php'; |
||
24 | |||
25 | /** |
||
26 | * CardwallPlugin |
||
27 | */ |
||
28 | class cardwallPlugin extends Plugin { |
||
29 | |||
30 | /** |
||
31 | * @var Cardwall_OnTop_ConfigFactory |
||
32 | */ |
||
33 | private $config_factory; |
||
34 | |||
35 | public function getConfigFactory() { |
||
36 | if (!$this->config_factory) { |
||
37 | $tracker_factory = TrackerFactory::instance(); |
||
38 | $element_factory = Tracker_FormElementFactory::instance(); |
||
39 | $this->config_factory = new Cardwall_OnTop_ConfigFactory($tracker_factory, $element_factory); |
||
40 | } |
||
41 | return $this->config_factory; |
||
42 | } |
||
43 | |||
44 | const RENDERER_TYPE = 'plugin_cardwall'; |
||
45 | |||
46 | |||
47 | public function getHooksAndCallbacks() { |
||
48 | if (defined('TRACKER_BASE_URL')) { |
||
49 | $this->addHook('cssfile'); |
||
50 | $this->addHook('javascript_file'); |
||
51 | $this->addHook('tracker_report_renderer_types'); |
||
52 | $this->addHook('tracker_report_renderer_instance'); |
||
53 | $this->addHook(TRACKER_EVENT_TRACKERS_DUPLICATED); |
||
54 | $this->addHook(TRACKER_EVENT_BUILD_ARTIFACT_FORM_ACTION); |
||
55 | $this->addHook(TRACKER_EVENT_REDIRECT_AFTER_ARTIFACT_CREATION_OR_UPDATE); |
||
56 | $this->_addHook(Event::JAVASCRIPT); |
||
57 | $this->addHook(Event::IMPORT_XML_PROJECT_TRACKER_DONE); |
||
58 | $this->addHook(TRACKER_EVENT_MANAGE_SEMANTICS); |
||
59 | $this->addHook(TRACKER_EVENT_SEMANTIC_FROM_XML); |
||
60 | $this->addHook(TRACKER_EVENT_GET_SEMANTIC_FACTORIES); |
||
61 | |||
62 | if (defined('AGILEDASHBOARD_BASE_DIR')) { |
||
63 | $this->addHook(AGILEDASHBOARD_EVENT_ADDITIONAL_PANES_ON_MILESTONE); |
||
64 | $this->addHook(AGILEDASHBOARD_EVENT_ADDITIONAL_PANES_INFO_ON_MILESTONE); |
||
65 | $this->addHook(AGILEDASHBOARD_EVENT_INDEX_PAGE); |
||
66 | $this->addHook(AGILEDASHBOARD_EVENT_MILESTONE_SELECTOR_REDIRECT); |
||
67 | $this->addHook(AGILEDASHBOARD_EVENT_PLANNING_CONFIG); |
||
68 | $this->addHook(AGILEDASHBOARD_EVENT_PLANNING_CONFIG_UPDATE); |
||
69 | $this->addHook(AGILEDASHBOARD_EVENT_REST_GET_CARDWALL); |
||
70 | $this->addHook(AGILEDASHBOARD_EVENT_REST_GET_MILESTONE); |
||
71 | $this->addHook(AGILEDASHBOARD_EVENT_IS_CARDWALL_ENABLED); |
||
72 | $this->addHook(AGILEDASHBOARD_EVENT_GET_CARD_FIELDS); |
||
73 | $this->addHook(AGILEDASHBOARD_EVENT_REST_RESOURCES); |
||
74 | $this->addHook(AGILEDASHBOARD_EXPORT_XML); |
||
75 | } |
||
76 | } |
||
77 | return parent::getHooksAndCallbacks(); |
||
78 | } |
||
79 | |||
80 | /** |
||
81 | * @see Plugin::getDependencies() |
||
82 | */ |
||
83 | public function getDependencies() { |
||
84 | return array('tracker'); |
||
85 | } |
||
86 | |||
87 | |||
88 | // TODO : transform into a OnTop_Config_Command, and move code to ConfigFactory |
||
89 | public function tracker_event_trackers_duplicated($params) { |
||
90 | foreach ($params['tracker_mapping'] as $from_tracker_id => $to_tracker_id) { |
||
91 | if ($this->getOnTopDao()->duplicate($from_tracker_id, $to_tracker_id)) { |
||
0 ignored issues
–
show
|
|||
92 | $this->getOnTopColumnDao()->duplicate($from_tracker_id, $to_tracker_id, $params); |
||
93 | $this->getOnTopColumnMappingFieldDao()->duplicate($from_tracker_id, $to_tracker_id, $params['tracker_mapping'], $params['field_mapping']); |
||
94 | $this->getOnTopColumnMappingFieldValueDao()->duplicate($from_tracker_id, $to_tracker_id, $params['tracker_mapping'], $params['field_mapping'], $params['plugin_cardwall_column_mapping']); |
||
95 | } |
||
96 | } |
||
97 | } |
||
98 | |||
99 | /** |
||
100 | * This hook ask for types of report renderer |
||
101 | * |
||
102 | * @param array types Input/Output parameter. Expected format: $types['my_type'] => 'Label of the type' |
||
103 | */ |
||
104 | public function tracker_report_renderer_types($params) { |
||
105 | $params['types'][self::RENDERER_TYPE] = $GLOBALS['Language']->getText('plugin_cardwall', 'title'); |
||
106 | } |
||
107 | |||
108 | /** |
||
109 | * This hook asks to create a new instance of a renderer |
||
110 | * |
||
111 | * @param array $params: |
||
0 ignored issues
–
show
There is no parameter named
$params: . Did you maybe mean $params ?
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit. Consider the following example. The parameter /**
* @param array $germany
* @param array $ireland
*/
function finale($germany, $island) {
return "2:1";
}
The most likely cause is that the parameter was changed, but the annotation was not. ![]() |
|||
112 | * mixed 'instance' Output parameter. must contain the new instance |
||
113 | * string 'type' the type of the new renderer |
||
114 | * array 'row' the base properties identifying the renderer (id, name, description, rank) |
||
115 | * Report 'report' the report |
||
116 | * |
||
117 | * @return void |
||
118 | */ |
||
119 | public function tracker_report_renderer_instance($params) { |
||
120 | if ($params['type'] == self::RENDERER_TYPE) { |
||
121 | //First retrieve specific properties of the renderer that are not saved in the generic table |
||
122 | if ( !isset($row['field_id']) ) { |
||
0 ignored issues
–
show
The variable
$row seems only to be defined at a later point. As such the call to isset() seems to always evaluate to false .
This check marks calls to This is likely the result of code being shifted around. Consider removing these calls. ![]() |
|||
123 | $row['field_id'] = null; |
||
124 | if ($params['store_in_session']) { |
||
125 | $this->report_session = new Tracker_Report_Session($params['report']->id); |
||
126 | $this->report_session->changeSessionNamespace("renderers.{$params['row']['id']}"); |
||
127 | $row['field_id'] = $this->report_session->get("field_id"); |
||
128 | } |
||
129 | if (!$row['field_id']) { |
||
130 | $dao = new Cardwall_RendererDao(); |
||
131 | $cardwall_row = $dao->searchByRendererId($params['row']['id'])->getRow(); |
||
132 | if ($cardwall_row) { |
||
133 | $row['field_id'] = $cardwall_row['field_id']; |
||
134 | } |
||
135 | } |
||
136 | } |
||
137 | |||
138 | $report = $params['report']; |
||
139 | $config = new Cardwall_OnTop_ConfigEmpty(); |
||
140 | |||
141 | if ($report->tracker_id != 0) { |
||
142 | $config = $this->getConfigFactory()->getOnTopConfigByTrackerId($report->tracker_id); |
||
143 | } |
||
144 | //Build the instance from the row |
||
145 | $params['instance'] = new Cardwall_Renderer( |
||
146 | $this, |
||
147 | $config, |
||
148 | $params['row']['id'], |
||
149 | $params['report'], |
||
150 | $params['row']['name'], |
||
151 | $params['row']['description'], |
||
152 | $params['row']['rank'], |
||
153 | $row['field_id'], |
||
154 | $this->getPluginInfo()->getPropVal('display_qr_code') |
||
0 ignored issues
–
show
The method
getPropVal does only exist in ArchiveDeletedItemsPlugi... and CardwallPluginInfo , but not in AdminDelegationPluginInf...gileDashboardPluginInfo .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
155 | ); |
||
156 | if ($params['store_in_session']) { |
||
157 | $params['instance']->initiateSession(); |
||
158 | } |
||
159 | } |
||
160 | } |
||
161 | |||
162 | public function getPluginInfo() { |
||
163 | if (!is_a($this->pluginInfo, 'CardwallPluginInfo')) { |
||
164 | $this->pluginInfo = new CardwallPluginInfo($this); |
||
165 | } |
||
166 | return $this->pluginInfo; |
||
167 | } |
||
168 | |||
169 | public function cssfile($params) { |
||
170 | // Only show the stylesheet if we're actually in the Cardwall pages. |
||
171 | // This stops styles inadvertently clashing with the main site. |
||
172 | if ($this->isAgileDashboardOrTrackerUrl() || |
||
173 | strpos($_SERVER['REQUEST_URI'], '/my/') === 0 || |
||
174 | strpos($_SERVER['REQUEST_URI'], '/projects/') === 0 || |
||
175 | strpos($_SERVER['REQUEST_URI'], '/widgets/') === 0 ) { |
||
176 | echo '<link rel="stylesheet" type="text/css" href="'. $this->getThemePath() .'/css/style.css" />'; |
||
177 | } |
||
178 | } |
||
179 | |||
180 | public function javascript_file($params) { |
||
181 | // Only show the js if we're actually in the Cardwall pages. |
||
182 | // This stops styles inadvertently clashing with the main site. |
||
183 | if ($this->isAgileDashboardOrTrackerUrl() && $this->canUseStandardJavsacript()) { |
||
184 | echo $this->getJavascriptIncludesForScripts(array( |
||
185 | 'ajaxInPlaceEditorExtensions.js', |
||
186 | 'cardwall.js', |
||
187 | 'script.js', |
||
188 | 'custom-mapping.js', |
||
189 | 'CardsEditInPlace.js', |
||
190 | 'fullscreen.js', |
||
191 | )); |
||
192 | } |
||
193 | } |
||
194 | |||
195 | /** |
||
196 | * @see Event::TRACKER_EVENT_MANAGE_SEMANTICS |
||
197 | */ |
||
198 | public function tracker_event_manage_semantics($parameters) { |
||
199 | $tracker = $parameters['tracker']; |
||
200 | /* @var $semantics Tracker_SemanticCollection */ |
||
201 | $semantics = $parameters['semantics']; |
||
202 | |||
203 | |||
204 | $card_fields_semantic = Cardwall_Semantic_CardFields::load($tracker); |
||
205 | $semantics->add($card_fields_semantic->getShortName(), $card_fields_semantic); |
||
206 | } |
||
207 | |||
208 | /** |
||
209 | * @see TRACKER_EVENT_SEMANTIC_FROM_XML |
||
210 | */ |
||
211 | public function tracker_event_semantic_from_xml($params) { |
||
212 | $tracker = $params['tracker']; |
||
213 | $xml = $params['xml']; |
||
214 | $xml_mapping = $params['xml_mapping']; |
||
215 | $type = $params['type']; |
||
216 | |||
217 | if ($type == Cardwall_Semantic_CardFields::NAME) { |
||
218 | $params['semantic'] = Cardwall_Semantic_CardFieldsFactory::instance()->getInstanceFromXML($xml, $xml_mapping, $tracker); |
||
219 | } |
||
220 | } |
||
221 | |||
222 | /** |
||
223 | * @see TRACKER_EVENT_GET_SEMANTIC_FACTORIES |
||
224 | */ |
||
225 | public function tracker_event_get_semantic_factories($params) { |
||
226 | $params['factories'][] = Cardwall_Semantic_CardFieldsFactory::instance(); |
||
227 | } |
||
228 | |||
229 | private function getJavascriptIncludesForScripts(array $script_names) { |
||
230 | $html = ''; |
||
231 | foreach ($script_names as $script_name) { |
||
232 | $html .= '<script type="text/javascript" src="'.$this->getPluginPath().'/js/'.$script_name.'"></script>'."\n"; |
||
233 | } |
||
234 | return $html; |
||
235 | } |
||
236 | |||
237 | private function isAgileDashboardOrTrackerUrl() { |
||
238 | return (defined('AGILEDASHBOARD_BASE_DIR') && |
||
239 | strpos($_SERVER['REQUEST_URI'], AGILEDASHBOARD_BASE_URL.'/') === 0 || |
||
240 | strpos($_SERVER['REQUEST_URI'], TRACKER_BASE_URL.'/') === 0); |
||
241 | } |
||
242 | |||
243 | private function canUseStandardJavsacript() { |
||
244 | $use_standard = true; |
||
245 | |||
246 | $em = EventManager::instance(); |
||
247 | $em->processEvent( |
||
248 | CARDWALL_EVENT_USE_STANDARD_JAVASCRIPT, |
||
249 | array( |
||
250 | 'use_standard' => &$use_standard |
||
251 | ) |
||
252 | ); |
||
253 | |||
254 | return $use_standard; |
||
255 | } |
||
256 | |||
257 | public function javascript($params) { |
||
258 | include $GLOBALS['Language']->getContent('script_locale', null, 'cardwall', '.js'); |
||
259 | echo "var tuleap = tuleap || { };".PHP_EOL; |
||
260 | echo "tuleap.cardwall = tuleap.cardwall || { };".PHP_EOL; |
||
261 | echo "tuleap.cardwall.base_url = '". CARDWALL_BASE_URL ."/';".PHP_EOL; |
||
262 | echo PHP_EOL; |
||
263 | } |
||
264 | |||
265 | private function denyAccess($tracker_id) { |
||
0 ignored issues
–
show
|
|||
266 | $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied')); |
||
267 | $GLOBALS['Response']->redirect(TRACKER_BASE_URL.'/?tracker='. $tracker_id); |
||
268 | } |
||
269 | |||
270 | /** |
||
271 | * @see Event::AGILEDASHBOARD_EVENT_GET_CARD_FIELDS |
||
272 | */ |
||
273 | public function agiledashboard_event_get_card_fields($parameters) { |
||
274 | $parameters['card_fields_semantic'] = Cardwall_Semantic_CardFields::load($parameters['tracker']); |
||
275 | } |
||
276 | |||
277 | public function agiledashboard_event_additional_panes_on_milestone($params) { |
||
278 | $pane_info = $this->getPaneInfo($params['milestone']); |
||
279 | |||
280 | if (! $pane_info) { |
||
281 | return; |
||
282 | } |
||
283 | |||
284 | if ($params['request']->get('pane') == Cardwall_PaneInfo::IDENTIFIER) { |
||
285 | $pane_info->setActive(true); |
||
286 | $params['active_pane'] = $this->getCardwallPane($pane_info, $params['milestone'], $params['user'], $params['milestone_factory']); |
||
287 | } |
||
288 | $params['panes'][] = $pane_info; |
||
289 | } |
||
290 | |||
291 | public function agiledashboard_event_additional_panes_info_on_milestone($params) { |
||
292 | $pane_info = $this->getPaneInfo($params['milestone']); |
||
293 | |||
294 | if (! $pane_info) { |
||
295 | return; |
||
296 | } |
||
297 | |||
298 | $params['pane_info_list'][] = $pane_info; |
||
299 | } |
||
300 | |||
301 | private function getPaneInfo($milestone) { |
||
302 | $tracker = $milestone->getArtifact()->getTracker(); |
||
303 | |||
304 | if (! $this->getOnTopDao()->isEnabled($tracker->getId())) { |
||
305 | return; |
||
306 | } |
||
307 | |||
308 | return new Cardwall_PaneInfo($milestone, $this->getThemePath()); |
||
309 | } |
||
310 | |||
311 | public function agiledashboard_event_index_page($params) { |
||
312 | // Only display a cardwall if there is something to display |
||
313 | if ($params['milestone'] && $params['milestone']->getPlannedArtifacts() && count($params['milestone']->getPlannedArtifacts()->getChildren()) > 0) { |
||
314 | $pane_info = new Cardwall_PaneInfo($params['milestone'], $this->getThemePath()); |
||
315 | $params['pane'] = $this->getCardwallPane($pane_info, $params['milestone'], $params['user'], $params['milestone_factory']); |
||
316 | } |
||
317 | } |
||
318 | |||
319 | protected function getCardwallPane(Cardwall_PaneInfo $info, Planning_Milestone $milestone, PFUser $user, Planning_MilestoneFactory $milestone_factory) { |
||
320 | $config = $this->getConfigFactory()->getOnTopConfigByPlanning($milestone->getPlanning()); |
||
321 | if ($config) { |
||
322 | return new Cardwall_Pane( |
||
323 | $info, |
||
324 | $milestone, |
||
325 | $config, |
||
326 | $user, |
||
327 | $milestone_factory |
||
328 | ); |
||
329 | } |
||
330 | return null; |
||
331 | } |
||
332 | |||
333 | public function agiledashboard_event_milestone_selector_redirect($params) { |
||
334 | if ($params['milestone']->getArtifact()) { |
||
335 | $tracker = $params['milestone']->getArtifact()->getTracker(); |
||
336 | if ($this->getOnTopDao()->isEnabled($tracker->getId())) { |
||
337 | $params['redirect_parameters']['pane'] = 'cardwall'; |
||
338 | } |
||
339 | } |
||
340 | } |
||
341 | |||
342 | public function tracker_event_redirect_after_artifact_creation_or_update($params) { |
||
343 | $cardwall = $params['request']->get('cardwall'); |
||
344 | $redirect = $params['redirect']; |
||
345 | if ($cardwall) { |
||
346 | if (!$redirect->stayInTracker()) { |
||
347 | list($redirect_to, $redirect_params) = each($cardwall); |
||
348 | switch ($redirect_to) { |
||
349 | case 'agile': |
||
350 | $this->redirectToAgileDashboard($redirect, $redirect_params); |
||
351 | break; |
||
352 | case 'renderer': |
||
353 | $this->redirectToRenderer($redirect, $redirect_params); |
||
354 | break; |
||
355 | } |
||
356 | } else { |
||
357 | $this->appendCardwallParameter($redirect, $cardwall); |
||
358 | } |
||
359 | } |
||
360 | } |
||
361 | |||
362 | private function redirectToAgileDashboard(Tracker_Artifact_Redirect $redirect, array $redirect_params) { |
||
363 | list($planning_id, $artifact_id) = each($redirect_params); |
||
364 | $planning = PlanningFactory::build()->getPlanning($planning_id); |
||
365 | if ($planning) { |
||
366 | $redirect->base_url = AGILEDASHBOARD_BASE_URL; |
||
367 | $redirect->query_parameters = array( |
||
368 | 'group_id' => $planning->getGroupId(), |
||
369 | 'planning_id' => $planning->getId(), |
||
370 | 'action' => 'show', |
||
371 | 'aid' => $artifact_id, |
||
372 | 'pane' => 'cardwall', |
||
373 | ); |
||
374 | } |
||
375 | } |
||
376 | |||
377 | private function redirectToRenderer(Tracker_Artifact_Redirect $redirect, array $redirect_params) { |
||
378 | list($report_id, $renderer_id) = each($redirect_params); |
||
379 | $redirect->base_url = TRACKER_BASE_URL; |
||
380 | $redirect->query_parameters = array( |
||
381 | 'report' => $report_id, |
||
382 | 'renderer' => $renderer_id, |
||
383 | ); |
||
384 | } |
||
385 | |||
386 | public function tracker_event_build_artifact_form_action($params) { |
||
387 | $cardwall = $params['request']->get('cardwall'); |
||
388 | if ($cardwall) { |
||
389 | $this->appendCardwallParameter($params['redirect'], $cardwall); |
||
390 | } |
||
391 | } |
||
392 | |||
393 | private function appendCardwallParameter(Tracker_Artifact_Redirect $redirect, $cardwall) { |
||
394 | list($key, $value) = explode('=', urldecode(http_build_query(array('cardwall' => $cardwall)))); |
||
395 | $redirect->query_parameters[$key] = $value; |
||
396 | } |
||
397 | |||
398 | /** |
||
399 | * @param array $params parameters send by Event |
||
400 | * Parameters: |
||
401 | * 'project' => The given project |
||
402 | * 'into_xml' => The SimpleXMLElement to fill in |
||
403 | */ |
||
404 | public function agiledashboard_export_xml ($params) { |
||
405 | $tracker_factory = TrackerFactory::instance(); |
||
406 | |||
407 | $cardwall_xml_export = new CardwallConfigXmlExport( |
||
408 | $params['project'], |
||
409 | $tracker_factory, |
||
410 | $this->getConfigFactory(), |
||
411 | new XML_RNGValidator() |
||
412 | ); |
||
413 | |||
414 | $cardwall_xml_export->export($params['into_xml']); |
||
415 | } |
||
416 | |||
417 | /** |
||
418 | * |
||
419 | * @param array $params |
||
420 | * @see Event::IMPORT_XML_PROJECT_TRACKER_DONE |
||
421 | */ |
||
422 | public function import_xml_project_tracker_done($params) { |
||
423 | $cardwall_ontop_import = new CardwallConfigXmlImport( |
||
424 | $params['project_id'], |
||
425 | $params['mapping'], |
||
426 | new Cardwall_OnTop_Dao, |
||
427 | new Cardwall_OnTop_ColumnDao, |
||
428 | EventManager::instance(), |
||
429 | new XML_RNGValidator() |
||
430 | ); |
||
431 | $cardwall_ontop_import->import($params['xml_content']); |
||
432 | } |
||
433 | |||
434 | public function agiledashboard_event_rest_get_milestone($params) { |
||
435 | $config = $this->getConfigFactory()->getOnTopConfig($params['milestone']->getPlanning()->getPlanningTracker()); |
||
436 | if ($config && $config->isEnabled()) { |
||
437 | $params['milestone_representation']->enableCardwall(); |
||
438 | } |
||
439 | } |
||
440 | |||
441 | private function buildRightVersionOfMilestonesCardwallResource($version) { |
||
442 | $class_with_right_namespace = '\\Tuleap\\Cardwall\\REST\\'.$version.'\\MilestonesCardwallResource'; |
||
443 | return new $class_with_right_namespace($this->getConfigFactory()); |
||
444 | } |
||
445 | |||
446 | public function agiledashboard_event_rest_get_cardwall($params) { |
||
447 | $milestones_cardwall = $this->buildRightVersionOfMilestonesCardwallResource($params['version']); |
||
448 | |||
449 | $params['cardwall'] = $milestones_cardwall->get($params['milestone']); |
||
450 | |||
451 | } |
||
452 | |||
453 | /** |
||
454 | * Fetches HTML |
||
455 | * |
||
456 | * @param array $params parameters sent by Event |
||
457 | * |
||
458 | * Parameters: |
||
459 | * 'tracker' => The planning tracker |
||
460 | * 'view' => A string of HTML |
||
461 | */ |
||
462 | public function agiledashboard_event_planning_config($params) { |
||
463 | $tracker = $params['tracker']; |
||
464 | $config = $this->getConfigFactory()->getOnTopConfig($tracker); |
||
465 | |||
466 | $admin_view = new Cardwall_OnTop_Config_View_Admin(); |
||
467 | $params['view'] = $admin_view->displayAdminOnTop($config); |
||
468 | } |
||
469 | |||
470 | public function agiledashboard_event_is_cardwall_enabled($params) { |
||
471 | $tracker = $params['tracker']; |
||
472 | $params['enabled'] = $this->getConfigFactory() |
||
473 | ->isOnTopConfigEnabledForPlanning($tracker); |
||
474 | } |
||
475 | |||
476 | /** |
||
477 | * @param array $params parameters sent by Event |
||
478 | * |
||
479 | * Parameters: |
||
480 | * 'tracker' => The planning tracker |
||
481 | * 'request' => The Request |
||
482 | */ |
||
483 | public function agiledashboard_event_planning_config_update($params) { |
||
484 | $request = $params['request']; |
||
485 | $request->set('use_freestyle_columns', 1); |
||
486 | |||
487 | $this->getConfigFactory()->getOnTopConfigUpdater($params['tracker']) |
||
488 | ->process($request); |
||
489 | } |
||
490 | |||
491 | /** |
||
492 | * @return Cardwall_OnTop_Dao |
||
493 | */ |
||
494 | private function getOnTopDao() { |
||
495 | return new Cardwall_OnTop_Dao(); |
||
496 | } |
||
497 | |||
498 | /** |
||
499 | * @return Cardwall_OnTop_ColumnDao |
||
500 | */ |
||
501 | private function getOnTopColumnDao() { |
||
502 | return new Cardwall_OnTop_ColumnDao(); |
||
503 | } |
||
504 | |||
505 | /** |
||
506 | * @return Cardwall_OnTop_ColumnMappingFieldDao |
||
507 | */ |
||
508 | private function getOnTopColumnMappingFieldDao() { |
||
509 | return new Cardwall_OnTop_ColumnMappingFieldDao(); |
||
510 | } |
||
511 | |||
512 | /** |
||
513 | * @return Cardwall_OnTop_ColumnMappingFieldValueDao |
||
514 | */ |
||
515 | private function getOnTopColumnMappingFieldValueDao() { |
||
516 | return new Cardwall_OnTop_ColumnMappingFieldValueDao(); |
||
517 | } |
||
518 | |||
519 | public function process(Codendi_Request $request) { |
||
520 | switch($request->get('action')) { |
||
521 | case 'toggle_user_autostack_column': |
||
522 | $display_preferences_controller = new Cardwall_UserPreferences_UserPreferencesController($request); |
||
523 | $display_preferences_controller->toggleAutostack(); |
||
524 | break; |
||
525 | |||
526 | case 'toggle_user_display_avatar': |
||
527 | $display_preferences_controller = new Cardwall_UserPreferences_UserPreferencesController($request); |
||
528 | $display_preferences_controller->toggleUserDisplay(); |
||
529 | break; |
||
530 | |||
531 | case 'get-card': |
||
532 | try { |
||
533 | $single_card_builder = new Cardwall_SingleCardBuilder( |
||
534 | $this->getConfigFactory(), |
||
535 | new Cardwall_CardFields( |
||
536 | UserManager::instance(), |
||
537 | Tracker_FormElementFactory::instance() |
||
538 | ), |
||
539 | Tracker_ArtifactFactory::instance(), |
||
540 | PlanningFactory::build() |
||
541 | ); |
||
542 | $controller = new Cardwall_CardController( |
||
543 | $request, |
||
544 | $single_card_builder->getSingleCard( |
||
545 | $request->getCurrentUser(), |
||
546 | $request->getValidated('id', 'uint', 0), |
||
547 | $request->getValidated('planning_id', 'uint', 0) |
||
548 | ) |
||
549 | ); |
||
550 | $controller->getCard(); |
||
551 | } catch (Exception $exception) { |
||
552 | $GLOBALS['Response']->addFeedback(Feedback::ERROR, $exception->getMessage()); |
||
553 | $GLOBALS['Response']->sendStatusCode(400); |
||
554 | } |
||
555 | break; |
||
556 | |||
557 | default: |
||
558 | echo 'Hello !'; |
||
559 | } |
||
560 | } |
||
561 | |||
562 | public function agiledashboard_event_rest_resources($params) { |
||
563 | $injector = new Cardwall_REST_ResourcesInjector(); |
||
564 | $injector->populate($params['restler']); |
||
565 | } |
||
566 | } |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
integer
values, zero is a special case, in particular the following results might be unexpected: