Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/smart-sl.../Nextend/SmartSli.../Applicat.../Model
File: ModelGenerator.php
<?php
[0] Fix | Delete
[1] Fix | Delete
[2] Fix | Delete
namespace Nextend\SmartSlider3\Application\Model;
[3] Fix | Delete
[4] Fix | Delete
[5] Fix | Delete
use Exception;
[6] Fix | Delete
use Nextend\Framework\Data\Data;
[7] Fix | Delete
use Nextend\Framework\Database\Database;
[8] Fix | Delete
use Nextend\Framework\Form\Container\ContainerTable;
[9] Fix | Delete
use Nextend\Framework\Form\ContainerInterface;
[10] Fix | Delete
use Nextend\Framework\Form\Element\Button\ButtonRecordViewer;
[11] Fix | Delete
use Nextend\Framework\Form\Element\Text\Number;
[12] Fix | Delete
use Nextend\Framework\Misc\Base64;
[13] Fix | Delete
use Nextend\Framework\Model\AbstractModelTable;
[14] Fix | Delete
use Nextend\SmartSlider3\Generator\AbstractGeneratorGroup;
[15] Fix | Delete
use Nextend\SmartSlider3\Generator\GeneratorFactory;
[16] Fix | Delete
use Nextend\SmartSlider3\SlideBuilder\BuilderComponentCol;
[17] Fix | Delete
use Nextend\SmartSlider3\SlideBuilder\BuilderComponentLayer;
[18] Fix | Delete
use Nextend\SmartSlider3\SlideBuilder\BuilderComponentRow;
[19] Fix | Delete
use Nextend\SmartSlider3\SlideBuilder\BuilderComponentSlide;
[20] Fix | Delete
[21] Fix | Delete
class ModelGenerator extends AbstractModelTable {
[22] Fix | Delete
[23] Fix | Delete
protected function createConnectorTable() {
[24] Fix | Delete
[25] Fix | Delete
return Database::getTable('nextend2_smartslider3_generators');
[26] Fix | Delete
}
[27] Fix | Delete
[28] Fix | Delete
private static function getLayout($type) {
[29] Fix | Delete
[30] Fix | Delete
$slideBuilder = new BuilderComponentSlide();
[31] Fix | Delete
[32] Fix | Delete
switch ($type) {
[33] Fix | Delete
case 'image':
[34] Fix | Delete
$slideBuilder->set(array(
[35] Fix | Delete
'title' => "{title}",
[36] Fix | Delete
'thumbnail' => "{thumbnail}",
[37] Fix | Delete
'backgroundImage' => "{image}",
[38] Fix | Delete
'background-type' => 'image'
[39] Fix | Delete
));
[40] Fix | Delete
break;
[41] Fix | Delete
[42] Fix | Delete
case 'image_extended':
[43] Fix | Delete
$slideBuilder->set(array(
[44] Fix | Delete
'title' => "{title}",
[45] Fix | Delete
'thumbnail' => "{thumbnail}",
[46] Fix | Delete
'backgroundImage' => "{image}",
[47] Fix | Delete
'background-type' => 'image'
[48] Fix | Delete
));
[49] Fix | Delete
[50] Fix | Delete
$slideBuilder->content->set(array(
[51] Fix | Delete
'verticalalign' => 'flex-end',
[52] Fix | Delete
'desktopportraitpadding' => '0|*|0|*|0|*|0|*|px'
[53] Fix | Delete
));
[54] Fix | Delete
$row = new BuilderComponentRow($slideBuilder->content);
[55] Fix | Delete
$row->set(array(
[56] Fix | Delete
'bgcolor' => '00000080',
[57] Fix | Delete
));
[58] Fix | Delete
$col = new BuilderComponentCol($row, '1');
[59] Fix | Delete
$col->set(array(
[60] Fix | Delete
'desktopportraitinneralign' => "left"
[61] Fix | Delete
));
[62] Fix | Delete
$heading = new BuilderComponentLayer($col, 'heading');
[63] Fix | Delete
$heading->set(array(
[64] Fix | Delete
'desktopportraitselfalign' => 'inherit'
[65] Fix | Delete
));
[66] Fix | Delete
$heading->item->set(array(
[67] Fix | Delete
'heading' => '{title/1}',
[68] Fix | Delete
));
[69] Fix | Delete
break;
[70] Fix | Delete
[71] Fix | Delete
case 'article':
[72] Fix | Delete
$slideBuilder->set(array(
[73] Fix | Delete
'title' => "{title}",
[74] Fix | Delete
'description' => '{description}',
[75] Fix | Delete
'href' => '{url}',
[76] Fix | Delete
'thumbnail' => "{thumbnail}",
[77] Fix | Delete
'backgroundImage' => "{image}",
[78] Fix | Delete
'background-type' => 'image'
[79] Fix | Delete
));
[80] Fix | Delete
[81] Fix | Delete
$slideBuilder->content->set(array(
[82] Fix | Delete
'verticalalign' => 'flex-end',
[83] Fix | Delete
'desktopportraitpadding' => '0|*|0|*|0|*|0|*|px',
[84] Fix | Delete
));
[85] Fix | Delete
$row = new BuilderComponentRow($slideBuilder->content);
[86] Fix | Delete
$row->set(array(
[87] Fix | Delete
'bgcolor' => '00000080',
[88] Fix | Delete
));
[89] Fix | Delete
$col = new BuilderComponentCol($row, '1');
[90] Fix | Delete
$col->set(array(
[91] Fix | Delete
'desktopportraitinneralign' => "left",
[92] Fix | Delete
));
[93] Fix | Delete
$heading = new BuilderComponentLayer($col, 'heading');
[94] Fix | Delete
$heading->set(array(
[95] Fix | Delete
'desktopportraitselfalign' => 'inherit'
[96] Fix | Delete
));
[97] Fix | Delete
$heading->item->set(array(
[98] Fix | Delete
'heading' => '{title}',
[99] Fix | Delete
'font' => Base64::encode('{"data":[{"extra":"","color":"ffffffff","size":"36||px","tshadow":"0|*|0|*|0|*|000000ff","afont":"Roboto,Arial","lineheight":"1.5","bold":0,"italic":0,"underline":0,"align":"inherit","letterspacing":"normal","wordspacing":"normal","texttransform":"none"},{"extra":""}]}')
[100] Fix | Delete
));
[101] Fix | Delete
break;
[102] Fix | Delete
[103] Fix | Delete
case 'product':
[104] Fix | Delete
$slideBuilder->set(array(
[105] Fix | Delete
'title' => "{title}",
[106] Fix | Delete
'description' => '{description}',
[107] Fix | Delete
'href' => '{url}',
[108] Fix | Delete
'thumbnail' => "{thumbnail}",
[109] Fix | Delete
'backgroundImage' => "{image}",
[110] Fix | Delete
'background-type' => 'image'
[111] Fix | Delete
));
[112] Fix | Delete
[113] Fix | Delete
$slideBuilder->content->set(array(
[114] Fix | Delete
'verticalalign' => 'flex-end',
[115] Fix | Delete
'desktopportraitpadding' => '0|*|0|*|0|*|0|*|px',
[116] Fix | Delete
));
[117] Fix | Delete
$row = new BuilderComponentRow($slideBuilder->content);
[118] Fix | Delete
$row->set(array(
[119] Fix | Delete
'bgcolor' => '00000080',
[120] Fix | Delete
));
[121] Fix | Delete
$col = new BuilderComponentCol($row, '1/2');
[122] Fix | Delete
$col->set(array(
[123] Fix | Delete
'desktopportraitinneralign' => "left",
[124] Fix | Delete
));
[125] Fix | Delete
$heading = new BuilderComponentLayer($col, 'heading');
[126] Fix | Delete
$heading->set(array(
[127] Fix | Delete
'desktopportraitselfalign' => 'inherit'
[128] Fix | Delete
));
[129] Fix | Delete
$heading->item->set(array(
[130] Fix | Delete
'heading' => '{title}',
[131] Fix | Delete
'font' => Base64::encode('{"data":[{"extra":"","color":"ffffffff","size":"36||px","tshadow":"0|*|0|*|0|*|000000ff","afont":"Roboto,Arial","lineheight":"1.5","bold":0,"italic":0,"underline":0,"align":"inherit","letterspacing":"normal","wordspacing":"normal","texttransform":"none"},{"extra":""}]}'),
[132] Fix | Delete
));
[133] Fix | Delete
$col2 = new BuilderComponentCol($row, '1/2');
[134] Fix | Delete
$col2->set(array(
[135] Fix | Delete
'desktopportraitinneralign' => "right",
[136] Fix | Delete
));
[137] Fix | Delete
$text = new BuilderComponentLayer($col2, 'text');
[138] Fix | Delete
$text->set(array(
[139] Fix | Delete
'desktopportraitselfalign' => 'inherit'
[140] Fix | Delete
));
[141] Fix | Delete
$text->item->set(array(
[142] Fix | Delete
'content' => '{price}',
[143] Fix | Delete
'font' => Base64::encode('{"data":[{"extra":"","color":"ffffffff","size":"36||px","tshadow":"0|*|0|*|0|*|000000ff","afont":"Roboto,Arial","lineheight":"1.5","bold":0,"italic":0,"underline":0,"align":"inherit","letterspacing":"normal","wordspacing":"normal","texttransform":"none"},{"extra":""}]}'),
[144] Fix | Delete
));
[145] Fix | Delete
[146] Fix | Delete
break;
[147] Fix | Delete
[148] Fix | Delete
case 'event':
[149] Fix | Delete
$slideBuilder->set(array(
[150] Fix | Delete
'title' => "{title}",
[151] Fix | Delete
'description' => '{description}',
[152] Fix | Delete
'href' => '{url}',
[153] Fix | Delete
'thumbnail' => "{thumbnail}",
[154] Fix | Delete
'backgroundImage' => "{image}",
[155] Fix | Delete
'background-type' => 'image'
[156] Fix | Delete
));
[157] Fix | Delete
$slideBuilder->content->set(array(
[158] Fix | Delete
'verticalalign' => 'flex-end',
[159] Fix | Delete
'desktopportraitpadding' => '0|*|0|*|0|*|0|*|px',
[160] Fix | Delete
));
[161] Fix | Delete
$row = new BuilderComponentRow($slideBuilder->content);
[162] Fix | Delete
$row->set(array(
[163] Fix | Delete
'bgcolor' => '00000080',
[164] Fix | Delete
));
[165] Fix | Delete
$col = new BuilderComponentCol($row, '1/2');
[166] Fix | Delete
$col->set(array(
[167] Fix | Delete
'desktopportraitinneralign' => "left",
[168] Fix | Delete
));
[169] Fix | Delete
$heading = new BuilderComponentLayer($col, 'heading');
[170] Fix | Delete
$heading->set(array(
[171] Fix | Delete
'desktopportraitselfalign' => 'inherit'
[172] Fix | Delete
));
[173] Fix | Delete
$heading->item->set(array(
[174] Fix | Delete
'heading' => '{title}',
[175] Fix | Delete
'font' => Base64::encode('{"data":[{"extra":"","color":"ffffffff","size":"36||px","tshadow":"0|*|0|*|0|*|000000ff","afont":"Roboto,Arial","lineheight":"1.5","bold":0,"italic":0,"underline":0,"align":"inherit","letterspacing":"normal","wordspacing":"normal","texttransform":"none"},{"extra":""}]}'),
[176] Fix | Delete
));
[177] Fix | Delete
$col2 = new BuilderComponentCol($row, '1/2');
[178] Fix | Delete
$col2->set(array(
[179] Fix | Delete
'desktopportraitinneralign' => "right",
[180] Fix | Delete
));
[181] Fix | Delete
$heading = new BuilderComponentLayer($col2, 'heading');
[182] Fix | Delete
$heading->set(array(
[183] Fix | Delete
'desktopportraitselfalign' => 'inherit'
[184] Fix | Delete
));
[185] Fix | Delete
$heading->item->set(array(
[186] Fix | Delete
'heading' => '{start_date}',
[187] Fix | Delete
'font' => Base64::encode('{"data":[{"extra":"","color":"ffffffff","size":"36||px","tshadow":"0|*|0|*|0|*|000000ff","afont":"Roboto,Arial","lineheight":"1.5","bold":0,"italic":0,"underline":0,"align":"inherit","letterspacing":"normal","wordspacing":"normal","texttransform":"none"},{"extra":""}]}'),
[188] Fix | Delete
));
[189] Fix | Delete
[190] Fix | Delete
break;
[191] Fix | Delete
[192] Fix | Delete
case 'youtube':
[193] Fix | Delete
$slideBuilder->set(array(
[194] Fix | Delete
'title' => "{title}",
[195] Fix | Delete
'description' => '{description}',
[196] Fix | Delete
'thumbnail' => "{thumbnail}",
[197] Fix | Delete
'backgroundColor' => "ffffff00",
[198] Fix | Delete
'background-type' => 'color',
[199] Fix | Delete
'desktopportraitpadding' => '0|*|0|*|0|*|0|*|px',
[200] Fix | Delete
));
[201] Fix | Delete
[202] Fix | Delete
$youtube = new BuilderComponentLayer($slideBuilder->content, 'youtube');
[203] Fix | Delete
$youtube->item->set(array(
[204] Fix | Delete
"youtubeurl" => "{video_url}",
[205] Fix | Delete
));
[206] Fix | Delete
break;
[207] Fix | Delete
[208] Fix | Delete
case 'vimeo':
[209] Fix | Delete
$slideBuilder->set(array(
[210] Fix | Delete
'title' => "{title}",
[211] Fix | Delete
'description' => '{description}',
[212] Fix | Delete
'thumbnail' => "{image200x150/1}",
[213] Fix | Delete
'backgroundColor' => "ffffff00",
[214] Fix | Delete
'background-type' => 'color',
[215] Fix | Delete
'desktopportraitpadding' => '0|*|0|*|0|*|0|*|px',
[216] Fix | Delete
));
[217] Fix | Delete
[218] Fix | Delete
$vimeo = new BuilderComponentLayer($slideBuilder->content, 'vimeo');
[219] Fix | Delete
$vimeo->item->set(array(
[220] Fix | Delete
"vimeourl" => "{url}",
[221] Fix | Delete
'image' => '{image}'
[222] Fix | Delete
));
[223] Fix | Delete
[224] Fix | Delete
break;
[225] Fix | Delete
[226] Fix | Delete
case 'video_mp4':
[227] Fix | Delete
$slideBuilder->set(array(
[228] Fix | Delete
'title' => "{name}",
[229] Fix | Delete
'desktopportraitpadding' => '0|*|0|*|0|*|0|*|px',
[230] Fix | Delete
));
[231] Fix | Delete
[232] Fix | Delete
$video = new BuilderComponentLayer($slideBuilder->content, 'video');
[233] Fix | Delete
$video->item->set(array(
[234] Fix | Delete
"video_mp4" => "{video}",
[235] Fix | Delete
));
[236] Fix | Delete
break;
[237] Fix | Delete
[238] Fix | Delete
case 'social_post':
[239] Fix | Delete
$slideBuilder->set(array(
[240] Fix | Delete
'title' => "{title}",
[241] Fix | Delete
'description' => '{description}',
[242] Fix | Delete
'href' => '{url}',
[243] Fix | Delete
'thumbnail' => "{author_image}",
[244] Fix | Delete
'backgroundColor' => "ffffff00",
[245] Fix | Delete
'background-type' => 'color',
[246] Fix | Delete
));
[247] Fix | Delete
[248] Fix | Delete
$slideBuilder->content->set(array(
[249] Fix | Delete
'verticalalign' => 'center',
[250] Fix | Delete
'desktopportraitpadding' => '0|*|0|*|0|*|0|*|px',
[251] Fix | Delete
'desktopportraitmargin' => '0|*|0|*|0|*|0|*|px'
[252] Fix | Delete
));
[253] Fix | Delete
[254] Fix | Delete
$row = new BuilderComponentRow($slideBuilder->content);
[255] Fix | Delete
$row->set(array(
[256] Fix | Delete
'bgcolor' => '00000080',
[257] Fix | Delete
'desktopportraitpadding' => '10|*|10|*|10|*|10|*|px',
[258] Fix | Delete
'desktopportraitmargin' => '0|*|0|*|0|*|0|*|px'
[259] Fix | Delete
));
[260] Fix | Delete
$col = new BuilderComponentCol($row, '1');
[261] Fix | Delete
$col->set(array(
[262] Fix | Delete
'desktopportraitinneralign' => "left",
[263] Fix | Delete
'desktopportraitmargin' => '0|*|0|*|0|*|0|*|px',
[264] Fix | Delete
'desktopportraitpadding' => '10|*|10|*|10|*|10|*|px'
[265] Fix | Delete
));
[266] Fix | Delete
$heading = new BuilderComponentLayer($col, 'heading');
[267] Fix | Delete
$heading->set(array(
[268] Fix | Delete
'desktopportraitmargin' => '0|*|0|*|0|*|0|*|px',
[269] Fix | Delete
'desktopportraitselfalign' => 'inherit'
[270] Fix | Delete
));
[271] Fix | Delete
$heading->item->set(array(
[272] Fix | Delete
'heading' => '{message}',
[273] Fix | Delete
));
[274] Fix | Delete
$image = new BuilderComponentLayer($col, 'image');
[275] Fix | Delete
$image->set(array(
[276] Fix | Delete
'desktopportraitmargin' => '0|*|0|*|0|*|0|*|px',
[277] Fix | Delete
'desktopportraitselfalign' => 'inherit'
[278] Fix | Delete
));
[279] Fix | Delete
$image->item->set(array(
[280] Fix | Delete
'image' => '{author_image}',
[281] Fix | Delete
));
[282] Fix | Delete
$button = new BuilderComponentLayer($col, 'button');
[283] Fix | Delete
$button->set(array(
[284] Fix | Delete
'desktopportraitmargin' => '0|*|0|*|0|*|0|*|px',
[285] Fix | Delete
'desktopportraitselfalign' => 'inherit'
[286] Fix | Delete
));
[287] Fix | Delete
$button->item->set(array(
[288] Fix | Delete
'content' => '{url_label}',
[289] Fix | Delete
));
[290] Fix | Delete
[291] Fix | Delete
break;
[292] Fix | Delete
[293] Fix | Delete
case 'text':
[294] Fix | Delete
$slideBuilder->set(array(
[295] Fix | Delete
'title' => "{title}"
[296] Fix | Delete
));
[297] Fix | Delete
$slideBuilder->content->set(array(
[298] Fix | Delete
'verticalalign' => 'flex-end',
[299] Fix | Delete
'desktopportraitpadding' => '0|*|0|*|0|*|0|*|px',
[300] Fix | Delete
));
[301] Fix | Delete
$row = new BuilderComponentRow($slideBuilder->content);
[302] Fix | Delete
$row->set(array(
[303] Fix | Delete
'bgcolor' => '00000080',
[304] Fix | Delete
));
[305] Fix | Delete
$col = new BuilderComponentCol($row, '1');
[306] Fix | Delete
$col->set(array(
[307] Fix | Delete
'desktopportraitinneralign' => "left",
[308] Fix | Delete
));
[309] Fix | Delete
$heading = new BuilderComponentLayer($col, 'heading');
[310] Fix | Delete
$heading->set(array(
[311] Fix | Delete
'desktopportraitselfalign' => 'inherit'
[312] Fix | Delete
));
[313] Fix | Delete
$heading->item->set(array(
[314] Fix | Delete
'heading' => '{title}',
[315] Fix | Delete
'font' => Base64::encode('{"data":[{"extra":"","color":"ffffffff","size":"36||px","tshadow":"0|*|0|*|0|*|000000ff","afont":"Roboto,Arial","lineheight":"1.5","bold":0,"italic":0,"underline":0,"align":"inherit","letterspacing":"normal","wordspacing":"normal","texttransform":"none"},{"extra":""}]}')
[316] Fix | Delete
));
[317] Fix | Delete
break;
[318] Fix | Delete
[319] Fix | Delete
case 'text_generator':
[320] Fix | Delete
$slideBuilder->set(array(
[321] Fix | Delete
'title' => "{variable1}"
[322] Fix | Delete
));
[323] Fix | Delete
$slideBuilder->content->set(array(
[324] Fix | Delete
'verticalalign' => 'flex-end',
[325] Fix | Delete
'desktopportraitpadding' => '0|*|0|*|0|*|0|*|px',
[326] Fix | Delete
));
[327] Fix | Delete
$row = new BuilderComponentRow($slideBuilder->content);
[328] Fix | Delete
$row->set(array(
[329] Fix | Delete
'bgcolor' => '00000080',
[330] Fix | Delete
));
[331] Fix | Delete
$col = new BuilderComponentCol($row, '1');
[332] Fix | Delete
$col->set(array(
[333] Fix | Delete
'desktopportraitinneralign' => "left",
[334] Fix | Delete
));
[335] Fix | Delete
$heading = new BuilderComponentLayer($col, 'heading');
[336] Fix | Delete
$heading->set(array(
[337] Fix | Delete
'desktopportraitselfalign' => 'inherit'
[338] Fix | Delete
));
[339] Fix | Delete
$heading->item->set(array(
[340] Fix | Delete
'heading' => '{variable1}',
[341] Fix | Delete
'font' => Base64::encode('{"data":[{"extra":"","color":"ffffffff","size":"36||px","tshadow":"0|*|0|*|0|*|000000ff","afont":"Roboto,Arial","lineheight":"1.5","bold":0,"italic":0,"underline":0,"align":"inherit","letterspacing":"normal","wordspacing":"normal","texttransform":"none"},{"extra":""}]}')
[342] Fix | Delete
));
[343] Fix | Delete
break;
[344] Fix | Delete
[345] Fix | Delete
default:
[346] Fix | Delete
return $slideBuilder->set(array(
[347] Fix | Delete
'title' => "title",
[348] Fix | Delete
'description' => '',
[349] Fix | Delete
'backgroundColor' => "ffffff00",
[350] Fix | Delete
'background-type' => 'color',
[351] Fix | Delete
));
[352] Fix | Delete
}
[353] Fix | Delete
[354] Fix | Delete
return $slideBuilder->getData();
[355] Fix | Delete
}
[356] Fix | Delete
[357] Fix | Delete
public function createGenerator($sliderId, $params) {
[358] Fix | Delete
[359] Fix | Delete
$data = new Data($params);
[360] Fix | Delete
[361] Fix | Delete
unset($params['type']);
[362] Fix | Delete
unset($params['group']);
[363] Fix | Delete
unset($params['record-slides']);
[364] Fix | Delete
[365] Fix | Delete
try {
[366] Fix | Delete
$generatorId = $this->_create($data->get('type'), $data->get('group'), json_encode($params));
[367] Fix | Delete
[368] Fix | Delete
[369] Fix | Delete
$source = $this->getGeneratorGroup($data->get('group'))
[370] Fix | Delete
->getSource($data->get('type'));
[371] Fix | Delete
[372] Fix | Delete
$slideData = self::getLayout($source->getLayout());
[373] Fix | Delete
[374] Fix | Delete
$slideData['record-slides'] = intval($data->get('record-slides', 5));
[375] Fix | Delete
[376] Fix | Delete
$slidesModel = new ModelSlides($this);
[377] Fix | Delete
$slideId = $slidesModel->createSlideWithGenerator($sliderId, $generatorId, $slideData);
[378] Fix | Delete
[379] Fix | Delete
return array(
[380] Fix | Delete
'slideId' => $slideId,
[381] Fix | Delete
'generatorId' => $generatorId
[382] Fix | Delete
);
[383] Fix | Delete
} catch (Exception $e) {
[384] Fix | Delete
throw new Exception($e->getMessage());
[385] Fix | Delete
}
[386] Fix | Delete
}
[387] Fix | Delete
[388] Fix | Delete
/**
[389] Fix | Delete
* @param ContainerInterface $container
[390] Fix | Delete
*/
[391] Fix | Delete
public function renderFields($container) {
[392] Fix | Delete
[393] Fix | Delete
$settings = new ContainerTable($container, 'generator', n2_('Generator settings'));
[394] Fix | Delete
[395] Fix | Delete
$generatorRow = $settings->createRow('generator-row');
[396] Fix | Delete
[397] Fix | Delete
new Number($generatorRow, 'record-slides', n2_('Slides'), 5, array(
[398] Fix | Delete
'unit' => n2_x('slides', 'Unit'),
[399] Fix | Delete
'wide' => 3,
[400] Fix | Delete
));
[401] Fix | Delete
[402] Fix | Delete
new Number($generatorRow, 'cache-expiration', n2_('Cache expiration'), 24, array(
[403] Fix | Delete
'wide' => 3,
[404] Fix | Delete
'unit' => n2_('Hours')
[405] Fix | Delete
));
[406] Fix | Delete
[407] Fix | Delete
new ButtonRecordViewer($generatorRow, 'record-viewer');
[408] Fix | Delete
[409] Fix | Delete
}
[410] Fix | Delete
[411] Fix | Delete
/**
[412] Fix | Delete
* @param $type
[413] Fix | Delete
*
[414] Fix | Delete
* @return AbstractGeneratorGroup
[415] Fix | Delete
*/
[416] Fix | Delete
public function getGeneratorGroup($type) {
[417] Fix | Delete
[418] Fix | Delete
return GeneratorFactory::getGenerator($type);
[419] Fix | Delete
}
[420] Fix | Delete
[421] Fix | Delete
public function get($id) {
[422] Fix | Delete
return Database::queryRow("SELECT * FROM " . $this->getTableName() . " WHERE id = :id", array(
[423] Fix | Delete
":id" => $id
[424] Fix | Delete
));
[425] Fix | Delete
}
[426] Fix | Delete
[427] Fix | Delete
public function import($generator) {
[428] Fix | Delete
$this->table->insert(array(
[429] Fix | Delete
'type' => $generator['type'],
[430] Fix | Delete
'group' => $generator['group'],
[431] Fix | Delete
'params' => $generator['params']
[432] Fix | Delete
));
[433] Fix | Delete
[434] Fix | Delete
return $this->table->insertId();
[435] Fix | Delete
}
[436] Fix | Delete
[437] Fix | Delete
private function _create($type, $group, $params) {
[438] Fix | Delete
$this->table->insert(array(
[439] Fix | Delete
'type' => $type,
[440] Fix | Delete
'group' => $group,
[441] Fix | Delete
'params' => $params
[442] Fix | Delete
));
[443] Fix | Delete
[444] Fix | Delete
return $this->table->insertId();
[445] Fix | Delete
}
[446] Fix | Delete
[447] Fix | Delete
public function save($generatorId, $params) {
[448] Fix | Delete
[449] Fix | Delete
$this->table->update(array(
[450] Fix | Delete
'params' => json_encode($params)
[451] Fix | Delete
), array('id' => $generatorId));
[452] Fix | Delete
[453] Fix | Delete
return $generatorId;
[454] Fix | Delete
}
[455] Fix | Delete
[456] Fix | Delete
public function delete($id) {
[457] Fix | Delete
$this->table->deleteByAttributes(array(
[458] Fix | Delete
"id" => intval($id)
[459] Fix | Delete
));
[460] Fix | Delete
}
[461] Fix | Delete
[462] Fix | Delete
public function duplicate($id) {
[463] Fix | Delete
$generatorRow = $this->get($id);
[464] Fix | Delete
$generatorId = $this->_create($generatorRow['type'], $generatorRow['group'], $generatorRow['params']);
[465] Fix | Delete
[466] Fix | Delete
return $generatorId;
[467] Fix | Delete
}
[468] Fix | Delete
[469] Fix | Delete
public function getSliderId($generatorId) {
[470] Fix | Delete
[471] Fix | Delete
$slidesModal = new ModelSlides($this);
[472] Fix | Delete
$slideData = Database::queryRow("SELECT slider FROM " . $slidesModal->getTableName() . " WHERE generator_id = :id", array(
[473] Fix | Delete
":id" => $generatorId
[474] Fix | Delete
));
[475] Fix | Delete
[476] Fix | Delete
return $slideData['slider'];
[477] Fix | Delete
}
[478] Fix | Delete
}
[479] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function