Пример #1
0
	function rearrange($idart)
	{
		// CBdd::update('CALL rearrange_galerie('.$idart.');');
            $iKey = 1 ;
            $oRes = CBdd::select('SELECT id FROM galerie WHERE idart = ' . $idart . ' ORDER BY rang') ;
            while ($tiItems = mysql_fetch_assoc($oRes))
            {
                CBdd::execute("UPDATE galerie SET rang = " . $iKey . " WHERE id=" . $tiItems['id']) ;
                $iKey++ ;
            }
	}
Пример #2
0
	function sql($sqlfile){
		$ok = true;
		$file = file_get_contents($sqlfile); 
		// $file = ereg_replace("#;[^'a-zA-Z0-9\"]+#", ";///", $file);
		
		$arr_req = explode("///", $file);
		foreach($arr_req as $req) {
		  	if(trim($req)) {
				if(!ereg('DROP|ALTER|INSERT',$req)) $this->nb_elts ++;
		  		$out = CBdd::execute($req);
		  		$ok = $ok && $out;
			}
		}
		return $ok;
	}
Пример #3
0
	function reverse_etat_contact() {
		$sql = "UPDATE entreprise SET etatcontact_ent=abs(etatcontact_ent-1) WHERE id_ent = " . $this->table['id'];
		$res = CBdd::execute($sql);
		return $res;
	}
Пример #4
0
	function down_rang() {
		$nom_table=$this->table['tablename'];
		if ($this->table['tablename'] == 'cat') $id=$this->table['id_cat'];           
		else if ($this->table['tablename'] == 'commune') $id=$this->table['id_com'];   
		else if ($this->table['tablename'] == 'secteur') $id=$this->table['id_sec'];   
		else if ($this->table['tablename'] == 'commune') $id=$this->table['id_com'];  
		else if ($this->table['tablename'] == 'entreprise') $id=$this->table['id_ent'];
		else $id=$this->table['id'];
		$sql='select rang from '.$nom_table.' where id='.$id.'';
		$rang   = CBdd::select_one($sql, 'rang');
		$rang_plus=$rang+1;
		$sql2='UPDATE '.$nom_table.' SET rang = IF(rang='.$rang.','.$rang_plus.','.$rang.') WHERE rang IN ('.$rang.','.$rang_plus.')';
		$res = CBdd::execute($sql2);
		return $res;
	}
Пример #5
0
    /**
     * Diminuer dans le rang
     *
     */
    public function downRang()
    {
        $toTables = $this->__getById() ;
        if ($toTables[$this->zRangColone] >= 1)
        {
            // --- l'enregistrement inferieur
            $zWhere  = ($this->zParentColone) ? $this->zParentColone . " = " . $toTables[$this->zParentColone] : "" ;
            $zWhere .= ($zWhere) ? " AND " : "" ;
            $zWhere .= $this->zRangColone . " > " . $toTables[$this->zRangColone] ;

            $zSql = "SELECT id, " . $this->zRangColone . " FROM " . $this->zTableName . " WHERE " . $zWhere . " ORDER BY " . $this->zRangColone . " ASC LIMIT 1" ;
            $toPermutRangs = CBdd::select_row($zSql) ;

            // --- permutation
            if (isset($toPermutRangs['id']))
            {
                $zSql = "UPDATE " . $this->zTableName . " SET " . $this->zRangColone . " = " . $toPermutRangs[$this->zRangColone] . " WHERE id = " . $this->iId . " ; " ;
                CBdd::execute($zSql) ;
                $zSql = "UPDATE " . $this->zTableName . " SET " . $this->zRangColone . " = " . $toTables[$this->zRangColone] . " WHERE id = " . $toPermutRangs['id'] . " ; " ;
                CBdd::execute($zSql) ;
            }
        }
        return true;
    }
