当前位置: 首页>>代码示例>>PHP>>正文


PHP model::delete方法代码示例

本文整理汇总了PHP中model::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP model::delete方法的具体用法?PHP model::delete怎么用?PHP model::delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在model的用法示例。


在下文中一共展示了model::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: delete

 public function delete($id)
 {
     global $main;
     $this->setId($id);
     parent::delete();
     $main->addLog("package::delete #{$id}");
     return true;
 }
开发者ID:codegooglecom,项目名称:bnpanel,代码行数:8,代码来源:class_package.php

示例2: delete

 public function delete($id)
 {
     $this->setId($id);
     parent::delete();
     //Deleting relation between addons and packages
     $id = intval($id);
     global $package;
     $package->package_addons->setPrimaryKey('addon_id');
     $package->package_addons->setId($id);
     $package->package_addons->delete();
 }
开发者ID:codegooglecom,项目名称:bnpanel,代码行数:11,代码来源:class_addon.php

示例3: delete

 /**
  * Deletes a user 
  */
 public function delete($id)
 {
     global $main;
     //you cant delete yourself
     if ($id != $main->getCurrentStaffId()) {
         $this->setId($id);
         parent::delete();
         $main->addLog("Staff User deleted: {$id}");
         return true;
     }
     return false;
 }
开发者ID:codegooglecom,项目名称:bnpanel,代码行数:15,代码来源:class_staff.php

示例4: asset_upload

 /**
  * Process the uploaded file
  * @param {Integer} $id the asset
  * @param {String} $path the path of the uploaded file in the temporary folder
  * @param {String} $message
  * @returns {Boolean} true on success, false otherwise
  */
 static function asset_upload($id, $path, $message)
 {
     switch (model::getKey($id, 'mode')) {
         case '2':
             global $assetsLCL;
             $newid = assets::version_increment2($id, $message);
             if (!$newid) {
                 return false;
             }
             if (!move_uploaded_file($path, $assetsLCL . model::getKey($newid, 'file'))) {
                 return false;
             }
             break;
         case '1':
         default:
             global $assetsLCL;
             if (!file_exists($assetsLCL . assets::getbackupfolder($id))) {
                 if (!mkdir($assetsLCL . assets::getbackupfolder($id), 0755, true)) {
                     return false;
                 }
             }
             if (!is_writable($assetsLCL . assets::getbackupfolder($id))) {
                 return false;
             }
             if (file_exists($assetsLCL . assets::getbackuppath($id))) {
                 return false;
             }
             if (!is_writable($assetsLCL . model::getKey($id, 'file'))) {
                 return false;
             }
             $new_id = assets::version_backup($id);
             if (!$new_id) {
                 return false;
             }
             if (!move_uploaded_file($path, $assetsLCL . model::getKey($id, 'file'))) {
                 unlink($assetsLCL . model::getKey($new_id, 'file'));
                 model::delete($new_id);
                 return false;
             }
             if (!assets::version_increment($id, $message)) {
                 return false;
             }
             break;
     }
     return true;
 }
开发者ID:remyla,项目名称:damas-core,代码行数:53,代码来源:asset.php

示例5: batchDelete

 public function batchDelete()
 {
     try {
         $request = Request::instance();
         $content = $request->getContent();
         $items = explode(',', $content);
         if (!empty($items)) {
             foreach ($items as $item) {
                 $model = $this->model->findById($item);
                 if ($model) {
                     $this->model->delete($model);
                 }
             }
         }
         return Response::json($items);
     } catch (Exception $e) {
         return Response::json($e->getMessage(), 400);
     }
 }
开发者ID:khaledof,项目名称:brikaCms,代码行数:19,代码来源:ApiContactsController.php

示例6: delete

 public function delete($where = array())
 {
     $modelcontent = zotop::model('content.modelcontent');
     if (empty($where)) {
         $where = array('id', '=', $this->id);
     }
     $data = $this->db()->select('id', 'modelid', 'globalid')->where($where)->getAll();
     foreach ($data as $item) {
         //删除模型内容数据
         if ($item['modelid']) {
             $modelcontent->modelid = $item['modelid'];
             $modelcontent->delete();
         }
         //删除内容数据
         parent::delete(array('id', '=', $item['id']));
         //删除附件
         //删除钩子,可以调用该钩子删除其他模块的相关数据
         zotop::run('content.delete', $item['id']);
     }
     return true;
 }
开发者ID:dalinhuang,项目名称:zotop,代码行数:21,代码来源:content.php

示例7: del

 public function del($id)
 {
     $where = 'id = ' . $id;
     return parent::delete('produtos', $where);
 }
开发者ID:LucasMMota,项目名称:estoque,代码行数:5,代码来源:produtosModel.php

