Gentics Portal.Node PHP API
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
All
Classes
Namespaces
Functions
Variables
Pages
common
modules
bulk
models
GenerationForm.php
1
<?php
2
/**
3
* Gentics Portal.Node PHP
4
* Author & Copyright (c) by Gentics Software GmbH
5
* sales@gentics.com
6
* http://www.gentics.com
7
* Licenses can be found in the LICENSE.txt file in the root-folder of this installation
8
* You must not use this software without a valid license agreement.
9
*
10
* UserGenerationForm class
11
*
12
*/
13
class
GenerationForm
extends
CFormModel
14
{
15
/**
16
* @var integer
17
* @desc quantity of users to generate
18
*/
19
public
$usersQty;
20
21
public
$likesQty;
22
23
public
$likesContentId;
24
25
public
$commentsQty;
26
27
public
$commentsForEach;
28
29
public
$commentsContentId;
30
31
/**
32
* Declares the validation rules.
33
* The rules state that userQty is required and must be an integer,
34
*
35
* @return array
36
*/
37
public
function
rules
()
38
{
39
return
array(
40
// usersQty is required and must be an integer
41
array(
'usersQty, likesQty, commentsQty'
,
'numerical'
,
'integerOnly'
=>
true
),
42
array(
'commentsForEach'
,
'boolean'
),
43
array(
'likesContentId, commentsContentId'
,
'length'
,
'max'
=> 255),
44
//array('likesContentId, commentsContentId', 'exists'),
45
);
46
}
47
48
/**
49
* Checks if given contentId already exist
50
*
51
* @param string $field defines what field should be checked
52
*
53
* @return bool
54
*/
55
public
function
exists
($field)
56
{
57
if
($field ==
'likesContentId'
&& (!empty($this->likesQty) && empty($this->likesContentId))) {
58
$this->addError(
'likesContentId'
,
'Likes content id can\'t be empty'
);
59
return
false
;
60
}
61
if
($field ==
'commentsContentId'
&& (!empty($this->commentsQty) && empty($this->commentsContentId))) {
62
$this->addError(
'likesContentId'
,
'Comments content id can\'t be empty'
);
63
return
false
;
64
}
65
66
return
true
;
67
}
68
69
/**
70
* Declares attribute labels.
71
*
72
* @return array
73
*/
74
public
function
attributeLabels
()
75
{
76
return
array(
77
'usersQty'
=>
BulkModule::t
(
"Users quantity"
),
78
'likesQty'
=>
BulkModule::t
(
"Likes quantity"
),
79
'commentsQty'
=>
BulkModule::t
(
"Comments quantity"
),
80
'likesForEach'
=>
BulkModule::t
(
"For each user"
),
81
'commentsForEach'
=>
BulkModule::t
(
"For each user"
),
82
'likesContentId'
=>
BulkModule::t
(
"Content id"
),
83
'commentsContentId'
=>
BulkModule::t
(
"Content id"
),
84
);
85
}
86
}
Generated on Thu Feb 6 2014 15:47:54 for Gentics Portal.Node PHP API by
1.8.1.2