本文整理汇总了PHP中flexicontent_html::ItemVoteDisplay方法的典型用法代码示例。如果您正苦于以下问题:PHP flexicontent_html::ItemVoteDisplay方法的具体用法?PHP flexicontent_html::ItemVoteDisplay怎么用?PHP flexicontent_html::ItemVoteDisplay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flexicontent_html
的用法示例。
在下文中一共展示了flexicontent_html::ItemVoteDisplay方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getList
//.........这里部分代码省略.........
if ($dateformat == JText::_('custom')) {
$dateformat = $params->get('custom_date_format_feat', JText::_('DATE_FORMAT_LC3'));
}
$date_fields_feat = $params->get('date_fields_feat', array('created'));
$date_fields_feat = !is_array($date_fields_feat) ? array($date_fields_feat) : $date_fields_feat;
$lists[$ord]['featured'][$i]->date_created = "";
if (in_array('created', $date_fields_feat)) {
// Created
$lists[$ord]['featured'][$i]->date_created .= $params->get('date_label_feat', 1) ? '<span class="date_label_feat">' . JText::_('FLEXI_DATE_CREATED') . '</span> ' : '';
$lists[$ord]['featured'][$i]->date_created .= '<span class="date_value_feat">' . JHTML::_('date', $row->created, $dateformat) . '</span>';
}
$lists[$ord]['featured'][$i]->date_modified = "";
if (in_array('modified', $date_fields_feat)) {
// Modified
$lists[$ord]['featured'][$i]->date_modified .= $params->get('date_label_feat', 1) ? '<span class="date_label_feat">' . JText::_('FLEXI_DATE_MODIFIED') . '</span> ' : '';
$modified_date = $row->modified != $db->getNullDate() ? JHTML::_('date', $row->modified, $dateformat) : JText::_('FLEXI_DATE_NEVER');
$lists[$ord]['featured'][$i]->date_modified .= '<span class="date_value_feat">' . $modified_date . '</span>';
}
}
$lists[$ord]['featured'][$i]->image_rendered = $thumb_rendered;
$lists[$ord]['featured'][$i]->image = $thumb;
$lists[$ord]['featured'][$i]->hits = $row->hits;
$lists[$ord]['featured'][$i]->hits_rendered = '';
if ($display_hits_feat && $has_access_hits) {
FlexicontentFields::loadFieldConfig($hitsfield, $row);
$lists[$ord]['featured'][$i]->hits_rendered .= $params->get('hits_label_feat') ? '<span class="hits_label_feat">' . JText::_($hitsfield->label) . '</span> ' : '';
$lists[$ord]['featured'][$i]->hits_rendered .= $hits_icon;
$lists[$ord]['featured'][$i]->hits_rendered .= ' (' . $row->hits . (!$params->get('hits_label_feat') ? ' ' . JTEXT::_('FLEXI_HITS_L') : '') . ')';
}
$lists[$ord]['featured'][$i]->voting = '';
if ($display_voting_feat && $has_access_voting) {
FlexicontentFields::loadFieldConfig($votingfield, $row);
$lists[$ord]['featured'][$i]->voting .= $params->get('voting_label_feat') ? '<span class="voting_label_feat">' . JText::_($votingfield->label) . '</span> ' : '';
$lists[$ord]['featured'][$i]->voting .= '<div class="voting_value_feat">' . flexicontent_html::ItemVoteDisplay($votingfield, $row->id, $row->rating_sum, $row->rating_count, 'main', '', $params->get('vote_stars_feat', 1), $params->get('allow_vote_feat', 0), $params->get('vote_counter_feat', 1), !$params->get('voting_label_feat')) . '</div>';
}
if ($display_comments_feat) {
$lists[$ord]['featured'][$i]->comments = $row->comments_total;
$lists[$ord]['featured'][$i]->comments_rendered = $params->get('comments_label_feat') ? '<span class="comments_label_feat">' . JText::_('FLEXI_COMMENTS') . '</span> ' : '';
$lists[$ord]['featured'][$i]->comments_rendered .= $comments_icon;
$lists[$ord]['featured'][$i]->comments_rendered .= ' (' . $row->comments_total . (!$params->get('comments_label_feat') ? ' ' . JTEXT::_('FLEXI_COMMENTS_L') : '') . ')';
}
$lists[$ord]['featured'][$i]->catid = $row->catid;
$lists[$ord]['featured'][$i]->itemcats = explode(",", $row->itemcats);
$lists[$ord]['featured'][$i]->link = JRoute::_(FlexicontentHelperRoute::getItemRoute($row->slug, $row->categoryslug, $forced_itemid, $row) . ($method_curlang == 1 ? "&lang=" . substr($row->language, 0, 2) : ""));
$lists[$ord]['featured'][$i]->title = strlen($row->title) > $cuttitle_feat ? JString::substr($row->title, 0, $cuttitle_feat) . '...' : $row->title;
$lists[$ord]['featured'][$i]->alias = $row->alias;
$lists[$ord]['featured'][$i]->fulltitle = $row->title;
$lists[$ord]['featured'][$i]->text = $mod_do_stripcat_feat ? flexicontent_html::striptagsandcut($row->introtext, $mod_cut_text_feat) : $row->introtext;
$lists[$ord]['featured'][$i]->typename = $row->typename;
$lists[$ord]['featured'][$i]->access = $row->access;
$lists[$ord]['featured'][$i]->featured = 1;
if ($use_fields_feat && @$row->fields && $fields_feat) {
$lists[$ord]['featured'][$i]->fields = array();
foreach ($fields_feat as $field) {
if (!isset($row->fields[$field])) {
continue;
}
/*$lists[$ord]['featured'][$i]->fields[$field] = new stdClass();
$lists[$ord]['featured'][$i]->fields[$field]->display = @$row->fields[$field]->display ? $row->fields[$field]->display : '';
$lists[$ord]['featured'][$i]->fields[$field]->name = $row->fields[$field]->name;
$lists[$ord]['featured'][$i]->fields[$field]->id = $row->fields[$field]->id;*/
// Expose field to the module template ... the template should NOT modify this ...
if (!isset($row->fields[$field]->display)) {
$row->fields[$field]->display = '';
}
$lists[$ord]['featured'][$i]->fields[$field] = $row->fields[$field];
示例2: ItemVote
/**
* Creates the ajax voting stars system
*
* @param array $field
* @param int or string $xid
* @since 1.0
*/
static function ItemVote(&$field, $xid, $vote)
{
// Check for invalid xid
if ($xid != 'main' && $xid != 'extra' && $xid != 'all' && !(int) $xid) {
$html .= "ItemVote(): invalid xid '" . $xid . "' was given";
return;
}
if (!$vote) {
$vote = new stdClass();
$vote->rating_sum = $vote->rating_count = 0;
} else {
if (!isset($vote->rating_sum) || !isset($vote->rating_sum)) {
$vote->rating_sum = $vote->rating_count = 0;
}
}
$html = '';
$int_xid = (int) $xid;
$item_id = $field->item_id;
// Get extra voting option (composite voting)
$xids = array();
if (($xid == 'all' || $xid == 'extra' || $int_xid) && ($enable_extra_votes = $field->parameters->get('enable_extra_votes', ''))) {
// Retrieve and split-up extra vote types, (removing last one if empty)
$extra_votes = $field->parameters->get('extra_votes', '');
$extra_votes = preg_split("/[\\s]*%%[\\s]*/", $extra_votes);
if (empty($extra_votes[count($extra_votes) - 1])) {
unset($extra_votes[count($extra_votes) - 1]);
}
// Split extra voting ids (xid) and their titles
foreach ($extra_votes as $extra_vote) {
@(list($extra_id, $extra_title, $extra_desc) = explode("##", $extra_vote));
$xids[$extra_id] = new stdClass();
$xids[$extra_id]->id = (int) $extra_id;
$xids[$extra_id]->title = JText::_($extra_title);
$xids[$extra_id]->desc = JText::_($extra_desc);
}
}
// Get user current history so that it is reflected on the voting
$vote_history = JFactory::getSession()->get('vote_history', array(), 'flexicontent');
if (!isset($vote_history[$item_id]) || !is_array($vote_history[$item_id])) {
$vote_history[$item_id] = array();
}
// Add main vote option
if ($xid == 'main' || $xid == 'all') {
$vote_label = JText::_($field->parameters->get('main_label', 'FLEXI_VOTE_AVERAGE_RATING'));
$counter_show_label = $field->parameters->get('main_counter_show_label', 1);
$add_review_form = $field->parameters->get('allow_reviews', 0);
$html .= flexicontent_html::ItemVoteDisplay($field, $item_id, $vote->rating_sum, $vote->rating_count, 'main', $vote_label, $stars_override = 0, $allow_vote = true, $vote_counter = 'default', $counter_show_label, $add_review_form, $xids, $review_type = 'item');
}
if ($xid == 'all' || $xid == 'extra' || $int_xid && isset($xids[$xid])) {
if ($int_xid) {
$_xids = array($int_xid => $xids[$int_xid]);
} else {
$_xids =& $xids;
}
$counter_show_label = $field->parameters->get('extra_counter_show_label', 1);
foreach ($_xids as $extra_id => $xid_obj) {
if (!isset($vote->extra[$extra_id])) {
$extra_vote = new stdClass();
$extra_vote->rating_sum = $extra_vote->rating_count = 0;
$extra_vote->extra_id = $extra_id;
} else {
$extra_vote = $vote->extra[$extra_id];
}
// Display incomplete vote
if ((int) $extra_id && !isset($vote_history[$item_id]['main']) && isset($vote_history[$item_id][$extra_id])) {
$_rating_sum = $vote_history[$item_id][$extra_id];
$rating_count = 1;
} else {
$_rating_sum = 0;
$rating_count = 0;
}
$html .= flexicontent_html::ItemVoteDisplay($field, $item_id, $extra_vote->rating_sum + $_rating_sum, $extra_vote->rating_count + $rating_count, $extra_vote->extra_id, $xid_obj, $stars_override = 0, $allow_vote = true, $vote_counter = 'default', $counter_show_label);
}
}
return '<div class="' . $field->name . '-group">' . $html . '</div>';
}
示例3: ItemVote
/**
* Creates the ajax voting stars system
*
* @param array $field
* @param int or string $xid
* @since 1.0
*/
static function ItemVote( &$field, $xid, $vote )
{
// Check for invalid xid
if ($xid!='main' && $xid!='extra' && $xid!='all' && !(int)$xid) {
$html .= "ItemVote(): invalid xid '".$xid."' was given";
return;
}
$db = JFactory::getDBO();
$id = $field->item_id;
$enable_extra_votes = $field->parameters->get('extra_votes', '');
$extra_votes = !$enable_extra_votes ? '' : $field->parameters->get('extra_votes', '');
$main_label = !$enable_extra_votes ? '' : $field->parameters->get('main_label', '');
// Set a Default main label if one was not given but extra votes exist
$main_label = (!$main_label && $extra_votes) ? JText::_('FLEXI_OVERALL') : $main_label;
$html = '';
if (!$vote) {
// These are mass retrieved for multiple items, to optimize performance
//$db->setQuery( 'SELECT * FROM #__content_rating WHERE content_id=' . $id );
//$vote = $db->loadObject();
$vote = new stdClass();
$vote->rating_sum = $vote->rating_count = 0;
} else if (!isset($vote->rating_sum) || !isset($vote->rating_sum)) {
$vote->rating_sum = $vote->rating_count = 0;
}
if ($xid=='main' || $xid=='all') {
$html .= flexicontent_html::ItemVoteDisplay( $field, $id, $vote->rating_sum, $vote->rating_count, 'main', $main_label );
}
if ($xid=='all' || $xid=='extra' || (int)$xid) {
// Retrieve and split-up extra vote types, (removing last one if empty)
$extra_votes = preg_split("/[\s]*%%[\s]*/", $extra_votes);
if ( empty($extra_votes[count($extra_votes)-1]) ) unset( $extra_votes[count($extra_votes)-1] );
// Split extra voting ids (xid) and their titles
$xid_arr = array();
foreach ($extra_votes as $extra_vote) {
list($extra_id, $extra_title) = explode("##", $extra_vote);
$xid_arr[$extra_id] = $extra_title;
}
// Query the database
if ( (int)$xid )
{
if ( !isset($vote->extra[(int)$xid]) ) {
$extra_vote = new stdClass();
$extra_vote->rating_sum = $extra_vote->rating_count = 0;
$extra_vote->extra_id = (int)$xid;
} else {
$extra_vote = $vote->extra[(int)$xid];
}
$html .= flexicontent_html::ItemVoteDisplay( $field, $id, $extra_vote->rating_sum, $extra_vote->rating_count, $extra_vote->extra_id, $xid_arr[(int)$xid] );
}
else
{
foreach ( $xid_arr as $extra_id => $extra_title) {
if ( !isset($vote->extra[$extra_id]) ) {
$extra_vote = new stdClass();
$extra_vote->rating_sum = $extra_vote->rating_count = 0;
$extra_vote->extra_id = $extra_id;
} else {
$extra_vote = $vote->extra[$extra_id];
}
$html .= flexicontent_html::ItemVoteDisplay( $field, $id, $extra_vote->rating_sum, $extra_vote->rating_count, $extra_vote->extra_id, $extra_title );
}
}
}
return $html;
}