Пример #6
0
	// Owen 01/2011 pour echaper au session de suppression
	$_SESSION['id']=x;
	//
	$nom = $_group['nom'];
	$id1= $_group['id'];
	$etat = $_group ['etat'];

	$sql1 = "SELECT text FROM groupe WHERE id = " . $id1;
	$text	= CBdd::select_one($sql1,'text');
	
	// Owen 01/2011 suppression contact �artir de vider groupe
	$text1=str_replace("|",",",$text);
	$tab = explode(",",$text1); 
	$text2=count($tab);
	for ($i=0; $i<$text2 and $text2!=0; $i++){
		if ($tab[$i]!='') CBdd::execute("DELETE FROM user WHERE id = " . $tab[$i]);
		else $not=1;
	}
	$tgroupe->update();
	if ($not!=1) $msginfo = "groupe bien vid&eacute;";
	$a = 0;
	break;
case 5555://confirmer
	if(!empty($_GET['id'])) $id = $_GET['id'];
	$a = 0;
	$_SESSION['confirme']='ok';
	$_SESSION['id']=$id;
	break;
case 6 : // Filtrer
	if(!empty($_GET['idcat'])) $idcat = $_GET['idcat'];
	$_SESSION['idcat'] = $idcat;
Пример #7
0
	$tgroupe->update();
	for ($i=0; $i<$text2 and $text2!=0; $i++){
		if ($tab[$i]!=''){
				$Zsql = "SELECT * FROM entreprise WHERE commune_alias=".$tab[$i];
				$commune = CBdd::select_one($Zsql,'commune_alias');
				//echo 'commune'.$commune;
				
				array_push($tab_user, $commune);
				
				$tab_user_old 	= CTableGroupeCommune::get_array_id_user($id);
				$tab_user_new 	= array_unique(array_merge($tab_user_old, $tab_user));
				if($tab_user_new) $liste_user_new = implode("|", $tab_user_new);
				$groupe = new CTableGroupeCommune(array('id'=>$id, 'text'=>$liste_user_new));
				$groupe->update();
		
				if(!$commune) CBdd::execute("DELETE FROM commune WHERE id_com = " . $tab[$i]);
					
		}
		else $not=1;
	}
	
	if ($not!=1) $msginfo = "groupe bien vid&eacute;";
	$a = 0;
	break;
case 5555://confirmer
	
	// RECUPERATION VARIABLE
	$id = $_GET['id'];
	$_SESSION['confirme']='ok';
	$_SESSION['id']= $id ;
	
Пример #8
0
	function down_rang() {
		$sql = "
		call downrang('" . $this->table['tablename'] . "', " . $this->table['id'] . ")";
		$res = CBdd::execute($sql);
		return $res;
	}
Пример #9
0
	// Owen 01/2011 pour echaper au session de suppression
	$_SESSION['id']=x;
	//
	$nom = $_group['nom'];
	$id1= $_group['id'];
	$etat = $_group ['etat'];

	$sql1 = "SELECT text FROM groupeUtilitaire WHERE id = " . $id1;
	$text	= CBdd::select_one($sql1,'text');
	
	// Owen 01/2011 suppression contact à partir de vider groupe
	$text1=str_replace("|",",",$text);
	$tab = explode(",",$text1); 
	$text2=count($tab);
	for ($i=0; $i<$text2 and $text2!=0; $i++){
		if ($tab[$i]!='') CBdd::execute("DELETE FROM entreprise WHERE id_ent = " . $tab[$i]);
		else $not=1;
	}
	$tgroupe->update();
	if ($not!=1) $msginfo = "groupe bien vid&eacute;";
	$a = 0;
	break;
case 5555://confirmer
	if(!empty($_GET['id'])) $id = $_GET['id'];
	$a = 0;
	$_SESSION['confirme']='ok';
	$_SESSION['id']=$id;
	break;
case 6 : // Filtrer
	if(!empty($_GET['idcat'])) $idcat = $_GET['idcat'];
	$_SESSION['idcat'] = $idcat;
Пример #10
0
	function reverse_etat_contact() {
		$sql = "UPDATE user SET etat_contact=abs(etat_contact-1) WHERE id = " . $this->table['id'];
		$res = CBdd::execute($sql);
		return $res;
	}