more attendance
This commit is contained in:
parent
268691ffb4
commit
4632d30a78
@ -552,7 +552,12 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
|
|||||||
|
|
||||||
$items = $cb['items'];
|
$items = $cb['items'];
|
||||||
|
|
||||||
$conv_responses = array(array('like'),array('dislike'),array('agree'),array('disagree'),array('abstain'),array('attendyes'),array('attendno'),array('attendmaybe'));
|
$conv_responses = array(
|
||||||
|
'like' => array('title' => t('Likes','title')),'dislike' => array('title' => t('Dislikes','title')),
|
||||||
|
'agree' => array('title' => t('Agree','title')),'disagree' => array('title' => t('Disagree','title')), 'abstain' => array('title' => t('Abstain','title')),
|
||||||
|
'attendyes' => array('title' => t('Attending','title')), 'attendno' => array('title' => t('Not attending','title')), 'attendmaybe' => array('title' => t('Might attend','title'))
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// array with html for each thread (parent+comments)
|
// array with html for each thread (parent+comments)
|
||||||
$threads = array();
|
$threads = array();
|
||||||
@ -779,18 +784,7 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
like_puller($a, $item, $conv_responses, 'like');
|
builtin_activity_puller($item, $conv_responses);
|
||||||
|
|
||||||
if(feature_enabled($profile_owner, 'dislike'))
|
|
||||||
like_puller($a, $item, $conv_responses, 'dislike');
|
|
||||||
|
|
||||||
like_puller($a, $item, $conv_responses, 'attendyes');
|
|
||||||
like_puller($a, $item, $conv_responses, 'attendno');
|
|
||||||
like_puller($a, $item, $conv_responses, 'attendmaybe');
|
|
||||||
like_puller($a, $item, $conv_responses, 'agree');
|
|
||||||
like_puller($a, $item, $conv_responses, 'disagree');
|
|
||||||
like_puller($a, $item, $conv_responses, 'abstain');
|
|
||||||
|
|
||||||
|
|
||||||
if(! visible_activity($item)) {
|
if(! visible_activity($item)) {
|
||||||
continue;
|
continue;
|
||||||
@ -968,50 +962,45 @@ function item_photo_menu($item){
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns a like/dislike entry.
|
* @brief Checks item to see if it is one of the builtin activities (like/dislike, event attendance, consensus items, etc.)
|
||||||
* It gives back a HTML link to the channel that liked/disliked.
|
* Increments the count of each matching activity and adds a link to the author as needed.
|
||||||
*
|
*
|
||||||
* @param array $a (not used)
|
* @param array $a (not used)
|
||||||
* @param array $item
|
* @param array $item
|
||||||
* @param array &$arr
|
* @param array &$conv_responses (already created with builtin activity structure)
|
||||||
* @param string $mode like/dislike
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function like_puller($a, $item, &$arr, $mode) {
|
function builtin_activity_puller($item, &$conv_responses) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
foreach($conv_responses as $mode => $v) {
|
||||||
|
|
||||||
$url = '';
|
$url = '';
|
||||||
|
|
||||||
switch($mode) {
|
switch($mode) {
|
||||||
case 'like':
|
case 'like':
|
||||||
case 'unlike':
|
|
||||||
$verb = ACTIVITY_LIKE;
|
$verb = ACTIVITY_LIKE;
|
||||||
break;
|
break;
|
||||||
case 'dislike':
|
case 'dislike':
|
||||||
case 'undislike':
|
|
||||||
$verb = ACTIVITY_DISLIKE;
|
$verb = ACTIVITY_DISLIKE;
|
||||||
break;
|
break;
|
||||||
case 'agree':
|
case 'agree':
|
||||||
case 'unagree':
|
|
||||||
$verb = ACTIVITY_AGREE;
|
$verb = ACTIVITY_AGREE;
|
||||||
break;
|
break;
|
||||||
case 'disagree':
|
case 'disagree':
|
||||||
case 'undisagree':
|
|
||||||
$verb = ACTIVITY_DISAGREE;
|
$verb = ACTIVITY_DISAGREE;
|
||||||
break;
|
break;
|
||||||
case 'abstain':
|
case 'abstain':
|
||||||
case 'unabstain':
|
|
||||||
$verb = ACTIVITY_ABSTAIN;
|
$verb = ACTIVITY_ABSTAIN;
|
||||||
break;
|
break;
|
||||||
case 'attendyes':
|
case 'attendyes':
|
||||||
case 'unattendyes':
|
|
||||||
$verb = ACTIVITY_ATTEND;
|
$verb = ACTIVITY_ATTEND;
|
||||||
break;
|
break;
|
||||||
case 'attendno':
|
case 'attendno':
|
||||||
case 'unattendno':
|
|
||||||
$verb = ACTIVITY_ATTENDNO;
|
$verb = ACTIVITY_ATTENDNO;
|
||||||
break;
|
break;
|
||||||
case 'attendmaybe':
|
case 'attendmaybe':
|
||||||
case 'unattendmaybe':
|
|
||||||
$verb = ACTIVITY_ATTENDMAYBE;
|
$verb = ACTIVITY_ATTENDMAYBE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -1019,30 +1008,36 @@ function like_puller($a, $item, &$arr, $mode) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if((activity_match($item['verb'], $verb)) && ($item['id'] != $item['parent'])) {
|
if((activity_match($item['verb'], $verb)) && ($item['id'] != $item['parent'])) {
|
||||||
|
|
||||||
if($item['author']['xchan_url'])
|
|
||||||
$url = chanlink_url($item['author']['xchan_url']);
|
$name = (($item['author']['xchan_name']) ? $item['author']['xchan_name'] : t('Unknown'));
|
||||||
|
$url = (($item['author']['xchan_url'])
|
||||||
|
? '<a href="' . chanlink_url($item['author']['xchan_url']) . '">' . $name . '</a>'
|
||||||
|
: '<a href="#" class="disabled">' . $name . '</a>'
|
||||||
|
);
|
||||||
|
|
||||||
if(! $item['thr_parent'])
|
if(! $item['thr_parent'])
|
||||||
$item['thr_parent'] = $item['parent_mid'];
|
$item['thr_parent'] = $item['parent_mid'];
|
||||||
|
|
||||||
if(! ((isset($arr[$mode][$item['thr_parent'] . '-l'])) && (is_array($arr[$mode][$item['thr_parent'] . '-l']))))
|
if(! ((isset($conv_responses[$mode][$item['thr_parent'] . '-l']))
|
||||||
$arr[$mode][$item['thr_parent'] . '-l'] = array();
|
&& (is_array($conv_responses[$mode][$item['thr_parent'] . '-l']))))
|
||||||
|
$conv_responses[$mode][$item['thr_parent'] . '-l'] = array();
|
||||||
|
|
||||||
if(! isset($arr[$mode][$item['thr_parent']]))
|
// only list each unique author once
|
||||||
$arr[$mode][$item['thr_parent']] = 1;
|
if(in_array($url,$conv_responses[$mode][$item['thr_parent'] . '-l']))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if(! isset($conv_responses[$mode][$item['thr_parent']]))
|
||||||
|
$conv_responses[$mode][$item['thr_parent']] = 1;
|
||||||
else
|
else
|
||||||
$arr[$mode][$item['thr_parent']] ++;
|
$conv_responses[$mode][$item['thr_parent']] ++;
|
||||||
|
|
||||||
$name = (($item['author']['xchan_name']) ? $item['author']['xchan_name'] : t('Unknown'));
|
$conv_responses[$mode][$item['thr_parent'] . '-l'][] = $url;
|
||||||
|
}
|
||||||
if($url)
|
|
||||||
$arr[$mode][$item['thr_parent'] . '-l'][] = '<a href="'. $url . '">' . $name . '</a>';
|
|
||||||
else
|
|
||||||
$arr[$mode][$item['thr_parent'] . '-l'][] = '<a href="#" class="disabled">' . $name . '</a>';
|
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Format the like/dislike text for a profile item
|
// Format the like/dislike text for a profile item
|
||||||
@ -1662,6 +1657,7 @@ function get_responses($conv_responses,$response_verbs,$ob,$item) {
|
|||||||
$ret[$v]['list_part'] = '';
|
$ret[$v]['list_part'] = '';
|
||||||
}
|
}
|
||||||
$ret[$v]['button'] = get_response_button_text($v,$ret[$v]['count']);
|
$ret[$v]['button'] = get_response_button_text($v,$ret[$v]['count']);
|
||||||
|
$ret[$v]['title'] = $conv_responses[$v]['title'];
|
||||||
}
|
}
|
||||||
$ret['count'] = count($ret);
|
$ret['count'] = count($ret);
|
||||||
return $ret;
|
return $ret;
|
||||||
|
@ -56,21 +56,21 @@
|
|||||||
<div class="wall-item-tools">
|
<div class="wall-item-tools">
|
||||||
<div class="wall-item-tools-right btn-group pull-right">
|
<div class="wall-item-tools-right btn-group pull-right">
|
||||||
{{if $item.like}}
|
{{if $item.like}}
|
||||||
<button type="button" title="{{$item.like.0}}" class="btn btn-default btn-sm" onclick="dolike({{$item.id}},'like'); return false">
|
<button type="button" title="{{$item.like.0}}" class="btn btn-default btn-sm" onclick="dolike({{$item.id}},'like'); return false;">
|
||||||
<i class="icon-thumbs-up-alt" ></i>
|
<i class="icon-thumbs-up-alt" ></i>
|
||||||
</button>
|
</button>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{if $item.dislike}}
|
{{if $item.dislike}}
|
||||||
<button type="button" title="{{$item.dislike.0}}" class="btn btn-default btn-sm" onclick="dolike({{$item.id}},'dislike'); return false">
|
<button type="button" title="{{$item.dislike.0}}" class="btn btn-default btn-sm" onclick="dolike({{$item.id}},'dislike'); return false;">
|
||||||
<i class="icon-thumbs-down-alt" ></i>
|
<i class="icon-thumbs-down-alt" ></i>
|
||||||
</button>
|
</button>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{if $item.isevent}}
|
{{if $item.isevent}}
|
||||||
<button type="button" title="{{$item.attend.0}}" class="btn btn-default btn-sm" onclick="itemAddToCal({{$item.id}}); dolike({{$item.id}},'attendyes'); return false;">
|
<button type="button" title="{{$item.attend.0}}" class="btn btn-default btn-sm" onclick="itemAddToCal({{$item.id}}); dolike({{$item.id}},'attendyes'); return false;">
|
||||||
<i class="icon-plus" ></i>
|
<i class="icon-check" ></i>
|
||||||
</button>
|
</button>
|
||||||
<button type="button" title="{{$item.attend.1}}" class="btn btn-default btn-sm" onclick="itemAddToCal({{$item.id}}); dolike({{$item.id}},'attendno'); return false;">
|
<button type="button" title="{{$item.attend.1}}" class="btn btn-default btn-sm" onclick="dolike({{$item.id}},'attendno'); return false;">
|
||||||
<i class="icon-minus" ></i>
|
<i class="icon-check-empty" ></i>
|
||||||
</button>
|
</button>
|
||||||
<button type="button" title="{{$item.attend.2}}" class="btn btn-default btn-sm" onclick="itemAddToCal({{$item.id}}); dolike({{$item.id}},'attendmaybe'); return false;">
|
<button type="button" title="{{$item.attend.2}}" class="btn btn-default btn-sm" onclick="itemAddToCal({{$item.id}}); dolike({{$item.id}},'attendmaybe'); return false;">
|
||||||
<i class="icon-question" ></i>
|
<i class="icon-question" ></i>
|
||||||
@ -136,7 +136,7 @@
|
|||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
<h4 class="modal-title">{{$response.modal_title}}</h4>
|
<h4 class="modal-title">{{$response.title}}</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<ul>{{foreach $response.list as $liker}}<li role="presentation">{{$liker}}</li>{{/foreach}}</ul>
|
<ul>{{foreach $response.list as $liker}}<li role="presentation">{{$liker}}</li>{{/foreach}}</ul>
|
||||||
|
@ -143,7 +143,7 @@
|
|||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
<h4 class="modal-title">{{$response.modal_title}}</h4>
|
<h4 class="modal-title">{{$response.title}}</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<ul>{{foreach $response.list as $liker}}<li role="presentation">{{$liker}}</li>{{/foreach}}</ul>
|
<ul>{{foreach $response.list as $liker}}<li role="presentation">{{$liker}}</li>{{/foreach}}</ul>
|
||||||
@ -158,7 +158,7 @@
|
|||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user