*/ CCanDo::checkAdmin(); $transformation_id_move = CValue::post("transformation_id_move"); $direction = CValue::post("direction"); $transformation = new CEAITransformation(); $transformation->load($transformation_id_move); switch ($direction) { 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;
* 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();
<?php /** * Edit transformaiton rule EAI * * @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(); $transformation_id = CValue::getOrSession("transformation_id"); $event_class = CValue::getOrSession("event_class"); $message_class = CValue::getOrSession("message_class"); $transformation = new CEAITransformation(); $transformation->load($transformation_id); $transformation->loadRefActor(); // Création du template $smarty = new CSmartyDP(); $smarty->assign("transformation", $transformation); $smarty->assign("event_class", $event_class); $smarty->assign("message_class", $message_class); $smarty->display("inc_edit_transformation.tpl");
* @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::getOrSession("actor_guid"); $event_class = CValue::getOrSession("event_class"); $message_class = CValue::getOrSession("message_class"); /** @var CInteropActor $actor */ $actor = CMbObject::loadFromGuid($actor_guid); $event = new $event_class(); /** @var CInteropNorm $message */ $message = new $message_class(); $transformation = new CEAITransformation(); $transformation->actor_id = $actor->_id; $transformation->actor_class = $actor->_class; $transformations = $transformation->loadMatchingList(); // On charge la liste des règles possibles en fonction des propriétés de l'évènement $transf_rule = new CEAITransformationRule(); $transf_rules = array(); if ($where = $transf_rule->bindObject($message, $event)) { $transf_rules = $transf_rule->loadList($where, "rank"); } // Création du template $smarty = new CSmartyDP(); $smarty->assign("actor", $actor); $smarty->assign("event", $event); $smarty->assign("transf_rules", $transf_rules); $smarty->assign("transformation", $transformation);
/** * @see parent::store */ function store() { if (!$this->_id) { $transformation = new CEAITransformation(); $transformation->actor_id = $this->actor_id; $transformation->actor_class = $this->actor_class; $this->rank = $transformation->countMatchingList() + 1; } return parent::store(); }