public function seriesJsonQuery($string)
 {
     $seriesClient = new Series();
     if (!$this->validateSeries($string)) {
         return "";
     }
     $response = $seriesClient->simpleQuery($string);
     return $response;
 }
Exemple #2
0
 /**
  * Populates the Category object from the request
  * @return bean Category
  */
 protected function getBeanFromRequest()
 {
     global $logger;
     $logger->debug(get_class($this) . "::getBeanFromRequest()");
     $cat = new Series($_REQUEST);
     $cat->setScope($_REQUEST['catscope']);
     $logger->debug("Auto fill of Category bean has name of: " . $cat->getName());
     // TODO add events and gallery if linked
     return $cat;
 }
Exemple #3
0
 public function executeAddSeries(sfWebRequest $request)
 {
     try {
         $q = new Series();
         $q->setSeriesName($request->getParameter('series_name'));
         $q->setBrandId($request->getParameter('brand_id'));
         $q->save();
         $this->res = "Series Added!";
     } catch (Exception $exc) {
         $this->res = $exc->getMessage();
     }
 }
 /**
  * Store a newly created resource in storage.
  * POST /series
  *
  * @return Response
  */
 public function store()
 {
     $path = public_path() . '/uploads';
     //
     $seriesTitle = Input::get('SeriesTitle');
     $seriesDescription = Input::get('SeriesDesc');
     $episodeTitle = Input::get('EpisodeTitle');
     $episodeDesc = Input::get('EpisodeDesc');
     $seriesType = Input::get('EpisodeType');
     $episodeFile = Input::file('EpisodeFile');
     $file = [];
     foreach ($episodeFile as $key => $value) {
         # code...
         $file[] = $value->getClientOriginalName();
         $value->move($path, $value->getClientOriginalName());
     }
     $tmp = array('epsTitle' => $episodeTitle, 'EpsDescription' => $episodeDesc, 'filename' => $file);
     $keys = array_keys($tmp);
     $iteration = count($tmp[$keys[0]]);
     $eps = [];
     for ($i = 0; $i < $iteration; $i++) {
         $data = array();
         foreach ($tmp as $key => $value) {
             # code...
             $data[$key] = $value[$i];
             // $data['file'] = $value->getClientOriginalName();
         }
         $eps[] = array_merge($data);
     }
     // echo "<pre>";
     // var_dump($eps);
     // echo "</pre>";
     // Create Series
     $series = new Series();
     $series->title = strtolower($seriesTitle);
     $series->description = strtolower($seriesTitle);
     $series->type = $seriesType;
     $series->user_id = Auth::id();
     $series->category_id = 1;
     $series->save();
     // //Create Document
     $input = array();
     foreach ($eps as $key => $value) {
         # code...
         $input[] = new Documents(['title' => $value['epsTitle'], 'description' => $value['EpsDescription'], 'path' => $path . '/' . $value['filename']]);
     }
     $ser = Series::find($series->id);
     $ser->document()->saveMany($input);
     return Redirect::to('home');
 }
 public function testDestroy()
 {
     $series = Factory::create('Series');
     $this->action('DELETE', 'Admin\\SeriesController@destroy', $series->slug);
     $this->assertRedirectedToRoute('admin.series.index');
     $this->assertEquals(0, Series::count());
 }
 public function loadModel($id)
 {
     if (($model = Series::model()->findByPk($id)) === null) {
         throw new CHttpException(404, 'Страница не найдена');
     }
     return $model;
 }
 /**
  * Get printable message for this activity
  *
  * @return string
  */
 public function getMessage()
 {
     if ($this->type == self::ACTIVITY_SERIES_ADD) {
         return 'New series "' . $this->object->getTitle() . '" added';
     } else {
         if ($this->type == self::ACTIVITY_VOTE_UP) {
             return 'Line #' . $this->object->getLine()->getId() . ' voted up';
         } else {
             if ($this->type == self::ACTIVITY_VOTE_DOWN) {
                 return 'Line #' . $this->object->getLine()->getId() . ' voted down';
             } else {
                 if ($this->type == self::ACTIVITY_SUGGEST_SERIES) {
                     return 'New series suggested';
                 } else {
                     if ($this->type == self::ACTIVITY_SUGGEST_SCRIPT) {
                         return 'New script submitted';
                     } else {
                         if ($this->type == self::ACTIVITY_FLAG) {
                             return 'Line #' . $this->object->getLine()->getId() . ' flagged as bad';
                         }
                     }
                 }
             }
         }
     }
     return 'Well, something happened';
 }
 public function run()
 {
     DB::table('series')->truncate();
     $faker = Faker::create();
     foreach (range(1, 8) as $index) {
         Series::create(['title' => $faker->sentence, 'summary' => $faker->text, 'purpose' => $faker->sentence, 'duration' => $faker->time]);
     }
 }
