set previous item as current item

@return    void
160791
public function previous()
    {
        $this->_itemValid = true;

        if (!prev($this->_items)) {
            $this->_itemValid = false;
        } else {
            $this->_itemPosition--;
        }
    }
1001781
public function current()
    {
        $currentKey = $this->keys[$this->position];

        return isset($this->items[$currentKey]) ? $this->items[$currentKey] : null;
    }
1262582
public function set($key, $value) {
		
		$previous = $this->get($key);
		
		parent::set($key, $value);
		
		return $previous;
	}
1235801
protected function _setData() {
        if (($this->_currentPage == 0)) {
            $linkDisabled = false;
        }
        else {
            $linkDisabled = true;
        }

        if ($this->_currentPage < 1) {
            $this->_currentPage = 1;
        }

        $this->_nbrPage = ceil($this->_entry / $this->_byPage);

        if ($this->_nbrPage == 0) {
            $this->_nbrPage = 1;
        }

        if ($this->_currentPage > $this->_nbrPage) {
            $this->_currentPage = $this->_nbrPage;
        }

        if ($this->_currentPage == 1) {
            $this->_paginationFirstBefore = false;
        }

        if ($this->_currentPage == $this->_nbrPage) {
            $this->_paginationLastAfter = false;
        }

        //useless to hide links if there isn't pages enough
        if ($this->_paginationCut == false || $this->_paginationCut > $this->_nbrPage) {
            for ($i = 1; $i <= $this->_nbrPage; $i++) {
                if ($i == $this->_currentPage && $linkDisabled != false) {
                    $this->_paginationList[$i] = false;
                }
                else {
                    $this->_paginationList[$i] = preg_replace('#\{page\}#isU', $i, $this->_url);
                }
            }
        }
        else {
            if ($this->_paginationCut > (($this->_nbrPage / 2) - 2)) {
                $this->_paginationCut = intval(($this->_nbrPage / 2));
            }

            if ($this->_paginationCut < 1) {
                $this->_paginationCut = 1;
            }

            if (($this->_currentPage - $this->_paginationCut) > 0 && ($this->_currentPage + $this->_paginationCut) < $this->_nbrPage) {
                for ($i = $this->_currentPage - $this->_paginationCut; $i <= $this->_currentPage + $this->_paginationCut; $i++) {
                    if ($i == $this->_currentPage && $linkDisabled != false) {
                        $this->_paginationList[$i] = false;
                    }
                    else {
                        $this->_paginationList[$i] = preg_replace('#\{page\}#isU', $i, $this->_url);
                    }
                }
            }
            elseif (($this->_currentPage - $this->_paginationCut) > 0 && ($this->_currentPage + $this->_paginationCut) >= $this->_nbrPage) {
                for ($i = $this->_currentPage - $this->_paginationCut; $i <= $this->_nbrPage; $i++) {
                    if ($i == $this->_currentPage && $linkDisabled != false) {
                        $this->_paginationList[$i] = false;
                    }
                    else {
                        $this->_paginationList[$i] = preg_replace('#\{page\}#isU', $i, $this->_url);
                    }
                }
            }
            elseif (($this->_currentPage - $this->_paginationCut) <= 0 && ($this->_currentPage + $this->_paginationCut) < $this->_nbrPage) {
                for ($i = 1; $i <= $this->_currentPage + $this->_paginationCut; $i++) {
                    if ($i == $this->_currentPage && $linkDisabled != false) {
                        $this->_paginationList[$i] = false;
                    }
                    else {
                        $this->_paginationList[$i] = preg_replace('#\{page\}#isU', $i, $this->_url);
                    }
                }
            }
            else {
                for ($i = 1; $i <= $this->_nbrPage; $i++) {
                    if ($i == $this->_currentPage && $linkDisabled != false) {
                        $this->_paginationList[$i] = false;
                    }
                    else {
                        $this->_paginationList[$i] = preg_replace('#\{page\}#isU', $i, $this->_url);
                    }
                }
            }
        }
    }
953598
public function rewind()
	{
		// Set the current position to the first object.
		if (empty($this->objects))
		{
			$this->current = false;
		}
		else
		{
			$keys = $this->keys();
			$this->current = array_shift($keys);
		}
	}
1032762
def _setCurrentRecord(self, item, record):
        
        try:
            is_record = item.record() == record
        except:
            is_record = False
        
        if is_record:
            self.setCurrentItem(item)
            return True
        
        for c in range(item.childCount()):
            if self._setCurrentRecord(item.child(c), record):
                return True
        
        return False
56209
public function rewind()
    {
        if ($this->dataObject)
            $this->current = $this->dataObject->fetch($this->style);
    }
150805
def add_to_current_action(self, controller):
        """"""
        item = self.current_item
        self._history[self._index] = item + (controller,)
