CRM/Queue - Code style
[civicrm-core.git] / CRM / Queue / Menu.php
1 <?php
2
3 /*
4 +--------------------------------------------------------------------+
5 | CiviCRM version 4.6 |
6 +--------------------------------------------------------------------+
7 | Copyright CiviCRM LLC (c) 2004-2014 |
8 +--------------------------------------------------------------------+
9 | This file is a part of CiviCRM. |
10 | |
11 | CiviCRM is free software; you can copy, modify, and distribute it |
12 | under the terms of the GNU Affero General Public License |
13 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | |
15 | CiviCRM is distributed in the hope that it will be useful, but |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. |
19 | |
20 | You should have received a copy of the GNU Affero General Public |
21 | License and the CiviCRM Licensing Exception along |
22 | with this program; if not, contact CiviCRM LLC |
23 | at info[AT]civicrm[DOT]org. If you have questions about the |
24 | GNU Affero General Public License or the licensing of CiviCRM, |
25 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
26 +--------------------------------------------------------------------+
27 */
28
29 /**
30 * This file hard-codes the path entries for the queueing UI, which
31 * allows us to use these paths during upgrades.
32 *
33 * @package CRM
34 * @copyright CiviCRM LLC (c) 2004-2014
35 * $Id$
36 *
37 */
38
39 require_once 'CRM/Core/I18n.php';
40
41 /**
42 * Class CRM_Queue_Menu
43 */
44 class CRM_Queue_Menu {
45
46 /**
47 * @param string $path
48 * The path for which we are trying to locate the route.
49 * @param array $menuPath
50 * The route.
51 */
52 public static function alter($path, &$menuPath) {
53 switch ($path) {
54 case 'civicrm/queue/runner':
55 case 'civicrm/upgrade/queue/runner':
56 $menuPath['path'] = $path;
57 $menuPath['title'] = 'Queue Runner';
58 $menuPath['page_callback'] = 'CRM_Queue_Page_Runner';
59 $menuPath['access_arguments'][0][] = 'access CiviCRM';
60 $menuPath['access_callback'] = array('CRM_Core_Permission', 'checkMenu');
61 break;
62
63 case 'civicrm/queue/ajax/runNext':
64 case 'civicrm/upgrade/queue/ajax/runNext':
65 $menuPath['path'] = $path;
66 $menuPath['page_callback'] = array('CRM_Queue_Page_AJAX', 'runNext');
67 $menuPath['access_arguments'][0][] = 'access CiviCRM';
68 $menuPath['access_callback'] = array('CRM_Core_Permission', 'checkMenu');
69 break;
70
71 case 'civicrm/queue/ajax/skipNext':
72 case 'civicrm/upgrade/queue/ajax/skipNext':
73 $menuPath['path'] = $path;
74 $menuPath['page_callback'] = array('CRM_Queue_Page_AJAX', 'skipNext');
75 $menuPath['access_arguments'][0][] = 'access CiviCRM';
76 $menuPath['access_callback'] = array('CRM_Core_Permission', 'checkMenu');
77 break;
78
79 case 'civicrm/queue/ajax/onEnd':
80 case 'civicrm/upgrade/queue/ajax/onEnd':
81 $menuPath['path'] = $path;
82 $menuPath['page_callback'] = array('CRM_Queue_Page_AJAX', 'onEnd');
83 $menuPath['access_arguments'][0][] = 'access CiviCRM';
84 $menuPath['access_callback'] = array('CRM_Core_Permission', 'checkMenu');
85 break;
86
87 default:
88 // unrecognized
89 }
90 }
91 }