public function createAndAddToListFromRequest(Request $request) { $data = $request->getPost(); $list = new Lists(); $list->save($data); $this->addToExitedList($list, $request); }
public function actionEdit() { $this->layout = '//layouts/admin'; $success = false; $id = $_REQUEST['id']; $model = ListsFields::model()->findByPk($id); $list = Lists::model()->findByPk($model->list_id); $this->pageTitle = is_object($model) ? $model->name : 'Новая характеристика'; $this->breadcrumbs = array('Справочники' => array('/admin/lists'), $list->name => array('/admin/lists/edit/' . $list->id), 'Управление характеристиками' => array('/admin/lists/fields/list/' . $list->id), $model->title); if (isset($_POST['data']) && is_object($model)) { $dataArray = $_POST['data']; if ($dataArray['data_type'] == 'list' || $dataArray['data_type'] == 'multiple') { if (!isset($dataArray['rel']) || !$dataArray['rel']) { $newList = new Lists(); $newList->setAttributes(array("name" => "Справочник для <" . $dataArray['title'] . ">")); if ($newList->save()) { $dataArray['rel'] = $newList->id; } } } $model->setAttributes($dataArray); if ($model->save()) { $success = true; } } $this->render('edit', array('model' => $model, 'list' => $list, 'success' => $success, 'errors' => $model->errors)); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Lists(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Lists'])) { $model->attributes = $_POST['Lists']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id_list)); } } $this->render('create', array('model' => $model)); }
public function actionAdd() { $this->layout = '//layouts/admin'; $this->pageTitle = 'Новый справочник'; $this->breadcrumbs = array('Справочники' => array('/admin/lists'), 'Новый справочник'); $success = false; if (isset($_POST['data'])) { $model = new Lists(); $dataArray = $_POST['data']; $model->setAttributes($dataArray); if ($model->save()) { $success = true; } } if ($success) { $this->redirect("/admin/lists"); } if (!isset($model) || !is_object($model)) { $model = new Lists(); } $this->render('add', array('errors' => $model->errors)); }
public static function insertList($list_id, $name, $board_id) { $update = true; $model = Lists::getListbyListID($list_id); if ($model === null) { $model = new Lists(); $update = false; } $model->list_id = $list_id; $model->name = $name; $model->board_id = $board_id; if ($update) { if ($model->save()) { } } else { $model->insert(); } }
public function actionAddBySuffix() { $url = mb_substr(Yii::app()->request->requestUri, 1); if (!in_array(mb_substr($url, 0, 7), ['http://', 'https:/'], true)) { $url = 'http://' . $url; } if (mb_strlen($url)) { $bookmark = new Bookmarks(); $bookmark->user_id = Yii::app()->user->id; $bookmark->url = $url; $bookmark->title = $url; if (($host = parse_url($url, PHP_URL_HOST)) !== null) { $bookmark->title = $host; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 3); $body = curl_exec($curl); curl_close($curl); if ($body !== false && preg_match('#<title>([^<]+)#i', $body, $match)) { $bookmark->title = $match[1]; } } $subdomain = isset($_SERVER['SUBDOMAIN']) ? $_SERVER['SUBDOMAIN'] : ''; if (mb_strlen($subdomain)) { $list = Yii::app()->user->model->lists(['condition' => 'name = :name', 'params' => ['name' => $subdomain]]); if (count($list) == 0) { $list = new Lists(); $list->user_id = Yii::app()->user->id; $list->name = $subdomain; $list->save(); } else { $list = $list[0]; } $bookmark->list_id = $list->id; } $bookmark->save(); } $this->redirect(['index/index']); }
public function create_list() { $name = Input::get('name'); $store_id = Input::get('store_id'); $list = new Lists(); $list->name = $name; $list->owner_id = $this->user_id; $list->fav_count = 0; $list->save(); if (Request::format() == 'html') { return Redirect::to('/list/edit/' . $list->id); } else { $response_array = array('success' => true); $response_code = 200; $response = Response::json($response_array, $response_code); return $response; } }
public function save_list() { $id = Input::get('id'); $list = Lists::find($id); if (!$list) { $list = new Lists(); } $list->name = Input::get('name'); $list->description = Input::get('description'); $list->direction = Input::get('direction'); $image = Input::file('background_image'); $validator = Validator::make(array('ima' => $image), array('ima' => 'required|mimes:jpeg,bmp,png')); if ($validator->fails()) { $error_messages = $validator->messages(); $response_array = array('success' => false, 'error' => 'Invalid Input', 'error_code' => 401); $response_code = 200; $message = "Invalid Input File"; $type = "failed"; return Redirect::to('/admin/lists')->with('type', $type)->with('message', $message); } else { if (Input::hasFile('background_image')) { $list->background_image_url = upload_image(Input::file('background_image')); } $list->fav_count = $list->fav_count ? $list->fav_count : 0; $list->save(); $message = "Successfully updated the list"; $type = "success"; return Redirect::to('/admin/lists')->with('type', $type)->with('message', $message); } }
function InitData($project_name) { $listPageType = 'list_types'; $c = new Criteria(); $c->add(ListsPeer::LIST_ID, $listPageType); $listExist = ListsPeer::doSelectOne($c); if (!$listExist) { echo "Creating list 'list_type'...\n"; $newList = new Lists(); $newList->setLabel('List Types'); $newList->setListid($listPageType); $newList->setListtype('system'); $newList->save(); $newItem = new Listitem(); $newItem->setLabel('System list'); $newItem->setValue('system'); $newItem->save(null, $newList); $newItem = new Listitem(); $newItem->setLabel('Static list'); $newItem->setValue('static'); $newItem->save(null, $newList); $newItem = new Listitem(); $newItem->setLabel('Editable list'); $newItem->setValue('editable'); $newItem->save(null, $newList); } $listPageType = 'page_types'; $c = new Criteria(); $c->add(ListsPeer::LIST_ID, $listPageType); $listExist = ListsPeer::doSelectOne($c); if (!$listExist) { echo "Creating list 'page_types'...\n"; $newList = new Lists(); $newList->setLabel('Page Types'); $newList->setListid($listPageType); $newList->setListtype('system'); $newList->save(); $newItem = new Listitem(); $newItem->setLabel('Content page'); $newItem->setValue('CONTENT'); $newItem->save(null, $newList); $newItem = new Listitem(); $newItem->setLabel('Page reference'); $newItem->setValue('REFERENCE'); $newItem->save(null, $newList); $newItem = new Listitem(); $newItem->setLabel('External page'); $newItem->setValue('EXTERNAL'); $newItem->save(null, $newList); } $cultureType = 'culture'; $c = new Criteria(); $c->add(ListsPeer::LIST_ID, $cultureType); $listExist = ListsPeer::doSelectOne($c); if (!$listExist) { echo "Creating list 'culture'...\n"; $newList = new Lists(); $newList->setLabel('Culture'); $newList->setListid($cultureType); $newList->setListtype('system'); $newList->save(); $newItem = new Listitem(); $newItem->setLabel('english'); $newItem->setValue('en'); $newItem->save(null, $newList); /* $newItem = new Listitem(); $newItem->setLabel('български'); $newItem->setValue('bg'); $newItem->save(null, $newList);*/ } $userType = 'usertype'; $c = new Criteria(); $c->add(ListsPeer::LIST_ID, $userType); $listExist = ListsPeer::doSelectOne($c); if (!$listExist) { echo "Creating list 'user types'...\n"; $newList = new Lists(); $newList->setLabel('User Types'); $newList->setListid($userType); $newList->setListtype('system'); $newList->save(); $newItem = new Listitem(); $newItem->setLabel('Administrator (all rights)'); $newItem->setValue('admin'); $newItem->save(null, $newList); $newItem = new Listitem(); $newItem->setLabel('Editor (no access to administration modules)'); $newItem->setValue('editor'); $newItem->save(null, $newList); $newItem = new Listitem(); $newItem->setLabel('Editor (edit and save existing items)'); $newItem->setValue('restricted_editor'); $newItem->save(null, $newList); } $Mailinglist_Folder = Document::getDocumentByExclusiveTag('newsletter_folder_mailinglist'); if (!$Mailinglist_Folder) { $Newsletter_Root = Rootfolder::getRootfolderByModule('Newsletter'); $Mailinglist_Folder = new Folder(); $Mailinglist_Folder->setLabel('Mailing lists'); $Mailinglist_Folder->save(null, $Newsletter_Root); Document::addTag($Mailinglist_Folder, 'newsletter_folder_mailinglist'); } $def_site = Document::getDocumentByExclusiveTag('website_website_default'); if (!$def_site) { $website_root = Rootfolder::getRootfolderByModule('Website'); $def_site = new Website(); $def_site->setLabel(UtilsHelper::mb_ucfirst($project_name)); $def_site->save(null, $website_root); Document::addTag($def_site, 'website_website_default'); } $homePage = Document::getDocumentByExclusiveTag('website_page_home'); if (!$homePage) { $homePage = new Page(); $homePage->setLabel('Home'); $homePage->setPageType('CONTENT'); $homePage->setNavigationTitle('Home'); $homePage->setTemplate('default'); $homePage->save(null, $def_site); Document::addTag($homePage, 'website_page_home'); } }
<?php require_once '../util/database.php'; require_once '../models/List.php'; require_once '../models/SharedList.php'; if (isset($_SESSION['id'])) { $user_id = $_SESSION['id']; $list = new Lists(); if (isset($_POST['add_new_list'])) { $list_name = ucwords(strtolower(rtrim($_POST['list_name']))); $editable = isset($_POST['list_permission_check']) ? 1 : 0; $list->create($user_id, $list_name, $editable); if ($list_name != "") { $list->save(); View::render('dashboard.php'); } else { $_SESSION['error_message'] = "Please enter a list name"; View::render('dashboard.php'); } } if (isset($_POST['list_option'])) { $list_id = $_POST['list_id']; switch ($_POST['list_option']) { case 'save': $new_name = ucwords(strtolower(rtrim($_POST['list_name']))); $editable = $_POST['list_permission']; saveList($list, $new_name, $editable, $list_id, $user_id); echo $new_name; break; case 'delete': deleteList($list, $list_id, $user_id);
public function executeCreateOkFilter(sfWebRequest $request) { $this->forward404Unless($request->isMethod('post')); // On récupère les informations dont on a besoin dans le formulaire $params = array('mode' => 'create', 'filter_id' => $request->getPostParameter('id'), 'filter_name' => $request->getPostParameter('form[name]'), 'filter_description' => $request->getPostParameter('form[description]'), 'private_blacklist_content' => $request->getPostParameter('form[PBlist]'), 'globale_blacklist_content' => $request->getPostParameter('form[GBlist]'), 'private_whitelist_content' => $request->getPostParameter('form[PWlist]'), 'globale_whitelist_content' => $request->getPostParameter('form[GWlist]')); // Si le champ 'name' est vide, on arrête le traitement if ($params['filter_name'] == null) { //return $params; } // création du filtre s'il n'existe pas if ($params['filter_id'] == null) { $this->menu = $this->getMenu('createFilter'); // On créé un nouveau filtre $filter = new Filter(); $filter->name = $params['filter_name']; $filter->description = $params['filter_description']; $filter->save(); // On récupère son ID $params['filter_id'] = $filter->id; // Lien avec liste globales white $lfwg = new ListsFilter(); $lfwg->filter_id = $params['filter_id']; $lfwg->list_id = 1; $lfwg->ordre = 0; $lfwg->save(); // Lien avec liste global black $lfbg = new ListsFilter(); $lfbg->filter_id = $params['filter_id']; $lfbg->list_id = 2; $lfbg->ordre = 1; $lfbg->save(); // Création liste SI White du filtre $lists = new Lists(); $lists->name = "PW" . $params['filter_id']; $lists->type = "W"; $lists->origin = "SI"; $lists->static = 0; $lists->save(); $lfwp = new ListsFilter(); $lfwp->filter_id = $params['filter_id']; $lfwp->list_id = $lists->id; $lfwp->ordre = 2; $lfwp->save(); // Création liste SI Black du filtre $lists = new Lists(); $lists->name = "PB" . $params['filter_id']; $lists->type = "B"; $lists->origin = "SI"; $lists->static = 0; $lists->save(); $lfbp = new ListsFilter(); $lfbp->filter_id = $params['filter_id']; $lfbp->list_id = $lists->id; $lfbp->ordre = 3; $lfbp->save(); } else { $this->menu = $this->getMenu('index'); $sql = "UPDATE filter SET name = '{$params['filter_name']}', description = '{$params['filter_description']}' WHERE id = '{$params['filter_id']}';"; $dq = new Doctrine_Query(); $conn = $dq->getConnection(); $conn->execute($sql); } // On remet à jour les listes SI $private_blacklist_content_details = explode("\n", $params['private_blacklist_content']); $globale_blacklist_content_details = explode("\n", $params['globale_blacklist_content']); $private_whitelist_content_details = explode("\n", $params['private_whitelist_content']); $globale_whitelist_content_details = explode("\n", $params['globale_whitelist_content']); // Mise à jour White liste Globale $listGlobale_whitelist = Doctrine_Query::create()->delete()->from('ListsDetail')->where('lists_id = ?', 1)->execute(); for ($i = 0; $i < count($globale_whitelist_content_details); $i++) { if (trim($globale_whitelist_content_details[$i]) != "") { $insert = new ListsDetail(); $insert->domain = trim($globale_whitelist_content_details[$i]); $insert->lists_id = 1; $insert->save(); } } // Mise à jour Black liste Globale $listGlobale_blacklist = Doctrine_Query::create()->delete()->from('ListsDetail')->where('lists_id = ?', 2)->execute(); for ($i = 0; $i < count($globale_blacklist_content_details); $i++) { if (trim($globale_blacklist_content_details[$i]) != "") { $insert = new ListsDetail(); $insert->domain = trim($globale_blacklist_content_details[$i]); $insert->lists_id = 2; $insert->save(); } } // Mise à jour White liste Locale // Recherche de l'id de la liste $lists_query = Doctrine_Query::create()->select('id')->from('Lists')->where('name = ?', 'PW' . $params['filter_id']); $lists_res = $lists_query->fetchOne(); $id_PW = $lists_res['id']; // Suppression des détails $listLocale_whitelist = Doctrine_Query::create()->delete()->from('ListsDetail')->where('lists_id = ?', $id_PW)->execute(); for ($i = 0; $i < count($private_whitelist_content_details); $i++) { if (trim($private_whitelist_content_details[$i]) != "") { $insert = new ListsDetail(); $insert->domain = trim($private_whitelist_content_details[$i]); $insert->lists_id = $id_PW; $insert->save(); } } // Mise à jour Black liste Locale // Recherche de l'id de la liste $lists_query = Doctrine_Query::create()->select('id')->from('Lists')->where('name = ?', 'PB' . $params['filter_id']); $lists_res = $lists_query->fetchOne(); $id_PB = $lists_res['id']; // Suppression des détails $listLocale_blacklist = Doctrine_Query::create()->delete()->from('ListsDetail')->where('lists_id = ?', $id_PB)->execute(); for ($i = 0; $i < count($private_blacklist_content_details); $i++) { if (trim($private_blacklist_content_details[$i]) != "") { $insert = new ListsDetail(); $insert->domain = trim($private_blacklist_content_details[$i]); $insert->lists_id = $id_PB; $insert->save(); } } // Traitement des listes externes (Toulouse) // Ajout des liens $lists_query = Doctrine_Query::create()->select('id')->from('Lists')->where('origin != ?', 'SI'); $lists_res = $lists_query->fetchArray(); $dq = new Doctrine_Query(); $conn = $dq->getConnection(); foreach ($lists_res as $list) { // Suppression de l'ancien lien s'il existe $sql = " delete from lists_filter"; $sql .= " where list_id = {$list['id']}"; $sql .= " and filter_id = {$params['filter_id']}"; $conn->execute($sql); // Ajout du lien s'il est coché if ($request->getPostParameter('chBox_' . $list['id']) != null) { $insert = new ListsFilter(); $insert->list_id = $list['id']; $insert->filter_id = $params['filter_id']; $insert->ordre = 4; $insert->save(); } } }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Import(); $baseUrl = Yii::app()->createUrl('import/admin'); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Cart']) && !Yii::app()->shoppingCart->isEmpty() && !isset($_POST['Import'])) { $cart = new Cart(); if (isset($_POST['Cart'])) { $cart->attributes = $_POST['Cart']; $_GET['Cart']['address'] = $cart->address; $_GET['Cart']['hours'] = $cart->hours; } else { $cart->address = $_GET['Cart']['address']; $cart->hours = $_GET['Cart']['hours']; } $positions = Yii::app()->shoppingCart->getPositions(); $list = ''; //var_dump($_POST); //var_dump($_GET); foreach ($positions as $position) { $quantity = $position->getQuantity(); $list .= 'id_product=' . $position->id_product . '(' . $quantity . ' шт.);'; } //var_dump($list); //var_dump($positions); $id_user = Yii::app()->user->getID(); //var_dump($id_user); $sum_price = Yii::app()->shoppingCart->getCost(); //var_dump($sum_price); //$model->id_user=$id_user; $cart->attributes = $_POST['Cart']; $cart->clearErrors(); if ($cart->validate()) { $model->sum_price = $sum_price; $model->attributes = $cart->attributes; $model->status = Import::STATUS_ORDER; $model->save(); //var_dump($model->id_import); foreach ($positions as $position) { $lists = new Lists(); $lists->id_import = $model->id_import; $lists->id_product = $position->id_product; $lists->quantity = $position->getQuantity(); $lists->price = $position->getSumPrice(); $lists->save(); } Yii::app()->shoppingCart->clear(); if ($model->save()) { $this->redirect(array('site/index')); //var_dump($lists); } } //throw new CHttpException(404, 'The requested page does not exist.'); //else $this->redirect(array('import/makecart')); } if (Yii::app()->shoppingCart->isEmpty()) { $message = 'Корзина пуста.Невозможно оформить заказ.'; $this->render('error', array('message' => $message)); } $return = Yii::app()->user->returnUrl; if (isset($_POST['Import'])) { $model->attributes = $_POST['Import']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id_import)); } } if ($return != $baseUrl) { if (Yii::app()->shoppingCart->isEmpty()) { $message = 'Корзина пуста.Невозможно оформить заказ.'; $this->render('error', array('message' => $message)); } $this->render('MakeCart'); } else { $this->render('create', array('model' => $model)); } }
public function executeCreateOkFilter(sfWebRequest $request) { $this->menu = $this->getMenu('index'); $this->forward404Unless($request->isMethod('post')); // On récupère les informations dont on a besoin dans le formulaire $params = array('mode' => 'create', 'filter_id' => $request->getPostParameter('id'), 'filter_name' => $request->getPostParameter('form[name]'), 'filter_description' => $request->getPostParameter('form[description]'), 'private_blacklist_content' => $request->getPostParameter('form[PBlist]'), 'globale_blacklist_content' => $request->getPostParameter('form[GBlist]'), 'private_whitelist_content' => $request->getPostParameter('form[PWlist]'), 'globale_whitelist_content' => $request->getPostParameter('form[GWlist]')); // Si le champ 'name' est vide, on arrête le traitement if ($params['filter_name'] == null) { //return $params; } if ($params['filter_id'] == null) { // On créé un nouveau filtre $filter = new Filter(); $filter->name = $params['filter_name']; $filter->description = $params['filter_description']; $filter->save(); // On récupère son ID $params['filter_id'] = $filter->id; } else { $params['mode'] = 'update'; $sql = <<<SQL \t\t\t\tSELECT ld.id, ld.lists_id \t\t\t\tFROM lists_detail ld \t\t\t\t\tLEFT JOIN lists li ON ld.lists_id = li.id \t\t\t\t\tLEFT JOIN lists_filter lf ON li.id = lf.list_id \t\t\t\tWHERE lf.filter_id = '{$params['filter_id']}' \t\t\t\t\tAND li.origin = 'SI' \t\t\t\tORDER BY ld.lists_id SQL; $dq = new Doctrine_Query(); $conn = $dq->getConnection(); $lists = $conn->fetchAll($sql); foreach ($lists as $list) { $sql = <<<SQL \t\t\t\t\tDELETE FROM lists_detail WHERE id = '{$list['id']}'; SQL; $dq = new Doctrine_Query(); $conn = $dq->getConnection(); $conn->execute($sql); if ($list['lists_id'] != $ancVal) { $ancVal = $list['lists_id']; $sql = <<<SQL \t\t\t\t\t\tDELETE FROM lists WHERE id = '{$ancVal}'; SQL; $dq = new Doctrine_Query(); $conn = $dq->getConnection(); $conn->execute($sql); } } $sql = "UPDATE filter SET name = '{$params['filter_name']}', description = '{$params['filter_description']}' WHERE id = '{$params['filter_id']}';"; $dq = new Doctrine_Query(); $conn = $dq->getConnection(); $conn->execute($sql); $deleteAllListFilter = Doctrine_Query::create()->delete()->from('ListsFilter')->where('filter_id = ?', $params['filter_id'])->execute(); } // On remet à jour les listes globales $private_blacklist_content_details = explode("\n", $params['private_blacklist_content']); $globale_blacklist_content_details = explode("\n", $params['globale_blacklist_content']); $private_whitelist_content_details = explode("\n", $params['private_whitelist_content']); $globale_whitelist_content_details = explode("\n", $params['globale_whitelist_content']); $listGlobale_whitelist = Doctrine_Query::create()->delete()->from('ListsDetail')->where('lists_id = ?', 0)->execute(); for ($i = 0; $i < count($globale_whitelist_content_details); $i++) { if ($globale_whitelist_content_details[$i] != null) { $insert = new ListsDetail(); $insert->domain = $globale_whitelist_content_details[$i]; $insert->lists_id = 0; $insert->save(); } } $listGlobale_blacklist = Doctrine_Query::create()->delete()->from('ListsDetail')->where('lists_id = ?', 1)->execute(); for ($i = 0; $i < count($globale_blacklist_content_details); $i++) { if ($globale_blacklist_content_details[$i] != null) { $insert = new ListsDetail(); $insert->domain = $globale_blacklist_content_details[$i]; $insert->lists_id = 1; $insert->save(); } } // On les attachent au filtre que l'on a créé $attach_global_whitelist = new ListsFilter(); $attach_global_whitelist->list_id = 0; $attach_global_whitelist->filter_id = $params['filter_id']; $attach_global_whitelist->ordre = 0; $attach_global_whitelist->save(); $attach_global_blacklist = new ListsFilter(); $attach_global_blacklist->list_id = 1; $attach_global_blacklist->filter_id = $params['filter_id']; $attach_global_blacklist->ordre = 1; $attach_global_blacklist->save(); // On créé une nouvelle liste (whitelist) if ($params['private_whitelist_content'] != null) { $whitelist = new Lists(); $whitelist->name = 'PW' . $params['filter_id']; $whitelist->type = 'W'; $whitelist->origin = 'SI'; $whitelist->static = '1'; $whitelist->save(); $id = $whitelist->id; for ($i = 0; $i < count($private_whitelist_content_details); $i++) { if ($private_whitelist_content_details[$i] != null) { $insert = new ListsDetail(); $insert->domain = $private_whitelist_content_details[$i]; $insert->lists_id = $whitelist->id; $insert->save(); } } $attach_whitelist = new ListsFilter(); $attach_whitelist->list_id = $whitelist->id; $attach_whitelist->filter_id = $params['filter_id']; $attach_whitelist->ordre = 2; $attach_whitelist->save(); } // On créé une nouvelle liste (blacklist) if ($params['private_blacklist_content'] != null) { $blacklist = new Lists(); $blacklist->name = 'PB' . $params['filter_id']; $blacklist->type = 'B'; $blacklist->origin = 'SI'; $blacklist->static = '1'; $blacklist->save(); $id = $blacklist->id; for ($i = 0; $i < count($private_blacklist_content_details); $i++) { if ($private_blacklist_content_details[$i] != null) { $insert = new ListsDetail(); $insert->domain = $private_blacklist_content_details[$i]; $insert->lists_id = $blacklist->id; $insert->save(); } } $attach_blacklist = new ListsFilter(); $attach_blacklist->list_id = $blacklist->id; $attach_blacklist->filter_id = $params['filter_id']; $attach_blacklist->ordre = 3; $attach_blacklist->save(); } // On récupère les listes provenant de Toulouse $lists_query = Doctrine_Query::create()->select('id')->from('Lists')->where('origin != ?', 'SI'); $lists_res = $lists_query->fetchArray(); foreach ($lists_res as $list) { if ($request->getPostParameter('chBox_' . $list['id']) != null) { $insert = new ListsFilter(); $insert->list_id = $list['id']; $insert->filter_id = $params['filter_id']; $insert->ordre = 4; $insert->save(); } } }