fitness-web/common/components/Helper.php

50 lines
1.3 KiB
PHP

<?php
namespace common\components;
class Helper
{
public static function hufRound($m){
$result = round($m/5, 0) * 5;
return $result;
}
public static function notInInterval($query ,$field , $start,$end ){
$query->andFilterWhere( ['or', [ '<', $field , isset( $start ) ? $start : '1900-01-01' ] ,[ '>=' , $field , isset($end) ? $end : '3000-01-01' ] ] );
}
public static function notPaid($query ,$field , $start,$end ){
$query->andFilterWhere( ['or', [ '<', $field , isset( $start ) ? $start : '1900-01-01' ] ,[ '>=' , $field , isset($end) ? $end : '3000-01-01' ] ,[ "transfer.status" => Transfer::STATUS_NOT_PAID ] ] );
}
public static function inInterval($query ,$field , $start,$end ){
$query->andFilterWhere([ '>=', $field , $start ] );
$query->andFilterWhere([ '<' , $field , $end ] );
}
public static function roleLabels(){
return [
'reception' => Yii::t('common/role' ,'Reception'),
'admin' => Yii::t('common/role' ,'Administrator'),
'employee' => Yii::t('common/role' ,'Alkalmazott'),
];
}
public static function roleDefinitions(){
return [
'employee' => [
'canAllow' => [ 'employee'],
],
'admin' => [
'canAllow' => ['admin','reception','employee'],
],
'reception' => [
'canAllow' => [ ],
],
];
}
}