Ejemplo n.º 1
0
 /**
  * @param sfWebRequest $request
  */
 public function executeSelectMapping(sfWebRequest $request)
 {
     $this->getContext()->getConfiguration()->loadHelpers(array('Url', 'I18N', 'Date', 'Tag', 'Number', 'Text', 'Partial'));
     // Appel AJAX requis.
     $this->forward404Unless($request->isXmlHttpRequest());
     $this->setLayout(sfView::NONE);
     $this->getResponse()->setContentType('application/json');
     // Vérifications du projet et du profil.
     $this->checkProject($request);
     $this->checkProfile($request, $this->ei_project);
     //**************************************************************************************************************
     // RECUPERATION ET VERIFICATIONS DES OBJETS : SCENARIO, NOEUD ROOT STRUCTURE,
     // CHEMIN DEPUIS SCENARIO.
     // Récupération & vérification du scénario.
     $this->ei_scenario = Doctrine_Core::getTable('EiScenario')->find($this->request->getParameter('ei_scenario_id'));
     $this->forward404Unless($this->ei_scenario);
     // Récupération & vérification du paramètre du block de la structure du scénario.
     $this->ei_block_param_id = $request->getParameter("ei_block_param_id");
     $this->ei_block_param = Doctrine_Core::getTable("EiBlockParam")->find($this->ei_block_param_id);
     // On récupère la racine du scénario.
     $this->ei_root_node = Doctrine_Core::getTable("EiDataSetStructure")->getRoot($this->ei_scenario->getId());
     $this->forward404Unless($this->ei_block_param);
     $this->forward404Unless($this->ei_root_node);
     /** @var TreeView $treeDisplay */
     $treeDisplay = new TreeView($this->ei_root_node, new ModeSelectTreeStrategy(), array("id" => "datasetstructure_tree_select", "formats" => array("node" => EiNodeDataSet::getFormNameFormat(), "leaf" => EiLeafDataSet::getFormNameFormat()), "actions" => array("select" => array("route" => "eiblockdatasetmapping_do_select_mapping", "parameters" => array('project_id' => $this->project_id, 'project_ref' => $this->project_ref, 'ei_scenario_id' => $this->ei_scenario->getId(), 'profile_name' => $this->profile_name, 'profile_id' => $this->profile_id, 'profile_ref' => $this->profile_ref, 'ei_block_param_id' => $this->ei_block_param_id)))));
     return $this->renderText(json_encode(array("success" => true, "html" => $treeDisplay->render())));
 }
