Ejemplo n.º 1
0
<?
			form(URI::same(), 'class="button"');
?>
<input type="hidden" name="area" value="<?php 
echo $row['id'];
?>
">
<input type="hidden" name="action" value="unsubscribe">
<input type="submit" value="<?php 
echo _("unsubscribe");
?>
">
<?
			form_end();
		}
		form(URI::same(), 'class="button"');
?>
<input type="hidden" name="area" value="<?php 
echo $row['id'];
?>
">
<input type="hidden" name="action" value="subscribe">
<input type="submit" value="<?php 
echo $row['activated'] ? _("subscribe anew") : _("subscribe");
?>
">
<?
		form_end();
?>
		</td>
<? } ?>
Ejemplo n.º 2
0
/**
 * 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>
<?
	}
}
Ejemplo n.º 3
0
	/**
	 * column "voting mode"
	 *
	 * @param integer $num_rows
	 * @param boolean $submitted
	 * @param integer $selected_proposal enable form only on detail page
	 * @param string  $link
	 */
	private function display_votingmode($num_rows, $submitted, $selected_proposal, $link) {
?>
		<td rowspan="<?=$num_rows?>"<?

		$admin_form = (Login::$admin and $selected_proposal and $this->votingmode_determination_admin());

		if ($this->votingmode_determination($submitted)) {
			if ($selected_proposal) {
				?> class="votingmode"<?
			} else {
				?> class="votingmode link" onClick="location.href='<?=$link?>#issue'"<?
			}
			?> title="<?
			if (Login::$member) {
				$entitled = Login::$member->entitled($this->area()->ngroup);
				$votingmode_demanded = $this->votingmode_demanded_by_member();
				if ($votingmode_demanded) {
					echo _("You demand offline voting.");
				} elseif ($entitled) {
					echo _("You can demand offline voting.");
				} else {
					echo _("You are not entitled in this group.");
				}
			} else {
				$entitled = false;
				$votingmode_demanded = false;
				echo _("determination if online or offline voting");
			}
			?>"><?
			if (!$selected_proposal) { ?><a href="<?=$link?>#issue"><? }
			?><img src="img/votingmode_20.png" width="75" height="20" alt="<?=_("determination if online or offline voting")?>" class="vmiddle"><?
			if (!$selected_proposal) { ?></a><? }
			if ($votingmode_demanded) { ?>&#10003;<? }
			if ($selected_proposal) {
				$disabled = $entitled ? "" : " disabled";
				form(URI::same());
				if ($votingmode_demanded) {
					echo _("You demand offline voting.")?>
<input type="hidden" name="action" value="revoke_votingmode">
<input type="submit" value="<?=_("Revoke")?>"<?=$disabled?>>
<?
				} else {
?>
<input type="hidden" name="action" value="demand_votingmode">
<input type="submit" value="<?=_("Demand offline voting")?>"<?=$disabled?>>
<?
				}
				form_end();
			}
		} elseif ($this->votingmode_offline()) {
			if ($admin_form) {
				?> class="votingmode"<?
			} else {
				?> class="votingmode link" onClick="location.href='votingmode_result.php?issue=<?=$this->id?>'"<?
			}
			?> title="<?=_("offline voting")?>"><a href="votingmode_result.php?issue=<?=$this->id?>"><img src="img/offline_voting_30.png" width="37" height="30" alt="<?=_("offline voting")?>" class="vmiddle"></a><?
		} elseif ($this->state!="entry") {
			?> class="votingmode link" onClick="location.href='votingmode_result.php?issue=<?=$this->id?>'" title="<?=_("online voting")?>"><a href="votingmode_result.php?issue=<?=$this->id?>"><img src="img/online_voting_30.png" width="24" height="30" alt="<?=_("online voting")?>" class="vmiddle"></a><?
		} else {
			?>><?
		}

		// offline voting by admin
		if (Login::$admin) {
			if ($admin_form) {
				form(URI::same()."#votingmode", 'id="votingmode"');
				input_hidden("action", "save_votingmode_admin");
?>
			<label><input type="checkbox" name="votingmode_admin" value="1"<?
				if ($this->votingmode_admin) { ?> checked<? }
				?>><?=_("offline voting by admin")?></label><br>
<?
				input_submit(_("apply"));
				form_end();
			} elseif ($this->votingmode_admin) {
				?><br><?=_("offline voting by admin");
			}
		}

		?></td>
<?
	}
Ejemplo n.º 4
0
	/**
	 * content area of one comment
	 *
	 * @param Comment $comment
	 */
	private function display_comment_content(Comment $comment) {
?>
		<p><?php 
echo content2html($comment->content);
?>
</p>
<?

		// reply
		if (
			self::$proposal->allowed_add_comments($this->rubric) and
			self::$parent!=$comment->id and
			!$comment->removed
		) {
			if (Login::access_allowed("comment")) {
				$open = self::$open;
				$open[] = $comment->id;
				$open = array_unique($open);
?>
		<div class="reply"><a href="<?php 
echo URI::append(['open' => $open, 'parent' => $comment->id]);
?>
#form" class="iconlink"><img src="img/reply.png" width="16" height="16" <?alt(_("reply"))?>></a></div>
<?
			} else {
?>
		<div class="reply iconlink disabled"><img src="img/reply.png" width="16" height="16" <?alt(_("reply"))?>></div>
<?
			}
		}

		// rating and remove/restore
		if ($comment->rating) {
			?><span class="rating" title="<?php 
echo _("sum of ratings");
?>
">+<?php 
echo $comment->rating;
?>
</span> <?
		}
		if (Login::$admin) {
			form(URI::same(), 'class="button"');
?>
<input type="hidden" name="id" value="<?php 
echo $comment->id;
?>
">
<?
			if ($comment->removed) {
?>
<input type="hidden" name="action" value="restore_comment">
<input type="submit" value="<?php 
echo _("restore");
?>
">
<?
			} else {
?>
<input type="hidden" name="action" value="remove_comment">
<input type="submit" value="<?php 
echo _("remove");
?>
">
<?
			}
			form_end();
		} elseif (
			self::$proposal->allowed_add_comments($this->rubric) and
			// don't allow to rate ones own comments
			!$comment->is_author() and
			// don't allow to rate removed comments
			!$comment->removed
		) {
			if (Login::access_allowed("rate")) {
				$disabled = "";
				$uri = URI::same()."#comment".$comment->id;
			} else {
				$disabled = " disabled";
				$uri = "";
			}
			if ($comment->score) {
				form($uri, 'class="button rating reset"');
?>
<input type="hidden" name="comment" value="<?php 
echo $comment->id;
?>
">
<input type="hidden" name="action" value="reset_rating">
<input type="submit" value="0"<?php 
echo $disabled;
?>
>
<?
				form_end();
			}
			for ($score=1; $score <= Comment::rating_score_max; $score++) {
				form($uri, 'class="button rating'.($score <= $comment->score?' selected':'').'"');
?>
<input type="hidden" name="comment" value="<?php 
echo $comment->id;
?>
">
<input type="hidden" name="action" value="set_rating">
<input type="hidden" name="rating" value="<?php 
echo $score;
?>
">
<input type="submit" value="+<?php 
echo $score;
?>
"<?php 
echo $disabled;
?>
>
<?
				form_end();
			}
		}

	}
Ejemplo n.º 5
0
/**
 * display help text
 *
 * default for logged in members:      show all help
 * default for not logged in sessions: hide all help
 *
 * This function should not be used on pages with forms, because users will lose their already filled in data if they click on the help buttons.
 *
 * @param string  $anchor (optional) for additional help messages on the same page
 * @param boolean $h1     (optional)
 */
function help($anchor="", $h1=false) {
	if ($anchor) {
		$link_anchor = "#help_".$anchor;
		$id = ' id="help_'.$anchor.'"';
		$identifier = BN."#".$anchor;
	} else {
		$link_anchor = "";
		$id = '';
		$identifier = BN;
	}
	if (Login::$member) {
		$show = !in_array($identifier, Login::$member->hide_help());
	} else {
		if ( isset($_SESSION['show_help']) ) {
			$show = in_array($identifier, $_SESSION['show_help']);
		} else {
			$show = false;
		}
	}
	if ($show) {
?>
<section class="help"<?=$id?>>
<?
		form(URI::same().$link_anchor, 'class="hide_help"');
		if ($anchor) {
?>
<input type="hidden" name="anchor" value="<?=$anchor?>">
<?
		}
?>
<input type="hidden" name="action" value="hide_help">
<input type="submit" value="<?=_("hide help")?>">
<?
		form_end();
		// read help content
		$display = false;
		$list = false;
		foreach ( file("locale/help_".LANG.".html", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) as $line ) {
			if ($display) {
				$line_begin = mb_substr($line, 0, 3);
				if ($line_begin == "===") break;
				// replace placeholders
				if ( strpos($line, "%")!==false ) {
					static $replace;
					if (!$replace) {
						$replace = array(
							'%REQUIRED_PROPONENTS'   => REQUIRED_PROPONENTS,
							'%QUORUM_VOTINGMODE'     => numden([QUORUM_VOTINGMODE_NUM, QUORUM_VOTINGMODE_DEN]),
							'%MAIL_SUPPORT'          => MAIL_SUPPORT,
							'%COMMENT_EDIT_INTERVAL' => translate_time_interval(COMMENT_EDIT_INTERVAL)
						);
					}
					$line = strtr($line, $replace);
				}
				// list / paragraph
				if ($line_begin == " * ") {
					if (!$list) {
						$list = true;
?>
<ul>
<?
					}
?>
	<li><?=mb_substr($line, 3)?></li>
<?
				} else {
					if ($list) {
?>
</ul>
<?
						$list = false;
					}
?>
<p><?=$line?></p>
<?
				}
			} elseif ($line == "===".$identifier) {
				$display = true;
			}
		}
?>
</section>
<?
	} else {
		form(URI::same().$link_anchor, 'class="show_help'.($h1?' h1':'').'"'.$id);
		if ($anchor) {
?>
<input type="hidden" name="anchor" value="<?=$anchor?>">
<?
		}
?>
<input type="hidden" name="action" value="show_help">
<input type="submit" value="<?=_("show help")?>">
<?
		form_end();
	}
}