3
/* vim: set expandtab tabstop=4 shiftwidth=4: */
4
// +----------------------------------------------------------------------+
6
// +----------------------------------------------------------------------+
7
// | Copyright (c) 2000-2009 WS Interactive |
8
// +----------------------------------------------------------------------+
9
// | Automne is subject to version 2.0 or above of the GPL license. |
10
// | The license text is bundled with this package in the file |
11
// | LICENSE-GPL, and is available through the world-wide-web at |
12
// | http://www.gnu.org/copyleft/gpl.html. |
13
// +----------------------------------------------------------------------+
14
// | Author: Antoine Pouch <antoine.pouch@ws-interactive.fr> & |
15
// | Author: S�bastien Pauchet <sebastien.pauchet@ws-interactive.fr> |
16
// +----------------------------------------------------------------------+
18
// $Id: resourcevalidationscatalog.php,v 1.1.1.1 2008/11/26 17:12:06 sebastien Exp $
21
* Class CMS_resourceValidationsCatalog
23
* Manages the catalog of resourceValidations
26
* @subpackage workflow
27
* @author Antoine Pouch <antoine.pouch@ws-interactive.fr> &
28
* @author S�bastien Pauchet <sebastien.pauchet@ws-interactive.fr>
31
class CMS_resourceValidationsCatalog extends CMS_grandFather
34
* Returns a resourceValidation object instance from a DB id or from GetValidationByID function if exists.
37
* @param integer $id the id of the saved object
38
* @return resourceValidation the instance unserialized, false if not found.
41
function getValidationInstance($id,$user=false)
43
if (!SensitiveIO::isPositiveInteger($id) && base64_decode($id) && $user) {
44
//load validation form encoded ID (new validations system)
45
$decodedID = explode('||',base64_decode($id));
46
$module = CMS_modulesCatalog::getByCodename($decodedID[0]);
47
$editions = $decodedID[1];
48
$resourceID = $decodedID[2];
49
if (isset($module) && isset($editions) && isset($resourceID)) {
50
return $module->getValidationByID($resourceID, $user, $editions);
56
serializedObject_rv as data
62
$q = new CMS_query($sql);
64
if ($q->getNumRows()) {
65
$instance = unserialize(stripslashes($q->getValue("data")));
66
$instance->setID($id);
69
parent::raiseError("Unknown id : ".$id);
75
* Returns all the resource validations the user can do
78
* @param CMS_user $user The user we want the validations of
79
* @param string $module_codebame The module codename we want the validations of, if ommitted, validations for all the modules will be returned
80
* @return array(string=>CMS_resourceValidation) The validations to do, indexed by module codename
83
function getValidations(&$user, $module_codename = false)
85
if (!is_a($user, "CMS_user")) {
86
parent::raiseError("User is not a valid CMS_user object");
89
if ($module_codename) {
90
if (!$module = CMS_resourceModulesCatalog::getByCodename($codename)) {
96
$modules = array($module);
98
$modules = CMS_modulesCatalog::getAll();
101
$validations = array();
102
foreach ($modules as $aModule) {
103
if (!$user->hasValidationClearance($aModule->getID())) {
106
$validations_to_add = $aModule->getValidations($user);
107
if ($validations_to_add) {
108
$validations[$aModule->getCodename()] = $validations_to_add;
b'\\ No newline at end of file'