936082
function Insert($item, $parent = null, $previous = null)
    {
        if ($previous)
        {
            $parent = $this->provider->ParentOf($previous);
        }
        $oldNext = $this->provider->NextOf($item);
        $oldPrev = $this->provider->PreviousOf($item);
        $oldFirst = $this->provider->FirstChildOf($parent);
        if (!($oldPrev && $previous && $this->provider->Equals($oldPrev, $previous)))
        {
            $this->CloseCutGap($oldPrev, $oldNext, $item);
        }
        $this->UpdateInsertItem($item, $parent, $previous);
        
        if (!$previous)
        {
            $this->AssureFirstChild($item, $oldFirst);
        }
    }
251175
private function getCurrentItem()
    {
        // Hack for weird initialization logic
        if (!$this->currentItem) {
            $key = $this->getCurrentKey();
            $this->currentItem = $this->getItemStorage()->get($key);
        }

        return $this->currentItem;
    }
244302
def previous_row(self):
        """"""
        row = self.currentIndex().row()
        rows = self.source_model.rowCount()
        if row == 0:
            row = rows
        self.selectRow(row - 1)
391268
function previousStep()
    {
        $this->setMetaData( 'current_stage', eZWizardBase::STAGE_PRE );
        $this->setMetaData( 'current_step', $this->metaData( 'current_step' ) - 1 );
        $this->savePersistentData();

        return $this->Module->redirectTo( $this->WizardURL );
    }
925230
protected function doMoveBefore() {
    $request = $this->getRequest();
    $persistenceFacade = $this->getPersistenceFacade();
    $isOrderBottom = $this->isOrderBotton($request);

    // load the moved object and the reference object
    $insertOid = ObjectId::parse($request->getValue('insertOid'));
    $referenceOid = ObjectId::parse($request->getValue('referenceOid'));
    $insertObject = $persistenceFacade->load($insertOid);
    $referenceObject = $isOrderBottom ? new NullNode() : $persistenceFacade->load($referenceOid);

    // check object existence
    $objectMap = ['insertOid' => $insertObject,
        'referenceOid' => $referenceObject];
    if ($this->checkObjects($objectMap)) {
      // determine the sort key
      $mapper = $insertObject->getMapper();
      $type = $insertObject->getType();
      $sortkeyDef = $mapper->getSortkey();
      $sortkey = $sortkeyDef['sortFieldName'];
      $sortdir = strtoupper($sortkeyDef['sortDirection']);

      // get the sortkey values of the objects before and after the insert position
      if ($isOrderBottom) {
        $lastObject = $this->loadLastObject($type, $sortkey, $sortdir);
        $prevValue = $lastObject != null ? $this->getSortkeyValue($lastObject, $sortkey) : 1;
        $nextValue = ceil($sortdir == 'ASC' ? $prevValue+1 : $prevValue-1);
      }
      else {
        $nextValue = $this->getSortkeyValue($referenceObject, $sortkey);
        $prevObject = $this->loadPreviousObject($type, $sortkey, $nextValue, $sortdir);
        $prevValue = $prevObject != null ? $this->getSortkeyValue($prevObject, $sortkey) :
          ceil($sortdir == 'ASC' ? $nextValue-1 : $nextValue+1);
      }

      // set the sortkey value to the average
      $insertObject->setValue($sortkey, ($nextValue+$prevValue)/2);
    }
  }
1351041
public function setCurrent($current) {
        if(!$this->routeKeyPrefix)
            $current = str_replace($this->routeKeyPrefix,'',$current);
        if(!is_numeric($current)) return;
        if($current <= $this->getMax()) $this->current_page = $current;
        else $this->current_page = $this->getMax();
    }
1211455
public function rewind()
    {
        $this->itemCount = 0;
        $this->position = 0;

        if ($this->config['firstPage']) {
            list($this->page, $shouldContinue) = $this->mapResults($this->config['firstPage']);
            $nextResultToken = $this->determineNextResultToken($this->page, $shouldContinue);
        } else {
            $this->page = null;
            $nextResultToken = $this->initialResultToken;
        }

        if ($nextResultToken) {
            $this->set($this->resultTokenPath, $this->callOptions, $nextResultToken);
        }
    }
943688
def item_selected(self, item=None):
        """"""
        if item is None:
            item = self.currentItem()

        # stack history is in inverse order
        try:
            index = self.stack_history[-(self.currentRow()+1)]
        except IndexError:
            pass
        else:
            self.editor.set_stack_index(index)
            self.editor.current_changed(index)
        self.hide()
785808
def go_previous_thumbnail(self):
        """"""
        if self.current_thumbnail is not None:
            index = self._thumbnails.index(self.current_thumbnail) - 1
            index = index if index >= 0 else len(self._thumbnails) - 1
            self.set_current_index(index)
            self.scroll_to_item(index)