/** * 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> <? } }