Exemplo n.º 1
0
	/**
	 * set the current Ngroup from $_GET['ngroup']
	 */
	public static function init() {
		if (!empty($_GET['ngroup'])) {
			$_SESSION['ngroup'] = intval($_GET['ngroup']);
			switch (BN) {
				// pages which use the ngroup parameter
			case "proposals.php":
			case "periods.php":
			case "areas.php":
			case "admin_areas.php":
				break;
				// jump to different page if the same page doesn't show the equivalent content in other groups
			case "proposal_edit.php":
				if (!isset($_GET['id']) and !isset($_GET['issue'])) break; // new (not alternative) proposal needs ngroup
			case "proposal.php":
			case "draft.php":
				redirect("proposals.php?ngroup=".$_SESSION['ngroup']);
			default:
				// remove ngroup parameter from URLs of ngroup-independent pages
				redirect(URI::strip(['ngroup'], true));
			}
		} elseif (!isset($_SESSION['ngroup'])) {
			$_SESSION['ngroup'] = 0;
		}
	}
Exemplo n.º 2
0
	/**
	 * display form with filters and search field
	 */
	public function display_form() {
?>
<form action="<?php 
echo BN;
?>
" method="GET" class="filter">
<?
		// pass on all other parameters
		URI::hidden(['filter'=>null, 'search'=>null, 'page'=>null]);

		// filter
		if ($this->filters) {
			$this->display_select_filter();
		}

		// search
		if ( $this->enable_search ) {
?>
<input type="text" name="search" value="<?php 
echo $this->search;
?>
" size="20">
<input type="submit" value="<?php 
echo _("search and filter");
?>
">
<?
		} else {
?>
<input type="submit" value="<?php 
echo _("filter");
?>
">
<?
		}
?>
<a href="<?php 
echo URI::strip(['filter', 'search']);
?>
"><?php 
echo _("reset");
?>
</a>
</form>
<?
	}
Exemplo n.º 3
0
	<div class="mid_dummy">
		<a href="<?=URI::build($params + ['filter'=>"closed"])?>" title="<?
printf(_("%d issues are finished, %d issues are cancelled"), $counts['finished'], $counts['cancelled']);
?>" class="top<?
if ($filter=="closed") { ?> active<? }
?>"><?=_("closed")?> (<?=($counts['finished']+$counts['cancelled'])?>)</a>
	</div>
</div>
<form id="search" action="<?=BN?>" method="GET">
<?
input_hidden('ngroup', $ngroup->id);
if ($filter) input_hidden("filter", $filter);
?>
<?=_("Search")?>: <input type="search" name="search" value="<?=h($search)?>">
<input type="submit" value="<?=_("search")?>">
<a href="<?=URI::strip(['search'])?>"><?=_("reset")?></a>
</form>
</div>

<table class="proposals">
<?

$pager = new Pager(10);

$sql = "SELECT issue.*
	FROM issue
	JOIN area ON area.id = issue.area AND area.ngroup = ".intval($ngroup->id);
$join_proposal = false;
$where = array();
$order_by = " ORDER BY issue.id DESC";
$show_results = false;
Exemplo n.º 4
0
	/**
	 * admins select a voting period
	 *
	 * @return boolean true if the period may be changed
	 */
	private function display_edit_period() {

		$options =& $this->available_periods();
		if (!$options) return false;

		if (@$_GET['edit_period']==$this->id) {
			form(URI::strip(['edit_period'])."#issue".$this->id);
			input_select("period", $options, $this->period);
			?><br><?
			input_hidden("issue", $this->id);
			input_hidden("action", "select_period");
?>
<input type="submit" value="<?=_("apply")?>">
<?
			form_end();
		} else {
			if ($this->period) {
				?><a href="periods.php?ngroup=<?=$this->area()->ngroup?>&amp;hl=<?=$this->period?>"><?=$this->period?></a><?
			}
			?><a href="<?=URI::append(['edit_period'=>$this->id])?>#issue<?=$this->id?>" class="iconlink"><img src="img/edit.png" width="16" height="16" alt="<?=_("edit")?>" title="<?=_("select voting period")?>"></a><?
		}

		return true;
	}
