Retrieves datatable's content
@return \Zend\View\Model\JsonModel
504674
public function getStyleDataAction()
    {
        // declare the Tool service that we will be using to completely create our tool.
        $melisTool = $this->getServiceLocator()->get('MelisCoreTool');

        // tell the Tool what configuration in the app.tool.php that will be used.
        $melisTool->setMelisToolKey('meliscms', 'meliscms_tool_styles');

        // Site Table
        /**
         * @var \MelisEngine\Model\Tables\MelisCmsStyleTable $tableStyle
         */
        $tableStyle = $this->getServiceLocator()->get('MelisEngineTableStyle');

        $colId = array();
        $dataCount = 0;
        $draw = 0;
        $tableData = array();

        // make sure that the request is an AJAX call
        if($this->getRequest()->isPost()) {
            $optionFilter = array();

            // get the tool columns
            $columns = $melisTool->getColumns();

            $colId = array_keys($melisTool->getColumns());

            $sortOrder = $this->getRequest()->getPost('order');
            $sortOrder = $sortOrder[0]['dir'];

            $selCol = $this->getRequest()->getPost('order');
            $selCol = $colId[$selCol[0]['column']];

            $draw = $this->getRequest()->getPost('draw');

            $start = $this->getRequest()->getPost('start');
            $length =  $this->getRequest()->getPost('length');

            $search = $this->getRequest()->getPost('search');
            $search = $search['value'];

            $limit = $this->getRequest()->getPost('length');

            $dataCount = $tableStyle->getStyleList($search = '', $melisTool->getSearchableColumns(), $selCol, $sortOrder);

            $getData = $tableStyle->getStyleList($search = '', $melisTool->getSearchableColumns(), $selCol, $sortOrder, $start, $limit);

            $tableData = $getData->toArray();

            for($ctr = 0; $ctr < count($tableData); $ctr++)
            {
                // Append style file status in the tables data
                $fileStatus = $this->getFilesStatus($tableData[$ctr]['style_path']);
                $tableData[$ctr]['style_files'] = '<span class="text-'.($fileStatus? 'success' : 'danger').'"><i class="fa fa-fw fa-circle"></i></span>';

                // apply text limits
                foreach($tableData[$ctr] as $vKey => $vValue)
                {
                    $tableData[$ctr][$vKey] = $vValue;
                    if($vKey == 'style_status'){
                        $status = '<span class="text-success"><i class="fa fa-fw fa-circle"></i></span>';
                        if(!$vValue){
                            $status = '<span class="text-danger"><i class="fa fa-fw fa-circle"></i></span>';
                        }

                        $tableData[$ctr][$vKey] = $status;
                    }
                }

                $tableData[$ctr]['DT_RowId'] = $tableData[$ctr]['style_id'];
            }
        }

        return new JsonModel(array(
            'draw' => (int) $draw,
            'recordsTotal' => count($dataCount->toArray()),
            'recordsFiltered' => count($tableData),
            'data' => $tableData,
        ));

    }
325929
public function toJson ()
    {
        $rows    = array_map("str_getcsv", explode("\n", trim($this->data)));
        $columns = array_shift($rows);
        $csv     = array();

        foreach ($rows as $row)
        {
            $csv[] = array_combine($columns, $row);
        }

        return json_encode($csv);
    }
1269017
public function html() {
    $html = NULL;
    if (count($this->jsonArray) > 0) {
      $content = json_encode($this->jsonArray,
        JSON_HEX_TAG|JSON_HEX_APOS|JSON_HEX_QUOT|JSON_HEX_AMP
      );
      
      $html = HTML::tag('div',$content,array('id'=>$this->getJsonId()))->setStyle('display','none');
    }

    return $html;
  }
589852
public function json() {
		$json = parent::json();

		$json['button_text'] = $this->button_text;
		$json['button_url']  = esc_url( $this->button_url );

		return $json;
	}
755965
public function getContent()
    {
        return strtr($this->getStubContent('model'), [
            '{{namespace}}' => $this->namespace,
            '{{name}}'      => $this->name,
            '{{table}}'     => $this->table,
            '{{relations}}' => $this->relations->getTrait(),
        ]);
    }
254029
public function getJSON()
    {
        global $CFG;
        $PDOX = $this->launch->pdox;

        $stmt = $PDOX->queryDie(
            "SELECT json FROM {$CFG->dbprefix}lti_result
                WHERE result_id = :RID",
            array(':RID' => $this->id)
        );
        $row = $stmt->fetch(\PDO::FETCH_ASSOC);
        return $row['json'];
    }
