@@ -206,7 +206,7 @@ public function update_stats($tag_id, $modid = 0, $catid = 0)
206206
207207 /** @var \XoopsModules\Tag\LinkHandler $linkHandler */
208208 $ linkHandler = \XoopsModules \Tag \Helper::getInstance ()->getHandler ('Link ' );
209- $ criteria = new \CriteriaCompo (new \Criteria ('tag_id ' , $ tag_id ));
209+ $ criteria = new \CriteriaCompo (new \Criteria ('tag_id ' , $ tag_id ));
210210 if (0 !== $ modid ) {
211211 $ criteria ->add (new \Criteria ('tag_modid ' , $ modid ), 'ADD ' );
212212 }
@@ -519,43 +519,46 @@ public function getItemCount($tag_id, $modid = 0, $catid = 0)
519519 * @param int $font_min
520520 * @return array tag data values for display
521521 */
522- public function getTagData ($ tags_array , $ font_max = 0 , $ font_min = 0 )
523- {
524- $ tags_data_array = [];
525- if (\is_array ($ tags_array ) && !empty ($ tags_array )) {
526- // set min and max tag count
527- $ count_array = \array_column ($ tags_array , 'count ' , 'id ' );
528- $ count_min = \count ($ count_array ) > 0 ? \min ($ count_array ) : 0 ;
529- $ count_min = $ count_min > 0 ? $ count_min : 0 ;
530- $ count_max = \count ($ count_array ) > 0 ? \max ($ count_array ) : 0 ;
531- $ count_max = $ count_max > 0 ? $ count_max : 0 ;
532-
533- $ term_array = \array_column ($ tags_array , 'term ' , 'id ' );
534- $ tags_term_array = \array_map ('\mb_strtolower ' , $ term_array );
535- \array_multisort ($ tags_term_array , \SORT_ASC , $ tags_array );
536- $ count_interval = $ count_max - $ count_min ;
537- $ level_limit = 5 ;
538-
539- $ font_ratio = $ count_interval ? ($ font_max - $ font_min ) / $ count_interval : 1 ;
540-
541- foreach ($ tags_array as $ tag ) {
542- /*
543- * Font-size = ((tag.count - count.min) * (font.max - font.min) / (count.max - count.min) ) * 100%
544- */
545- $ font_sz = \floor (($ tag ['count ' ] - $ count_min ) * $ font_ratio ) + $ font_min ;
546- $ level_sz = \floor (($ tag ['count ' ] - $ count_min ) * $ level_limit / $ count_max );
547- $ tags_data_array [] = [
548- 'id ' => $ tag ['id ' ],
549- 'font ' => empty ($ count_interval ) ? 100 : (int )$ font_sz ,
550- 'level ' => empty ($ count_max ) ? 0 : (int )$ level_sz ,
551- 'term ' => \urlencode ($ tag ['term ' ]),
552- 'title ' => \htmlspecialchars ($ tag ['term ' ], \ENT_QUOTES | \ENT_HTML5 ),
553- 'count ' => $ tag ['count ' ],
554- ];
555- }
556- }
557- return $ tags_data_array ;
558- }
522+ // public function getTagData($tags_array, $font_max = 0, $font_min = 0)
523+ // {
524+ // $tags_data_array = [];
525+ // if (\is_array($tags_array) && !empty($tags_array)) {
526+ // // set min and max tag count
527+ // $count_array = \array_column($tags_array, 'count', 'id');
528+ // $count_min = \count($count_array) > 0 ? \min($count_array) : 0;
529+ // $count_min = $count_min > 0 ? $count_min : 0;
530+ // $count_max = \count($count_array) > 0 ? \max($count_array) : 0;
531+ // $count_max = $count_max > 0 ? $count_max : 0;
532+ // if ($count_max > 0) {
533+ // $term_array = \array_column($tags_array, 'term', 'id');
534+ // $tags_term_array = \array_map('\mb_strtolower', $term_array);
535+ // \array_multisort($tags_term_array, \SORT_ASC, $tags_array);
536+ // $count_interval = $count_max - $count_min;
537+ // $level_limit = 5;
538+ //
539+ // $font_ratio = $count_interval ? ($font_max - $font_min) / $count_interval : 1;
540+ //
541+ // foreach ($tags_array as $tag) {
542+ // /*
543+ // * Font-size = ((tag.count - count.min) * (font.max - font.min) / (count.max - count.min) ) * 100%
544+ // */
545+ // $font_sz = \floor(($tag['count'] - $count_min) * $font_ratio) + $font_min;
546+ // $level_sz = \floor(($tag['count'] - $count_min) * $level_limit / $count_max);
547+ // $tags_data_array[] = [
548+ // 'id' => $tag['id'],
549+ // 'font' => empty($count_interval) ? 100 : (int)$font_sz,
550+ // 'level' => empty($count_max) ? 0 : (int)$level_sz,
551+ // 'term' => \urlencode($tag['term']),
552+ // 'title' => \htmlspecialchars($tag['term'], \ENT_QUOTES | \ENT_HTML5),
553+ // 'count' => $tag['count'],
554+ // ];
555+ // }
556+ // }
557+ // }
558+ //
559+ //
560+ // return $tags_data_array;
561+ // }
559562
560563 /**
561564 * Delete an object as well as links relying on it
@@ -581,7 +584,7 @@ public function delete(\XoopsObject $object, $force = true)
581584
582585 /** @var \XoopsModules\Tag\LinkHandler $linkHandler */
583586 $ linkHandler = $ helper ->getHandler ('Link ' );
584- $ criteria = new \Criteria ($ this ->keyName , $ object ->getVar ($ this ->keyName ));
587+ $ criteria = new \Criteria ($ this ->keyName , $ object ->getVar ($ this ->keyName ));
585588 $ linkHandler ->deleteAll ($ criteria , $ force );
586589 //$sql = 'DELETE' . " FROM {$this->table_link}" . " WHERE {$this->keyName} = " . $object->getVar($this->keyName);
587590 /*
@@ -594,7 +597,7 @@ public function delete(\XoopsObject $object, $force = true)
594597 */
595598 /** @var \XoopsModules\Tag\StatsHandler $statsHandler */
596599 $ statsHandler = $ helper ->getHandler ('Stats ' );
597- $ criteria = new \Criteria ($ this ->keyName , $ object ->getVar ($ this ->keyName ));
600+ $ criteria = new \Criteria ($ this ->keyName , $ object ->getVar ($ this ->keyName ));
598601 $ statsHandler ->deleteAll ($ criteria , $ force );
599602 //$sql = 'DELETE' . " FROM {$this->table_stats}" . " WHERE {$this->keyName} = " . $object->getVar($this->keyName);
600603
0 commit comments