本文整理汇总了PHP中RuleAction::addActionByAttributes方法的典型用法代码示例。如果您正苦于以下问题:PHP RuleAction::addActionByAttributes方法的具体用法?PHP RuleAction::addActionByAttributes怎么用?PHP RuleAction::addActionByAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RuleAction
的用法示例。
在下文中一共展示了RuleAction::addActionByAttributes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeAddRule
/**
* @since version 0.83 (before addRule)
*
* @param $input array of values
**/
function executeAddRule($input)
{
$this->check($_POST["affectentity"], UPDATE);
$collection = RuleCollection::getClassByType($_POST['sub_type']);
$rule = $collection->getRuleClass($_POST['sub_type']);
$ruleid = $rule->add($_POST);
if ($ruleid) {
//Add an action associated to the rule
$ruleAction = new RuleAction();
//Action is : affect computer to this entity
$ruleAction->addActionByAttributes("assign", $ruleid, "entities_id", $_POST["affectentity"]);
switch ($_POST['sub_type']) {
case 'RuleRight':
if ($_POST["profiles_id"]) {
$ruleAction->addActionByAttributes("assign", $ruleid, "profiles_id", $_POST["profiles_id"]);
}
$ruleAction->addActionByAttributes("assign", $ruleid, "is_recursive", $_POST["is_recursive"]);
}
}
Event::log($ruleid, "rules", 4, "setup", sprintf(__('%s adds the item'), $_SESSION["glpiname"]));
Html::back();
}
示例2: addRule
function addRule($input)
{
global $LANG;
$this->check($_POST["affectentity"], 'w');
$collection = RuleCollection::getClassByType($_POST['sub_type']);
$rule = $collection->getRuleClass($_POST['sub_type']);
$ruleid = $rule->add($_POST);
if ($ruleid) {
//Add an action associated to the rule
$ruleAction = new RuleAction();
//Action is : affect computer to this entity
$ruleAction->addActionByAttributes("assign", $ruleid, "entities_id", $_POST["affectentity"]);
switch ($_POST['sub_type']) {
case 'RuleRight':
if ($_POST["profiles_id"]) {
$ruleAction->addActionByAttributes("assign", $ruleid, "profiles_id", $_POST["profiles_id"]);
}
$ruleAction->addActionByAttributes("assign", $ruleid, "is_recursive", $_POST["is_recursive"]);
}
}
Event::log($ruleid, "rules", 4, "setup", $_SESSION["glpiname"] . " " . $LANG['log'][22]);
glpi_header($_SERVER['HTTP_REFERER']);
}