'Januar', 2 => 'Februar', 3 => 'März', 4 => 'April', 5 => 'Mai', 6 => 'Juni', 7 => 'Juli', 8 => 'August', 9 => 'September', 10 => 'Oktober', 11 => 'November', 12 => 'Dezember', ]; private static $roles = [ 0 => 'Kunde', 1 => 'Admin', 2 => 'SuperAdmin', 3 => 'SySAdmin', ]; public static function getMonth($i){ return self::$months[intval($i)]; } public static function getRoleLabel($role_id = 0){ return ''.self::$roles[$role_id].''; } public static function getLabel($id){ switch ($id) { case 0: return 'badge-default'; break; case 1: return 'badge-warning'; break; case 2: return 'badge-primary'; break; case 3: return 'badge-primary'; break; } } public static function getRolesOptions(){ $ret = ""; foreach (self::$roles as $role_id => $value){ $ret .= '\n'; } return $ret; } public static function getYearSelectOptions(){ $start = date("Y", strtotime("-5 years", time())); $end = date("Y", strtotime("+1 years", time())); $values = range($start, $end); $now = date("Y", time()); $ret = ""; foreach ($values as $value){ $attr = ($value == $now) ? 'selected="selected"' : ''; $ret .= '\n'; } return $ret; } public static function getAttributesWithoutParents($id = false, $sameId = false, $all = true){ $values = Attribute::where('parent_id', null)->get(); $ret = ""; if($all){ $ret .= '\n'; } foreach ($values as $value){ if($sameId == $value->id){ continue; } $attr = ($value->id == $id) ? 'selected="selected"' : ''; $ret .= '\n'; } return $ret; } public static function getCategoriesWithoutParents($id = false, $sameId = false, $all = true){ $values = Category::where('parent_id', null)->get(); $ret = ""; if($all){ $ret .= '\n'; } foreach ($values as $value){ if($sameId == $value->id){ continue; } $attr = ($value->id == $id) ? 'selected="selected"' : ''; $ret .= '\n'; } return $ret; } public static function getProductsOptions($ids = array(), $all = true){ if($ids == null){ $ids = array(); } $values = Product::where('active', 1)->get(); $ret = ""; if($all){ $ret .= '\n'; } foreach ($values as $value){ $attr = in_array($value->id, $ids) ? 'selected="selected"' : ''; $ret .= '\n'; } return $ret; } public static function getCategoriesOptions($ids = array(), $all = true){ $values = Category::where('active', 1)->get(); $ret = ""; if($all){ $ret .= '\n'; } foreach ($values as $value){ $attr = in_array($value->id, $ids) ? 'selected="selected"' : ''; $ret .= '\n'; } return $ret; } public static function getAttributesOptions($ids = array(), $all = true){ $values = Attribute::where('active', 1)->get(); $ret = ""; if($all){ $ret .= '\n'; } foreach ($values as $value){ $attr = in_array($value->id, $ids) ? 'selected="selected"' : ''; $ret .= '\n'; } return $ret; } public static function getUserLevelOptions($id = false, $all = true){ $values = UserLevel::where('active', 1)->get(); $ret = ""; if($all){ $ret .= '\n'; } foreach ($values as $value){ $attr = ($value->id == $id) ? 'selected="selected"' : ''; $ret .= '\n'; } return $ret; } public static function getCompanyOptions($company){ $options = array(1 => __('business'), 0 => __('private'), ); $ret = ""; foreach ($options as $id => $value){ $attr = ($id == $company) ? 'selected="selected"' : ''; $ret .= '\n'; } return $ret; } public static function getContriesWithMore($id, $all=true){# $values = Country::all(); $counter = 1; $ret = ""; if($all){ $ret .= '\n'; } foreach ($values as $value){ if( $counter == 7){ $ret .= ''; } $attr = ($value->id == $id) ? 'selected="selected"' : ''; $ret .= '\n'; $counter ++; } $ret .= ''; return $ret; } public static function getContriesCodes($id, $all=true){# $values = Country::all(); $counter = 1; $ret = ""; if($all){ $ret .= '\n'; } foreach ($values as $value){ if(!$value->phone) continue; if( $counter == 7){ $ret .= ''; } $attr = ($value->id == $id) ? 'selected="selected"' : ''; $ret .= '\n'; $counter ++; } $ret .= ''; return $ret; } public static function getCountriesWithoutUsedShippings($all=true){# $values = Country::all(); $country_ids = ShippingCountry::all()->pluck('country_id')->toArray(); $ret = ""; if($all){ $ret .= '\n'; } foreach ($values as $value){ if(!in_array($value->id, $country_ids)){ $ret .= '\n'; } } return $ret; } public static function getCountriesForShipping($id, $all=false){# $values = ShippingCountry::all(); $ret = ""; if($all){ $ret .= '\n'; } foreach ($values as $value){ $attr = ($value->id == $id) ? 'selected="selected"' : ''; $ret .= '\n'; } return $ret; } public static function getSalutation($id){ $values = array('mr' => __('MR'), 'ms' => __('MS')); $ret = ""; $ret .= '\n'; foreach ($values as $key => $value){ $attr = ($key == $id) ? 'selected="selected"' : ''; $ret .= '\n'; } return $ret; } public static function getSalutationLang($id){ $values = array('mr' => __('MR'), 'ms' => __('MS')); return (!empty($values[$id]) ? $values[$id] : ''); } public static function getTaxSaleOptions($id){ $values = array('1' => __('taxable_sales_1'), '2' => __('taxable_sales_2')); $ret = ""; $ret .= '\n'; foreach ($values as $key => $value){ $attr = ($key == $id) ? 'selected="selected"' : ''; $ret .= '\n'; } return $ret; } public static function getMembersOptions($id, $all=false){ $values = User::where('active', '=', true)->where('blocked', '=', false)->where('payment_account', '>=', now())->get(); $ret = ""; if($all){ $ret .= '\n'; } foreach ($values as $value){ $attr = ($value->id == $id) ? 'selected="selected"' : ''; $to=""; if($value->account){ $to = $value->account->first_name." ".$value->account->last_name." | "; } $ret .= '\n'; } return $ret; } }