17 Nov - Static Sites to laravel

This commit is contained in:
Kevin Adametz 2018-11-17 02:01:22 +01:00
parent 610aa1e202
commit 5ff57a21a7
3661 changed files with 569001 additions and 771 deletions

View file

@ -1,6 +1,8 @@
<?php
namespace App\Services;
use App\Models\Attribute;
use App\Models\Category;
use App\Models\Country;
use App\Models\IndustrySector;
use App\Models\Interest;
@ -64,8 +66,6 @@ class HTMLHelper
return $ret;
}
public static function getYearSelectOptions(){
$start = date("Y", strtotime("-5 years", time()));
$end = date("Y", strtotime("+1 years", time()));
@ -79,6 +79,66 @@ class HTMLHelper
return $ret;
}
public static function getAttributesWithoutParents($id = false, $sameId = false, $all = true){
$values = Attribute::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 getCategoriesWithoutParents($id = false, $sameId = false, $all = true){
$values = Category::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 getCategoriesOptions($ids = array(), $all = true){
$values = Category::where('active', 1)->get();
$ret = "";
if($all){
$ret .= '<option value="">'.__('no').'</option>\n';
}
foreach ($values as $value){
$attr = in_array($value->id, $ids) ? 'selected="selected"' : '';
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->name.'</option>\n';
}
return $ret;
}
public static function getAttributesOptions($ids = array(), $all = true){
$values = Attribute::where('active', 1)->get();
$ret = "";
if($all){
$ret .= '<option value="">'.__('no').'</option>\n';
}
foreach ($values as $value){
$attr = in_array($value->id, $ids) ? 'selected="selected"' : '';
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->name.'</option>\n';
}
return $ret;
}
/* public static function getCompanyOptions($company){
$options = array(1 => __('business'), 0 => __('private'), );
$ret = "";