1<?php 2/** 3 * FarmSync DokuWiki Plugin 4 * 5 * @author Michael Große <grosse@cosmocode.de> 6 * @license GPL 2 7 */ 8 9namespace dokuwiki\plugin\farmsync\meta; 10 11use dokuwiki\Form\Form; 12 13/** 14 * Display conflicts in media updates 15 */ 16class MediaConflict extends UpdateResults { 17 18 protected $source; 19 20 public function __construct($item, $target, $source) { 21 $this->source = $source; 22 parent::__construct($item, $target); 23 } 24 25 26 /** 27 * Adds conflict resolution form 28 * 29 * @return string 30 */ 31 public function getResultLine() { 32 $result = parent::getResultLine(); 33 $form = new Form(); 34 $form->attrs(array('data-animal' => $this->getAnimal(), "data-page" => $this->getItem(), "data-type" => 'media')); 35 36 $sourcebase = $this->_farm_util->getAnimalLink($this->source); 37 $sourcelink = $form->addTagOpen('a'); 38 $sourcelink->attr('href', "$sourcebase/lib/exe/fetch.php?media=" . $this->getItem())->attr('target', '_blank'); 39 $form->addHTML($this->helper->getLang('link:srcversion')); 40 $form->addTagClose('a'); 41 42 $animalbase = $this->_farm_util->getAnimalLink($this->getAnimal()); 43 $animallink = $form->addTagOpen('a'); 44 $animallink->attr('href', "$animalbase/lib/exe/fetch.php?media=" . $this->getItem())->attr('target', '_blank'); 45 $form->addHTML($this->helper->getLang('link:dstversion')); 46 $form->addTagClose('a'); 47 48 $form->addButton("theirs", $this->helper->getLang('button:keep')); 49 $form->addButton("override", $this->helper->getLang('button:overwrite')); 50 51 $result .= $form->toHTML(); 52 return $result; 53 } 54} 55