コード例 #1
0
 /**
  * List all backup
  */
 public function indexAction()
 {
     $this->_toolbar->addBreadcrumb('m_system_system_manager');
     $this->_toolbar->addBreadcrumb('m_system_backup_database');
     $this->_toolbar->addHeaderPrimary('m_system_backup_database');
     $this->_toolbar->addCustomButton('system|database|backup', 'Backup Database', '/admin/system/database/backup/', 'glyphicon glyphicon-floppy-disk', 'btn btn-success');
     $this->_toolbar->addCustomButton('system|database|fullBackUp', 'Backup Full Site', '/admin/system/database/fullBackUp/', 'glyphicon glyphicon-retweet', 'btn btn-primary');
     $filesBackup = glob(APP_DIR . '/backup/database/' . '*.backup');
     $files = [];
     foreach ($filesBackup as $index => $file) {
         $fileOb = new \stdClass();
         $fileOb->id = $index + 1;
         $fileOb->name = basename($file);
         $fileOb->base64Name = base64_encode($fileOb->name);
         $fileOb->size = number_format(filesize($file) / (1024 * 1024), 3) . ' MB';
         $files[] = $fileOb;
     }
     //Add filter
     $this->addFilter('filter_order', 'id', 'string');
     $this->addFilter('filter_order_dir', 'ASC', 'string');
     //Get all filter
     $filter = $this->getFilter();
     $this->view->setVar('_filter', $filter);
     $currentPage = $this->request->get('page');
     $this->view->setVar('_page', ZPagination::getPaginationNativeArray($files, $this->config->pagination->limit, $currentPage));
     $this->view->setVar('_pageLayout', [['type' => 'check_all'], ['type' => 'index', 'title' => '#'], ['type' => 'link', 'title' => 'File Name', 'column' => 'name', 'access' => $this->acl->isAllowed('system|database|download'), 'link' => '/admin/system/database/download/', 'link_prefix' => 'base64Name', 'sort' => false], ['type' => 'text', 'title' => 'Size', 'class' => 'text-center', 'column' => 'size', 'sort' => false]]);
 }