Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
Method.Workflow.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
5  * @package FDL
6 */
7 /**
8  * Generated Header (not documented yet)
9  *
10  * @author Anakeen 2000
11  * @version $Id: Method.Workflow.php,v 1.4 2008/08/14 09:59:14 eric Exp $
12  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
13  * @package FDL
14  * @subpackage GED
15  */
16 /**
17  */
18 // ---------------------------------------------------------------
19 // $Id: Method.Workflow.php,v 1.4 2008/08/14 09:59:14 eric Exp $
20 // $Source: /home/cvsroot/anakeen/freedom/freedom/Class/Freedom/Method.Workflow.php,v $
21 // ---------------------------------------------------------------
22 var $defaultedit = "FREEDOM:EDIT_WORKFLOW";
23 var $defaultview = "FREEDOM:VIEW_WORKFLOW:S";
24 
25 function edit_workflow($target = "finfo", $ulink = true, $abstract = "Y")
26 {
27  global $action;
28  include_once ("FDL/editutil.php");
29  //$action->parent->AddJsRef($action->GetParam("CORE_PUBURL")."/FREEDOM/Layout/workflow.js");
30  $this->lay->Set("docid", $this->id);
31  $this->lay->Set("TITLE", $this->title);
32  if (($docid = $this->id) != 0) {
33  $this->lay->Set("onclick", "edit_transition($docid);");
34  } else {
35  $this->lay->Set("onclick", "alert('veuillez valider le document avant d editer les transitions');");
36  }
37 
38  $title = $this->Getattribute("BA_TITLE");
39  $this->lay->Set("name1", $title->getLabel());
40  $value = $this->GetValue($title->id);
41  $this->lay->Set("inputtype1", getHtmlInput($this, $title, $value));
42 
43  $descrip = $this->Getattribute("WOR_DESCRIP");
44  $this->lay->Set("name2", $descrip->getLabel());
45  $value = $this->GetValue($descrip->id);
46  $this->lay->Set("inputtype2", getHtmlInput($this, $descrip, $value));
47 
48  $etat = $this->Getattribute("WOR_ETAT");
49  $this->lay->Set("name3", $etat->getLabel());
50  $value = $this->GetValue($etat->id);
51  $this->lay->Set("inputtype3", getHtmlInput($this, $etat, $value));
52 
53  $tt = $this->Getattribute("WOR_TT");
54  $this->lay->Set("name4", $tt->getLabel());
55  $value = $this->GetValue($tt->id);
56  $this->lay->Set("inputtype4", getHtmlInput($this, $tt, $value));
57 
58  $tt = $this->Getattribute("WOR_FAM");
59  $this->lay->Set("name5", $tt->getLabel());
60  $value = $this->GetValue($tt->id);
61  $this->lay->Set("inputtype5", getHtmlInput($this, $tt, $value));
62 }
63 
64 function view_workflow()
65 {
66  global $action;
67 
68  $nom_etats = explode("\n", $this->GetValue("wor_nometat"));
69  $id_etats = explode("\n", $this->GetValue("wor_idetat"));
70  $idetats_ini = explode("\n", $this->GetValue("wor_trans_idetat_ini"));
71  $idetats_fin = explode("\n", $this->GetValue("wor_trans_idetat_fin"));
72  $descriptions = explode("\n", $this->GetValue("wor_trans_descrip"));
73  $tts = explode("\n", $this->GetValue("wor_trans_tt"));
74  $tab_tts = explode("\n", $this->Getvalue("wor_tt"));
75 
76  while (list($k, $xmlencode) = each($tab_tts)) {
77  $temp = base64_decode($xmlencode);
78  $entete = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" standalone=\"yes\" ?>";
79  $xml = $entete;
80  $xml.= $temp;
81  $id = recup_argument_from_xml($xml, "id_doc");
82  $tab_relation_tts[$id]["xml"] = $xmlencode;
83  $title = recup_argument_from_xml($xml, "title");
84  $tab_relation_tts[$id]["title"] = $title;
85  }
86  //print_r($tab_relation_tts);
87 
88  while (list($k, $v) = each($idetats_ini)) {
89  $descrip[$v][$idetats_fin[$k]] = $descriptions[$k];
90  $type_trans[$v][$idetats_fin[$k]] = $tts[$k];
91  }
92  // print_r($type_trans);
93  $ligne1 = array();
94  reset($nom_etats);
95  $nom_etats2 = $nom_etats;
96  $nom_etats[-1] = "transition_initiale";
97  $id_etats[-1] = "-1";
98  //to be in first
99  $lignes[-1]["etat"] = "transition_initiale";
100  $lignes[-1]["LIGNEEE"] = "LIGNE_transition_initiale:-1";
101 
102  while (list($i, $etat) = each($nom_etats)) {
103  if ($i != - 1) {
104  $ligne1[$i]["nom_etat"] = $etat;
105  // $ligne2[$i]["new_trans"]="";
106  $lignes[$i]["etat"] = $etat;
107  $lignes[$i]["LIGNEEE"] = "LIGNE_$etat";
108  }
109  }
110 
111  $this->lay->setBlockData("LIGNE1", $ligne1);
112  $this->lay->setBlockData("LIGNE2", $ligne2);
113  $this->lay->setBlockData("LIGNES", $lignes);
114 
115  reset($nom_etats);
116 
117  while (list($i, $etat) = each($nom_etats)) {
118  reset($nom_etats2);
119  while (list($x, $etat2) = each($nom_etats2)) {
120 
121  $etat_ini = $etat;
122  // $idetat_ini=$idetats_ini[$i];
123  $idetat_ini = $id_etats[$i];
124  $etat_fin = $etat2;
125  $idetat_fin = $id_etats[$x];
126  // $idetat_fin=$idetats_fin[$x];
127  $result = 100 / sizeof($nom_etats);
128  // printf($result);
129  $id_tt = $type_trans[$idetat_ini][$idetat_fin];
130 
131  if ($id_tt != "") {
132  $inputlay = new Layout("FREEDOM/Layout/input_transition2.xml", $action);
133  $inputlay->set("width", "$result");
134  $inputlay->set("value_descrip", $descrip[$idetat_ini][$idetat_fin]);
135  $xml_tt = $tab_relation_tts["$id_tt"]["xml"];
136  $inputlay->set("xml", $xml_tt);
137  $text_tt = $tab_relation_tts["$id_tt"]["title"];
138  $inputlay->set("text_tt", $text_tt);
139  $inputlay->set("famid", 555);
140 
141  $inte[$i][$x]["input"] = $inputlay->gen();
142  } else {
143  $inte[$i][$x]["input"] = "<td></td>";
144  }
145  }
146  }
147  reset($nom_etats);
148  //$inte[0]["idtt"]="dd";
149  while (list($i, $etat) = each($nom_etats)) {
150  // print_r($inte[$i]);printf("<BR>");
151  $this->lay->setBlockData($lignes[$i]["LIGNEEE"], $inte[$i]);
152  }
153  //$action->lay->gen();
154 
155 }
156 ?>
← centre documentaire © anakeen - published under CC License - Dynacase