示例8: header

 case "update":
     if (is_null(arg('id')) || is_null(arg('keys'))) {
         header("HTTP/1.1: 400 Bad Request");
         echo "Bad command";
         exit;
     }
     $id = model::update(arg("id"), json_decode(arg("keys")));
     echo json_encode(model_json::node(arg("id"), 1, $NODE_TAG | $NODE_PRM));
     break;
 case "delete":
     if (is_null(arg('id'))) {
         header("HTTP/1.1: 400 Bad Request");
         echo "Bad command";
         exit;
     }
     if (!model::delete(arg("id"))) {
         header("HTTP/1.1: 409 Conflict");
         echo "delete Error, please change your values";
         exit;
     }
     break;
     /* other operations */
 /* other operations */
 case "findSQL":
     if (is_null(arg('query'))) {
         header('HTTP/1.1: 400 Bad Request');
         exit;
     }
     # Forbidden SQL manipulation keywords
     if (stripos(arg('query'), 'ALTER') || stripos(arg('query'), 'CALL') || stripos(arg('query'), 'CREATE') || stripos(arg('query'), 'DELETE') || stripos(arg('query'), 'DROP') || stripos(arg('query'), 'HANDLER') || stripos(arg('query'), 'INSERT') || stripos(arg('query'), 'LOAD') || stripos(arg('query'), 'RENAME') || stripos(arg('query'), 'REPLACE') || stripos(arg('query'), 'TRUNCATE') || stripos(arg('query'), 'UPDATE')) {
         header('HTTP/1.1: 400 Bad Request');
开发者ID:remyla,项目名称:damas-core,代码行数:31,代码来源:model.json.php

示例9: json_encode

<?php

session_start();
if (!$_SESSION['name'] || !$_POST['guess'] || $_POST['guess'] !== md5(sha1($_SESSION['name'] . "wechat") . "youchat")) {
    echo "不合法的来路!";
    die;
}
include "../model/model.php";
//调用model删除置顶数据
$news = new model("news");
$id = $_POST['id'];
if ($news->delete($id)) {
    $data['status'] = 1;
    $data['msg'] = "删除成功";
} else {
    $data['status'] = 0;
    $data['msg'] = "删除失败";
}
echo json_encode($data);
开发者ID:phpcyy,项目名称:static,代码行数:19,代码来源:delete.php

示例10: del

 public function del($p_id, $c_id)
 {
     $where = 'clientes_id = ' . $c_id . ' AND produtos_id = ' . $p_id;
     return parent::delete('pedidos', $where);
 }
开发者ID:LucasMMota,项目名称:estoque,代码行数:5,代码来源:pedidosModel.php

示例11: delete

 /**
  * Delete user.
  * 
  * @param  string    $account 
  * @param  null      $id          add this param to avoid the warning of php.
  * @access public
  * @return bool
  */
 public function delete($account, $id = null)
 {
     $user = $this->getByAccount($account);
     if (!$user) {
         return false;
     }
     parent::delete(TABLE_USER, $user->id);
     return !dao::isError();
 }
开发者ID:leowh,项目名称:colla,代码行数:17,代码来源:model.php

示例12: json_encode

        echo json_encode(model_json::multi(explode(",", $_GET['id'])));
    }
    exit;
}
if ($_SERVER['REQUEST_METHOD'] == 'PUT') {
    damas_service::allowed("model::update");
    if (!isset($_PUT['id']) || !isset($_PUT['keys']) || ($_PUT['id'] == '' || $_PUT['keys'] == '')) {
        header("HTTP/1.1: 400 Bad Request");
        echo "Bad command";
        exit;
    }
    $id = model::update($_PUT['id'], json_decode($_PUT['keys']));
    echo json_encode(model_json::node(arg("id"), 1, $NODE_TAG | $NODE_PRM));
    damas_service::log_event();
    exit;
}
if ($_SERVER['REQUEST_METHOD'] == 'DELETE') {
    damas_service::allowed("model::delete");
    if (!isset($_DELETE['id']) || $_DELETE['id'] == '') {
        header("HTTP/1.1: 400 Bad Request");
        echo "Bad command";
        exit;
    }
    if (!model::delete($_DELETE['id'])) {
        header("HTTP/1.1: 409 Conflict");
        echo "delete Error, please change your values";
        exit;
    }
    damas_service::log_event();
    exit;
}
开发者ID:remyla,项目名称:damas-core,代码行数:31,代码来源:model.crud.php

示例13: failed

             $error_detected = true;
             $msg .= model::getKey($id, 'file') . " move_uploaded_file failed (enough space?). ";
             continue;
         }
         break;
     case '1':
     default:
         $new_id = assets::version_backup($id);
         if (!$new_id) {
             $error_detected = true;
             $msg .= model::getKey($id, 'file') . " backup failed. ";
             continue;
         }
         if (!move_uploaded_file($file['tmp_name'], $assetsLCL . model::getKey($id, 'file'))) {
             unlink($assetsLCL . model::getKey($new_id, 'file'));
             model::delete($new_id);
             $error_detected = true;
             $msg .= model::getKey($id, 'file') . " move_uploaded_file failed (enough space?). ";
             continue;
         }
         if (!assets::version_increment($id, arg('message'))) {
             $error_detected = true;
             $msg .= model::getKey($id, 'file') . " increment failed. ";
             continue;
         }
         model::setKey($id, 'bytes', $file['size']);
         break;
 }
 //if( !assets::asset_upload( $asset, $file['tmp_name'], "new version uploaded" ) )
 //{
 //	header("HTTP/1.1: 304 Not Modified Asset Not updated");
开发者ID:remyla,项目名称:damas-core,代码行数:31,代码来源:asset.json.php

示例14: delete

 public function delete($id)
 {
     $child = $this->getChildID($id);
     if (empty($child)) {
         $r = parent::delete($id);
         if ($r) {
             $this->cache(true);
         }
         return true;
     }
     $this->error(zotop::t('无法删除,删除前请先删除子类别'));
 }
开发者ID:dalinhuang,项目名称:zotop,代码行数:12,代码来源:category.php

示例15: empty_

 /**
  * Empty a node. underscore because empty is a reserved word
  * @return {Boolean} true
  */
 static function empty_($id)
 {
     $children = model::children($id);
     for ($i = 0; $i < sizeof($children); $i++) {
         model::delete($children[$i]);
     }
     return true;
 }
开发者ID:remyla,项目名称:damas-core,代码行数:12,代码来源:model.php


注:本文中的model::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。