function imgDocsViaTags($strTitle, $strLabel, $strDivGroup, $tags) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- $attributes = new stdClass(); $attributes->lTableWidth = 900; $attributes->lUnderscoreWidth = 400; $attributes->divID = $strDivGroup; $attributes->divImageID = $strDivGroup . 'Img'; $attributes->bStartOpen = true; $attributes->bAddTopBreak = true; openBlock($strTitle, '', $attributes); echoT('<ul style="list-style-type: none; margin-left: -40px;">' . "\n"); foreach ($tags as $tblock) { $enumContext = imgDocTags\xlateContextViaTagType($tblock->econtext); echoT('<li><b>' . imgDocTags\strXlateImgDocContext($tblock->econtext) . '</b>' . "\n"); if ($tblock->lNumTags == 0) { echoT('<ul style="margin-bottom: 10px;"><li><i>No tags defined</i></ul>'); } else { echoT('<ul style="margin-bottom: 10px;">' . "\n"); foreach ($tblock->tags as $tag) { if ($tag->lCnt > 0) { $strLink = strLinkView_ImageDocsViaTag($tag->lTagID, $enumContext, 'View', true); } else { $strLink = ' '; } echoT('<li>' . $strLink . htmlspecialchars($tag->strDDLEntry) . ' <i>(used by ' . number_format($tag->lCnt) . ' ' . $strLabel . ($tag->lCnt == 1 ? '' : 's') . ') </i>' . '</li>' . "\n"); } echoT('</ul>' . "\n"); } echoT('</li>' . "\n"); } echoT('</ul>' . "\n"); $attributes->bCloseDiv = true; closeBlock($attributes); }
function loadImgDocTags(&$lNumTags, &$tags, $bHideRetired = true) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- $tags = array(); if ($bHideRetired) { $sqlHide = ' AND NOT dit_bRetired '; } else { $sqlHide = ''; } $sqlStr = "SELECT\n dit_lKeyID, dit_enumContext, dit_strDDLEntry,\n dit_lSortIDX, dit_bRetired\n FROM doc_img_tag_ddl\n WHERE 1 {$this->sqlWhere} {$sqlHide}\n ORDER BY dit_lSortIDX, dit_lKeyID;"; $query = $this->db->query($sqlStr); $lNumTags = $query->num_rows(); if ($lNumTags == 0) { $tags[0] = new stdClass(); $tag =& $tags[0]; $tag->lTagID = $tag->enumContext = $tag->strDDLEntry = $tag->lSortIDX = $tag->strIDType = $tag->enumEntryType = $tag->enumParentContext = $tag->bRetired = null; } else { $idx = 0; foreach ($query->result() as $row) { $tags[$idx] = new stdClass(); $tag =& $tags[$idx]; $tag->lTagID = (int) $row->dit_lKeyID; $tag->enumContext = $row->dit_enumContext; $tag->strDDLEntry = $row->dit_strDDLEntry; $tag->lSortIDX = (int) $row->dit_lSortIDX; // contextual info $tag->strIDType = imgDocTags\strXlateImgDocType($tag->enumContext, $tag->bImage); $tag->enumEntryType = $tag->bImage ? CENUM_IMGDOC_ENTRY_IMAGE : CENUM_IMGDOC_ENTRY_PDF; $tag->enumParentContext = imgDocTags\xlateContextViaTagType($tag->enumContext); $tag->bRetired = (bool) $row->dit_bRetired; ++$idx; } } }