1
0
Fork 0

make event confirmation work

This commit is contained in:
rabuzarus 2015-06-01 13:57:45 +02:00 committed by rabuzarus
commit 0077494396
4 changed files with 152 additions and 7 deletions

View file

@ -175,8 +175,51 @@ class Item extends BaseObject {
}
}*/
// process action responses - e.g. like/dislike/attend/agree/whatever
$response_verbs = array('like');
$response_verbs[] = 'dislike';
if($item['object-type'] === ACTIVITY_OBJ_EVENT) {
$response_verbs[] = 'attendyes';
$response_verbs[] = 'attendno';
$response_verbs[] = 'attendmaybe';
$isevent = true;
$attend = array( t('I will attend'), t('I will not attend'), t('I might attend'));
}
$consensus = (($item['item_flags'] & ITEM_CONSENSUS)? true : false);
if($consensus) {
$response_verbs[] = 'agree';
$response_verbs[] = 'disagree';
$response_verbs[] = 'abstain';
}
$responses = get_responses($conv_responses,$response_verbs,$this,$item);
// like_button_label from red -> needs to be removed
//$like_button_label = tt('Like','Likes',$like_count,'noun');
// another part from red - it is here for compatility - maybe removed later
$like_count = ((x($conv_responses['like'],$item['uri'])) ? $conv_responses['like'][$item['uri']] : '');
$like_list = ((x($conv_responses['like'],$item['uri'])) ? $conv_responses['like'][$item['uri'] . '-l'] : '');
if (count($like_list) > MAX_LIKERS) {
$like_list_part = array_slice($like_list, 0, MAX_LIKERS);
array_push($like_list_part, '<a href="#" data-toggle="modal" data-target="#likeModal-' . $this->get_id() . '"><b>' . t('View all') . '</b></a>');
} else {
$like_list_part = '';
}
$like_button_label = tt('Like','Likes',$like_count,'noun');
$dislike_count = ((x($conv_responses['dislike'],$item['uri'])) ? $conv_responses['dislike'][$item['uri']] : '');
$dislike_list = ((x($conv_responses['dislike'],$item['uri'])) ? $conv_responses['dislike'][$item['uri'] . '-l'] : '');
$dislike_button_label = tt('Dislike','Dislikes',$dislike_count,'noun');
if (count($dislike_list) > MAX_LIKERS) {
$dislike_list_part = array_slice($dislike_list, 0, MAX_LIKERS);
array_push($dislike_list_part, '<a href="#" data-toggle="modal" data-target="#dislikeModal-' . $this->get_id() . '"><b>' . t('View all') . '</b></a>');
} else {
$dislike_list_part = '';
}
$like = ((x($conv_responses['like'],$item['uri'])) ? format_like($conv_responses['like'][$item['uri']],$conv_responses['like'][$item['uri'] . '-l'],'like',$item['uri']) : '');
$dislike = ((x($conv_responses['dislike'],$item['uri'])) ? format_like($conv_responses['dislike'][$item['uri']],$conv_responses['dislike'][$item['uri'] . '-l'],'dislike',$item['uri']) : '');
$like = ((x($conv_responses['like'],$item['uri'])) ? format_like($conv_responses['like'][$item['uri']],$conv_responses['like'][$item['uri'] . '-l'],'like',$item['uri']) : '');
/*
* We should avoid doing this all the time, but it depends on the conversation mode
@ -324,7 +367,9 @@ class Item extends BaseObject {
'body' => $body_e,
'text' => $text_e,
'id' => $this->get_id(),
'guid' => urlencode($item['guid']),
'guid' => $item['guid'],
'isevent' => $isevent,
'attend' => $attend,
'linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['author-link'])) ? $item['author-link'] : $item['url'])),
'olinktitle' => sprintf( t('View %s\'s profile @ %s'), $this->get_owner_name(), ((strlen($item['owner-link'])) ? $item['owner-link'] : $item['url'])),
'to' => t('to'),
@ -360,6 +405,7 @@ class Item extends BaseObject {
'vote' => $buttons,
'like' => $like,
'dislike' => $dislike,
'responses' => $responses,
'switchcomment' => t('Comment'),
'comment' => $this->get_comment_box($indent),
'previewing' => ($conv->is_preview() ? ' preview ' : ''),