GlisWeb framework
_prodotti.duplica.php
Vai alla documentazione di questo file.
1 <?php
2 
14  // inclusione del framework
15  require '../../../../../_src/_config.php';
16 
17  // verifica dati
18  if( isset( $_REQUEST['old'] ) && isset( $_REQUEST['new'] ) ) {
19 
20  // log
21  logWrite( 'richiesta duplicazione prodotto ' . $_REQUEST['old'] . ' -> ' . $_REQUEST['new'], 'prodotti', LOG_INFO );
22 
23  // duplicazione riga principale
24  $dup = mysqlDuplicateRow( $cf['mysql']['connection'], 'prodotti', $_REQUEST['old'], $_REQUEST['new'] );
25 
26  // duplicazione contenuti
27  $old = mysqlQuery( $cf['mysql']['connection'], 'SELECT * FROM contenuti WHERE id_prodotto = ?', array( array( 's' => $_REQUEST['old'] ) ) );
28  foreach( $old as $ol ) {
29  $dup = mysqlDuplicateRow( $cf['mysql']['connection'], 'contenuti', $ol['id'], NULL, array( 'id_prodotto' => $_REQUEST['new'] ) );
30  }
31 
32  // duplicazione immagini
33  $old = mysqlQuery( $cf['mysql']['connection'], 'SELECT * FROM immagini WHERE id_prodotto = ?', array( array( 's' => $_REQUEST['old'] ) ) );
34  foreach( $old as $ol ) {
35  $dup = mysqlDuplicateRow( $cf['mysql']['connection'], 'immagini', $ol['id'], NULL, array( 'id_prodotto' => $_REQUEST['new'] ) );
36  }
37 
38  // duplicazione file
39  $old = mysqlQuery( $cf['mysql']['connection'], 'SELECT * FROM file WHERE id_prodotto = ?', array( array( 's' => $_REQUEST['old'] ) ) );
40  foreach( $old as $ol ) {
41  $dup = mysqlDuplicateRow( $cf['mysql']['connection'], 'file', $ol['id'], NULL, array( 'id_prodotto' => $_REQUEST['new'] ) );
42  }
43 
44  // duplicazione associazioni categorie
45  $old = mysqlQuery( $cf['mysql']['connection'], 'SELECT * FROM prodotti_categorie WHERE id_prodotto = ?', array( array( 's' => $_REQUEST['old'] ) ) );
46  foreach( $old as $ol ) {
47  $dup = mysqlDuplicateRow( $cf['mysql']['connection'], 'prodotti_categorie', $ol['id'], NULL, array( 'id_prodotto' => $_REQUEST['new'] ) );
48  }
49 
50  } else {
51 
52  buildJson( array( 'error' => true ) );
53 
54  }
55 
56 ?>
logWrite( $m, $f='site', $l=LOG_NOTICE, $d=DIRECTORY_LOG, $t=CURRENT_LOG_LEVEL, $s=SITE_STATUS)
scrive un messaggio nei log del sito
Definition: _log.utils.php:48
mysqlQuery( $c, $q, $p=false, &$e=array())
$cf['ricerca']['template']
Definition: _030.common.php:7
mysqlDuplicateRow( $c, $t, $o, $n=NULL, $x=array())
buildJson( $content, $encoding=ENCODING_UTF8, $headers=array())
$_REQUEST['__view__'][ $ct['view']['id']]['__restrict__']['id_progetto']['EQ']