Пример #1
0
 /**
  * Delete user
  * @access  public
  * @param   user_id
  * @return  true, if successful
  *          false and add error into global var $msg, if unsuccessful
  * @author  Cindy Qi Li
  */
 public function Delete($userIDs)
 {
     // delete customized guidelines created by user but yet open to public
     include_once AC_INCLUDE_PATH . 'classes/DAO/GuidelinesDAO.class.php';
     include_once AC_INCLUDE_PATH . 'classes/DAO/ChecksDAO.class.php';
     include_once AC_INCLUDE_PATH . 'classes/DAO/UserLinksDAO.class.php';
     include_once AC_INCLUDE_PATH . 'classes/Utility.class.php';
     $userIDs = Utility::sanitizeIntArray($userIDs);
     $guidelinesDAO = new GuidelinesDAO();
     $guidelines = $guidelinesDAO->getGuidelineByUserIDs($userIDs);
     if (is_array($guidelines)) {
         foreach ($guidelines as $guideline) {
             if ($guideline['open_to_public'] == 0) {
                 $guidelinesDAO->Delete($guideline['guideline_id']);
             }
         }
     }
     // delete customized checks created by user but yet open to public
     $checksDAO = new ChecksDAO();
     $checks = $checksDAO->getCheckByUserIDs($userIDs);
     if (is_array($checks)) {
         foreach ($checks as $check) {
             if ($check['open_to_public'] == 0) {
                 $checksDAO->Delete($check['check_id']);
             }
         }
     }
     // delete user links and decisions generated by this user
     $userLinksDAO = new UserLinksDAO();
     $userLinks = $userLinksDAO->DeleteByUserID($userIDs);
     $sql = "DELETE FROM " . TABLE_PREFIX . "users\n\t\t         WHERE user_id in (" . implode(",", $userIDs) . ")";
     return $this->execute($sql);
 }
Пример #2
0
/* Inclusive Design Institute                                           */
/*                                                                      */
/* This program is free software. You can redistribute it and/or        */
/* modify it under the terms of the GNU General Public License          */
/* as published by the Free Software Foundation.                        */
/************************************************************************/
// $Id$
define('AC_INCLUDE_PATH', '../include/');
include AC_INCLUDE_PATH . 'vitals.inc.php';
include_once AC_INCLUDE_PATH . 'classes/DAO/ChecksDAO.class.php';
$checksDAO = new ChecksDAO();
if (isset($_POST['submit_no'])) {
    $msg->addFeedback('CANCELLED');
    header('Location: index.php');
    exit;
} else {
    if (isset($_POST['submit_yes'])) {
        $checksDAO->Delete($_REQUEST['id']);
        $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
        header('Location: index.php');
        exit;
    }
}
require AC_INCLUDE_PATH . 'header.inc.php';
unset($hidden_vars);
$row = $checksDAO->getCheckByID($_REQUEST['id']);
$name_html = '<ul><li>' . _AC($row['name']) . '</li></ul>';
$hidden_vars['id'] = $_REQUEST['id'];
$msg->addConfirm(array('DELETE_CHECK', $name_html), $hidden_vars);
$msg->printConfirm();
require AC_INCLUDE_PATH . 'footer.inc.php';