本文整理汇总了PHP中eZPolicyLimitation::setAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP eZPolicyLimitation::setAttribute方法的具体用法?PHP eZPolicyLimitation::setAttribute怎么用?PHP eZPolicyLimitation::setAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZPolicyLimitation
的用法示例。
在下文中一共展示了eZPolicyLimitation::setAttribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createNew
static function createNew($policyID, $identifier)
{
$policyParameter = new eZPolicyLimitation(array());
$policyParameter->setAttribute('policy_id', $policyID);
$policyParameter->setAttribute('identifier', $identifier);
$policyParameter->store();
return $policyParameter;
}
示例2: limitationList
function limitationList($useCache = true, $ignoreLimitIdentifier = false)
{
if (!isset($this->Limitations) || !$useCache) {
$limitations = eZPersistentObject::fetchObjectList(eZPolicyLimitation::definition(), null, array('policy_id' => $this->attribute('id')), null, null, true);
eZDebugSetting::writeDebug('kernel-policy-limitation', $limitations, "before policy limitations " . $this->ID);
eZDebugSetting::writeDebug('kernel-policy-limitation', $this, "policy itself before before limitations check");
if ($ignoreLimitIdentifier === false && isset($this->LimitIdentifier) && $this->LimitIdentifier) {
$limitIdentifier = $this->attribute('limit_identifier');
$limitValue = $this->attribute('limit_value');
$limitationTouched = false;
$checkEmptyLimitation = true;
foreach ($limitations as $limitation) {
if ($limitation->attribute('identifier') == $limitIdentifier) {
if ($limitIdentifier == 'Subtree') {
$limitationTouched = true;
$values = $limitation->attribute('values');
foreach ($values as $limitationValue) {
$value = $limitationValue->attribute('value');
if (strpos($value, $limitValue) === 0) {
$checkEmptyLimitation = false;
eZDebugSetting::writeDebug('kernel-policy-limitation', $value, "Limitationvalue has been left in the limitation [limitValue={$limitValue}]");
} else {
if (strpos($limitValue, $value) === 0) {
$checkEmptyLimitation = false;
$limitationValue->setAttribute('value', $limitValue);
eZDebugSetting::writeDebug('kernel-policy-limitation', $value, "Limitationvalue has been exchanged to the value from cond assignment [limitValue={$limitValue}]");
} else {
eZDebugSetting::writeDebug('kernel-policy-limitation', $value, "Limitationvalue has been removed from limitation [limitValue={$limitValue}]");
//exlude limitation value from limitation..
unset($limitationValue);
}
}
}
if ($checkEmptyLimitation) {
eZDebugSetting::writeDebug('kernel-policy-limitation', $this, 'The policy has been disabled');
$this->Disabled = true;
$this->Limitations = array();
return $this->Limitations;
}
}
}
}
if (!$limitationTouched) {
$policyLimitation = new eZPolicyLimitation(array('id' => -1, 'policy_id' => $this->attribute('id'), 'identifier' => $this->attribute('limit_identifier')));
$policyLimitation->setAttribute('limit_value', $this->attribute('limit_value'));
$limitations[] = $policyLimitation;
}
}
eZDebugSetting::writeDebug('kernel-policy-limitation', $limitations, "policy limitations " . $this->ID);
$this->Limitations = $limitations;
}
return $this->Limitations;
}