connect(); $_SESSION['m_admin']['aggregationtype']['structures'] = array(); $this->query("select doctypes_first_level_id from ".$_SESSION['tablename']['fold_aggregationtypes_doctypes_level1']." where foldertype_id = ".$id); while($res = $this->fetch_object()) { array_push($_SESSION['m_admin']['aggregationtype']['structures'], $res->doctypes_first_level_id); } $_SESSION['m_admin']['doctypes'] = array(); for($i=0;$i< count($_SESSION['m_admin']['aggregationtype']['structures']);$i++) { $tmp = array(); $this->query("select d.description, d.type_id from ".$_SESSION['tablename']['doctypes']." d where d.doctypes_first_level_id = ".$_SESSION['m_admin']['aggregationtype']['structures'][$i]); while($res = $this->fetch_object()) { $type_id = $res->type_id; if(!in_array($type_id, $tmp)) { array_push($tmp, $type_id); array_push($_SESSION['m_admin']['doctypes'], array('ID' => $type_id, 'COMMENT' => $this->show_string($res->description))); } } } $_SESSION['m_admin']['aggregationtype']['doctypes'] = array(); $this->query("select d.description, fd.doctype_id from ".$_SESSION['tablename']['fold_aggregationtypes_doctypes']." fd, ".$_SESSION['tablename']['doctypes']." d where d.type_id = fd.doctype_id and fd.foldertype_id = ".$id." order by d.description "); while($res = $this->fetch_object()) { //array_push($_SESSION['m_admin']['aggregationtype']['doctypes'], array('id'=>$res->doctype_id, 'label' => $res->description)); array_push($_SESSION['m_admin']['aggregationtype']['doctypes'], $res->doctype_id); } $_SESSION['m_admin']['load_doctypes'] = false; } /** * Form for the management of the aggregationtype. * * @param string $mode administrator mode (modification, suspension, authorization, delete) * @param string $id aggregationtype identifier (empty by default) */ public function formaggregationtype($mode,$id = "") { $func = new functions(); $state = true; require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_security.php"); $sec = new security(); $_SESSION['m_admin']['aggregationtype']['COLL_ID']= ""; if($mode == "up") { $_SESSION['m_admin']['mode'] = "up"; if(empty($_SESSION['error'])) { $this->connect(); $this->query("select * from ".$_SESSION['tablename']['fold_aggregationtypes']." where foldertype_id = ".$id); if($this->nb_result() == 0) { $_SESSION['error'] = _AGGREGATIONTYPE_MISSING; $state = false; } else { $_SESSION['m_admin']['aggregationtype']['aggregationtypeId'] = $id; $line = $this->fetch_object(); $_SESSION['m_admin']['aggregationtype']['desc'] = $this->show_string($line->aggregationtype_label); $_SESSION['m_admin']['aggregationtype']['comment'] = $this->show_string($line->maarch_comment); $_SESSION['m_admin']['aggregationtype']['indexes'] = $this->get_indexes($id, 'minimal'); $_SESSION['m_admin']['aggregationtype']['mandatory_indexes'] = $this->get_mandatory_indexes($id); if (!isset($_SESSION['m_admin']['load_doctypes']) || $_SESSION['m_admin']['load_doctypes'] == true) { $this->load_doctypes($id); $_SESSION['m_admin']['load_doctypes'] = false; } $_SESSION['m_admin']['aggregationtype']['COLL_ID'] = $line->coll_id; $table_view = $sec->retrieve_view_from_coll_id($_SESSION['m_admin']['aggregationtype']['COLL_ID']); $this->query("select count(*) as total_doc from ".$table_view." where foldertype_id = ".$_SESSION['m_admin']['aggregationtype']['aggregationtypeId']); //$this->show(); $line = $this->fetch_object(); $total_doc = $line->total_doc; } } } else { $_SESSION['m_admin']['aggregationtype']['indexes'] = array(); $_SESSION['m_admin']['aggregationtype']['mandatory_indexes'] = array(); } //$this->show_array($_SESSION['m_admin']); if($mode == "add") { echo '
'._AGGREGATIONTYPE_ADDITION.'
'._AGGREGATIONTYPE_MODIFICATION.'