delete() public méthode

Delete the search
public delete ( ) : boolean
Résultat boolean
Exemple #1
0
 $scripts->addFile('db_qbe.js');
 //Get saved search list.
 $savedSearch = new SavedSearches($GLOBALS);
 $savedSearch->setUsername($GLOBALS['cfg']['Server']['user'])->setDbname($_REQUEST['db']);
 if (!empty($_REQUEST['searchId'])) {
     $savedSearch->setId($_REQUEST['searchId']);
 }
 //Action field is sent.
 if (isset($_REQUEST['action'])) {
     $savedSearch->setSearchName($_REQUEST['searchName']);
     if ('create' === $_REQUEST['action']) {
         $saveResult = $savedSearch->setId(null)->setCriterias($_REQUEST)->save();
     } elseif ('update' === $_REQUEST['action']) {
         $saveResult = $savedSearch->setCriterias($_REQUEST)->save();
     } elseif ('delete' === $_REQUEST['action']) {
         $deleteResult = $savedSearch->delete();
         //After deletion, reset search.
         $savedSearch = new SavedSearches($GLOBALS);
         $savedSearch->setUsername($GLOBALS['cfg']['Server']['user'])->setDbname($_REQUEST['db']);
         $_REQUEST = array();
     } elseif ('load' === $_REQUEST['action']) {
         if (empty($_REQUEST['searchId'])) {
             //when not loading a search, reset the object.
             $savedSearch = new SavedSearches($GLOBALS);
             $savedSearch->setUsername($GLOBALS['cfg']['Server']['user'])->setDbname($_REQUEST['db']);
             $_REQUEST = array();
         } else {
             $loadResult = $savedSearch->load();
         }
     }
     //Else, it's an "update query"