public function index()
 {
     $this->set('categories', BrandCategory::getAll());
     $this->set('logs', Log::getLatest(25));
     $this->render('findguidelines/index');
 }
 public function brand()
 {
     ini_set('post_max_size', '32M');
     ini_set('upload_max_filesize', '32M');
     ini_set('memory_limit', '64M');
     $id = null;
     if (!empty($_GET['id'])) {
         $id = (int) $_GET['id'];
     }
     $brand = new Brand();
     $brand->withId($id);
     if (!empty($_POST)) {
         if (isset($_POST['name'])) {
             $brand->name = $_POST['name'];
         }
         if (isset($_POST['brandColor'])) {
             $brand->brandColor = $_POST['brandColor'];
         }
         if (isset($_POST['borderColor'])) {
             $brand->borderColor = $_POST['borderColor'];
         }
         if (isset($_POST['category'])) {
             $brand->category = $_POST['category'];
         }
         if (isset($_POST['tags'])) {
             $brand->tags = $_POST['tags'];
         }
         if (isset($_POST['slug'])) {
             $brand->slug = $_POST['slug'];
         }
         if (isset($_POST['url'])) {
             $brand->url = $_POST['url'];
         }
         if (isset($_POST['date'])) {
             $brand->date = $_POST['date'];
         }
         if (isset($_POST['isPDF'])) {
             $brand->isPDF = $_POST['isPDF'];
         }
         if (isset($_POST['status'])) {
             $brand->status = $_POST['status'];
         }
         if ($brand->save()) {
             if (!empty($_FILES)) {
                 if (!empty($_FILES['logoPNG']['size'])) {
                     $this->uploadFileToBrand($brand, 'logoPNG', 'png');
                 }
                 if (!empty($_FILES['logoSVG']['size'])) {
                     $this->uploadFileToBrand($brand, 'logoSVG', 'svg');
                 }
             }
             header('Location: ' . $this->getUrl('brands'));
             exit;
         }
     }
     $this->set('categories', BrandCategory::getAll());
     $this->set('brand', $brand);
     $this->render('administration/brand');
 }