Exemplo n.º 5
0
	/**
	 * display the page with the form to edit or add a record
	 */
	protected function display_edit() {

		if ($this->id) {
			// edit existing record
			if (!$this->object) {
				$this->object = new $this->classname($this->id);
				if (!$this->object->id) {
					warning(_("The record you want to edit does not exist."));
					$this->redirect_to_list();
				}
			}
?>
<h2><?php 
echo $this->msg_strtr($this->msg_edit_record, $this->object);
?>
</h2>
<?
			$form_action = URI::append(['id'=>$this->object->id]);
		} else {
			// add new record
			if (!$this->object) {
				$this->object = new $this->classname;
			}
?>
<h2><?php 
echo $this->msg_add_record;
?>
</h2>
<?
			$form_action = "";
		}

		$this->display_edit_form_top($form_action);

?>
<fieldset>
<?

		$this->display_edit_content();

		if (method_exists($this, "after_edit_content")) {
			$this->after_edit_content();
		}

?>
<div class="buttons th"><span class="cancel"><a href="<?php 
echo URI::strip(['id']);
?>
"><?php 
echo _("cancel");
?>
</a></span><span class="input"><input type="submit" value="<?php 
echo _("save");
?>
"></span></div>
</fieldset>
<input type="hidden" name="action" value="editsubmit">
<?
		form_end();

	}
Exemplo n.º 6
0
	/**
	 * display pager
	 *
	 * @param integer $pagelinksdist (optional)
	 */
	public function display($pagelinksdist=3) {

?>
<div class="pager">
<?

		$showpagebegin = max(1, $this->page - $pagelinksdist);
		$showpageend = min($this->pagescount, $this->page + $pagelinksdist);

		$linkpart = URI::linkpart(URI::strip(['page', 'itemsperpage']));

		if ( $this->linescount > 10 ) { // display the items-per-page switch only if it would change anything
?>
<div class="itemsperpage"><?php 
echo $this->msg_itemsperpage;
?>
: &nbsp;&nbsp;
<?
			foreach ( array(10, 20, 50, 100) as $i ) {
				?><a href="<?php 
echo $linkpart;
?>
itemsperpage=<?php 
echo $i;
?>
"<?
				if ( $this->itemsperpage == $i ) { ?> class="active"<? }
				?>><?php 
echo $i;
?>
</a>
<?
			}
			?></div>
<?
		}

		$linkpart2 = $linkpart."itemsperpage=".$this->itemsperpage."&amp;";

		if ( $this->pagescount > 1 ) { // display the page only if there is more than 1 page
?>
<div class="pages"><?php 
echo _("Pages");
?>
: &nbsp;&nbsp;
<?
			if ( $this->page > $pagelinksdist + 1) {
				?><a href="<?php 
echo $linkpart2;
?>
page=1">1</a><?
				echo $this->separator;
				if ( $this->page > $pagelinksdist + 2 ) echo $this->ellipsis.$this->separator;
			}
			for ($i=$showpagebegin;$i<=$showpageend;$i++) {
				?><a href="<?php 
echo $linkpart2;
?>
page=<?php 
echo $i;
?>
"<?
				if ( $this->page==$i ) { ?> class="active"<? }
				?>><?php 
echo $i;
?>
</a><?
				if ( $i < $showpageend ) echo $this->separator;
			}
			if ( $this->page < $this->pagescount - $pagelinksdist ) {
				if ( $this->page < $this->pagescount - ($pagelinksdist+1) ) echo $this->separator.$this->ellipsis;
				echo $this->separator;
				?><a href="<?php 
echo $linkpart2;
?>
page=<?php 
echo $this->pagescount;
?>
"><?php 
echo $this->pagescount;
?>
</a><?
			}
			?></div>
<?
		}

?>
<div class="clearfix"></div>
</div>
<?

	}