case "up":
        $transformation->rank--;
        break;
    case "down":
        $transformation->rank++;
        break;
    default:
}
$transf_to_move = new CEAITransformation();
$transf_to_move->actor_class = $transformation->actor_class;
$transf_to_move->actor_id = $transformation->actor_id;
$transf_to_move->rank = $transformation->rank;
$transf_to_move->loadMatchingObject();
if ($transf_to_move->_id) {
    $direction == "up" ? $transf_to_move->rank++ : $transf_to_move->rank--;
    $transf_to_move->store();
}
$transformation->store();
/** @var CInteropActor $actor */
$actor = new $transformation->actor_class();
$actor->load($transformation->actor_id);
/** @var CEAITransformation[] $transformations */
$transformations = $actor->loadBackRefs("transformations", "rank");
$i = 1;
foreach ($transformations as $_transformation) {
    $_transformation->rank = $i;
    $_transformation->store();
    $i++;
}
CAppUI::stepAjax("CEAITransformation-msg-Move rank done");
CApp::rip();
 * Link transformations
 *
 * @category EAI
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  SVN: $Id:$
 * @link     http://www.mediboard.org
 */
CCanDo::checkAdmin();
$actor_guid = CValue::post("actor_guid");
$event_name = CValue::post("event_name");
$transformation_rules = CValue::post("transformation_rules", array());
/** @var CInteropActor $actor */
$actor = CMbObject::loadFromGuid($actor_guid);
$event = new $event_name();
// Ajout des transformations à l'acteur
foreach ($transformation_rules as $_transf_rule_id) {
    $transformation_rule = new CEAITransformationRule();
    $transformation_rule->load($_transf_rule_id);
    $transformation = new CEAITransformation();
    $transformation->bindTransformationRule($transformation_rule, $actor);
    $transformation->message = $event_name;
    if ($msg = $transformation->store()) {
        CAppUI::setMsg($msg, UI_MSG_ERROR);
    } else {
        CAppUI::setMsg("CEAITransformation-msg-modify");
    }
}
echo CAppUI::getMsg();
CApp::rip();