403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/lpost.delivery/lib/entity/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/lpost.delivery/lib/entity/pickupstoragetable.php
<?php
namespace Lpost\Delivery\Entity;

use Bitrix\Main\Localization\Loc,
    Bitrix\Main\ORM\Data\DataManager,
    Bitrix\Main\ORM\Fields\DatetimeField,
    Bitrix\Main\ORM\Fields\IntegerField,
    Bitrix\Main\ORM\Fields\StringField,
    Bitrix\Main\ORM\Fields\TextField,
    Bitrix\Main\ORM\Fields\Validators\LengthValidator,
    Bitrix\Main\Type\DateTime;

Loc::loadMessages(__FILE__);

/**
 * Class PickupStorageTable
 *
 * Fields:
 * <ul>
 * <li> id int mandatory
 * <li> id_pickup int mandatory
 * <li> type string(255) mandatory
 * <li> data text mandatory
 * <li> data_update datetime optional default current datetime
 * <li> params text mandatory
 * </ul>
 *
 * @package Bitrix\Delivery
 **/

class PickupStorageTable extends DataManager
{
    /**
     * Returns DB table name for entity.
     *
     * @return string
     */
    public static function getTableName()
    {
        return 'lpost_delivery_pickup_storage';
    }

    /**
     * Returns entity map definition.
     *
     * @return array
     */
    public static function getMap()
    {
        return [
            new IntegerField(
                'id',
                [
                    'primary' => true,
                    'autocomplete' => true,
                    'title' => Loc::getMessage('PICKUP_STORAGE_ENTITY_ID_FIELD')
                ]
            ),
            new IntegerField(
                'id_pickup',
                [
                    'required' => true,
                    'title' => Loc::getMessage('PICKUP_STORAGE_ENTITY_ID_PICKUP_FIELD')
                ]
            ),
            new StringField(
                'type',
                [
                    'required' => true,
                    'validation' => [__CLASS__, 'validateType'],
                    'title' => Loc::getMessage('PICKUP_STORAGE_ENTITY_TYPE_FIELD')
                ]
            ),
            new TextField(
                'data',
                [
                    'required' => true,
                    'title' => Loc::getMessage('PICKUP_STORAGE_ENTITY_DATA_FIELD'),
                    'save_data_modification' => function () {
                        return array(
                            function ($value) {
                                return serialize($value);
                            }
                        );
                    },
                    'fetch_data_modification' => function () {
                        return array(
                            function ($value) {
                                return unserialize($value);
                            }
                        );
                    }
                ]
            ),
            new DatetimeField(
                'data_update',
                [
                    'default' => function()
                    {
                        return new DateTime();
                    },
                    'title' => Loc::getMessage('PICKUP_STORAGE_ENTITY_DATA_UPDATE_FIELD')
                ]
            ),
            new TextField(
                'params',
                [
                    'title' => Loc::getMessage('PICKUP_STORAGE_ENTITY_PARAMS_FIELD'),
                    'save_data_modification' => function () {
                        return array(
                            function ($value) {
                                return serialize($value);
                            }
                        );
                    },
                    'fetch_data_modification' => function () {
                        return array(
                            function ($value) {
                                return unserialize($value);
                            }
                        );
                    }
                ]
            ),
        ];
    }

    public static function deleteAll()
    {
        if(!is_callable(array(get_parent_class(__CLASS__), "deleteAll"))){
            global $DB;
            return $DB->Query("TRUNCATE TABLE " . self::getTableName(), true);
        } else {
            return parent::deleteAll();
        }
    }

    /**
     * Returns validators for type field.
     *
     * @return array
     */
    public static function validateType()
    {
        return [
            new LengthValidator(null, 255),
        ];
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit