First Commit
This commit is contained in:
commit
610aa1e202
4204 changed files with 636764 additions and 0 deletions
168
app/Services/HTMLHelper.php
Normal file
168
app/Services/HTMLHelper.php
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
<?php
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\Country;
|
||||
use App\Models\IndustrySector;
|
||||
use App\Models\Interest;
|
||||
use Form;
|
||||
|
||||
class HTMLHelper
|
||||
{
|
||||
|
||||
|
||||
private static $months = [
|
||||
1 => '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',
|
||||
];
|
||||
|
||||
|
||||
public static function getMonth($i){
|
||||
return self::$months[intval($i)];
|
||||
}
|
||||
|
||||
public static function getRoleLabel($role_id = 0){
|
||||
return '<span class="badge badge-pill '.self::getLable($role_id).'">'.self::$roles[$role_id].'</span>';
|
||||
}
|
||||
|
||||
public static function getLable($id){
|
||||
switch ($id) {
|
||||
case 0:
|
||||
return 'badge-default';
|
||||
break;
|
||||
case 1:
|
||||
return 'badge-warning';
|
||||
break;
|
||||
case 2:
|
||||
return 'badge-primary';
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static function getRolesOptions(){
|
||||
$ret = "";
|
||||
foreach (self::$roles as $role_id => $value){
|
||||
$ret .= '<option value="'.$role_id.'">'.$value.'</option>\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 .= '<option value="'.$value.'" '.$attr.'>'.$value.'</option>\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 .= '<option value="'.$id.'" '.$attr.'>'.$value.'</option>\n';
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
public static function getIndustrySectorsWithoutParents($id = false, $sameId = false, $all = true){
|
||||
$values = IndustrySector::where('parent_id', null)->get();
|
||||
$ret = "";
|
||||
if($all){
|
||||
$ret .= '<option value="">'.__('no').'</option>\n';
|
||||
}
|
||||
foreach ($values as $value){
|
||||
if($sameId == $value->id){
|
||||
continue;
|
||||
}
|
||||
$attr = ($value->id == $id) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->name.'</option>\n';
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getContriesWithMore($id, $all=true){#
|
||||
$values = Country::all();
|
||||
$counter = 1;
|
||||
$ret = "";
|
||||
if($all){
|
||||
$ret .= '<option value="">'.__('please select').'</option>\n';
|
||||
|
||||
}
|
||||
foreach ($values as $value){
|
||||
if( $counter == 7){
|
||||
$ret .= '<optgroup label="'.__('further countrie').'">';
|
||||
}
|
||||
$attr = ($value->id == $id) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->getLocated().'</option>\n';
|
||||
|
||||
$counter ++;
|
||||
}
|
||||
$ret .= '</optgroup>';
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getContriesCodes($id, $all=true){#
|
||||
$values = Country::all();
|
||||
$counter = 1;
|
||||
$ret = "";
|
||||
if($all){
|
||||
$ret .= '<option value="">'.__('please select').'</option>\n';
|
||||
|
||||
}
|
||||
foreach ($values as $value){
|
||||
|
||||
if(!$value->phone) continue;
|
||||
if( $counter == 7){
|
||||
$ret .= '<optgroup label="'.__('further countrie').'">';
|
||||
}
|
||||
$attr = ($value->id == $id) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->phone.'('.$value->getLocated().')</option>\n';
|
||||
|
||||
$counter ++;
|
||||
}
|
||||
$ret .= '</optgroup>';
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
public static function getSalutation($id){
|
||||
$values = array('mr' => __('MR'), 'ms' => __('MS'));
|
||||
$ret = "";
|
||||
$ret .= '<option value="">'.__('please select').'</option>\n';
|
||||
foreach ($values as $key => $value){
|
||||
$attr = ($key == $id) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$key.'" '.$attr.'>'.$value.'</option>\n';
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getSalutationLang($id){
|
||||
$values = array('mr' => __('MR'), 'ms' => __('MS'));
|
||||
return (!empty($values[$id]) ? $values[$id] : '');
|
||||
}
|
||||
*/
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue