public static function addGroup($groupName, $messages)
 {
     if (!Util::isEmpty($messages)) {
         foreach ($messages as $k => $v) {
             FlashMessageStorage::add($k, $v, $groupName);
         }
     }
 }
 public static function getLayoutPath($routeData, $layoutName = null)
 {
     if (Util::isEmpty($layoutName)) {
         return null;
     }
     if (RouteData::isSystemRequest($routeData)) {
         $basePath = 'ph/phAdmin/application/views/_layout/';
     } else {
         $basePath = 'application/views/_layout/';
     }
     $filePath = $basePath . $layoutName . '.' . self::$VIEW_FILE_EXTENSION;
     if (file_exists($filePath)) {
         return $filePath;
     }
     return null;
 }
示例#3
0
 private function getUrlValidationErrors($catalog)
 {
     $errors = [];
     if (Util::isEmpty($catalog['url'])) {
         $errors['Catalog_EmptyUrl'] = 1;
         return $errors;
     }
     $catalogWithSameUrl = $this->catalogDAO->getByUrl($catalog['url']);
     if (!Util::isEmpty($catalogWithSameUrl) && $catalogWithSameUrl['id'] !== $catalog['id']) {
         $errors['Catalog_ExistingUrl'] = ['url' => $catalog['url']];
     }
     return $errors;
 }
 private function getNameValidationErrors($product)
 {
     $errors = [];
     if (Util::isEmpty($product['name'])) {
         $errors['Product_EmptyName'] = 1;
         return $errors;
     }
     return $errors;
 }
 private function getPasswordValidationErrors($user)
 {
     $errors = [];
     if (Util::isEmpty($user['password'])) {
         $errors['User_EmptyPassword'] = 1;
     } else {
         if (!StringUtil::equal($user['password'], $user['password_confirm'])) {
             $errors['User_PasswordNotConfirmed'] = 1;
         }
     }
     return $errors;
 }