Ejemplo n.º 2
0
 /**
  * Composant permettant d'afficher les paramètres d'un bloc et de les mettre à jour.
  *
  * Comprend l'édition du bloc, l'édition des paramètres ainsi que le mapping avec les noeuds du jeu de données.
  *
  * @param sfWebRequest $request
  */
 public function executeShowParams(sfWebRequest $request)
 {
     // On récupère le block parent.
     /** @var EiBlock $block */
     $block = Doctrine_Core::getTable("EiVersionStructure")->findBlock($this->ei_version_structure_id);
     $blockParams = $block->getParams();
     $scenarioId = $this->ei_scenario_id;
     $this->ei_block_parameters = $block->getJSONParameters($block->getAllAscendantsParams());
     // Réupération de la structure du scénario.
     $structures = Doctrine_Core::getTable("EiDataSetStructure")->getTreeArrayForITree($scenarioId);
     // Création du TreeViewer.
     $treeViewer = new TreeViewer("EiDataSetStructure");
     $treeViewer->import($structures);
     $selected = array();
     /** @var EiBlockParam $param */
     foreach ($blockParams as $key => $param) {
         /** @var EiBlockDataSetMapping $mapped */
         $mapped = $param->getMapping(EiBlockDataSetMapping::$TYPE_IN);
         if ($mapped != null) {
             $selected[$key] = $mapped->getEiDatasetStructureId();
         }
     }
     // TreeViewer pour le mapping.
     $this->treeDisplay = new TreeView($treeViewer, new ModeSelectTreeStrategy(), array("baseId" => "datasetstructure_tree_select_" . $block->getId(), "objects" => $blockParams, "selected" => $selected, "formats" => array("node" => EiNodeDataSet::getFormNameFormat(), "leaf" => EiLeafDataSet::getFormNameFormat()), "actions" => array("select" => array("route" => "eiblockdatasetmapping_select_mapping", "parameters" => array('project_id' => $this->project_id, 'project_ref' => $this->project_ref, 'ei_scenario_id' => $scenarioId, 'profile_name' => $this->profile_name, 'profile_id' => $this->profile_id, 'profile_ref' => $this->profile_ref, 'ei_block_param_id' => ':ei_block_param_id'), "target" => ":ei_block_param_id"), "doSelect" => array("route" => "eiblockdatasetmapping_do_select_mapping", "parameters" => array('project_id' => $this->project_id, 'project_ref' => $this->project_ref, 'ei_scenario_id' => $scenarioId, 'profile_name' => $this->profile_name, 'profile_id' => $this->profile_id, 'profile_ref' => $this->profile_ref, 'ei_block_param_id' => ':ei_block_param_id', 'type' => EiBlockDataSetMapping::$TYPE_IN), "target" => ":ei_block_param_id"))));
     $selected = array();
     /** @var EiBlockParam $param */
     foreach ($blockParams as $key => $param) {
         /** @var EiBlockDataSetMapping $mapped */
         $mapped = $param->getMapping(EiBlockDataSetMapping::$TYPE_OUT);
         if ($mapped != null) {
             $selected[$key] = $mapped->getEiDatasetStructureId();
         }
     }
     // TreeViewer pour le mapping.
     $this->treeDisplayOut = new TreeView($treeViewer, new ModeSelectTreeStrategy(), array("baseId" => "datasetstructure_tree_select_out_" . $block->getId(), "objects" => $blockParams, "selected" => $selected, "formats" => array("node" => EiNodeDataSet::getFormNameFormat(), "leaf" => EiLeafDataSet::getFormNameFormat()), "actions" => array("select" => array("route" => "eiblockdatasetmapping_select_mapping", "parameters" => array('project_id' => $this->project_id, 'project_ref' => $this->project_ref, 'ei_scenario_id' => $scenarioId, 'profile_name' => $this->profile_name, 'profile_id' => $this->profile_id, 'profile_ref' => $this->profile_ref, 'ei_block_param_id' => ':ei_block_param_id'), "target" => ":ei_block_param_id"), "doSelect" => array("route" => "eiblockdatasetmapping_do_select_mapping", "parameters" => array('project_id' => $this->project_id, 'project_ref' => $this->project_ref, 'ei_scenario_id' => $scenarioId, 'profile_name' => $this->profile_name, 'profile_id' => $this->profile_id, 'profile_ref' => $this->profile_ref, 'ei_block_param_id' => ':ei_block_param_id', 'type' => EiBlockDataSetMapping::$TYPE_OUT), "target" => ":ei_block_param_id"))));
 }
Ejemplo n.º 3
0
 /**
  * TODO: Optimiser visionneuse de JDD.
  *
  * @param sfWebRequest $request
  */
 public function executeManager(sfWebRequest $request)
 {
     $memoryLimit = ini_get("memory_limit");
     ini_set("memory_limit", "-1");
     /** @var EiDataSet $ei_data_set */
     $ei_data_set = $this->ei_data_set->getEiDataSet();
     $countLines = $ei_data_set->getCountOfLines();
     if ($countLines < 1000) {
         // Réupération de la structure du jeu de données.
         $structures = $ei_data_set->getTreeArrayForITree();
         // Création du TreeViewer.
         $treeViewer = new TreeViewer("EiDataSet");
         $treeViewer->import($structures);
         $this->treeDisplay = new TreeView($treeViewer, new ModeEditTreeStrategy(), array("id" => "dataset_source_tree_" . time(), "formats" => array("node" => EiNodeDataSet::getFormNameFormat(), "leaf" => EiLeafDataSet::getFormNameFormat()), "types" => array("root" => array("icon" => TreeView::$TYPE_XML, "name" => "root"), "node" => array("icon" => TreeView::$TYPE_TAG, "name" => "node"), "attr" => array("icon" => TreeView::$TYPE_XSL_VALUE, "name" => "attribute"), "leaf" => array("icon" => TreeView::$TYPE_VALUE, "name" => "value")), "authorizations" => array("rename" => array("leaf"), "new" => array(), "remove" => array(), "dragndrop" => array()), "init" => array("openAll" => true), "styleMessageResultat" => 2, "styleMessageResultatObject" => '#ei_data_set_content', "actions" => array("rename" => array("route" => "eidataset_rename_value_dataline", "parameters" => array('project_id' => $this->project_id, 'project_ref' => $this->project_ref, 'ei_scenario_id' => $this->ei_scenario->getId(), 'profile_name' => $this->profile_name, 'profile_id' => $this->profile_id, 'profile_ref' => $this->profile_ref, 'ei_data_set_id' => $ei_data_set->getId(), 'ei_data_line_id' => 'ei_node_id'), "target" => "ei_node_id"))));
     } else {
         $this->treeDisplay = null;
     }
     ini_set("memory_limit", $memoryLimit);
 }
