orderField=$s; } function getOrderField() { return $this->orderField; } function setInsertRedirect($s) { $this->InsertRedirect=$s; } function getInsertRedirect() { return $this->InsertRedirect; } function setUpdateRedirect($s) { $this->UpdateRedirect=$s; } function getUpdateRedirect() { return $this->UpdateRedirect; } function setDeleteRedirect($s) { $this->DeleteRedirect=$s; } function getDeleteRedirect() { return $this->DeleteRedirect; } function setActionPage($s) { $this->actionPage=$s; } function getActionPage() { return $this->actionPage; } function addSelectType($xSelectObject) { $this->SelectObjects[$xSelectObject->getName()]=$xSelectObject; } function getSelectType($s) { if($this->SelectObjects[$s]) { return $this->SelectObjects[$s]; } else { die(sprintf('SelectType "%s" not found in xObject->getSelectType',$s)); } } function getSelectTypes() { return $this->SelectObjects; } function addInsertType($xInsertObject) { $this->InsertObjects[$xInsertObject->getName()]=$xInsertObject; } function getInsertType($s) { if($this->InsertObjects[$s]) { return $this->InsertObjects[$s]; } else { die(sprintf('InsertType "%s" not found in xObject->getInsertType',$s)); } } function getInsertTypes() { return $this->InsertObjects; } function addUpdateType($xUpdateObject) { $this->UpdateObjects[$xUpdateObject->getName()]=$xUpdateObject; } function getUpdateType($s) { if($this->UpdateObjects[$s]) { return $this->UpdateObjects[$s]; } else { die(sprintf('UpdateType "%s" not found in xObject->getUpdateType',$s)); } } function getUpdateTypes() { return $this->UpdateObjects; } function addFormType($xFormObject) { $this->FormObjects[$xFormObject->getName()]=$xFormObject; } function getFormType($s) { if($this->FormObjects[$s]) { return $this->FormObjects[$s]; } else { die(sprintf('FormType "%s" not found in xObject->getFormType',$s)); } } function getFormTypes() { return $this->FormObjects; } function addCheckType($xCheckObject) { $this->CheckObjects[$xCheckObject->getName()]=$xCheckObject; } function getCheckType($s) { if($this->CheckObjects[$s]) { return $this->CheckObjects[$s]; } else { die(sprintf('CheckType "%s" not found in xObject->getCheckType',$s)); } } function getCheckTypes() { return $this->CheckObjects; } function addDeleteType($xDeleteObject) { $this->DeleteObjects[$xDeleteObject->getName()]=$xDeleteObject; } function getDeleteType($s) { if($this->DeleteObjects[$s]) { return $this->DeleteObjects[$s]; } else { die(sprintf('DeleteType "%s" not found in xObject->getDeleteType',$s)); } } function getDeleteTypes() { return $this->DeleteObjects; } function setTableName($name) { $this->TableName=$name; } function getTableName() { return $this->TableName; } function setIdName($name) { $this->IdName=$name; } function setIdValue($val) { $this->IdValue=$val; } function getIdName() { return $this->IdName; } function getIdValue() { return $this->IdValue; } function setName($name) { $this->Name=$name; } function getName() { return $this->Name; } function getFields() { return $this->_FLD; } function addFields($_=array()) { if(is_array($_) && !empty($_))//если есть поля { foreach($_ as $key=>$val) { $this->_FLD[]=$val; } } else//полей нет, берём все поля { $_fld = mysql_list_fields(DB, $this->getTableName()); $_ = mysql_num_fields($_fld); for ($i = 0; $i < $_; $i++) { $this->_FLD[]=mysql_field_name($_fld, $i); } } } function removeFields($_=array()) { if(is_array($_)) { foreach($this->_FLD as $key=>$val) { if(in_array($val,$_)) { unset($this->_FLD[$key]); } } } } } ?>start = $s; } function setOffset($s) { $this->offset = $s; } function setTotal($s) { $this->total = $s; } function setPagesNavigationFunction($s) { $this->pagesNavigationFunction = $s; } function setLimitMoreLess($s) { $this->limitMoreLess = $s; } function getNav() { return $this->{$this->pagesNavigationFunction}($this->limitPattern); } /* HELP*HELP*HELP*HELP*HELP*HELP*HELP*HELP*HELP* структура возвращаемого массива array( 'nav'=>array( int->int, //позиция в навигации, int->'selected' //выбранная позиция в навигации ) , 'total'->int, //общее количество выбранных записей 'pages'=>int, //общее количество страниц 'prev_page'=>int, //предыдущая страница 'next_page'=>int,//следующая страница 'less'=>int,// ....меньше - ссылки при поблоковом выводе ... 6 7 8 9 10 ... 'more'=>int // ....больше - ссылки при поблоковом выводе ... 6 7 8 9 10 ... ); */ function pagesAsArray() { if($this->total<=$this->offset) { return; } if($this->total>1) { if(!$this->start) { $this->start=1; } $pages = ceil($this->total/$this->offset); for($i=1;$i<=$pages;$i++) { if($i==$this->start) { if(($i-1)>0) { $_['prev_page'] = $i-1; } if(($i+1)<=$pages) { $_['next_page'] = $i+1; } $_['nav'][$i] = 'selected'; } else { $_['nav'][$i] =$i; } } $_['pages']=$pages; $_['total']=$this->total; return $_; } } function pagesMoreLessAsArray() { if($this->total<=$this->offset) { return; } $pages = ceil($this->total/$this->offset); $limitMoreLess = $this->limitMoreLess; if($pages>$limitMoreLess) { if(!$this->start) $this->start=1; $limitMoreLess_half = floor($limitMoreLess/2); $current_page_num=$this->start; $prev_page=$current_page_num-1; if($prev_page) $_['prev_page'] = $prev_page; if ($current_page_num<=$limitMoreLess_half) { $this->start=1; $end=$limitMoreLess; } if ($current_page_num>$limitMoreLess_half) { $this->start=$current_page_num - $limitMoreLess_half; $end=$current_page_num + $limitMoreLess_half; if ($end>$pages) { $end = $pages; $this->start=$pages - $limitMoreLess +1; } } for($i=$this->start;$i<=$end;$i++) { if($i==$current_page_num) { $_['nav'][$i] = 'selected'; } else { $_['nav'][$i] =$i; } } $next_page=$current_page_num+1; if($next_page>$pages) $next_page=''; if($next_page) $_['next_page'] = $next_page; $_['pages']=$pages; $_['total']=$this->total; return $_; } else { if(!$this->start) $this->start=1; $current_page_num=$this->start; $prev_page=$current_page_num-1; if($prev_page) $_['prev_page'] = $prev_page; $end=$pages; for($i=1;$i<=$end;$i++) { if($i==$current_page_num) { $_['nav'][$i] = 'selected'; } else { $_['nav'][$i] =$i; } } $next_page=$current_page_num+1; if($next_page>$pages) $next_page=''; if($next_page) $_['next_page'] = $next_page; $_['pages']=$pages; $_['total']=$this->total; return $_; } } } ?>