Пример #1
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>
<?
	}
}
Пример #2
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();
			}
		}

	}
Пример #3
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;
	}
	/**
	 * table body
	 *
	 * overload method for line highlighting
	 *
	 * @param resource $result
	 * @param boolean $direct_edit
	 * @param boolean $show_edit_column
	 * @param integer $linescount
	 */
	protected function display_list_tbody($result, $direct_edit, $show_edit_column, $linescount) {
?>
<tbody>
<?

		if ($this->enable_pager) {

			if (!isset($_GET['page']) and isset($_GET['hl'])) {
				// go to the page with the record to be highlighted
				$line = 0;
				while ( $object = DB::fetch_object($result, $this->classname) ) {
					if ($_GET['hl']==$object->id) {
						$this->pager->page = $this->pager->page_for_line($line);
						break;
					}
					$line++;
				}
			}

			$this->pager->seek($result);
			$line = $this->pager->firstline;
		} else {
			$line = 0;
		}
		while ( $object = DB::fetch_object($result, $this->classname) and (!$this->enable_pager or $line <= $this->pager->lastline) ) {
?>
	<tr class="<?=stripes($line);
			if (isset($_GET['hl']) and $_GET['hl']==$object->id) { ?> highlight<? }
			?>">
<?

			// use the submitted values instead of the the record from the database
			if ($direct_edit and isset($this->directedit_objects[$object->id])) {
				$object = $this->directedit_objects[$object->id];
			}

			foreach ( $this->columns as $column ) {
				if (isset($column[3]) and $column[3]===false) continue;
?>
		<td<? $this->cellclass($column) ?>><?

				$method = "print_".(!empty($column[3])?$column[3]:"text");
				if (method_exists($this, $method)) {
					$this->$method(
						// parameters for print methods:
						($column[0]?$object->$column[0]:null), // 1 content
						$object,                               // 2 object
						$column,                               // 3 column description (array)
						$line,                                 // 4 line number (starting at 0)
						$linescount                            // 5 count of lines selected in the database
					);
				} else {
					$method = "dbtableadmin_".$method;
					$object->$method(
						// parameters for print methods:
						($column[0]?$object->$column[0]:null), // 1 content
						$column,                               // 2 column description (array)
						$line,                                 // 3 line number (starting at 0)
						$linescount                            // 4 count of lines selected in the database
					);
				}
				?></td>
<?
			}

			// right column for edit, delete, duplicate
			if ($show_edit_column) {
?>
		<td class="nowrap">
<?
				// edit
				if ($this->enable_edit) {
?>
			<a href="<?=URI::append(['id'=>$object->id])?>" class="iconlink"><img src="img/edit.png" width="16" height="16" <?alt(_("edit"))?>></a>
<?
				}
				// duplicate
				if ($this->enable_duplicate) {
?>
			<input type="button" value="<?=_("duplicate")?>" onclick="submit_button('duplicate', <?=$object->id?>);">
<?
				}
				// delete
				if ( $this->enable_delete_single or $this->enable_delete_checked ) {
					$this->display_list_delete($object);
				}
?>
		</td>
<?
			}

?>
	</tr>
<?
			$line++;
		} // end while

?>
</tbody>
<?
	}
Пример #5
0
	/**
	 * link to insert a new record
	 */
	protected function display_add_record() {
?>
<div class="add_record"><a href="<?php 
echo URI::append(['id' => 0]);
?>
" class="icontextlink"><img src="img/plus.png" width="16" height="16" alt="<?php 
echo _("plus");
?>
"><?php 
echo $this->msg_add_record;
?>
</a></div>
<?
	}