english/administrator/components/com_menus/models/item.php
/**
	 * Method to perform batch operations on an item or a set of items.
	 *
	 * @param	array	$commands	An array of commands to perform.
	 * @param	array	$pks		An array of category ids.
	 *
	 * @return	boolean	Returns true on success, false on failure.
	 * @since	1.6
	 */
Method to perform batch operations on an item or a set of items.
@param       array   $commands       An array of commands to perform.
@param       array   $pks            An array of category ids.

@return      boolean Returns true on success, false on failure.
Method to perform batch operations on an item or a set of items . @param array $commands An array of commands to perform . @param array $pks An array of category ids . @return boolean Returns true on success false on failure .
function batch($commands, $pks)
	{
		$pks = array_unique($pks);
		JArrayHelper::toInteger($pks);
		if (array_search(0, $pks, true)) {
			unset($pks[array_search(0, $pks, true)]);
		}
		if (empty($pks)) {
			$this->setError(JText::_('COM_MENUS_NO_ITEM_SELECTED'));
			return false;
		}
		$done = false;
		if (!empty($commands['assetgroup_id'])) {
			if (!$this->batchAccess($commands['assetgroup_id'], $pks)) {
				return false;
			}
			$done = true;
		}
		if (!empty($commands['menu_id'])) {
			$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c');
			if ($cmd == 'c' && !$this->batchCopy($commands['menu_id'], $pks)) {
				return false;
			}
			else if ($cmd == 'm' && !$this->batchMove($commands['menu_id'], $pks)) {
				return false;
			}
			$done = true;
		}
		if (!$done) {
			$this->setError(JText::_('JGLOBAL_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
			return false;
		}
		return true;
	}
function batch ( $ commands , $ pks ) { $ pks = array_unique ( $ pks ) ; JArrayHelper :: toInteger ( $ pks ) ; if ( array_search ( 0 , $ pks , true ) ) { unset ( $ pks [ array_search ( 0 , $ pks , true ) ] ) ; } if ( empty ( $ pks ) ) { $ this -> setError ( JText :: _ ( 'COM_MENUS_NO_ITEM_SELECTED' ) ) ; return false ; } $ done = false ; if ( ! empty ( $ commands [ 'assetgroup_id' ] ) ) { if ( ! $ this -> batchAccess ( $ commands [ 'assetgroup_id' ] , $ pks ) ) { return false ; } $ done = true ; } if ( ! empty ( $ commands [ 'menu_id' ] ) ) { $ cmd = JArrayHelper :: getValue ( $ commands , 'move_copy' , 'c' ) ; if ( $ cmd == 'c' && ! $ this -> batchCopy ( $ commands [ 'menu_id' ] , $ pks ) ) { return false ; } else if ( $ cmd == 'm' && ! $ this -> batchMove ( $ commands [ 'menu_id' ] , $ pks ) ) { return false ; } $ done = true ; } if ( ! $ done ) { $ this -> setError ( JText :: _ ( 'JGLOBAL_ERROR_INSUFFICIENT_BATCH_INFORMATION' ) ) ; return false ; } return true ; }
Method to perform batch operations on an item or a set of items.
Method to perform batch operations on an item or a set of items .
// Sanitize user ids. // Remove any values of zero.