Esempio n. 1
0
 /**
  * passMenuItems
  *
  * @param <object> $params
  * inc_children
  * inc_noItemid
  * @param <array> $selection
  * @param <string> $assignment
  *
  * @return <bool>
  */
 function passMenuItem(&$main, &$params, $selection = array(), $assignment = 'all')
 {
     $pass = 0;
     if ($main->_params->Itemid) {
         $selection = $main->makeArray($selection);
         $pass = in_array($main->_params->Itemid, $selection);
         if ($pass && $params->inc_children == 2) {
             $pass = 0;
         } else {
             if (!$pass && $params->inc_children) {
                 $parentids = NNFrameworkAssignmentsMenu::getParentIds($main, $main->_params->Itemid);
                 if (!version_compare(JVERSION, '1.6.0', 'l')) {
                     $parentids = array_diff($parentids, array('1'));
                 }
                 foreach ($parentids as $parent) {
                     if (in_array($parent, $selection)) {
                         $pass = 1;
                         break;
                     }
                 }
                 unset($parentids);
             }
         }
     } else {
         if ($params->inc_noItemid) {
             $pass = 1;
         }
     }
     if ($pass) {
         return $assignment == 'include';
     } else {
         return $assignment == 'exclude';
     }
 }
Esempio n. 2
0
	/**
	 * passMenuItems
	 *
	 * @param <object> $params
	 * inc_children
	 * inc_noItemid
	 * @param <array> $selection
	 * @param <string> $assignment
	 *
	 * @return <bool>
	 */
	function passMenuItem( &$main, &$params, $selection = array(), $assignment = 'all' )
	{
		$pass = 0;

		if ( $main->_params->Itemid ) {
			$selection = $main->makeArray( $selection );
			$pass = in_array( $main->_params->Itemid, $selection );
			if ( $pass && $params->inc_children == 2 ) {
				$pass = 0;
			} else if ( !$pass && $params->inc_children ) {
				$parentids = NNFrameworkAssignmentsMenu::getParentIds( $main, $main->_params->Itemid );
				foreach ( $parentids as $parent ) {
					if ( in_array( $parent, $selection ) ) {
						$pass = 1;
						break;
					}
				}
				unset( $parentids );
			}
		} else if ( $params->inc_noItemid ) {
			$pass = 1;
		}

		if ( $pass ) {
			return ( $assignment == 'include' );
		} else {
			return ( $assignment == 'exclude' );
		}
	}