/** * Unserialization of choices * @param $input * @return array */ function uncomposeSelection($input) { if ($input !== "" && \PHPFusion\QuantumFields::is_serialized($input)) { return (array) unserialize($input); } return array(); }
/** * Mood should be present. * Static calls for caching, so only single query * Label parsing * @return string */ public function display_mood_buttons() { $html = openform('mood_form-' . $this->post_id, 'post', FUSION_REQUEST . "#post_" . $this->post_id); $mood_cache = $this->cache_mood(); if (!empty($mood_cache)) { foreach ($mood_cache as $mood_id => $mood_data) { //jQuery data model for ajax $html .= form_hidden('post_author', '', $this->post_author); $html .= form_hidden('post_id', '', $this->post_id); if (!$this->mood_exists($this->post_author, $mood_id, $this->post_id)) { // Post Button $html .= "<button name='post_mood' id='" . $this->post_id . "-{$mood_id}' class='btn btn-sm btn-default m-r-5' data-mood='{$mood_id}' data-post='{$this->post_id}' value='" . $mood_id . "'>" . (!empty($mood_data['mood_icon']) ? "<i class='" . $mood_data['mood_icon'] . "'></i>" : "") . QuantumFields::parse_label($mood_data['mood_name']) . "</button>"; } else { // Unpost Button $html .= "<button name='unpost_mood' id='" . $this->post_id . "-{$mood_id}' class='btn btn-sm btn-default active m-r-5' data-mood='{$mood_id}' data-post='{$this->post_id}' value='" . $mood_id . "'>" . (!empty($mood_data['mood_icon']) ? "<i class='" . $mood_data['mood_icon'] . "'></i>" : "") . QuantumFields::parse_label($mood_data['mood_name']) . "</button>"; } } } $html .= closeform(); return (string) $html; }
function breadcrumb_page_arrays($tree_index, $tree_full, $id_col, $title_col, $getname, $id) { $crumb =& $crumb; if (isset($tree_index[get_parent($tree_index, $id)])) { $_name = get_parent_array($tree_full, $id); $crumb = array('link' => isset($_name[$id_col]) ? clean_request($getname . "=" . $_name[$id_col], array("aid"), TRUE) : "", 'title' => isset($_name[$title_col]) ? \PHPFusion\QuantumFields::parse_label($_name[$title_col]) : ""); if (get_parent($tree_index, $id) == 0) { return $crumb; } $crumb_1 = breadcrumb_page_arrays($tree_index, $tree_full, $id_col, $title_col, $getname, get_parent($tree_index, $id)); if (!empty($crumb_1)) { $crumb = array_merge_recursive($crumb, $crumb_1); } } return $crumb; }
/** * Displays forum mood listing */ private function displayMoodList() { $locale = fusion_get_locale('', FORUM_ADMIN_LOCALE); $mood_max_count = dbcount("(mood_id)", DB_FORUM_MOODS, ""); $_GET['rowstart'] = isset($_GET['rowstart']) && isnum($_GET['rowstart']) && $_GET['rowstart'] <= $mood_max_count ? intval($_GET['rowstart']) : 0; $mood_query = "SELECT fm.*, count(post_id) 'mood_count' FROM " . DB_FORUM_MOODS . " fm\n LEFT JOIN " . DB_POST_NOTIFY . " pn ON pn.notify_mood_id = fm.mood_id\n GROUP BY mood_id ORDER BY mood_id ASC LIMIT 0, 16"; $mood_result = dbquery($mood_query); $rows = dbrows($mood_result); if ($rows > 0) { ?> <table class="table table-responsive table-striped table-hover m-t-20 m-b-20"> <thead> <tr> <td class="col-xs-2"><?php echo $locale['forum_107']; ?> </td> <td class="col-xs-2"><?php echo $locale['forum_108']; ?> </td> <td><?php echo $locale['forum_109']; ?> </td> <td><?php echo $locale['forum_115']; ?> </td> <td><?php echo $locale['forum_110']; ?> </td> <td><?php echo $locale['forum_111']; ?> </td> <td><?php echo $locale['forum_112']; ?> </td> </tr> </thead> <tbody> <?php while ($data = dbarray($mood_result)) { $edit_link = clean_request("ref=mood_form&action=edit&mood_id=" . $data['mood_id'], array("ref", "action", "mood_id"), FALSE); $delete_link = clean_request("ref=mood_form&action=delete&mood_id=" . $data['mood_id'], array("ref", "action", "mood_id"), FALSE); ?> <tr> <td> <a href="<?php echo $edit_link; ?> "> <?php echo QuantumFields::parse_label($data['mood_name']); ?> </a> </td> <td><?php echo sprintf($locale['forum_113'], ucfirst(fusion_get_userdata("user_name")), QuantumFields::parse_label($data['mood_description'])); ?> </td> <td> <?php if (!empty($data['mood_icon'])) { ?> <i class="<?php echo $data['mood_icon']; ?> "></i> <?php } ?> </td> <td><?php echo format_word($data['mood_count'], $locale['fmt_post']); ?> </td> <td><?php echo getgroupname($data['mood_notify']); ?> </td> <td><?php echo getgroupname($data['mood_access']); ?> </td> <td> <a href="<?php echo $edit_link; ?> "><?php echo $locale['edit']; ?> </a> - <a href="<?php echo $delete_link; ?> "><?php echo $locale['delete']; ?> </a> </td> </tr> <?php } ?> </tbody> </table> <?php if ($mood_max_count > 16) { echo makepagenav($_GET['rowstart'], $rows, $mood_max_count, 3); } ?> <?php } else { ?> <div class="well text-center"><?php echo $locale['forum_114']; ?> </div> <?php } }