This repository has been archived by the owner on Apr 5, 2019. It is now read-only.
forked from basisentscheid/basisentscheid
/
proposal.php
798 lines (739 loc) · 23.7 KB
/
proposal.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
<?
/**
* proposal details
*
* @author Magnus Rosenbaum <dev@cmr.cx>
* @package Basisentscheid
*/
require "inc/common_http.php";
URI::strip_one_time_params(array(
'comment',
'reply',
'parent',
'comment_edit',
'openhl',
'edit_admission_decision',
'edit_annotation',
'show_drafts',
'edit_proponent',
'become_proponent',
'remove_proponent'
));
// resolve shortcuts for notification mails
if (!empty($_GET['comment'])) Comments::redirect_append_show(intval($_GET['comment']));
if (!empty($_GET['reply'])) Comments::redirect_append_reply(intval($_GET['reply']));
$proposal = new Proposal(@$_GET['id']);
if (!$proposal->id) {
error("The requested proposal does not exist!");
}
$issue = $proposal->issue();
$_SESSION['ngroup'] = $issue->area()->ngroup;
if ($action) {
switch ($action) {
case "submit_proposal":
Login::access_action("entitled", $_SESSION['ngroup']);
if (!$proposal->is_proponent(Login::$member)) {
warning(_("Your are not a proponent of this proposal."));
redirect();
}
$proposal->submit();
redirect();
break;
case "apply_proponent":
Login::access_action("entitled", $_SESSION['ngroup']);
action_required_parameters('proponent');
$proposal->update_proponent(trim($_POST['proponent']));
redirect();
break;
case "become_proponent":
Login::access_action("entitled", $_SESSION['ngroup']);
action_required_parameters('proponent');
$proposal->add_proponent(trim($_POST['proponent']));
redirect();
break;
case "confirm_proponent":
Login::access_action("entitled", $_SESSION['ngroup']);
action_required_parameters('member');
if (!$proposal->is_proponent(Login::$member)) {
warning(_("Your are not a proponent of this proposal."));
redirect();
}
$member = new Member($_POST['member']);
if (!$member->id) {
warning(_("The member does not exist."));
redirect();
}
$proposal->confirm_proponent($member);
redirect();
break;
case "confirm_remove_proponent":
Login::access_action("entitled", $_SESSION['ngroup']);
$proposal->remove_proponent(Login::$member);
redirect();
break;
case "add_support":
Login::access_action("entitled", $_SESSION['ngroup']);
$proposal->add_support();
redirect("#supporters");
break;
case "add_support_anonym":
Login::access_action("entitled", $_SESSION['ngroup']);
$proposal->add_support(true);
redirect("#supporters");
break;
case "renew_support":
Login::access_action("entitled", $_SESSION['ngroup']);
$proposal->renew_support();
redirect("#supporters");
break;
case "revoke_support":
Login::access_action("entitled", $_SESSION['ngroup']);
$proposal->revoke_support();
redirect("#supporters");
break;
case "demand_votingmode":
Login::access_action("entitled", $_SESSION['ngroup']);
$issue->demand_votingmode();
redirect();
break;
case "revoke_votingmode":
Login::access_action("entitled", $_SESSION['ngroup']);
$issue->revoke_votingmode();
redirect();
break;
case "save_votingmode_admin":
Login::access_action("admin");
$issue->save_votingmode_admin(!empty($_POST['votingmode_admin']));
redirect("#votingmode");
break;
case "select_period":
Login::access_action("admin");
action_proposal_select_period();
break;
case "admission_decision":
Login::access_action("admin");
action_required_parameters("admission_decision");
$proposal->set_admission_decision(trim($_POST['admission_decision']));
redirect("#admission_decision");
break;
case "save_annotation":
Login::access_action("admin");
action_required_parameters("annotation");
$proposal->annotation = trim($_POST['annotation']);
$proposal->update(["annotation"]);
redirect("#annotation");
break;
case "move_to_issue":
Login::access_action("admin");
action_required_parameters("issue");
$proposal->move_to_issue($_POST['issue']);
redirect();
break;
case "add_comment":
if ( !Login::access_allowed("comment") ) {
warning(_("You don't have permissions to write comments."));
redirect();
}
action_required_parameters("title", "content", "parent");
$comment = new Comment;
if ( in_array($_POST['parent'], ["pro", "contra", "discussion"]) ) {
$comment->parent = 0;
$comment->rubric = $_POST['parent'];
} else {
$parent = new Comment($_POST['parent']);
if (!$parent->id) {
warning(_("Parent comment does not exist."));
redirect();
}
$comment->parent = $parent->id;
$comment->rubric = $parent->rubric;
}
if ( !$proposal->allowed_add_comments($comment->rubric) ) {
warning(_("Adding or rating comments is not allowed in this phase."));
redirect();
}
$comment->proposal = $proposal->id;
$comment->title = trim($_POST['title']);
if (!$comment->title) {
warning(_("The title of the comment must be not empty."));
break;
}
$comment->content = trim($_POST['content']);
if (!$comment->content) {
warning(_("The content of the comment must be not empty."));
break;
}
$comment->add($proposal);
Comments::redirect_append_show($comment->id);
break;
case "update_comment":
if ( !Login::access_allowed("comment") ) {
warning(_("You don't have permissions to write comments."));
redirect();
}
action_required_parameters("title", "content", "id");
$comment = new Comment($_POST['id']);
if (!$comment->id) {
warning(_("This comment does not exist."));
redirect();
}
$comment->title = trim($_POST['title']);
if (!$comment->title) {
warning(_("The title of the comment must be not empty."));
break;
}
$comment->content = trim($_POST['content']);
if (!$comment->content) {
warning(_("The content of the comment must be not empty."));
break;
}
$comment->apply_changes();
Comments::redirect_append_show($comment->id);
break;
case "set_rating":
if ( !Login::access_allowed("rate") ) {
warning(_("You don't have permissions to rate comments."));
redirect();
}
action_required_parameters("comment", "rating");
$comment = new Comment($_POST['comment']);
if (!$comment->id) {
warning(_("This comment does not exist."));
redirect();
}
if ( !$proposal->allowed_add_comments($comment->rubric) ) {
warning(_("Adding or rating arguments is not allowed in this phase."));
redirect();
}
if ( !$comment->set_rating(intval($_POST['rating'])) ) redirect();
redirect("#comment".$comment->id);
break;
case "reset_rating":
if ( !Login::access_allowed("rate") ) {
warning(_("You don't have permissions to rate comments."));
redirect();
}
action_required_parameters("comment");
$comment = new Comment($_POST['comment']);
if (!$comment->id) {
warning(_("This comment does not exist."));
redirect();
}
if ( !$proposal->allowed_add_comments($comment->rubric) ) {
warning(_("Adding or rating arguments is not allowed in this phase."));
redirect();
}
if ( !$comment->delete_rating() ) redirect();
redirect("#comment".$comment->id);
break;
case "remove_comment":
case "restore_comment":
Login::access_action("admin");
action_required_parameters("id");
$comment = new Comment($_POST['id']);
if (!$comment->id) {
warning(_("This comment does not exist."));
redirect();
}
$comment->removed = ($action=="remove_comment");
$comment->update(["removed"]);
redirect("#comment".$comment->id);
break;
default:
warning(_("Unknown action"));
redirect();
}
}
// $is_propronent means only confirmed proponents
list($supporters, $proponents, $is_supporter, $is_proponent, $is_valid) = $proposal->supporters();
html_head(_("Proposal")." ".$proposal->id, true);
// messages
if (isset($_GET['remove_proponent']) and $proposal->is_proponent(Login::$member, false)) {
?>
<div class="messages">
<?
if (!$proposal->allowed_change_proponents()) {
warning(_("You can not remove yourself from the proponents list once voting preparation has started or the proposal has been closed!"));
} else {
form(URI::same(), 'class="notice"');
?>➤ <?=_("Do you really want to remove yourself from the proponents of this proposal?");
if ($proposal->proponents_count()==1 and $proposal->is_proponent(Login::$member, true)) {
?> <?=_("Since you are the last proponent, the proposal will be scheduled to be revoked.");
}
?>
<input type="hidden" name="action" value="confirm_remove_proponent">
<input type="submit" value="<?=_("Yes")?>">
<a href="<?=URI::same()?>"><?=_("No")?></a>
<?
form_end();
}
?>
</div>
<div class="clearfix"></div>
<?
}
if (Login::$member and $proposal->revoke) {
?>
<div class="messages">
<?
notice(sprintf(
_("This proposal lost all it's proponents and will be revoked on %s or when voting preparation begins, if it then still has less than %d proponents."),
dateformat_smart($proposal->revoke), REQUIRED_PROPONENTS
));
?>
</div>
<div class="clearfix"></div>
<?
}
?>
<section class="proposal_info">
<? display_proposal_info($proposal, $issue, $proponents, $is_proponent); ?>
</section>
<section class="proposal_content">
<?
if (($is_proponent or Login::$admin) and $proposal->allowed_edit_content()) {
?>
<div class="add"><a href="proposal_edit.php?id=<?=$proposal->id?>" class="icontextlink"><img src="img/edit.png" width="16" height="16" alt="<?=_("edit")?>"><?=_("Edit proposal")?></a></div>
<?
}
?>
<h2><?=_("Title")?></h2>
<p class="proposal proposal_title"><?=h($proposal->title)?></p>
<h2><?=_("Content")?></h2>
<p class="proposal"><?=content2html($proposal->content)?></p>
<?
if ($is_proponent and $proposal->allowed_edit_reason_only()) {
?>
<div class="add"><a href="proposal_edit.php?id=<?=$proposal->id?>" class="icontextlink"><img src="img/edit.png" width="16" height="16" alt="<?=_("edit")?>"><?=_("Edit reason")?></a></div>
<?
}
?>
<h2><?=_("Reason")?></h2>
<p class="proposal"><?=content2html($proposal->reason)?></p>
</section>
<div class="clearfix"></div>
<?
Comments::display($proposal);
help("timebar");
// time bar
if ($proposal->submitted or $proposal->revoke) {
$times = array();
// proposal dates
if ($proposal->submitted) {
$times[] = array($proposal->submitted, _("Submitted"), _("Submitted at %s."));
}
if ($proposal->admitted) {
$times[] = array($proposal->admitted, _("Admitted"), _("Admitted at %s."));
}
if ($proposal->revoke) {
$times[] = array($proposal->revoke, _("Revoke"),
strtr(_("Revoke proposal at %s if it then has less than %d proponents."), array('%d'=>REQUIRED_PROPONENTS))
);
}
if ($proposal->cancelled) {
switch ($proposal->state) {
case "revoked":
$times[] = array($proposal->cancelled, _("Revoked"), _("Revoked at %s."));
break;
case "cancelled_interval":
$times[] = array($proposal->cancelled, _("Cancelled"), _("Cancelled at %s because not admitted for too long."));
break;
case "cancelled_debate":
$times[] = array($proposal->cancelled, _("Cancelled"), _("Cancelled at %s because for other proposals of the same issue the debate was started."));
break;
case "cancelled_admin":
$times[] = array($proposal->cancelled, _("Cancelled"), _("Cancelled by admin at %s."));
break;
}
}
// issue/period dates
if ($issue->debate_started) {
if (!$proposal->cancelled or $proposal->cancelled > $issue->debate_started) {
$times[] = array($issue->debate_started, _("Debate"), _("Debate started at %s."));
}
} elseif ($issue->period and !$proposal->cancelled) {
$times[] = array($issue->period()->debate, _("Debate"), _("Debate starts at %s."));
}
if ($issue->preparation_started) {
if (!$proposal->cancelled or $proposal->cancelled > $issue->preparation_started) {
$times[] = array($issue->preparation_started, _("Preparation"), _("Voting preparation started at %s."));
}
} elseif ($issue->period and !$proposal->cancelled) {
$times[] = array($issue->period()->preparation, _("Preparation"), _("Voting preparation starts at %s."));
}
if ($issue->voting_started) {
if (!$proposal->cancelled or $proposal->cancelled > $issue->voting_started) {
$times[] = array($issue->voting_started, _("Voting"), _("Voting started at %s."));
}
} elseif ($issue->period and !$proposal->cancelled and !$issue->votingmode_offline()) {
$times[] = array($issue->period()->voting, _("Voting"), _("Voting starts at %s."));
}
if ($issue->counting_started) {
if (!$proposal->cancelled or $proposal->cancelled > $issue->counting_started) {
$times[] = array($issue->counting_started, _("Counting"), ("Counting started at %s."));
}
} elseif ($issue->period and !$proposal->cancelled and !$issue->votingmode_offline()) {
$times[] = array($issue->period()->counting, _("Counting"), _("Counting starts at %s."));
}
if ($issue->finished and !$proposal->cancelled) {
$times[] = array($issue->finished, _("Finished"), _("Finished at %s."));
}
if ($issue->cleared) {
$times[] = array($issue->cleared, _("Cleared"), _("Cleared at %s."));
}
if ($issue->clear) {
$times[] = array($issue->clear, _("Clear"), _("Will be cleared at %s."));
}
Timebar::display($times);
}
display_annotation($proposal);
if ($proposal->state != "draft") display_quorum($proposal, $supporters, $is_supporter, $is_valid);
?>
<section id="issue">
<?
if (Login::$admin) {
if ($proposal->allowed_move_to_issue()) {
?>
<div class="add"><?=_("Move this proposal to issue")?>: <?
form(URI::same());
input_select("issue", $proposal->options_move_to_issue());
input_hidden("action", "move_to_issue");
input_submit(_("move"));
form_end();
?></div>
<?
}
} else {
if ($issue->allowed_add_alternative_proposal()) {
if (Login::$member and Login::$member->entitled($_SESSION['ngroup'])) {
?>
<div class="add"><a href="proposal_edit.php?issue=<?=$proposal->issue?>" class="icontextlink"><img src="img/plus.png" width="16" height="16" alt="<?=_("plus")?>"><?=_("Add alternative proposal")?></a></div>
<?
} else {
?>
<div class="add icontextlink disabled" title="<?=_("You are not logged in, not in this group, not eligible or not verified.")?>"><img src="img/plus.png" width="16" height="16" alt="<?=_("plus")?>"><?=_("Add alternative proposal")?></div>
<?
}
}
}
?>
<h2><?=_("This and alternative proposals")?></h2>
<table class="proposals">
<?
$show_results = in_array($issue->state, ['finished', 'cancelled']);
Issue::display_proposals_th($show_results);
list($proposals, $submitted) = $issue->proposals_list();
$issue->display_proposals($proposals, $submitted, count($proposals), $show_results, $proposal->id);
?>
</table>
</section>
<?
html_foot();
/**
* display the right column with area and proponents
*
* @param Proposal $proposal
* @param Issue $issue
* @param array $proponents
* @param boolean $is_proponent
*/
function display_proposal_info(Proposal $proposal, Issue $issue, array $proponents, $is_proponent) {
?>
<h2><?=_("Area")?></h2>
<p class="proposal"><?=h($issue->area()->name)?></p>
<?
$is_any_proponent = false;
if (Login::$member) {
foreach ( $proponents as $proponent ) {
if ($proponent->id==Login::$member->id) {
$is_any_proponent = true;
break;
}
}
}
$allowed_edit_proponent = false;
if ($proposal->allowed_change_proponents()) {
if (Login::$member and Login::$member->entitled($_SESSION['ngroup'])) {
$allowed_edit_proponent = true;
if (!$is_any_proponent) {
?>
<div class="add"><a href="<?=URI::append(['become_proponent'=>1])?>" class="icontextlink"><img src="img/plus.png" width="16" height="16" alt="<?=_("plus")?>"><?=_("become proponent")?></a></div>
<?
}
} else {
?>
<div class="add icontextlink disabled" title="<?=_("You are not logged in, not in this group, not eligible or not verified.")?>"><img src="img/plus.png" width="16" height="16" alt="<?=_("plus")?>"><?=_("become proponent")?></div>
<?
}
}
?>
<h2><?=_("Proponents")?></h2>
<div class="proponents">
<ul>
<?
$confirmed_proponents = 0;
foreach ( $proponents as $proponent ) {
/** @var Member $proponent */
if ($proponent->proponent_confirmed) $confirmed_proponents++;
// show unconfirmed proponents only to confirmed proponents and himself
if (!$is_proponent and !$proponent->proponent_confirmed and (!Login::$member or $proponent->id!=Login::$member->id)) continue;
?>
<li><?
if (Login::$member and $proponent->id==Login::$member->id and $allowed_edit_proponent) {
if (isset($_GET['edit_proponent'])) {
form(URI::same(), "", "", "proponent", true);
?>
<input type="text" name="proponent" value="<?=h($proponent->proponent_name)?>" maxlength="<?=Proposal::proponent_length?>" required><br>
<input type="hidden" name="action" value="apply_proponent">
<input type="submit" value="<?=_("apply changes")?>">
<?
form_end();
} else {
if ($proponent->proponent_confirmed) {
echo content2html($proponent->proponent_name);
} else {
?>
<span class="unconfirmed"><?=content2html($proponent->proponent_name)?></span>
(<?=$proponent->identity()?>)
<?
}
?> <a href="<?=URI::append(['edit_proponent'=>1])?>" class="iconlink"><img src="img/edit.png" width="16" height="16" alt="<?=_("edit")?>" title="<?=_("edit your proponent name and contact details")?>"></a><a href="<?=URI::append(['remove_proponent'=>1])?>" class="iconlink"><img src="img/delete.png" width="21" height="16" alt="<?=_("delete")?>" title="<?=_("remove yourself from the list of proponents")?>"></a><?
}
} elseif ($proponent->proponent_confirmed) {
echo content2html($proponent->proponent_name);
} elseif ($is_proponent and $allowed_edit_proponent) {
form(URI::same());
?>
<span class="unconfirmed"><?=content2html($proponent->proponent_name)?></span>
(<?=$proponent->identity()?>)
<input type="hidden" name="member" value="<?=$proponent->id?>">
<input type="hidden" name="action" value="confirm_proponent">
<input type="submit" value="<?=_("confirm")?>">
<?
form_end();
} else {
?><span class="unconfirmed"><?=content2html($proponent->proponent_name)?></span><?
}
?></li>
<?
}
if (Login::$member and $allowed_edit_proponent and isset($_GET['become_proponent']) and !$is_any_proponent) {
?>
<li><?
form(URI::same(), "", "", "proponent", true);
?>
<input type="text" name="proponent" value="<?=h(Login::$member->username())?>" maxlength="<?=Proposal::proponent_length?>" required><br>
<div class="explain"><?=_("Enter your name and contact details as you would like to see them in the proposal. To prevent fraud, also your username will be shown to the other proponents.")?></div>
<input type="hidden" name="action" value="become_proponent">
<input type="submit" value="<?=_("apply to become proponent")?>">
<?
form_end();
?>
</li>
<?
}
?>
</ul>
<?
// submit proposal
if ($proposal->state=="draft") {
$needed = REQUIRED_PROPONENTS - $confirmed_proponents;
if ($needed > 0) {
?>
<p class="more_proponents"><?
printf(ngettext("One more proponent is needed for submission.", "%d more proponents are needed for submission.", $needed), $needed);
?></p>
<?
} elseif ($is_proponent) {
form(URI::same(), "", "submit_proposal");
?>
<input type="hidden" name="action" value="submit_proposal">
<input type="submit" value="<?=_("submit proposal")?>">
<?
form_end();
}
}
?>
</div>
<?
// show drafts only to the proponents
if (!$is_proponent and !Login::$admin) return;
if ($proposal->state=="draft" or !empty($_GET['show_drafts'])) {
$proposal->display_drafts($proponents);
} else {
?>
<h2><a href="<?=URI::append(['show_drafts'=>1])?>"><?=_("Drafts")?></a></h2>
<?
}
}
/**
* display supporters and offline voting demanders
*
* @param Proposal $proposal
* @param array $supporters
* @param mixed $is_supporter
* @param boolean $is_valid
*/
function display_quorum(Proposal $proposal, array $supporters, $is_supporter, $is_valid) {
?>
<section class="quorum">
<h2 id="supporters"><?=_("Supporters")?>:</h2>
<div class="bargraph_container">
<?
$proposal->bargraph_quorum($is_supporter, $is_valid);
?>
</div>
<?
if (Login::$member or Login::$admin) {
?>
<?=join(", ", $supporters);
} else {
?>
<span class="disabled"><?=_("The list of supporters is only visible for logged in users.")?></span>
<?
}
if ($proposal->allowed_change_supporters()) {
?>
<br class="clear">
<?
$disabled = (Login::$member and Login::$member->entitled($_SESSION['ngroup'])) ? "" : " disabled";
if ($is_supporter) {
if ($is_valid) {
?><div class="support">✓ <?
if ($is_supporter==="anonymous") {
echo _("You support this proposal anonymously.");
} else {
echo _("You support this proposal.");
}
?></div><?
} else {
?><div class="support_expired">✓ <?
if ($is_supporter==="anonymous") {
echo _("Your anonymous support for this proposal is expired.");
} else {
echo _("Your support for this proposal is expired.");
}
?></div><?
form(URI::same()."#supporters");
?>
<input type="hidden" name="action" value="renew_support">
<input type="submit" value="<?=_("Renew your support for this proposal")?>"<?=$disabled?>>
<?
form_end();
}
if (Login::$member and $proposal->is_proponent(Login::$member, false)) {
$disabled = ' disabled title="'._("You can not remove your support while you are proponent.").'"';
}
form(URI::same()."#supporters");
?>
<input type="hidden" name="action" value="revoke_support">
<input type="submit" value="<?=_("Revoke your support for this proposal")?>"<?=$disabled?>>
<?
form_end();
} else {
form(URI::same()."#supporters");
?>
<input type="hidden" name="action" value="add_support">
<input type="submit" value="<?=_("Support this proposal")?>"<?=$disabled?>>
<?
form_end();
form(URI::same()."#supporters");
?>
<input type="hidden" name="action" value="add_support_anonym">
<input type="submit" value="<?=_("Support this proposal anonymously")?>"<?=$disabled?>>
<?
form_end();
}
}
?>
<div class="clearfix"></div>
<?
// admission by decision
if (Login::$admin) {
if (!empty($_GET['edit_admission_decision'])) {
form(URI::same()."#admission_decision", "", "admission_decision", "admission_decision", true);
if ($proposal->admission_decision!==null) {
?>
<b><?=_("Admitted by decision")?>:</b>
<input type="text" name="admission_decision" value="<?=h($proposal->admission_decision)?>">
<input type="submit" value="<?=_("apply changes")?>">
<?
} else {
?>
<b id="admission_decision"><?=_("Admit proposal due to a decision")?>:</b>
<input type="text" name="admission_decision">
<input type="submit" value="<?=_("admit proposal")?>">
<?
}
?>
<input type="hidden" name="action" value="admission_decision">
<?
form_end();
} elseif ($proposal->admission_decision!==null) {
?>
<div id="admission_decision" class="admission_decision">
<b><?=_("Admitted by decision")?>:</b>
<?=content2html($proposal->admission_decision)?>
<a href="<?=URI::append(['edit_admission_decision'=>1])?>#admission_decision" class="iconlink"><img src="img/edit.png" width="16" height="16" <?alt(_("edit"))?>></a>
</div>
<?
} else {
?>
<div class="admission_decision">
<a href="<?=URI::append(['edit_admission_decision'=>1])?>#admission_decision"><?=_("Admit proposal due to a decision")?></a>
</div>
<?
}
} elseif ($proposal->admission_decision!==null) {
?>
<div id="admission_decision" class="admission_decision">
<b><?=_("Admitted by decision")?>:</b>
<?=content2html($proposal->admission_decision)?>
</div>
<?
}
?>
</section>
<?
}
/**
* display annotation by admins
*
* @param Proposal $proposal
*/
function display_annotation(Proposal $proposal) {
if (Login::$admin) {
?>
<section id="annotation">
<?
if (!empty($_GET['edit_annotation'])) {
?>
<h2><?=_("Annotation by admins")?></h2>
<?
form(URI::same()."#annotation", "", "annotation", "annotation", true);
?>
<textarea name="annotation" cols="100" rows="3"><?=h($proposal->annotation)?></textarea>
<input type="hidden" name="action" value="save_annotation">
<input type="submit" value="<?=_("save")?>">
<?
form_end();
} else {
?>
<div class="add"><a href="<?=URI::append(['edit_annotation'=>1])?>#annotation" class="iconlink"><img src="img/edit.png" width="16" height="16" <?alt(_("edit"))?>></a></div>
<h2><?=_("Annotation by admins")?></h2>
<?=content2html($proposal->annotation)?>
<?
}
?>
</section>
<?
} elseif ($proposal->annotation) {
?>
<section id="annotation">
<h2><?=_("Annotation by admins")?></h2>
<?=content2html($proposal->annotation)?>
</section>
<?
}
}