Example #1
0
	function prepare()
	{
		// Prepare JS
		$this->ownerDocument->head
			->a(new LPC_HTML_script("//tinymce.cachefly.net/4.0/tinymce.min.js"), "TinyMCE")
			->a(new LPC_HTML_script(LPC_js."/LPC_HTML_editor.js"), "LPC HTML editor");

		// Prepare textarea
		$this->textarea->setUID();
		$this->a($this->textarea);

		// Prepare controls
		$controlsDiv = new LPC_HTML_node();
		$this->a($controlsDiv);
		$checkbox = new LPC_HTML_node('input');
		$controlsDiv->a($checkbox);
		$checkbox->setUID();
		$checkbox->setAttrs(array(
			'type' => 'checkbox',
			'onChange' => "LPC_HTML_editor.showHideHandle(this, '".$this->textarea->id."')",
		));
		$label = new LPC_HTML_node("label");
		$controlsDiv->a($label);
		$label->setAttr("for", $checkbox->id);
		$label->a(" ".__L('scaffoldingUseHtmlEditor'));
		if ($this->init) {
			$js = new LPC_HTML_script();
			$js->a("$(document).ready(function() { LPC_HTML_editor.initAndShow($('#".$checkbox->id."').get(0), '".$this->textarea->id."'); });");
			$this->a($js);
		}
	}
Example #2
0
	function populatePaginating()
	{
		$elemCount=$this->getElementCount();
		if (!$this->entriesPerPage || $elemCount <= $this->entriesPerPage)
			return null;

		$pageCount=ceil($elemCount / $this->entriesPerPage);
		$paginator=new LPC_HTML_node("div");
		$paginator->setAttr('id', 'list_paginator_'.$this->id);
		$paginator->setAttr('class', $this->paginatorClass);
		$paginator->a(__L("lpcListPageLabel")." ");

		$pages=array();
		$firstStart = 1;
		$firstEnd = min($this->paginatorEndsPages, $pageCount);
		for($page = $firstStart; $page <= $firstEnd; $page++)
			$pages[] = $page;

		$aroundStart = max($firstStart, $this->currentPage - $this->paginatorAroundPages);
		$aroundEnd = min($pageCount, $this->currentPage + $this->paginatorAroundPages);
		for($page = $aroundStart; $page<=$aroundEnd; $page++)
			$pages[]=$page;

		$lastStart = max(1,$pageCount-$this->paginatorEndsPages);
		$lastEnd = $pageCount;

		for($page = $lastStart; $page <= $lastEnd; $page++)
			$pages[]=$page;
		$pages = array_unique($pages);

		$lastPage=0;
		foreach($pages as $page) {
			if ($page!=$lastPage+1)
				$paginator->a(" … ");
			elseif ($page>1)
				$paginator->a(" &bull; ");
			$lastPage=$page;
			if ($page==$this->currentPage) {
				$paginator->a("<b>".$page."</b>");
				continue;
			}
			$paginator->a($this->getPageLink($page));
		}
		$this->a($paginator);
	}
Example #3
0
/**
 * Records a new field section, and then prints the localized version of $label into the form as
 * <hX class="sectionbreak"><span>$label</span></hX>
 * where X is = $level
 */
function formheading($label, $level = 1)
{
    set_formsection($label, $level);
    echo '<div class="sectionbreak"><p>' . __L($label) . '</p></div>';
}
Example #4
0
File: logout.php Project: Gutza/LPC
<?php

$p = LPC_Page::getCurrent();
$u = LPC_User::getCurrent(true);
if (!$u)
	$p->a(new LPC_HTML_error(__L("lpcLogoutAlready")));
else {
	$u->logout();
	$p->a(new LPC_HTML_confirm(__L("lpcLogoutConfirm")));
}
$p->show();
Example #5
0
File: index.php Project: Gutza/LPC
<?php

$p = LPC_Page::getCurrent();
$u = LPC_User::getCurrent();

if (!$u->isSuperuser()) {
	$p->a(new LPC_HTML_error(__L('genericErrorRights')));
	return;
}

$p->st("LPC main menu");

$p->a("<ul>
<li><a href='translate/'>Translations</a></li>
<li><a href='flush_privileges.php'>Flush privileges</a></li>
<li><a href='scaffolding/'>Scaffolding</a></li>
<li><a href='logout.php'>Log out</a></li>
</ul>");
Example #6
0
<?php

$u=LPC_User::getCurrent();
$p=LPC_Page::getCurrent();

if (!$u->isHyperuser()) {
	$p->a(new LPC_HTML_error(__L("genericErrorRights")));
	return;
}

$u->expireCache(0,0);
$p->a(new LPC_HTML_confirm(__L("lpcFlushPrivsConfirm")));