public function analyze($edi_id) { $edifact = Edifact::model()->FindByPk($edi_id); $EdiParser = new EDI\Parser(); $f = explode(PHP_EOL, $edifact->message); $parsed = $EdiParser->parse($f); $analyser = new EDI\Analyser(); $analyser->edi_message = $f; $mapping_segments = realpath(Yii::getPathOfAlias('edifact-data')) . '/D95B/segments.xml'; $analyser->loadSegmentsXml($mapping_segments); $text = $analyser->process($parsed); $save_file_path = Yii::app()->params['edi_analyzer']['result_path'] . '/edi_analyze_' . $edi_id . '.txt'; file_put_contents($save_file_path, $text); }
<div class="row"> <h3 class="header blue lighter smaller"> EDI File Readable </h3> <div class="span12"> <pre> <?php $edifact = Edifact::model()->FindByPk($model->ecntEdifact->id); $EdiParser = new EDI\Parser(); $f = explode(PHP_EOL, $edifact->message); $parsed = $EdiParser->parse($f); $analyser = new EDI\Analyser(); $analyser->edi_message = $edifact->message; $mapping_segments = realpath(Yii::getPathOfAlias('edifact-data')) . '/D95B/segments.xml'; $analyser->loadSegmentsXml($mapping_segments); echo $analyser->process($parsed); ?> </pre> </div> </div> <?php } ?> <div class="space-12"></div> <?php echo $cancel_buton = $this->widget("bootstrap.widgets.TbButton", array("icon" => "chevron-left", "size" => "large", "url" => isset($_GET["returnUrl"]) ? $_GET["returnUrl"] : array("{$this->id}/admin"), "visible" => Yii::app()->user->checkAccess("Edifactdata.EcntContainer.*") || Yii::app()->user->checkAccess("Edifactdata.EcntContainer.View"), "htmlOptions" => array("class" => "search-button", "data-toggle" => "tooltip", "title" => Yii::t("EdifactDataModule.crud", "Back"))), true); $cancel_buton;