function content_55cdec34b3a217_22184263($_smarty_tpl) { ?> <fieldset class="rating" id="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['rate_id']->value, ENT_QUOTES, 'UTF-8'); ?> "> <?php $_smarty_tpl->tpl_vars["title"] = new Smarty_Variable(); $_smarty_tpl->tpl_vars["title"]->_loop = false; $_smarty_tpl->tpl_vars["val"] = new Smarty_Variable(); $_from = fn_get_discussion_ratings(''); if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars["title"]->key => $_smarty_tpl->tpl_vars["title"]->value) { $_smarty_tpl->tpl_vars["title"]->_loop = true; $_smarty_tpl->tpl_vars["val"]->value = $_smarty_tpl->tpl_vars["title"]->key; ?> <?php $_smarty_tpl->tpl_vars['item_rate_id'] = new Smarty_variable((string) $_smarty_tpl->tpl_vars['rate_id']->value . "_" . (string) $_smarty_tpl->tpl_vars['val']->value, null, 0); ?> <input type="radio" id="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['item_rate_id']->value, ENT_QUOTES, 'UTF-8'); ?> " name="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['rate_name']->value, ENT_QUOTES, 'UTF-8'); ?> " value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['val']->value, ENT_QUOTES, 'UTF-8'); ?> " <?php if ($_smarty_tpl->tpl_vars['rate_value']->value == $_smarty_tpl->tpl_vars['val']->value) { ?> checked="checked"<?php } ?> <?php if ($_smarty_tpl->tpl_vars['disabled']->value) { ?> disabled="disabled"<?php } ?> /><label for="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['item_rate_id']->value, ENT_QUOTES, 'UTF-8'); ?> " title="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['title']->value, ENT_QUOTES, 'UTF-8'); ?> "><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['title']->value, ENT_QUOTES, 'UTF-8'); ?> </label> <?php } ?> </fieldset><?php }
/** * Update multiple posts at once * @param array $posts posts data * @return boolean always true */ function fn_update_discussion_posts($posts) { if (!empty($posts) && is_array($posts)) { $threads = db_get_hash_single_array("SELECT post_id, thread_id FROM ?:discussion_posts WHERE post_id IN (?n)", array('post_id', 'thread_id'), array_keys($posts)); $messages_exist = db_get_fields("SELECT post_id FROM ?:discussion_messages WHERE post_id IN (?n)", array_keys($posts)); $rating_exist = db_get_fields("SELECT post_id FROM ?:discussion_rating WHERE post_id IN (?n)", array_keys($posts)); fn_delete_notification('company_access_denied'); foreach ($posts as $p_id => $data) { unset($data['thread_id'], $data['post_id']); if (!empty($data['date'])) { $data['timestamp'] = fn_discussion_parse_datetime($data['date'] . ' ' . $data['time']); } // Validate rating value if (!empty($data['rating_value']) && !in_array($data['rating_value'], array_keys(fn_get_discussion_ratings()))) { unset($data['rating_value']); } db_query("UPDATE ?:discussion_posts SET ?u WHERE post_id = ?i", $data, $p_id); if (in_array($p_id, $messages_exist)) { db_query("UPDATE ?:discussion_messages SET ?u WHERE post_id = ?i", $data, $p_id); } else { $data['thread_id'] = $threads[$p_id]; $data['post_id'] = $p_id; db_query("INSERT INTO ?:discussion_messages ?e", $data); } if (in_array($p_id, $rating_exist)) { db_query("UPDATE ?:discussion_rating SET ?u WHERE post_id = ?i", $data, $p_id); } else { $data['thread_id'] = $threads[$p_id]; $data['post_id'] = $p_id; db_query("INSERT INTO ?:discussion_rating ?e", $data); } } } return true; }
function content_55cceca01dcfa5_62697154($_smarty_tpl) { if (!is_callable('smarty_function_set_id')) { include '/home/coriolan/public_html/lead/app/functions/smarty_plugins/function.set_id.php'; } if ($_smarty_tpl->tpl_vars['runtime']->value['customization_mode']['design'] == "Y" && @constant('AREA') == "C") { $_smarty_tpl->_capture_stack[0][] = array("template_content", null, null); ob_start(); ?> <div class="clearfix cm-field-container"> <div class="ty-rating" id="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['rate_id']->value, ENT_QUOTES, 'UTF-8'); ?> "> <?php $_smarty_tpl->tpl_vars["title"] = new Smarty_Variable(); $_smarty_tpl->tpl_vars["title"]->_loop = false; $_smarty_tpl->tpl_vars["val"] = new Smarty_Variable(); $_from = fn_get_discussion_ratings(''); if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars["title"]->key => $_smarty_tpl->tpl_vars["title"]->value) { $_smarty_tpl->tpl_vars["title"]->_loop = true; $_smarty_tpl->tpl_vars["val"]->value = $_smarty_tpl->tpl_vars["title"]->key; ?> <?php $_smarty_tpl->tpl_vars['item_rate_id'] = new Smarty_variable((string) $_smarty_tpl->tpl_vars['rate_id']->value . "_" . (string) $_smarty_tpl->tpl_vars['val']->value, null, 0); ?> <input type="radio" id="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['item_rate_id']->value, ENT_QUOTES, 'UTF-8'); ?> " class="ty-rating__check" name="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['rate_name']->value, ENT_QUOTES, 'UTF-8'); ?> " value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['val']->value, ENT_QUOTES, 'UTF-8'); ?> " /><label class="ty-rating__label" for="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['item_rate_id']->value, ENT_QUOTES, 'UTF-8'); ?> " title="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['title']->value, ENT_QUOTES, 'UTF-8'); ?> "><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['title']->value, ENT_QUOTES, 'UTF-8'); ?> </label> <?php } ?> </div> </div><?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]); if (!empty($_capture_buffer)) { if (isset($_capture_assign)) { $_smarty_tpl->assign($_capture_assign, ob_get_contents()); } if (isset($_capture_append)) { $_smarty_tpl->append($_capture_append, ob_get_contents()); } Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean(); } else { $_smarty_tpl->capture_error(); } if (trim(Smarty::$_smarty_vars['capture']['template_content'])) { if ($_smarty_tpl->tpl_vars['auth']->value['area'] == "A") { ?> <span class="cm-template-box template-box" data-ca-te-template="addons/discussion/views/discussion/components/rate.tpl" id="<?php echo smarty_function_set_id(array('name' => "addons/discussion/views/discussion/components/rate.tpl"), $_smarty_tpl); ?> "><div class="cm-template-icon icon-edit ty-icon-edit hidden"></div><?php echo Smarty::$_smarty_vars['capture']['template_content']; ?> <!--[/tpl_id]--></span><?php } else { echo Smarty::$_smarty_vars['capture']['template_content']; } } } else { ?> <div class="clearfix cm-field-container"> <div class="ty-rating" id="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['rate_id']->value, ENT_QUOTES, 'UTF-8'); ?> "> <?php $_smarty_tpl->tpl_vars["title"] = new Smarty_Variable(); $_smarty_tpl->tpl_vars["title"]->_loop = false; $_smarty_tpl->tpl_vars["val"] = new Smarty_Variable(); $_from = fn_get_discussion_ratings(''); if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars["title"]->key => $_smarty_tpl->tpl_vars["title"]->value) { $_smarty_tpl->tpl_vars["title"]->_loop = true; $_smarty_tpl->tpl_vars["val"]->value = $_smarty_tpl->tpl_vars["title"]->key; ?> <?php $_smarty_tpl->tpl_vars['item_rate_id'] = new Smarty_variable((string) $_smarty_tpl->tpl_vars['rate_id']->value . "_" . (string) $_smarty_tpl->tpl_vars['val']->value, null, 0); ?> <input type="radio" id="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['item_rate_id']->value, ENT_QUOTES, 'UTF-8'); ?> " class="ty-rating__check" name="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['rate_name']->value, ENT_QUOTES, 'UTF-8'); ?> " value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['val']->value, ENT_QUOTES, 'UTF-8'); ?> " /><label class="ty-rating__label" for="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['item_rate_id']->value, ENT_QUOTES, 'UTF-8'); ?> " title="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['title']->value, ENT_QUOTES, 'UTF-8'); ?> "><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['title']->value, ENT_QUOTES, 'UTF-8'); ?> </label> <?php } ?> </div> </div><?php } }