| Conditions | 7 |
| Paths | 16 |
| Total Lines | 33 |
| Code Lines | 25 |
| Lines | 8 |
| Ratio | 24.24 % |
| Changes | 0 | ||
| 1 | <? function renderDocument($document, $cmsPrefix, $slugPrefix = '') {?> |
||
| 2 | <div class="grid-box-10"> |
||
| 3 | <h3> |
||
| 4 | <a class="btn documentTitle" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/edit-document?slug=<?=$slugPrefix . $document->slug?>" title="Edit"> |
||
| 5 | <i class="fa fa-file-text-o"></i> |
||
| 6 | <small class="state <?=strtolower($document->state)?>"><i class="fa <?=$document->state == 'published' ? 'fa-check-circle-o' : 'fa-times-circle-o' ?>"></i></small> |
||
| 7 | <?=$document->title?> |
||
| 8 | </a> |
||
| 9 | <? if ($document->unpublishedChanges) : ?><small class="small unpublished-changes">Unpublished Changes</small><? endif ?> |
||
| 10 | <small class="small documentType"><?=$document->documentType?></small> |
||
| 11 | <small class="small lastModified" title="<?=date('r', $document->lastModificationDate)?>"> |
||
| 12 | <span class="label">Modified:</span> |
||
| 13 | <?=\library\cc\StringUtil::timeElapsedString($document->lastModificationDate)?> |
||
| 14 | </small> |
||
| 15 | <small class="small lastModifiedBy"> |
||
| 16 | <span class="label">By:</span> |
||
| 17 | <?=$document->lastModifiedBy?> |
||
| 18 | </small> |
||
| 19 | </h3> |
||
| 20 | </div> |
||
| 21 | <div class="documentActions grid-box-2"> |
||
| 22 | <? if ($document->state == 'unpublished' || $document->unpublishedChanges) : ?> |
||
| 23 | <a class="btn publish" title="Publish" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/publish-document?slug=<?=$slugPrefix . $document->slug?>"><i class="fa fa-check"></i></a> |
||
| 24 | <? endif ?> |
||
| 25 | View Code Duplication | <? if ($document->state == 'published') : ?> |
|
|
|
|||
| 26 | <a class="btn unpublish" title="Unpublish" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/unpublish-document?slug=<?=$slugPrefix . $document->slug?>"><i class="fa fa-times"></i></a> |
||
| 27 | <? endif ?> |
||
| 28 | <a class="btn" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/edit-document?slug=<?=$slugPrefix . $document->slug?>" title="Edit"><i class="fa fa-pencil"></i></a> |
||
| 29 | View Code Duplication | <? if ($document->state == 'unpublished') : ?> |
|
| 30 | <a onclick="return confirm('Are you sure you want to delete this item?');" class="btn error" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/delete-document?slug=<?=$slugPrefix . $document->slug?>" title="Delete"><i class="fa fa-trash"></i></a> |
||
| 31 | <? endif ?> |
||
| 32 | </div> |
||
| 33 | <?}?> |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.