<?php

require_once "../connection/connect.php";
require_once "../../models/index/index.php";
$cnct = new cnct_class();
$cnx = $cnct->cnct();
$index_data['cnx'] = $cnx;
$index = new index($index_data);
$table = $_POST['table'];
$Table = $index->capitalize($table);
$data = array();
if (isset($_POST)) {
    foreach ($_POST as $key => $post) {
        if ($key != 'table' && $key != 'checkAll') {
            $data[$key] = $post;
        }
    }
}
//var_dump($data);die();
$itemsDeleted = $index->deleteGeneralItems($data, $table);
if ($itemsDeleted) {
    header('Location: ../../index/' . $table . '.php?note=All Selected Was Deleted');
} else {
    header('Location: ../../index/' . $table . '.php?note=Sorry, Please Try Again');
}
Ejemplo n.º 2
0
<?php

session_start();
require_once "../connection/connect.php";
require_once "../../models/index/index.php";
require_once "../../models/index/simpleImage.php";
$cnct = new cnct_class();
$cnx = $cnct->cnct();
$index_data['cnx'] = $cnx;
$index = new index($index_data);
$image = new simpleImage($index_data);
$table = $_GET['table'];
$Table = $index->capitalize($table);
$id = $_GET['id'];
$item_id = $_GET['item_id'];
$file = $_GET['file'];
$data[] = $id;
if ($index->deleteGeneralItems($data, 'image_to_' . $table)) {
    header('Location: ../../index/manageImages.php?table=' . $table . '&id=' . $item_id . '&note=' . $index->toView($Table) . ' Image Deleted');
} else {
    header('Location: ../../index/manageImages.php?table=' . $table . '&id=' . $item_id . '&note=' . $index->toView($Table) . ' Image Not Deleted,Please Try Again');
}
Ejemplo n.º 3
0
            }
        }
    }
}
if (!isset($error)) {
    unset($tablesData);
    //unset($_SESSION['postData']);
    //echo 'Image Added';
    echo '<script language="javascript" > parent.location=parent.document.location.href; </script>';
    $seqInd = array_keys($seq);
    $mainTable = $seqInd[0];
    if (file_exists('../../index/edit' . ucfirst($mainTable) . '_language.php')) {
        echo '<script language="javascript" >if(confirm("You Must Add In Different Languages \\n Navigate Now?")) { parent.location="../../index/edit' . ucfirst($mainTable) . '_language.php?id=' . $added[$mainTable] . '"; }</script>';
    }
} else {
    if (count($added)) {
        foreach (array_reverse($added) as $Dtable => $Did) {
            $index->deleteGeneralItems(array(0 => $Did), $Dtable);
        }
    } elseif (count($images_added)) {
        foreach ($images_added as $Dtable => $Did) {
            $index->deleteOrfanImages(array(0 => $Did), 'image');
        }
    }
    //**********************************************************************
    echo $error . ' Please Try Again';
}
?>
</p>
</body>
</html>
$ItemToEditTable=array_keys($data);
$ItemToEditTable=$ItemToEditTable[0];
$ItemToEditId=array_values($data);
$ItemToEditId=$ItemToEditId[0];
*/
$filterData['keyword'] = $_POST[$PT1 . '_id'];
$filterData['filterBy'] = $PT1 . '_id';
$old = $index->getAllGeneralExactItemsWithJoins($filterData, $table);
$cols = $index->getGeneralColums($table);
$PRI = $cols['primaryKeys'];
$PRI = $PRI[0];
$oldData = array();
foreach ($old as $key3 => $val3) {
    $oldData[$key3] = $val3[$PRI];
}
if ($index->deleteGeneralItems($oldData, $table)) {
    $newData[$PT1 . '_id'] = $_POST[$PT1 . '_id'];
    //setting the new data would be added to the table. this represents the selected item to be edited
    //var_dump($old);die();
    foreach ($_POST[$PT2] as $key2 => $val) {
        $newData[$PT2 . '_id'] = $val;
        //setting the new data would be added to the table. this represents the checked sub-item that is assigned to be item edited
        //var_dump($newData);die();
        if (!$index->addGeneralItem($newData, $table)) {
            $result = false;
            break;
        } else {
            $result = true;
        }
    }
    if ($result) {