<commit_before><?php

namespace frontend\controllers;

use common\components\FrontendController;
use Yii;
use frontend\models\TimekeepingFrontend;
use frontend\models\search\TimekeepingSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;

/**
 * TimekeepingController implements the CRUD actions for TimekeepingFrontend model.
 */
class TimekeepingController extends FrontendController
{
    /**
     * @inheritdoc
     */
    public function behaviors()
    {
        return [
            'verbs' => [
                'class' => VerbFilter::className(),
                'actions' => [
                    'delete' => ['POST'],
                ],
            ],
        ];
    }

    /**
     * Lists all TimekeepingFrontend models.
     * @return mixed
     */
    public function actionIndex()
    {
        $searchModel = new TimekeepingSearch();
		$params = Yii::$app->request->queryParams;
		
		$params['deleted']=0;
		$params['from_time']= isset($params['TimekeepingSearch']['from_time'])?date("Y-m-d H:i",strtotime($params['TimekeepingSearch']['from_time'])):'';
		$params['to_time']= isset($params['TimekeepingSearch']['to_time'])?date("Y-m-d H:i",strtotime($params['TimekeepingSearch']['to_time'])):'';
		$params['deleted']=0;
        $dataProvider = $searchModel->search($params);
        return $this->render('index', [
            'searchModel' => $searchModel,
            'dataProvider' => $dataProvider,
        ]);
    }
	   /**
     * Lists all TimekeepingFrontend models.
     * @return mixed
     */
    public function actionExport()
    {
		$searchModel = new TimekeepingSearch();
		$params = Yii::$app->request->queryParams;
		$params['deleted']=0;
		$params['from_time']= isset($params['TimekeepingSearch']['from_time'])?date("Y-m-d H:i",strtotime($params['TimekeepingSearch']['from_time'])):'';
		$params['to_time']= isset($params['TimekeepingSearch']['to_time'])?date("Y-m-d H:i",strtotime($params['TimekeepingSearch']['to_time'])):'';
		$params['deleted']=0;
        $dataProvider = $searchModel->search($params);
		$model = $dataProvider->getModels();
        \moonland\phpexcel\Excel::export([
			'models' => $model,
			 'fileName' => 'Timekeeping_export_'.date("Y-m-d_His"), 
			
				'columns' => [
						[
							'attribute' => 'staff_name',
							'header' => 'Tên nhân viên',
							'format' => 'raw',
							'headerOptions' => ['style'=>'text-align: center;width:150px'],
							'contentOptions'=>['style'=>'text-align: center; vertical-align:middle;'],
							'value' => function($data) {
				
								return isset($data->staff) ?$data->staff->name : null;
			   
							}
						 ],
						 [
							 'attribute' => 'phone',
							'header' => 'Điện thoại',
							'format' => 'raw',
							'options' => ['width' => '20px'],<commit_msg>Update export<commit_after><?php

namespace frontend\controllers;

use common\components\FrontendController;
use Yii;
use frontend\models\TimekeepingFrontend;
use frontend\models\search\TimekeepingSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;

/**
 * TimekeepingController implements the CRUD actions for TimekeepingFrontend model.
 */
class TimekeepingController extends FrontendController
{
    /**
     * @inheritdoc
     */
    public function behaviors()
    {
        return [
            'verbs' => [
                'class' => VerbFilter::className(),
                'actions' => [
                    'delete' => ['POST'],
                ],
            ],
        ];
    }

    /**
     * Lists all TimekeepingFrontend models.
     * @return mixed
     */
    public function actionIndex()
    {
        $searchModel = new TimekeepingSearch();
		$params = Yii::$app->request->queryParams;
		
		$params['deleted']=0;
		$params['from_time']= isset($params['TimekeepingSearch']['from_time'])?date("Y-m-d H:i",strtotime($params['TimekeepingSearch']['from_time'])):'';
		$params['to_time']= isset($params['TimekeepingSearch']['to_time'])?date("Y-m-d H:i",strtotime($params['TimekeepingSearch']['to_time'])):'';
		$params['deleted']=0;
        $dataProvider = $searchModel->search($params);
        return $this->render('index', [
            'searchModel' => $searchModel,
            'dataProvider' => $dataProvider,
        ]);
    }
	   /**
     * Lists all TimekeepingFrontend models.
     * @return mixed
     */
    public function actionExport()
    {
		
		$searchModel = new TimekeepingSearch();
		$params = Yii::$app->request->queryParams;
		$params['deleted']=0;
		$params['from_time']= isset($params['TimekeepingSearch']['from_time'])?date("Y-m-d H:i",strtotime($params['TimekeepingSearch']['from_time'])):'';
		$params['to_time']= isset($params['TimekeepingSearch']['to_time'])?date("Y-m-d H:i",strtotime($params['TimekeepingSearch']['to_time'])):'';
		$params['deleted']=0;
        $dataProvider = $searchModel->search($params);
		$model = $dataProvider->getModels();
        \moonland\phpexcel\Excel::export([
			'models' => $model,
			 'fileName' => 'Timekeeping_export_'.date("Y-m-d_His"), 
			
				'columns' => [
						[
							'attribute' => 'staff_name',
							'header' => '<NAME>',
							'format' => 'raw',
							'headerOptions' => ['style'=>'text-align: center;width:150px'],
							'contentOptions'=>['style'=>'text-align: center; vertical-align:middle;'],
							'value' => function($data) {
				
								return isset($data->staff) ?$data->staff->name : null;
			   
							}
						 ],
						 [
							 'attribute' => 'phone',
							'header' => 'Điện thoại',
							'format' => 'raw',
							'options' => ['width' => '20px'],
{'fraction_non_alphanumeric': 0.18761124955500177, 'fraction_numerical': 0.003203987184051264, 'mean_word_length': 3.1468634686346864, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 70, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3740238', 'n_tokens_mistral': 1985, 'n_tokens_neox': 1745, 'n_words': 262}