Current Path :
/
home
/
develito
/
www
/
components
/
com_sobipro
/
opt
/
fields
/
adm
/
Or
Select Your Path :
Upload File :
New :
File
Dir
/home/develito/www/components/com_sobipro/opt/fields/adm/info.php
<?php /** * @package: SobiPro Component for Joomla! * * @author * Name: Sigrid Suski & Radek Suski, Sigsiu.NET GmbH * Email: sobi[at]sigsiu.net * Url: https://www.Sigsiu.NET * * @copyright Copyright (C) 2006 - 2020 Sigsiu.NET GmbH (https://www.sigsiu.net). All rights reserved. * @license GNU/GPL Version 3 * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 * as published by the Free Software Foundation, and under the additional terms according section 7 of GPL v3. * * See https://www.gnu.org/licenses/gpl.html and https://www.sigsiu.net/licenses. * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * * @created 12-Sep-2015 by Sigrid Suski * @modified 28 July 2020 by Sigrid Suski */ defined( 'SOBIPRO' ) || exit( 'Restricted access' ); SPLoader::loadClass( 'opt.fields.info' ); /** * Class SPField_InfoAdm */ class SPField_InfoAdm extends SPField_Info { /** * Saves the translatable elements. * * @param $attr * * @throws SPException * @throws \Sobi\Error\Exception * @noinspection Annotator */ public function save( &$attr ) { $attr = $this->saveAttr( $attr ); /** @noinspection Annotator */ parent::save( $attr ); } /** * @param $attr * @param int $fid * * @throws SPException * @throws \Sobi\Error\Exception */ public function saveNew( &$attr, $fid = 0 ) { $attr = $this->saveAttr( $attr ); if ( $fid ) { $this->fid = $fid; } } /** * @param $attr * * @return mixed * @throws SPException * @throws \Sobi\Error\Exception */ protected function saveAttr( &$attr ) { if ( $this->nid ) { $this->nid = $attr[ 'nid' ]; } // if ( !( isset( $attr[ 'viewInfo' ] ) ) ) { // $attr[ 'viewInfo' ] = $this->viewInfo; // $attr[ 'entryInfo' ] = $this->entryInfo; // } $data = [ 'key' => $this->nid . '-viewInfo', 'value' => $attr[ 'viewInfo' ], 'type' => 'field_information', 'fid' => $this->fid, 'id' => $attr[ 'section' ], 'section' => $attr[ 'section' ], ]; SPLang::saveValues( $data ); $data = [ 'key' => $this->nid . '-entryInfo', 'value' => $attr[ 'entryInfo' ], 'type' => 'field_information', 'fid' => $this->fid, 'id' => $attr[ 'section' ], 'section' => $attr[ 'section' ], ]; SPLang::saveValues( $data ); $attr[ 'required' ] = 0; $attr[ 'fee' ] = 0; $attr[ 'isFree' ] = 1; return $attr; } /** * @return array */ public function exportField() { $data = []; $data[] = [ 'attributes' => [ 'name' => 'viewInfo' ], 'value' => $this->viewInfo ]; $data[] = [ 'attributes' => [ 'name' => 'entryInfo' ], 'value' => $this->entryInfo ]; return $data; } /** * @param $data * @param $nid * * @throws SPException * @throws \Sobi\Error\Exception */ public function importField( $data, $nid ) { if ( count( $data ) ) { $this->nid = $nid; foreach ( $data as $set ) { $attr = $set[ 'attributes' ][ 'name' ]; $this->$attr = $set[ 'value' ]; } $viewInfo = [ 'key' => $this->nid . '-viewInfo', 'value' => $this->viewInfo, 'type' => 'field_information', 'fid' => $this->fid, 'id' => Sobi::Section(), 'section' => Sobi::Section(), ]; SPLang::saveValues( $viewInfo ); $entryInfo = [ 'key' => $this->nid . '-entryInfo', 'value' => $this->entryInfo, 'type' => 'field_information', 'fid' => $this->fid, 'id' => Sobi::Section(), 'section' => Sobi::Section(), ]; SPLang::saveValues( $entryInfo ); } } }