<commit_before><?php
/**
 * @link https://github.com/denar90/yii2-lazy-loading-module
 * @copyright Copyright (c) 2014 denar90
 * @license http://opensource.org/licenses/MIT MIT
 */

namespace denar90\lazyloading\controllers;

use Yii;
use yii\web\Controller;

class LazyLoadingController extends Controller {

    /**
     * Action for getting data.
     * @param boolean $getDataFlag
     * @param string $limit How many items get from table
     * @param string $offset
     * @return json $data Data with items
     */
    public function actionIndex($getDataFlag = false, $limit = 10, $offset = 0) {
        if ($getDataFlag) {
            $module = $this->module;
            //create instance of model with items
            $items = new $module->modelNamespace;
            $data = [
                'additionalData' => [
                    'limit' => $limit,
                    'offset' => $offset,
                    'mode' => $module->mode
                ]
            ];

            //build additional urls depends on mode
            switch($module->mode) {
                case 'list':
                    break;
                case 'view':
                    $viewItemLink = $module->additionalLinks['view']['controller'] . '/' . $module->additionalLinks['view']['action'];
                    $data['additionalData']['urls'] = [
                        'viewItem' => Yii::$app->urlManager->createUrl([$viewItemLink]),
                    ];
                    break;
                case 'edit':
                    $viewItemLink = $module->additionalLinks['view']['controller'] . '/' . $module->additionalLinks['view']['action'];
                    $removeItemLink = $module->additionalLinks['delete']['controller'] . '/' . $module->additionalLinks['delete']['action'];
                    $data['additionalData']['urls'] = [
                        'editItem' => Yii::$app->urlManager->createUrl([$viewItemLink]),
                        'removeItem' => Yii::$app->urlManager->createUrl([$removeItemLink])
                    ];
                    break;
            }

            //get data method from own model
            $data['items'] = $items->getAllItems($limit, $offset);
            Yii::$app->response->format = 'json';
            return $data;
        } else {
            return $this->render('index');
        }
    }
}<commit_msg>fix name of link for view item<commit_after><?php
/**
 * @link https://github.com/denar90/yii2-lazy-loading-module
 * @copyright Copyright (c) 2014 denar90
 * @license http://opensource.org/licenses/MIT MIT
 */

namespace denar90\lazyloading\controllers;

use Yii;
use yii\web\Controller;

class LazyLoadingController extends Controller {

    /**
     * Action for getting data.
     * @param boolean $getDataFlag
     * @param string $limit How many items get from table
     * @param string $offset
     * @return json $data Data with items
     */
    public function actionIndex($getDataFlag = false, $limit = 10, $offset = 0) {
        if ($getDataFlag) {
            $module = $this->module;
            //create instance of model with items
            $items = new $module->modelNamespace;
            $data = [
                'additionalData' => [
                    'limit' => $limit,
                    'offset' => $offset,
                    'mode' => $module->mode
                ]
            ];

            //build additional urls depends on mode
            switch($module->mode) {
                case 'list':
                    break;
                case 'view':
                    $viewItemLink = $module->additionalLinks['view']['controller'] . '/' . $module->additionalLinks['view']['action'];
                    $data['additionalData']['urls'] = [
                        'viewItem' => Yii::$app->urlManager->createUrl([$viewItemLink]),
                    ];
                    break;
                case 'edit':
                    $viewItemLink = $module->additionalLinks['view']['controller'] . '/' . $module->additionalLinks['view']['action'];
                    $removeItemLink = $module->additionalLinks['delete']['controller'] . '/' . $module->additionalLinks['delete']['action'];
                    $data['additionalData']['urls'] = [
                        'viewItem' => Yii::$app->urlManager->createUrl([$viewItemLink]),
                        'removeItem' => Yii::$app->urlManager->createUrl([$removeItemLink])
                    ];
                    break;
            }

            //get data method from own model
            $data['items'] = $items->getAllItems($limit, $offset);
            Yii::$app->response->format = 'json';
            return $data;
        } else {
            return $this->render('index');
        }
    }
}
{'fraction_non_alphanumeric': 0.14642332704006714, 'fraction_numerical': 0.005873715124816446, 'mean_word_length': 1.6892272983643541, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 57, 'https://': 2, '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': '5756409', 'n_tokens_mistral': 1263, 'n_tokens_neox': 1199, 'n_words': 254}