Exemplo n.º 1
0
	public function run()
	{
		$currentPageNum = 1;
		if($this->total > $this->maxPerPage)
		{	//If there`s no nessecary to paginate
			$currentPageNum = floor($this->total / $this->maxPerPage);
			if(($this->total % $this->maxPerPage) != 0)
				$currentPageNum++;	//round to greater
		}
		else
		{
			return;	//no pagination
		}

		$dec = floor(($this->currentPage-1) / 10);	//quantity of tens
		if($dec > 0)
		{
			echo CHtml::link('1', AAHelperUrl::replaceParam(Yii::app()->request->requestUri, 'page', 1)).' … ';
			if($dec > 2)
			{
				$pcntr = floor($dec/2)*10;
				echo CHtml::link('1', AAHelperUrl::replaceParam(Yii::app()->request->requestUri, 'page', $pcntr)).' … ';
			}
		}

		for($i = 1; $i < 12; $i++)
		{
			$pn = ($dec * 10) + $i;
			if($pn <= $currentPageNum)
			{	//Perhaps will finish earlier
				if($i == 11)
				{	//to next ten
					echo CHtml::link(Yii::t('AutoAdmin.common', 'More'), AAHelperUrl::replaceParam(Yii::app()->request->requestUri, 'page', $pn), array('class'=>'more'));
				}
				else
				{
					if($pn != $this->currentPage)
					{	//active, unactive...
						echo CHtml::link($pn, AAHelperUrl::replaceParam(Yii::app()->request->requestUri, 'page', $pn), array('class'=>'pagenum page'.$i));
					}
					else
					{
						echo CHtml::tag('span', array('class'=>'pagenum active'), $pn);
					}
				}
			}
		}
	}
Exemplo n.º 2
0
	/**
	 * Sets the link to a sublevel interface.
	 * Call this function only after fieldsConf().
	 * @param string $href Base href: the controller's action name - in non-directly ($directly=false) mode, a complete href othwerwise.
	 * @param bool $directly If set as true, no changes will be applied to $href. Otherwise it would be processed in compliance with internal rules.
	 */
	public function setSubHref($href, $directly=false)
	{
		if($directly)
			$this->subHref = $href;
		else
		{
			if(!$this->_data->fields)
				throw new AAException(Yii::t('AutoAdmin.errors', 'Function setSubHref() can be called only after fieldsConf()'));

			$this->subHref = $this->_controller->createUrl("{$this->_controller->id}/{$href}");
			//We have to store all parent "bk" sets. So we did it using "bkp" param as a stack.
			$bk = Yii::app()->request->getParam('bk', array());
			$bkp = Yii::app()->request->getParam('bkp', array());	//Parent interfaces' bindings
			array_push($bkp, $bk);
			$this->subHref = AAHelperUrl::replaceParam($this->subHref, 'bkp', $bkp);
		}
	}
Exemplo n.º 3
0
<?php
Yii::app()->clientScript
	->registerCssFile(AutoAdmin::$assetPath.'/css/edit.css')
	->registerScriptFile(AutoAdmin::$assetPath.'/js/edit.js');

$url = AAHelperUrl::replaceParam($baseURL, 'action', ($manageAction == 'edit' ? 'update' : 'insert'));

if(empty($this->breadcrumbs))
	$this->breadcrumbs[$this->pageTitle] = AAHelperUrl::stripParam($url, array('action', 'id'));
else
{
	$key = array_search($this->pageTitle, $this->breadcrumbs);
	if(is_numeric($key))
	{
		unset($this->breadcrumbs[$key]);
		$this->breadcrumbs[$this->pageTitle] = AAHelperUrl::stripParam($url, array('action', 'id'));
	}
}
?>
<h1><?php echo $this->pageTitle?></h1>
<?php
if(!empty($partialViews['up']))
	$this->renderPartial($partialViews['up'], $clientData);

if(!empty($clientData['subtitle']))
{
	?><h2><?php echo $clientData['subtitle']?></h2><?php
}
if(!empty($clientData['subhtml']))
{
	echo $clientData['subhtml'];