wCMF  3.6
 All Classes Namespaces Files Functions Variables Groups Pages
class.AdminController.php
Go to the documentation of this file.
1 <?php
2 /**
3  * wCMF - wemove Content Management Framework
4  * Copyright (C) 2005-2014 wemove digital solutions GmbH
5  *
6  * Licensed under the terms of any of the following licenses
7  * at your choice:
8  *
9  * - GNU Lesser General Public License (LGPL)
10  * http://www.gnu.org/licenses/lgpl.html
11  * - Eclipse Public License (EPL)
12  * http://www.eclipse.org/org/documents/epl-v10.php
13  *
14  * See the license.txt file distributed with this work for
15  * additional information.
16  *
17  * $Id: class.AdminController.php 1462 2014-02-04 23:52:27Z iherwig $
18  */
19 require_once(BASE."wcmf/lib/presentation/class.Controller.php");
20 require_once(BASE."wcmf/lib/presentation/class.WCMFInifileParser.php");
21 require_once(BASE."wcmf/lib/persistence/class.PersistenceFacade.php");
22 require_once(BASE."wcmf/lib/util/class.ObjectFactory.php");
23 
24 /**
25  * @class AdminController
26  * @ingroup Controller
27  * @brief AdminController is used as an entry point to the admintool.
28  *
29  * <b>Input actions:</b>
30  * - unspecified: Display the admintool start screen
31  *
32  * <b>Output actions:</b>
33  * - @em ok In any case
34  *
35  * @param[out] users An array of all user instances
36  * @param[out] roles An array of all role instances
37  * @param[out] configfiles An array of all configuration file names
38  * @param[out] mainconfigfile The name of the main configuration file
39  *
40  * @author ingo herwig <ingo@wemove.com>
41  */
43 {
44  var $_userManager = null;
45 
46  /**
47  * @see Controller::initialize()
48  */
49  function initialize(&$request, &$response)
50  {
51  parent::initialize($request, $response);
52 
53  // create UserManager instance
54  $objectFactory = &ObjectFactory::getInstance();
55  $this->_userManager = &$objectFactory->createInstanceFromConfig('implementation', 'UserManager');
56  }
57  /**
58  * @see Controller::validate()
59  */
60  function validate()
61  {
62  if($this->_userManager == null)
63  {
64  $this->setErrorMsg("No user manager defined.");
65  return false;
66  }
67  return true;
68  }
69  /**
70  * @see Controller::hasView()
71  */
72  function hasView()
73  {
74  return true;
75  }
76  /**
77  * Process action and assign data to View.
78  * @return False (Stop action processing chain).
79  * @see Controller::executeKernel()
80  */
81  function executeKernel()
82  {
83  $persistenceFacade = &PersistenceFacade::getInstance();
84  $this->_userManager->startTransaction();
85 
86  // assign model to view
87  $userType = $this->_userManager->getUserClassName();
88  $this->_response->setValue('userType', $userType);
89  $this->_response->setValue('userTemplateNode', $persistenceFacade->create($userType, BUILDDEPTH_REQUIRED));
90  $roleType = $this->_userManager->getRoleClassName();
91  $this->_response->setValue('roleType', $roleType);
92  $this->_response->setValue('roleTemplateNode', $persistenceFacade->create($roleType, BUILDDEPTH_REQUIRED));
93 
94  $this->_response->setValue('configfiles', WCMFInifileParser::getIniFiles());
95  $this->_response->setValue('mainconfigfile', $GLOBALS['CONFIG_PATH'].$GLOBALS['MAIN_CONFIG_FILE']);
96 
97  $this->_userManager->commitTransaction();
98 
99  // success
100  $this->_response->setAction('ok');
101  return false;
102  }
103 }
104 ?>
Controller is the base class of all controllers. If a Controller has a view it is expected to reside ...
initialize(&$request, &$response)
const BUILDDEPTH_REQUIRED
$GLOBALS['gJSONData']
AdminController is used as an entry point to the admintool.