Ejemplo n.º 1
0
 /**
  * execute the delete
  */
 function doDelete()
 {
     /**
      * is there a checker and does it allow delete?
      */
     if (isset($this->deleteChecker)) {
         if (!$this->deleteChecker->checkForDelete($this->menu->getMenuValues(), $this->dbMessage)) {
             return 0;
         }
     }
     if (hasCap($this->menu->requiredCap)) {
         /* test if all keycolumn values are set */
         $dq = new DeleteQuery($this->dbConn, $this->relation);
         $dq->setKeyColumns($this->keyColumns);
         $dq->setSubmitValueSet($_POST);
         $dq->setUpdateSet($_POST);
         /* leave an empty menu .. */
         if ($dq->areKeyColumnsSet()) {
             /* allow delete */
             $query = $dq->getQuery();
             $result = doDelete($this->dbConn, $query, $this->dbMessage);
             if ($result > 0) {
                 $this->dbMessage .= $result . ' rows deleted';
             } else {
                 $this->dbMessage .= ' delete failed';
             }
             $_GET = array();
             $this->keyValues = array();
             /* meuk */
         } else {
             $this->dbMessage .= 'DB ERROR: Delete failed.<br>Not all keyColumns have been set';
         }
     }
 }