Exemple #1
0
	/**
	 * returns HTML code for the filters
	 *
	 * @param cbEditRowView $editRowView
	 * @param string        $htmlFormatting  ( 'table', 'td', 'none' )
	 * @return unknown
	 */
	function filters( &$editRowView, $htmlFormatting = 'none' ) {
		global $_CB_framework;
		$lists 						=	array();
		if ( count( $this->_filters ) > 0 ) {
			/*
			if ( $this->pageNav !== null ) {
				$onchangeJs			=	$this->pageNav->js_limitstart(0);
			} else {
				$onchangeJs			=	'cbParentForm(this).submit();';
			}
			*/
			$valueObj				=	new cbObject();
			$saveName				=	array();
			foreach ( $this->_filters as $k => $v ) {
				$valname			=	'filter_' . $v['name'];
				$valueObj->$valname	=	$v['value'];

				// $filterXml			=	$v['xml'];
				$saveName[$k]		=	$v['xml']->attributes( 'name' );
				$this->_filters[$k]['xml']->addAttribute( 'name', 'filter_' . $saveName[$k] );

				$editRowView->setSelectValues( $v['xml'], $v['selectValues'] );
			}

			$renderedViews			=	array();

			foreach ( $this->_filters as $k => $v ) {
				// <filter> tag: $v['xml']

				$viewName				=	$v['xml']->attributes( 'view' );

				if ( $viewName ) {
					$view			=	$this->_filters[$k]['xmlparent']->getChildByNameAttr( 'view', 'name', $viewName );
					if ( ! $view ) {
						echo 'filter view ' . $viewName . ' not defined in filters';
					}
				} else {
					$view			=	$this->_filters[$k]['xml']->getElementByPath( 'view' );
				}

				if ( $view ) {
					if ( ( ! $viewName ) || ! in_array( $viewName, $renderedViews ) ) {
						$lists[$k]		=	$editRowView->renderEditRowView( $view, $valueObj, $this, $this->_options, 'param', $htmlFormatting );
					}
					if ( $viewName ) {
						$renderedViews[] =	$viewName;
					}
				} else {
					$editRowView->pushModelOfData( $valueObj );
					$editRowView->extendParamAttributes( $this->_filters[$k]['xml'], $this->control_name() );
					$result			=	$editRowView->renderParam( $this->_filters[$k]['xml'], $this->control_name(), false );
					$editRowView->popModelOfData();
					$lists[$k]		=	'<div class="cbFilter">'
									. '<span class="cbLabelSpan">' . $result[0] . '</span> '
									. '<span class="cbDescrSpan">' . $result[2] . '</span>'
									. '<span class="cbFieldSpan">' . $result[1] . '</span>'
									. '</div>';
				}
			}
			foreach ( $this->_filters as $k => $v ) {
				$this->_filters[$k]['xml']->addAttribute( 'name', $saveName[$k] );
			}
			if ( count( $lists ) > 1 ) {
				$adminimagesdir		=	$_CB_framework->getCfg( 'live_site' ) . '/components/com_comprofiler/images/';
				$lists[]			=	'<div class="cbFilter"><input type="image" src="' . $adminimagesdir . '/search.gif" alt="' . _UE_SEARCH . '" align="top" style="border: 0px;" /></div>';
			}
		}
		return $lists;
	}
 /**
  * Converts the parameters received as request array into the raw parms text NEVER ESCAPED
  *
  * @param  mixed    $params             Request array or string escaped only if MAGIC_QUOTES are ON
  * @param  boolean  $checkMagicSlashes  TRUE: if magic_quotes are ON, remove slashes, FALSE: never remove slashes
  * @return string                       The raw parms text NEVER addslash-ESCAPED
  */
 public static function getRawParamsUnescaped($params, $checkMagicSlashes)
 {
     if (is_array($params)) {
         $txt = array();
         foreach ($params as $k => $v) {
             if (is_array($v)) {
                 if (isset($v[0])) {
                     $v = implode("|*|", $v);
                 } else {
                     $r = '';
                     foreach ($v as $kk => $vv) {
                         $r .= '|**|' . $kk . '=' . $vv;
                     }
                     $v = $r;
                 }
             }
             if ($checkMagicSlashes && get_magic_quotes_gpc()) {
                 $v = stripslashes($v);
             }
             $txt[] = "{$k}={$v}";
         }
         /** @noinspection PhpDeprecationInspection */
         $ret = cbEditRowView::textareaHandling($txt);
     } else {
         if ($checkMagicSlashes && get_magic_quotes_gpc()) {
             $ret = stripslashes($params);
         } else {
             $ret = $params;
         }
     }
     return $ret;
 }