| Current Path : /var/www/html/mydlvsacc/backend/models/ |
| Current File : /var/www/html/mydlvsacc/backend/models/ReportGraph.php |
<?php
namespace backend\models;
use Yii;
/**
* This is the model class for table "report_graph".
*
* @property integer $id_report_graph
* @property integer $id_report_meta
* @property string $title_graph
* @property string $table_name
* @property string $sql_statement
* @property string $yAxis
* @property string $xAxis
* @property string $yAxis_replacement_name
* @property string $type_report
* @property string $created_at
* @property string $created_by
* @property string $updated_at
* @property string $updated_by
*/
class ReportGraph extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'report_graph';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[[ 'id_report_meta'], 'integer'],
[['title_graph', 'table_name', 'sql_statement', 'yAxis', 'xAxis', 'yAxis_replacement_name', 'type_report','graph_type', 'created_at', 'created_by', 'updated_at', 'updated_by'], 'string'],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id_report_graph' => 'Id Report Graph',
'id_report_meta' => 'Id Report Meta',
'title_graph' => 'Title Graph',
'table_name' => 'Table Name',
'sql_statement' => 'Sql Statement',
'yAxis' => 'Y Axis',
'xAxis' => 'X Axis',
'yAxis_replacement_name' => 'Y Axis Replacement Name',
'type_report' => 'Report Type',
'graph_type' => 'Graph Type ',
'created_at' => 'Created At',
'created_by' => 'Created By',
'updated_at' => 'Updated At',
'updated_by' => 'Updated By',
];
}
public function getReportMeta()
{
return $this->hasOne(ReportMeta::className(), ['id_report_meta' => 'id_report_meta']);
}
public function getGraph()
{
if($model->graph_type == "column"){
return "COLUMN CHART";
}elseif($model->graph_type == "bar"){
return "BAR CHART";
}elseif($model->graph_type == "area"){
return "AREA CHART";
}
}
}