public function testGetPrevNextKeysHasRightReturn() { $resArray = array("prev" => null, "next" => "key2"); $this->assertEquals($resArray, $this->stub->getPrevNextKeys(array("key1" => "val1", "key2" => "val2"), "key1")); $resArray = array("prev" => "key1", "next" => "key3"); $this->assertEquals($resArray, $this->stub->getPrevNextKeys(array("key1" => "val1", "key2" => "val2", "key3" => "val3"), "key2")); $resArray = array("prev" => "key1", "next" => null); $this->assertEquals($resArray, $this->stub->getPrevNextKeys(array("key1" => "val1", "key2" => "val2"), "key2")); }
} if (CValue::get("reloadzones") == 1) { $smarty->display("inc_zones_fields.tpl"); } else { if (!$compte_rendu_id && !$switch_mode && ($compte_rendu->fast_edit || $force_fast_edit || $compte_rendu->fast_edit_pdf && $pdf_thumbnails && $pdf_and_thumbs)) { $printers = $function->loadBackRefs("printers"); if (is_array($printers)) { /** @var $_printer CPrinter */ foreach ($printers as $_printer) { $_printer->loadTargetObject(); } } $smarty->assign("_source", $templateManager->document); $smarty->assign("printers", $printers); $smarty->assign("object_guid", CValue::get("object_guid")); $smarty->assign("unique_id", CValue::get("unique_id")); $smarty->display("fast_mode.tpl"); } else { // Charger le document précédent et suivant $prevnext = array(); if ($compte_rendu->_id) { $object->loadRefsDocs(); $prevnext = CMbArray::getPrevNextKeys($object->_ref_documents, $compte_rendu->_id); } $templateManager->initHTMLArea(); $smarty->assign("switch_mode", CValue::get("switch_mode", 0)); $smarty->assign("templateManager", $templateManager); $smarty->assign("prevnext", $prevnext); $smarty->display("edit_compte_rendu.tpl"); } }
$smarty->assign("file_id", $file_id); $smarty->assign("isConverted", $isConverted); $smarty->assign("show_editor", $show_editor); $smarty->assign("display_as_is", $display_as_is); if ($popup == 1) { $listCat = null; $fileprev = null; $filenext = null; if ($object) { $affichageFile = CFile::loadDocItemsByObject($object); // Récupération du fichier/doc préc et suivant $aAllFilesDocs = array(); foreach ($affichageFile as $keyCat => $currCat) { $aAllFilesDocs = array_merge($aAllFilesDocs, $affichageFile[$keyCat]["items"]); } $aFilePrevNext = CMbArray::getPrevNextKeys($aAllFilesDocs, $keyFileSel); foreach ($aFilePrevNext as $key => $value) { if ($value) { $aFile =& $aAllFilesDocs[$aFilePrevNext[$key]]; $keyFile = $aFile->_spec->key; ${"file" . $key} = array("elementId" => $aFile->{$keyFile}, "elementClass" => $aFile->_class); } } // Récupération des destinataires pour l'envoi par mail $destinataires = array(); CDestinataire::makeAllFor($object); $list_destinataires = CDestinataire::$destByClass; foreach ($list_destinataires as $_destinataires_by_class) { foreach ($_destinataires_by_class as $_destinataire) { if (!isset($_destinataire->nom) || strlen($_destinataire->nom) == 0 || $_destinataire->nom === " ") { continue;