"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "htdocs/libraries/icms/ipf/view/Table.php" between
impresscms-1.4.2_rc.tar.gz and impresscms-1.4.2.tar.gz

About: ImpressCMS is a Content Management System for easily building and maintaining a dynamic web site (a fork of XOOPS).

Table.php  (impresscms-1.4.2_rc):Table.php  (impresscms-1.4.2)
skipping to change at line 188 skipping to change at line 188
/** /**
* *
* @param $default_sort * @param $default_sort
*/ */
public function setDefaultSort($default_sort) { public function setDefaultSort($default_sort) {
$this->_sortsel = $default_sort; $this->_sortsel = $default_sort;
} }
/** /**
* @todo change to dependency injection methods * get the default sorting
*/ */
public function getDefaultSort() { public function getDefaultSort() {
if ($this->_sortsel) { return $this->getCookie(
return icms_getCookieVar($_SERVER['SCRIPT_NAME'] . '_' . $this->_id . '_sortsel',
$this->_id . '_sortsel', $this->_sortsel); $this->_sortsel ? : $this->_objectHandler->identifierName
} else { );
return icms_getCookieVar($_SERVER['SCRIPT_NAME'] . '_' .
$this->_id . '_sortsel', $this->_objectHandler->identifierName);
}
} }
/** /**
* *
* @param unknown_type $default_order * @param unknown_type $default_order
*/ */
public function setDefaultOrder($default_order) { public function setDefaultOrder($default_order) {
$this->_ordersel = $default_order; $this->_ordersel = $default_order;
} }
/** /**
* @todo change to dependency injection methods * @return string the default order returned from a cookie
*/ */
public function getDefaultOrder() { public function getDefaultOrder() {
if ($this->_ordersel) { return $this->getCookie($this->_id . '_ordersel', $this->_orderse
return icms_getCookieVar($_SERVER['SCRIPT_NAME'] . '_' . l ?: 'ASC');
$this->_id . '_ordersel', $this->_ordersel);
} else {
return icms_getCookieVar($_SERVER['SCRIPT_NAME'] . '_' .
$this->_id . '_ordersel', 'ASC');
}
} }
/** /**
* *
* @param $actions * @param $actions
*/ */
public function addWithSelectedActions($actions = array()) { public function addWithSelectedActions($actions = array()) {
$this->addColumn(new icms_ipf_view_Column('checked', 'center', 20 , false, false, ' ')); $this->addColumn(new icms_ipf_view_Column('checked', 'center', 20 , false, false, ' '));
$this->_withSelectedActions = $actions; $this->_withSelectedActions = $actions;
} }
skipping to change at line 268 skipping to change at line 263
} }
/** /**
* *
* @todo Switch to dependency injection * @todo Switch to dependency injection
*/ */
public function setSortOrder() { public function setSortOrder() {
$this->_sortsel = isset($_GET[$this->_objectHandler->_itemname . '_' . 'sortsel']) ? $_GET[$this->_objectHandler->_itemname . '_' . 'sortsel'] : $this->getDefaultSort(); $this->_sortsel = isset($_GET[$this->_objectHandler->_itemname . '_' . 'sortsel']) ? $_GET[$this->_objectHandler->_itemname . '_' . 'sortsel'] : $this->getDefaultSort();
//$this->_sortsel = isset($_POST['sortsel']) ? $_POST['sortsel'] : $this->_sortsel; //$this->_sortsel = isset($_POST['sortsel']) ? $_POST['sortsel'] : $this->_sortsel;
icms_setCookieVar($_SERVER['SCRIPT_NAME'] . '_' . $this->_id . '_ sortsel', $this->_sortsel); $this->setCookie($this->_id . '_sortsel', $this->_sortsel);
$fieldsForSorting = $this->_tempObject->getFieldsForSorting($this ->_sortsel); $fieldsForSorting = $this->_tempObject->getFieldsForSorting($this ->_sortsel);
if (isset($this->_tempObject->vars[$this->_sortsel]['itemName'])) { if (isset($this->_tempObject->vars[$this->_sortsel]['itemName'])) {
$this->_criteria->setSort($this->_tempObject->vars[$this- >_sortsel]['itemName'] . "." . $this->_sortsel); $this->_criteria->setSort($this->_tempObject->vars[$this- >_sortsel]['itemName'] . "." . $this->_sortsel);
} else { } else {
$this->_criteria->setSort($this->_objectHandler->_itemnam e . "." . $this->_sortsel); $this->_criteria->setSort($this->_objectHandler->_itemnam e . "." . $this->_sortsel);
} }
$this->_ordersel = isset($_GET[$this->_objectHandler->_itemname . '_' . 'ordersel']) ? $_GET[$this->_objectHandler->_itemname . '_' . 'ordersel'] : $this->getDefaultOrder(); $this->_ordersel = isset($_GET[$this->_objectHandler->_itemname . '_' . 'ordersel']) ? $_GET[$this->_objectHandler->_itemname . '_' . 'ordersel'] : $this->getDefaultOrder();
//$this->_ordersel = isset($_POST['ordersel']) ? $_POST['ordersel '] :$this->_ordersel; //$this->_ordersel = isset($_POST['ordersel']) ? $_POST['ordersel '] :$this->_ordersel;
icms_setCookieVar($_SERVER['SCRIPT_NAME'] . '_' . $this->_id . '_ $this->setCookie($this->_id . '_ordersel', $this->_ordersel);
ordersel', $this->_ordersel); $this->getOrdersArray();
$ordersArray = $this->getOrdersArray();
$this->_criteria->setOrder($this->_ordersel); $this->_criteria->setOrder($this->_ordersel);
} }
/** /**
* *
* @param $id * @param $id
*/ */
public function setTableId($id) { public function setTableId($id) {
$this->_id = $id; $this->_id = $id;
} }
skipping to change at line 413 skipping to change at line 408
* @param unknown_type $debug * @param unknown_type $debug
*/ */
public function fetchObjects($debug = false) { public function fetchObjects($debug = false) {
return $this->_objectHandler->getObjects($this->_criteria, true,t rue, false, $debug); return $this->_objectHandler->getObjects($this->_criteria, true,t rue, false, $debug);
} }
/** /**
* @todo change to dependency injection methods * @todo change to dependency injection methods
*/ */
public function getDefaultFilter() { public function getDefaultFilter() {
if ($this->_filtersel) { return $this->getCookie($this->_id . '_filtersel', $this->_filter
return icms_getCookieVar($_SERVER['SCRIPT_NAME'] . '_' . sel ?: 'default');
$this->_id . '_filtersel', $this->_filtersel);
} else {
return icms_getCookieVar($_SERVER['SCRIPT_NAME'] . '_' .
$this->_id . '_filtersel', 'default');
}
} }
/** /**
* *
*/ */
public function getFiltersArray() { public function getFiltersArray() {
$ret = array(); $ret = array();
$field = array(); $field = array();
$field['caption'] = _CO_ICMS_NONE; $field['caption'] = _CO_ICMS_NONE;
$field['selected'] = ''; $field['selected'] = '';
skipping to change at line 462 skipping to change at line 453
* @param unknown_type $default_filter2 * @param unknown_type $default_filter2
*/ */
public function setDefaultFilter2($default_filter2) { public function setDefaultFilter2($default_filter2) {
$this->_filtersel2 = $default_filter2; $this->_filtersel2 = $default_filter2;
} }
/** /**
* @todo change to dependency injection methods * @todo change to dependency injection methods
*/ */
public function getDefaultFilter2() { public function getDefaultFilter2() {
if ($this->_filtersel2) { return $this->getCookie('filtersel2', $this->_filtersel2 ?: 'defa
return icms_getCookieVar($_SERVER['SCRIPT_NAME'] . '_filt ult');
ersel2', $this->_filtersel2);
} else {
return icms_getCookieVar($_SERVER['SCRIPT_NAME'] . '_filt
ersel2', 'default');
}
} }
/** /**
* *
*/ */
public function getFilters2Array() { public function getFilters2Array() {
$ret = array(); $ret = array();
foreach ($this->_filtersel2options as $key=>$value) { foreach ($this->_filtersel2options as $key=>$value) {
$field = array(); $field = array();
$field['caption'] = $value; $field['caption'] = $value;
skipping to change at line 586 skipping to change at line 573
} }
/** /**
* *
*/ */
public function renderForPrint() { public function renderForPrint() {
} }
/** /**
* Gets from cookie
*
* @param string $fieldName Field name read from cookie
* @param string|null $defaultValue Default value
*
* @return string
*/
protected function getCookie($fieldName, $defaultValue = null) {
$name = 'tbl_' . str_replace('.', '_', $fieldName);
return isset($_COOKIE[$name]) ? $_COOKIE[$name] : $defaultValue;
}
/**
* Sets cookie
*
* @param string $fieldName
* @param string $value
*/
protected function setCookie($fieldName, $value) {
setcookie(
'tbl_' . $fieldName,
$value,
time() + 3600 * 24 * 365,
parse_url(ICMS_URL, PHP_URL_PATH),
parse_url(ICMS_URL, PHP_URL_HOST),
false,
true
);
}
/**
* Render the table of records for an IPF object * Render the table of records for an IPF object
* *
* @todo change to dependency injection methods * @todo change to dependency injection methods
* @todo remove the rest of the HTML and move it to the templates * @todo remove the rest of the HTML and move it to the templates
* *
* @param $fetchOnly * @param $fetchOnly
* @param $debug * @param $debug
*/ */
public function render($fetchOnly = false, $debug = false) { public function render($fetchOnly = false, $debug = false) {
global $impresscms; global $impresscms;
skipping to change at line 659 skipping to change at line 678
* We need access to the protected vars of the icms_ipf_Object fo r a few things in the table creation. * We need access to the protected vars of the icms_ipf_Object fo r a few things in the table creation.
* Since we may not have an icms_ipf_Object to look into now, let 's create one for this purpose * Since we may not have an icms_ipf_Object to look into now, let 's create one for this purpose
* and we will free it after * and we will free it after
*/ */
$this->_tempObject =& $this->_objectHandler->create(); $this->_tempObject =& $this->_objectHandler->create();
$this->_criteria->setStart($$start); $this->_criteria->setStart($$start);
$this->setSortOrder(); $this->setSortOrder();
$this->_limitsel = !empty($limitsel) ? $limitsel : icms_getCookie Var($script_name . '_limitsel', '15'); $this->_limitsel = isset($_GET['limitsel']) ? $_GET['limitsel'] : $this->getCookie('limitsel', '15');
if ($this->_isTree) { if ($this->_isTree) {
$this->_limitsel = 'all'; $this->_limitsel = 'all';
} }
icms_setCookieVar($script_name . '_limitsel', $this->_limitsel); $this->setCookie('limitsel', $this->_limitsel);
$limitsArray = $this->getLimitsArray(); $limitsArray = $this->getLimitsArray();
$this->_criteria->setLimit($this->_limitsel); $this->_criteria->setLimit($this->_limitsel);
$this->_filtersel = $filtersel; $this->_filtersel = $filtersel;
icms_setCookieVar($script_name . '_' . $this->_id . '_filtersel', $this->_filtersel); $this->setCookie($this->_id . '_filtersel', $this->_filtersel);
$filtersArray = $this->getFiltersArray(); $filtersArray = $this->getFiltersArray();
if ($filtersArray) { if ($filtersArray) {
$this->_tpl->assign('icms_optionssel_filtersArray', $filt ersArray); $this->_tpl->assign('icms_optionssel_filtersArray', $filt ersArray);
} }
// Check if the selected filter is defined and if so, create the selfilter2 // Check if the selected filter is defined and if so, create the selfilter2
if (!empty($this->_filterseloptions[$this->_filtersel])) { if (!empty($this->_filterseloptions[$this->_filtersel])) {
// check if method associate with this filter exists in t he handler // check if method associate with this filter exists in t he handler
if (is_array($this->_filterseloptions[$this->_filtersel]) ) { if (is_array($this->_filterseloptions[$this->_filtersel]) ) {
skipping to change at line 697 skipping to change at line 716
// then we will create the selfilter2 opt ions by calling this method // then we will create the selfilter2 opt ions by calling this method
$method = $this->_filterseloptions[$this- >_filtersel]; $method = $this->_filterseloptions[$this- >_filtersel];
$this->_filtersel2options = $this->_objec tHandler->$method(); $this->_filtersel2options = $this->_objec tHandler->$method();
$this->_filtersel2 = $filtersel2; $this->_filtersel2 = $filtersel2;
$filters2Array = $this->getFilters2Array( ); $filters2Array = $this->getFilters2Array( );
$this->_tpl->assign('icms_optionssel_filt ers2Array', $filters2Array); $this->_tpl->assign('icms_optionssel_filt ers2Array', $filters2Array);
icms_setCookieVar($script_name . '_filter $this->setCookie('filtersel2', $this->_fi
sel2', $this->_filtersel2); ltersel2);
if ($this->_filtersel2 != 'default') { if ($this->_filtersel2 !== 'default') {
$this->_criteria->add(new icms_db _criteria_Item($this->_filtersel, $this->_filtersel2)); $this->_criteria->add(new icms_db _criteria_Item($this->_filtersel, $this->_filtersel2));
} }
} }
} }
} }
// Check if we have a quicksearch // Check if we have a quicksearch
if (!empty($$quicksearch)) { if (!empty($$quicksearch)) {
$quicksearch_criteria = new icms_db_criteria_Compo(); $quicksearch_criteria = new icms_db_criteria_Compo();
if (is_array($this->_quickSearch['fields'])) { if (is_array($this->_quickSearch['fields'])) {
 End of changes. 13 change blocks. 
40 lines changed or deleted 53 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)