Exemple #9
0
 public function action_add_series()
 {
     $series_name = $_GET['series_name'];
     $regexp = '#[A-Z]{2}#';
     if (preg_match($regexp, $series_name)) {
         Series::create_new($series_name);
     }
     header('Location: /index.php?act=generator');
 }
 /**
  * Get the series.
  *
  * @param  int  $limit
  * @return void
  */
 protected function getSeries($limit = null)
 {
     $series = $this->series->whereHas('posts', function ($query) {
         $query->published();
     })->take($limit)->get();
     foreach ($series as $singleSeries) {
         Sitemap::addTag(route('series.show', $singleSeries->slug), $singleSeries->updated_at, 'weekly', '0.8');
     }
 }
 public function actionSeries($alias)
 {
     $series = Series::model()->published()->with(array('collection', 'goods' => array('scopes' => 'published', 'order' => 'goods.sort ASC'), 'slides' => array('scopes' => 'published', 'order' => 'slides.sort ASC'), 'images' => array('scopes' => 'published', 'order' => 'images.sort ASC')))->find('t.alias = :alias', array(':alias' => $alias));
     if (!$series) {
         throw new CHttpException(404);
     }
     $this->currentCollection = $series->collection;
     $this->render('series', array('model' => $series));
 }
Exemple #12
0
 public static function boot()
 {
     parent::boot();
     Series::updating(function ($series) {
         // delete cache entries for every path record
         foreach ($series->pathRecords as $record) {
             $record->deleteCache();
         }
     });
 }
 public function actionIndex($alias = '')
 {
     //$this->processPageRequest('page');
     // Список видов камней
     $seriesList = Series::model()->published()->findAll();
     // Определяем, выбран или нет вид камня
     $series = null;
     if (!empty($alias)) {
         // Если выбран вид камня
         $series = Series::model()->published()->with(array('slides' => array('scopes' => 'published', 'order' => 'slides.sort ASC')))->find('t.alias = :alias', array(':alias' => $alias));
         if (!$series) {
             throw new CHttpException(404);
         }
         $page = $series;
     } else {
         // Загружаем страницу "Каталог камня"
         Yii::import("application.modules.page.models.Page");
         $page = Page::model()->with(array('slides' => array('scopes' => 'published', 'order' => 'slides.sort ASC')))->findByPath("catalog");
     }
     // Список товаров
     $criteria = new CDbCriteria();
     $criteria->with = array('images' => array('scopes' => 'published', 'order' => 'images.sort ASC'));
     $criteria->order = 't.series_id ASC, t.title ASC';
     $model = new Stone('user_search');
     $model->unsetAttributes();
     if (isset($_GET['Stone'])) {
         $model->attributes = $_GET['Stone'];
         if ($model->title != '') {
             $criteria->condition = "(t.title LIKE :title OR t.title_rus LIKE :title)";
             $criteria->params = array(':title' => $model->title . '%');
             //$criteria->addSearchCondition('t.title', $model->title . '%', false, 'OR');
             //$criteria->addSearchCondition('t.title_rus', $model->title . '%', false);
         }
         $criteria->addSearchCondition('t.color_id', $model->color_id);
     }
     // Если выбран вид камня
     if (!empty($series)) {
         $model = $model->series($series->id);
     }
     $dataProvider = new CActiveDataProvider($model->published(), array('criteria' => $criteria, 'pagination' => array('pageVar' => 'page')));
     if (Yii::app()->request->isAjaxRequest) {
         // Обновление списка для бесконечной загрузки элементов
         if (isset($_GET['showMore'])) {
             $this->renderPartial('_list_ajax', array('dataProvider' => $dataProvider, 'pageNumber' => (int) Yii::app()->request->getParam('page', 1)));
         } else {
             $this->renderPartial('_list', array('dataProvider' => $dataProvider), false, true);
         }
         Yii::app()->end();
     } else {
         // Вывод каталога
         $this->render('index', array('page' => $page, 'model' => $model, 'dataProvider' => $dataProvider, 'seriesList' => $seriesList, 'sizerVariants' => $sizerVariants));
     }
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     while (true) {
         $result = Series::whereNeedsUpdate(true)->take(100)->get();
         if (count($result) === 0) {
             break;
         }
         foreach ($result as $series) {
             printf("%s (#%d)\n", $series->name, $series->id);
             $series->updateMuData();
         }
     }
 }
 protected function beforeAction($action)
 {
     $actions = array('index', 'create');
     if (in_array($action->id, $actions)) {
         $this->item_id = (int) Yii::app()->getRequest()->getParam('item_id');
         if (!$this->item_id) {
             throw new CHttpException(400, 'Не установлен ID серии');
         }
         if (($this->item = Series::model()->findByPk($this->item_id)) === null) {
             throw new CHttpException(404, 'Серия не найдена');
         }
     }
     return parent::beforeAction($action);
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index($series_id, $season_number)
 {
     //
     try {
         $series = Series::findOrFail($series_id);
     } catch (\Exception $e) {
         return response()->json(['status' => false, 'message' => 'The series cannot be found']);
     }
     $season = $series->seasons()->where('number', $season_number)->first();
     if ($season == null) {
         return response()->json(['status' => false, "message" => "No matching season!"]);
     }
     return view('season.create', compact('series', 'series_id', 'season'));
 }
Exemple #17
0
function selectSeason()
{
    echo "<form action=\"seriesreport.php\" method=\"get\">";
    echo "<table class=\"form\" style=\"border-width: 0px\" align=\"center\">";
    echo "<tr><th>Series</th><td>";
    Series::dropMenu($_GET['series'], 1);
    echo "</td></tr>";
    echo "<tr><th>Season</th><td>";
    seasonDropMenu($_GET['season'], 1);
    echo "</td></tr>";
    echo "<tr><td>&nbsp;</td></tr>";
    echo "<tr><td colspan=\"2\" class=\"buttons\">";
    echo "<input type=\"submit\" value=\"Get Season Scoreboard\" />\n";
    echo "</td></tr></table></form>";
}
 public function toggleWatch()
 {
     $seriesId = Input::get('series');
     $series = Series::findOrFail($seriesId);
     $user = Auth::user();
     if (!$series) {
         App::abort(400, 'Invalid params');
     } else {
         $watching = $user->watchSeries($series);
         if (Request::ajax()) {
             return Response::json(array('result' => true, 'watching' => $watching));
         } else {
             return Redirect::back();
         }
     }
 }
Exemple #19
0
 /**
  * Populates the Venue object from the request
  * @return bean Venue
  */
 protected function getBeanFromRequest()
 {
     global $logger;
     $prgm = new Program($_REQUEST);
     $genre = new Genre();
     $genre->setOid($_REQUEST['primaryGenre']);
     $prgm->setPrimaryGenre($genre);
     if (isset($_REQUEST['defaultVenue'])) {
         $venue = new Venue();
         $venue->setOid($_REQUEST['defaultVenue']);
         $prgm->setDefaultVenue($venue);
         $prgm->setVenues(array($venue));
     }
     // categories
     $cats = array();
     if (isset($_REQUEST['audience'])) {
         foreach ($_REQUEST['audience'] as $oid) {
             $category = new Audience();
             $category->setOid($oid);
             $cats['audience'][] = $category;
         }
     }
     if (isset($_REQUEST['genre'])) {
         foreach ($_REQUEST['genre'] as $oid) {
             $category = new Genre();
             $category->setOid($oid);
             $cats['genre'][] = $category;
         }
     }
     if (isset($_REQUEST['series'])) {
         foreach ($_REQUEST['series'] as $oid) {
             $category = new Series();
             $category->setOid($oid);
             $cats['series'][] = $category;
         }
     }
     if (isset($cats['audience'])) {
         $logger->debug("Number of audience categories in the form: " . count($cats['audience']));
     }
     if (isset($cats['genre'])) {
         $logger->debug("Number of genre categories in the form: " . count($cats['genre']));
     }
     if (isset($cats['series'])) {
         $logger->debug("Number of series categories in the form: " . count($cats['series']));
     }
     if (isset($cats['audience']) || isset($cats['genre']) || isset($cats['series'])) {
         $prgm->setCategories($cats);
     }
     // related events
     $events = array();
     if (isset($_REQUEST['exhibition'])) {
         foreach ($_REQUEST['exhibition'] as $oid) {
             $exhibition = new Exhibition();
             $exhibition->setOid($oid);
             $events[] = $exhibition;
         }
     }
     if (isset($events)) {
         $logger->debug("Number of related exhibitions in the form: " . count($events));
         $prgm->setExhibitions($events);
     }
     $events = array();
     if (isset($_REQUEST['course'])) {
         foreach ($_REQUEST['course'] as $oid) {
             $course = new Course();
             $course->setOid($oid);
             $events[] = $course;
         }
     }
     if (isset($events)) {
         $logger->debug("Number of related courses in the form: " . count($events));
         $prgm->setCourses($events);
     }
     $activities = array();
     if (isset($_REQUEST['activityChanged']) && $_REQUEST['activityChanged']) {
         // parse delimited attributes as pipe-delimited '|' string
         $startTimes = explode('|', $_REQUEST['activityStartTime']);
         $endTimes = explode('|', $_REQUEST['activityEndTime']);
         $venues = explode('|', $_REQUEST['activityVenueList']);
         $status = explode('|', $_REQUEST['activityStatusList']);
         $tickets = explode('|', $_REQUEST['activityTicketList']);
         for ($index = 0; $index < count($venues); $index++) {
             $schedule = new Schedule();
             $stint = strtotime($startTimes[$index]);
             $etint = strtotime($endTimes[$index]);
             $schedule->setStartTime($stint);
             $schedule->setEndTime($etint);
             $venue = new Venue();
             $venue->setOid($venues[$index]);
             $activity = new Performance();
             $activity->setSchedule($schedule);
             $activity->setVenue($venue);
             $activity->setActivityStatus($status[$index]);
             $activity->setTicketCode($tickets[$index]);
             $activities[] = $activity;
         }
     }
     if (isset($activities)) {
         $logger->debug("Number of related performances in the form: " . count($activities));
         $prgm->setChildren($activities);
     }
     return $prgm;
 }
 public static function _getReportChart($report, $start_date, $end_date, $frequency, $decorator = null)
 {
     $line_chart = new LineChart();
     $line_chart->setTitle($report->getTitle());
     $series = new Series();
     $temp = ReportPeer::getQueryResults($report->getId(), $start_date, $end_date, $frequency);
     if (self::isEmpty($temp)) {
         return null;
     }
     $titles = $report->getQueryTitles();
     $arrays = ReportPeer::fillWithEmptyValues($temp, $start_date, $end_date, $frequency);
     for ($i = 0; $i < sizeof($arrays); $i++) {
         $series->addSerie(new Serie(array_values($arrays[$i]), $titles[$i]));
     }
     $factors = Utils::find_factors(sizeof($arrays[0]) - 1, 7);
     $factor = $factors[sizeof($factors) - 1];
     $labels = array();
     for ($j = 0; $j < $factor + 1; $j++) {
         $labels[] = $j + 1;
     }
     $temp = array_keys($arrays[0]);
     for ($j = 0; $j < sizeof($labels); $j++) {
         if ($frequency == QueryResultPeer::FREQUENCY_MONTH) {
             $labels[$j] = date('M y', strtotime($temp[$j * (sizeof($arrays[0]) - 1) / $factor]));
         } else {
             $labels[$j] = $temp[$j * (sizeof($arrays[0]) - 1) / $factor];
         }
     }
     $series->setXLabels($labels);
     $series->autoSetYLabels(5);
     $series->normalize();
     $line_chart->setSeries($series);
     if ($decorator) {
         $decorator->decorate($line_chart);
     }
     return array('values' => $arrays, 'chart' => $line_chart);
 }
Exemple #21
0
 function authCheck($player)
 {
     $playername = $player;
     if (is_object($player)) {
         $playername = $player->name;
     }
     $series = new Series($this->series);
     if ($this->isHost($playername) || $this->isSteward($playername) || $series->isSteward($playername)) {
         return true;
     }
     $player = new Player($playername);
     return $player->isSuper();
 }
Exemple #22
0
 }
 if ($Conf->setting("gradejson_pset{$Pset->id}", 0) < $Now - 30) {
     if (is_int($Pset->grades_visible)) {
         $notdropped = "(not c.dropped or c.dropped<{$Pset->grades_visible})";
     } else {
         $notdropped = "not c.dropped";
     }
     $q = "select cn.notes, c.extension from ContactInfo c\n";
     if ($Pset->gitless_grades) {
         $q .= "\t\tjoin ContactGrade cn on (cn.cid=c.contactId and cn.pset={$Pset->psetid})";
     } else {
         $q .= "\t\tjoin ContactLink l on (l.cid=c.contactId and l.type=" . LINK_REPO . " and l.pset={$Pset->id})\n\t\tjoin RepositoryGrade rg on (rg.repoid=l.link and rg.pset={$Pset->id} and not rg.placeholder)\n\t\tjoin CommitNotes cn on (cn.hash=rg.gradehash and cn.pset=rg.pset)\n";
     }
     $result = $Conf->qe_raw($q . " where {$notdropped}");
     $series = new Series();
     $xseries = new Series();
     $noextra_series = $Pset->has_extra ? new Series() : null;
     $has_extra = false;
     while ($row = edb_row($result)) {
         if ($g = ContactView::pset_grade(json_decode($row[0]), $Pset)) {
             $series->add($g->total);
             if ($row[1]) {
                 $xseries->add($g->total);
             }
             if ($noextra_series) {
                 $noextra_series->add($g->total_noextra);
                 if ($g->total_noextra != $g->total) {
                     $has_extra = true;
                 }
             }
         }
 /**
  * Список серий:
  **/
 public function getItemsList()
 {
     return CHtml::listData(Series::model()->findAll(), 'id', 'title');
 }
<?php

$this->widget('yupe\\widgets\\OGridView', array('id' => 'item-grid', 'type' => 'condensed', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('name' => 'id', 'type' => 'raw', 'value' => 'CHtml::link($data->id, $data->url, array("target" => "_blank"))', 'htmlOptions' => array('style' => 'width:40px')), array('name' => 'image', 'type' => 'raw', 'value' => '$data->image ? CHtml::image($data->getImageUrl(220, 150), $data->title)  : ""', 'filter' => false, 'sortable' => false, 'htmlOptions' => array('style' => 'width:220px')), array('name' => 'title', 'class' => 'yupe.widgets.CustomEditableColumn', 'editable' => array('placement' => 'right')), array('name' => 'alias', 'class' => 'yupe.widgets.CustomEditableColumn', 'editable' => array('placement' => 'right')), array('name' => 'search_material_id', 'type' => 'raw', 'value' => '$data->material', 'filter' => CHtml::listData(Series::model()->findAll(array('select' => 'id, title', 'order' => 'sort ASC')), 'id', 'title')), array('name' => 'category_id', 'value' => '$data->category->title', 'filter' => $model->categoryList), array('name' => 'color_id', 'value' => '$data->colorTitle', 'filter' => $model->colorList), array('name' => 'sort', 'class' => 'yupe.widgets.CustomEditableColumn', 'htmlOptions' => array('style' => 'width:80px'), 'editable' => array('placement' => 'right', 'success' => 'js: function(response, newValue) {
                    $.fn.yiiGridView.update("item-grid"); 
                }')), array('name' => 'status', 'type' => 'raw', 'value' => '$this->grid->returnBootstrapStatusHtml($data, "status", "Status", array("pencil", "ok-sign"))', 'filter' => $model->getStatusList(), 'sortable' => false), array('class' => 'bootstrap.widgets.TbButtonColumn', 'template' => '{images}{update}{delete}', 'buttons' => array('images' => array('icon' => 'picture', 'label' => 'Изображения', 'url' => 'array("/interior/itemImageBackend/index", "item_id" => $data->id)')), 'htmlOptions' => array('style' => 'width: 80px; text-align: right;')))));
Exemple #25
0
 /**
  * Declares an association between this object and a Series object.
  *
  * @param      Series $v
  * @return     Model The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setSeries(Series $v = null)
 {
     if ($v === null) {
         $this->setSeriesId(NULL);
     } else {
         $this->setSeriesId($v->getId());
     }
     $this->aSeries = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the Series object, it will not be re-added.
     if ($v !== null) {
         $v->addModel($this);
     }
     return $this;
 }
Exemple #26
0
 /**
  * Logic behind adding a series.
  * @param Series $series
  * @return \Altamira\Chart
  */
 public function addSingleSeries(Series $series)
 {
     $this->series[$series->getTitle()] = $series;
     return $this;
 }
Exemple #27
0
 /**
  * 
  */
 public function __construct(array $points = array())
 {
     parent::__construct($points);
 }
<?php

require_once "../functions.php";
require_once "../classes/Series.class.php";
//data
//siia pääseb ligi sisseloginud kasutaja
//kui kasutaja on sisse loginud
//siis suunan data.php lehele
if (!isset($_SESSION["logged_in_user_id"])) {
    header("Location: login.php");
}
$Series = new Series($mysqli, $_SESSION["logged_in_user_id"]);
echo $mysqli->error;
//kasutaja tahab välja logida
if (isset($_GET["logout"])) {
    //aadressireal on olemas muutuja logout
    //kusutame kõik session muutujad ja peatame sessiooni
    session_destroy();
    header("Location: login.php");
}
$title = $season = $description = $picture = "";
$title_error = $season_error = $description_error = $picture_error = "";
if (isset($_POST["addSeries"])) {
    echo "vajutati nuppu";
    if (empty($_POST["title"])) {
        $title_error = "See väli on kohustuslik";
    } else {
        $title = cleanInput($_POST["title"]);
    }
    if (empty($_POST["season"])) {
        $season_error = "See väli on kohustuslik";
<?php

require_once "../header.php";
require_once "../functions.php";
require_once "../classes/Series.class.php";
?>

<?php 
$Series = new Series($mysqli, $_SESSION["logged_in_user_id"]);
$keyword = "";
if (isset($_GET["keyword"])) {
    $keyword = $_GET["keyword"];
    $series_array = getSeries($keyword);
} else {
    //käivitan funktsiooni
    $series_array = getSeries();
}
if (isset($_POST["createList"])) {
    // 1 seriaali id, 2 listi id
    //saveToList($_POST["add"], $_POST["new_dd_selection"]);
    // VAATA series.class rida 133
    $Series->addToList($_POST["add"], $_POST["new_dd_selection"]);
}
?>


<h2>All added series</h2>

<form action="home.php" method="get">
	<input type="search" name="keyword" value="<?php 
echo $keyword;
 public function execute($request)
 {
     //get params
     $this->brand = $this->getRequestParameter('brand');
     $this->series = $this->getRequestParameter('series');
     $this->model = $this->getRequestParameter('model');
     $this->configId = $this->getRequestParameter('config_id');
     //get image files
     $this->mainImage = $this->getRequest()->getFiles('main_image');
     $this->otherImages = $this->getRequest()->getFiles('other_images');
     //print_r($this->otherImages);
     //exit ();
     //load/create series and model
     if (SeriesPeer::isNew($this->series)) {
         //create new series
         $seriesObj = new Series();
         $seriesObj->setSeriesName($this->series);
         $seriesObj->setBrandId($this->brand);
         $seriesObj->save();
         //create new model
         $modelObj = new Model();
         $modelObj->setModelName($this->model);
         $modelObj->setSeries($seriesObj);
         $modelObj->save();
     } else {
         //load series object
         $seriesObj = SeriesPeer::getSeriesByName($this->series);
         if (ModelPeer::isNew($this->model)) {
             //create new model
             $modelObj = new Model();
             $modelObj->setModelName($this->model);
             $modelObj->setSeries($seriesObj);
             $modelObj->save();
         } else {
             $modelObj = ModelPeer::getModelByName($this->model);
         }
     }
     //////////////////////
     if (($this->isNew = $this->getRequestParameter('is_new')) == 'true') {
         //create new config
         $config = new Config();
         $config->setConfigName($this->getRequestParameter('name'));
         $config->setModel($modelObj);
         $config->save();
         //load config fields
         $configFields = ConfigFieldPeer::doSelect(new Criteria());
         foreach ($configFields as $configField) {
             //get param
             if ($this->hasRequestParameter("field_" . $configField->getId())) {
                 //if (strlen($this->getRequestParameter("field_".$configField->getId())) > 0 )
                 //{
                 $fieldValue = new FieldValue();
                 $fieldValue->setConfig($config);
                 $fieldValue->setFieldId($configField->getId());
                 $fieldValue->setValue($this->getRequestParameter("field_" . $configField->getId()));
                 $fieldValue->save();
                 //}
             }
         }
     } else {
         //load config
         $config = ConfigPeer::retrieveByPK($this->configId);
         //$config->setConfigName($this->getRequestParameter('name'));
         $config->setModel($modelObj);
         $config->save();
         //load config fields
         $configFields = ConfigFieldPeer::doSelect(new Criteria());
         foreach ($configFields as $configField) {
             //get param
             if ($this->hasRequestParameter("field_" . $configField->getId())) {
                 //if (strlen($this->getRequestParameter("field_".$configField->getId())) > 0 )
                 //{
                 $fieldValue = FieldValuePeer::getFieldValue($configField->getId(), $config->getId());
                 $fieldValue->setValue($this->getRequestParameter("field_" . $configField->getId()));
                 $fieldValue->save();
                 //}
             }
         }
     }
     //save main image
     MediaPeer::saveMedia($this->mainImage, $modelObj->getId(), MediaPeer::IMAGE, 'Model', true);
     //save other images
     foreach ($this->otherImages as $image) {
         MediaPeer::saveMedia($image, $modelObj->getId(), MediaPeer::IMAGE, 'Model', false);
     }
     if (($saveAndNew = $this->getRequestParameter('save_and_new')) == 'true') {
         $this->redirect('config/newconfig');
     } else {
         $this->redirect('config/editconfig?id=' . $config->getId());
     }
 }