echo URLHelper::getLink('dispatch.php/smileys'); ?> " data-dialog> <?php echo _('Smileys'); ?> </a> | <a href="<?php echo format_help_url("Basis.VerschiedenesFormat"); ?> " target="new"><?php echo _("Formatierungshilfen"); ?> </a> <br> <? $smileys = Smiley::getByIds($sm->get()) ?> <? if (!empty($smileys)) : ?> <? foreach ($smileys as $smiley) : ?> <img class="js" src="<?php echo $smiley->getUrl(); ?> " data-smiley=" :<?php echo $smiley->name; ?> : " style="cursor: pointer;" onClick="STUDIP.Forum.insertSmiley('<?php echo $textarea_id; ?> ', this)"> <? endforeach ?> <? elseif ($GLOBALS['user']->id != 'nobody') : ?>
/** * Back end for the smiley picker javascript module. * Renders a list of smileys very similar to the index action but * unfortunately still to different to be combined. * * @param mixed $view Subset to display, defaults to favorites if enabled * @param int $page Section of subset to display */ function picker_action($view = null, $page = 0) { $per_page = self::GRID_WIDTH * self::GRID_HEIGHT; $this->view = $view ?: ($this->default === 'favorites' ? 'favorites' : 'all'); $smileys = $this->view == 'favorites' ? Smiley::getByIds($this->favorites->get()) : Smiley::getGrouped($this->view); $this->page = $page; $this->pages = floor(count($smileys) / $per_page); array_walk($smileys, function ($smiley) { $smiley->link = Smiley::getURL($smiley->name); $smiley->html = Smiley::img($smiley->name); }); $this->smileys = array_slice($smileys, $page * $per_page, $per_page); $this->characters = Smiley::getUsedCharacters(); }
/** * Returns a list of how often a smiley has been favored. * * @return Array Associative array with smiley name as key and according * favored numbers as value */ static function getUsage() { $usage = array(); $query = "SELECT user_id, smiley_favorite FROM user_info WHERE smiley_favorite != ''"; $statement = DBManager::get()->prepare($query); $statement->execute(array()); $temp = $statement->fetchGrouped(PDO::FETCH_COLUMN); foreach ($temp as $user_id => $favorite_string) { $favorites = explode(',', $favorite_string); $smileys = Smiley::getByIds($favorites); foreach ($smileys as $smiley) { if (!isset($usage[$smiley->name])) { $usage[$smiley->name] = 0; } $usage[$smiley->name] += 1; } } return $usage; }