Exemple #1
0
 function mapDocs($object, $with_cancelled, $tri)
 {
     // Documents et fichiers
     $object->loadRefsDocItems($with_cancelled);
     CStoredObject::massLoadFwdRef($object->_ref_documents, "file_category_id");
     foreach ($object->_ref_documents as $_doc) {
         CDocumentItem::makeIconName($_doc);
         $_doc->loadContent(false);
         $_doc->loadRefCategory();
         $_doc->_ref_object = $object;
         $this->_all_docs[$this->makePrefix($tri, $object, $_doc)][] = $_doc;
     }
     CStoredObject::massLoadFwdRef($object->_ref_files, "file_category_id");
     foreach ($object->_ref_files as $_file) {
         CDocumentItem::makeIconName($_file);
         $_file->loadRefCategory();
         $_file->_ref_object = $object;
         $this->_all_docs[$this->makePrefix($tri, $object, $_file)][] = $_file;
     }
     // Formulaires
     $ex_link = new CExLink();
     $ex_link->setObject($object);
     $ex_link->level = "object";
     $ex_links = $ex_link->loadMatchingList();
     $ex_objects = CExLink::massLoadExObjects($ex_links);
     CStoredObject::massLoadFwdRef($ex_objects, "object_id");
     foreach ($ex_links as $_link) {
         $_ex = $_link->loadRefExObject();
         $_ex->updateCreationFields();
         $object = $_ex->loadTargetObject();
         $_ex->_ex_class_id = $_link->ex_class_id;
         $_ex->loadRefExClass();
         CDocumentItem::makeIconName($_ex->_ref_ex_class);
         $this->_all_docs[$this->makePrefix($tri, $object, $_ex)][] = $_link;
     }
 }
 $total = max($_total, $total);
 $ex_objects_counts[$_ex_class_id] = $_total;
 // Formula results
 $ex_objects_results[$_ex_class_id] = null;
 if ($_ex_class->_formula_field && !$search_mode) {
     $where_formula = $where;
     unset($where_formula["ex_class.cross_context_class"]);
     $ex_objects_results[$_ex_class_id] = $_ex_class->getFormulaResult($_ex_class->_formula_field, $where_formula);
 }
 if ($detail < 1) {
     continue;
 }
 /** @var CExLink[] $links */
 $where["ex_link.ex_class_id"] = "= '{$_ex_class_id}'";
 $links = $ex_link->loadList($where, $order, $limit, "ex_link.ex_object_id", $ljoin);
 CExLink::massLoadExObjects($links);
 /** @var CExObject[] $_ex_objects */
 $_ex_objects = array();
 foreach ($links as $_link) {
     $_ex = $_link->loadRefExObject();
     $_ex->_ex_class_id = $_link->ex_class_id;
     $_ex->load();
     $_ex_objects[$_link->ex_object_id] = $_ex;
 }
 /** @var CExObject $_ex */
 foreach ($_ex_objects as $_ex) {
     if (!$_ex->_id) {
         continue;
     }
     $_ex->updateCreationFields();
     $guid = "{$_ex->object_class}-{$_ex->object_id}";