974804
public function ajax()
    {
        return datatables($this->query())
            ->setTransformer(app($this->transformer))
            ->filterColumn('country_code', function (Builder $builder, $keyword) {
                $countryCode = collect(countries())->search(function ($country) use ($keyword) {
                    return mb_strpos($country['name'], $keyword) !== false || mb_strpos($country['emoji'], $keyword) !== false;
                });

                ! $countryCode || $builder->where('country_code', $countryCode);
            })
            ->filterColumn('language_code', function (Builder $builder, $keyword) {
                $languageCode = collect(languages())->search(function ($language) use ($keyword) {
                    return mb_strpos($language['name'], $keyword) !== false;
                });

                ! $languageCode || $builder->where('language_code', $languageCode);
            })
            ->orderColumn('name', 'name->"$.'.app()->getLocale().'" $1')
            ->make(true);
    }
233430
function jsonSerialize()
    {
        $result = [
            'title'        => $this->getTitle(),
            'link'         => $this->getLink(),
            'publicId'     => $this->getPublicId(),
            'description'  => $this->getDescription(),
            'lastModified' => $this->getLastModified()->format(\DateTime::ATOM),
            'url'          => $this->getUrl(),
            'items'        => $this->getItems(),
            'relations'    => $this->getRelations(),
        ];
        return $result;
    }
1097329
public function reloadsessionAction()
    {
        $sessionData = $this->sessionManager->getSessionData(false);

        $renderedContent = $this->viewRenderer
                                ->render('zend-developer-tools/toolbar/session-data-list', ['sessionData' => $sessionData]);

        return new JsonModel([
            'san_sessiontoolbar_data_renderedContent' => $renderedContent,
        ]);
    }
569681
public function getJson() : ?string 
    {
        if ( ! $this->hasJson()) {
            $this->setJson($this->getDefaultJson());
        }
        return $this->json;
    }
824764
public function getJson() {
		$json = [
			'title' => $this->title,
			'author' => $this->author,
			'show_cover_pic' => $this->show_cover_pic,
			'digest' => $this->digest,
			'content_source_url' => $this->content_source_url,
		];
		if($this->manager) {
			$materialMedia = $this->thumbMaterialMedia;
			$json['thumb_media_id'] = $materialMedia->media_id;
			$json['thumb_material_media_id'] = $materialMedia->id;
			$json['content'] = $this->wechatContent;
		} else {
			$json['thumb_url'] = $this->thumbMaterial->url;
			$json['content'] = $this->content;
		}
		
		return $json;
	}
280118
public function toJSON(){
        $outcomeValue = null;
        if($this->defaultValue != ''){
            $outcomeValue = Array($this->defaultValue);
        }else if($this->getAttributeValue('baseType') == 'integer' || $this->getAttributeValue('baseType') == 'float'){
            $outcomeValue = Array(0);
        }else{
            $outcomeValue = null;
        }

        $returnValue = taoQTI_models_classes_Matching_VariableFactory::createJSONVariableFromQTIData(
                        $this->getIdentifier()
                        , $this->getAttributeValue('cardinality')
                        , $this->getAttributeValue('baseType')
                        , $outcomeValue
        );

        return $returnValue;
    }
913756
public function data()
    {
        $ratings = RatingTotalModel::with([
            'rateable' => function ($query) {
                $query->with(['ratings', 'ratingTotal'])->select(['id', 'title', 'slug']);
            }])->get();

        $ratings = $ratings->filter(function ($value, $key) {
            return isset($value->rateable);
        });

        $resource = (new RatingTransformer())->transformCollection($ratings);

        return DataTables::of(collect($this->serializeToArray($resource)))
            ->rawColumns(['actions'])
            ->make();
    }
1324983
public function toJson()
    {
        $json = null;
        if (!empty($this->toArray())) {
            $json = json_encode($this->toArray());
        }

        return $json;
    }
560268
public function jsonSerialize()
    {
        return array_filter(
            [
                'enable' => $this->getEnable(),
                'enable_text' => $this->getEnableText()
            ],
            function ($value) {
                return $value !== null;
            }
        ) ?: null;
    }
1160410
protected function _getJson()
    {
        if ($this->_json) {
            return $this->_json;
        }

        return $this->_json = json_decode($this->_getBody(), true);
    }
1116093
public function toJSON()
    {
        $mapper = static::getMapper();
        $json = [];

        foreach ($this->toArray() as $key => $value) {
            $attribute = $mapper->getAttribute($key);
            $json[$key] = Type::factory($attribute['type'])->toJSON($value, $attribute);
        }

        return $json;
    }