public function recreatepasswordAction()
 {
     list($officeAdapter, $officeSql) = $this->createOfficeAdapter();
     $dbAdapter = $this->getServiceLocator()->get('dbAdapter');
     $dbSql = $this->getServiceLocator()->get('dbSql');
     $select = $dbSql->select(['u' => \User\Model\UserMapper::TABLE_NAME]);
     $select->where(['createdById' => 1]);
     $select->where(['oneofficeId IS NOT NULL']);
     $select->where(['salt IS NULL']);
     $paginatorAdapter = new \Zend\Paginator\Adapter\DbSelect($select, $dbAdapter);
     $paginator = new \Zend\Paginator\Paginator($paginatorAdapter);
     $paginator->setItemCountPerPage(50);
     $page = $this->getRequest()->getQuery('page', 1);
     $totalUpdate = $this->getRequest()->getQuery('totalUpdate', 0);
     $paginator->setCurrentPageNumber($page);
     $userMapper = $this->getServiceLocator()->get('\\User\\Model\\UserMapper');
     foreach ($paginator as $row) {
         $row = (array) $row;
         $user = new \User\Model\User();
         $user->exchangeArray($row);
         $user->setSalt($user->generateSalt());
         $user->setPassword($user->createPassword('vatgia.com'));
         $select = $officeSql->select(['u' => 'users']);
         $select->where(['ID' => $user->getOneofficeId()]);
         $select->where(['is_deleted' => 'no']);
         $check = $officeAdapter->query($officeSql->buildSqlString($select), $officeAdapter::QUERY_MODE_EXECUTE);
         if ($check->count()) {
             $user->setLocked(null);
         } else {
             $user->setLocked(1);
         }
         $userMapper->save($user);
         $totalUpdate++;
     }
     $this->getViewModel()->setTerminal(true);
     $this->getViewModel()->setVariable('paginator', $paginator);
     $this->getViewModel()->setVariable('page', $page);
     $this->getViewModel()->setVariable('totalPages', $paginator->count() + 1);
     $this->getViewModel()->setVariable('totalUpdate', $totalUpdate);
     if ($paginator->count()) {
         $this->getViewModel()->setVariable('redirectUri', Uri::build('/system/tool/recreatepassword', ['page' => $page + 1, 'totalUpdate' => $totalUpdate]));
     }
     return $this->getViewModel();
 }