Ejemplo n.º 4
0
 /**
  * Action retournant le formulaire d'édition de la structure du jeu de données.
  *
  * @param sfWebRequest $request
  */
 public function executeEdit(sfWebRequest $request)
 {
     // Préparation des éléments relatifs à la vue.
     $this->prepareNodeEdit($request);
     //**************************************************************************************************************
     // RECUPERATION ET VERIFICATIONS DES OBJETS : VERSIONS DU SCENARIO.
     // Récupération & vérification des versions du scénario.
     $this->ei_versions = Doctrine_Core::getTable('EiVersion')->findByEiScenarioId($this->ei_scenario->getId());
     $this->forward404Unless($this->ei_versions);
     // Réupération de la structure du scénario.
     $structures = Doctrine_Core::getTable("EiDataSetStructure")->getTreeArrayForITree($this->ei_scenario->getId());
     // Création du TreeViewer.
     $treeViewer = new TreeViewer("EiDataSetStructure");
     $treeViewer->import($structures);
     $this->treeDisplay = new TreeView($treeViewer, new ModeEditTreeStrategy(), array("id" => "datasetstructure_tree", "formats" => array("node" => EiNodeDataSet::getFormNameFormat(), "leaf" => EiLeafDataSet::getFormNameFormat()), "actions" => array("rename" => array("route" => "eidatasetstructure_rename_node", "parameters" => array('project_id' => $this->project_id, 'project_ref' => $this->project_ref, 'ei_scenario_id' => $this->ei_scenario->getId(), 'profile_name' => $this->profile_name, 'profile_id' => $this->profile_id, 'profile_ref' => $this->profile_ref, 'ei_node_id' => 'ei_node_id'), "target" => "ei_node_id"), "new" => array("route" => "eidatasetstructure_create_node", "parameters" => array('project_id' => $this->project_id, 'project_ref' => $this->project_ref, 'ei_scenario_id' => $this->ei_scenario->getId(), 'profile_name' => $this->profile_name, 'profile_id' => $this->profile_id, 'profile_ref' => $this->profile_ref, 'ei_node_parent_id' => 'ei_node_parent_id'), "target" => "ei_node_parent_id"), "remove" => array("route" => "eidatasetstructure_remove_node", "parameters" => array('project_id' => $this->project_id, 'project_ref' => $this->project_ref, 'ei_scenario_id' => $this->ei_scenario->getId(), 'profile_name' => $this->profile_name, 'profile_id' => $this->profile_id, 'profile_ref' => $this->profile_ref, 'ei_node_id' => 'ei_node_id'), "target" => "ei_node_id"), "dragndrop" => array("route" => "eidatasetstructure_move_node", "parameters" => array('project_id' => $this->project_id, 'project_ref' => $this->project_ref, 'ei_scenario_id' => $this->ei_scenario->getId(), 'profile_name' => $this->profile_name, 'profile_id' => $this->profile_id, 'profile_ref' => $this->profile_ref)))));
 }