diff options
author | vincent-peugnet <v.peugnet@free.fr> | 2018-12-22 09:01:20 +0100 |
---|---|---|
committer | vincent-peugnet <v.peugnet@free.fr> | 2018-12-22 09:01:20 +0100 |
commit | 0e95eb5121b2f4be63591705c367a0de10046133 (patch) | |
tree | fd389a73fffce6f1b3566bba7c07d02f07c196f7 | |
parent | 7f94fccda33383f3a7be364cf0c316e7ed2c61bb (diff) | |
download | wcms-0e95eb5121b2f4be63591705c367a0de10046133.tar.gz wcms-0e95eb5121b2f4be63591705c367a0de10046133.zip |
feature: linkto calc during render
-rw-r--r-- | app/class/art2.php | 2 | ||||
-rw-r--r-- | app/class/controllerart.php | 1 | ||||
-rw-r--r-- | app/class/modelrender.php | 11 | ||||
-rw-r--r-- | app/view/templates/home.php | 6 |
4 files changed, 17 insertions, 3 deletions
diff --git a/app/class/art2.php b/app/class/art2.php index 8bf2729..6f2d4d8 100644 --- a/app/class/art2.php +++ b/app/class/art2.php @@ -344,6 +344,8 @@ class Art2 $linkto = $this->linkto; } elseif ($option == 'sort') { return count($this->linkto); + } elseif ($option == 'string') { + return implode(', ', $this->linkto); } return $linkto; diff --git a/app/class/controllerart.php b/app/class/controllerart.php index ee99b6a..8511243 100644 --- a/app/class/controllerart.php +++ b/app/class/controllerart.php @@ -79,6 +79,7 @@ class Controllerart extends Controller $this->art->setrenderhead($head); $this->art->setdaterender($now); $this->art->setlinkfrom($this->renderengine->linkfrom()); + $this->art->setlinkto($this->renderengine->linkto()); return ['head' => $head, 'body' => $body]; diff --git a/app/class/modelrender.php b/app/class/modelrender.php index e24e067..8139d6d 100644 --- a/app/class/modelrender.php +++ b/app/class/modelrender.php @@ -466,6 +466,17 @@ class Modelrender extends Modelart return $linkfrom; } + public function linkto() + { + $linkto = []; + foreach ($this->artlist as $art) { + if(in_array($this->art->id(), $art->linkfrom())) { + $linkto[] = $art->id(); + } + } + return $linkto; + } + diff --git a/app/view/templates/home.php b/app/view/templates/home.php index a69882d..521d985 100644 --- a/app/view/templates/home.php +++ b/app/view/templates/home.php @@ -72,8 +72,8 @@ <th class="log">log</th> <th class="tag"><a href="<?= $opt->getadress('tag') ?>">tag</a></th> <th class="summary">summary</th> - <th class="linkto"><a href="<?= $opt->getadress('linkto') ?>">link to</a></th> - <th class="linkfrom"><a href="<?= $opt->getadress('linkfrom') ?>">linkfrom</a></th> + <th class="linkto"><a href="<?= $opt->getadress('linkto') ?>">to</a></th> + <th class="linkfrom"><a href="<?= $opt->getadress('linkfrom') ?>">from</a></th> <th class="datemodif"><a href="<?= $opt->getadress('datemodif') ?>">last modification</a></th> <th class="datecreation"><a href="<?= $opt->getadress('datecreation') ?>">date of creation</a></th> <th class="date"><a href="<?= $opt->getadress('date') ?>">date</a></th> @@ -89,7 +89,7 @@ <td class="log"><a href="<?= $this->uart('artlog', $item->id()) ?>" target="_blank">⁋</a></td> <td class="tag"><a title="<?= $item->tag('string') ?>"><?= $item->tag('sort') ?></a></td> <td class="summary"><?= $item->description() ?></td> - <td class="linkto"><?= $item->linkto('sort') ?></td> + <td class="linkto"><a title="<?= $item->linkto('string') ?>" ><?= $item->linkto('sort') ?></a></td> <td class="linkfrom"><a title="<?= $item->linkfrom('string') ?>" ><?= $item->linkfrom('sort') ?></a></td> <td class="datemodif"><?= $item->datemodif('hrdi') ?></td> <td class="datecreation"><?= $item->datecreation('hrdi') ?></td> |