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


PHP CLink::canDelete方法代码示例

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


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

示例1: die

<?php

if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
// @todo    convert to template
$object_id = (int) w2PgetParam($_GET, 'link_id', 0);
$task_id = (int) w2PgetParam($_GET, 'task_id', 0);
$project_id = (int) w2PgetParam($_GET, 'project_id', 0);
$object = new CLink();
$object->setId($object_id);
$obj = $object;
$canAddEdit = $obj->canAddEdit();
$canAuthor = $obj->canCreate();
$canEdit = $obj->canEdit();
$canDelete = $object->canDelete();
if (!$canAddEdit) {
    $AppUI->redirect(ACCESS_DENIED);
}
$obj = $AppUI->restoreObject();
if ($obj) {
    $object = $obj;
    $object_id = $object->getId();
} else {
    $object->load($object_id);
}
if (!$object && $object_id > 0) {
    $AppUI->setMsg('Link');
    $AppUI->setMsg('invalidID', UI_MSG_ERROR, true);
    $AppUI->redirect('m=' . $m);
}
开发者ID:illuminate3,项目名称:web2project,代码行数:31,代码来源:addedit.php

示例2: DBQuery

$q = new DBQuery();
$q->addQuery('links.*');
$q->addQuery('user_username');
$q->addQuery('contact_first_name,	contact_last_name');
$q->addQuery('project_id');
$q->addQuery('task_id, task_name');
$q->addTable('links');
$q->leftJoin('users', 'u', 'link_owner = user_id');
$q->leftJoin('contacts', 'c', 'user_contact = contact_id');
$q->leftJoin('projects', 'p', 'project_id = link_project');
$q->leftJoin('tasks', 't', 'task_id = link_task');
$q->addWhere('link_id = ' . $link_id);
// check if this record has dependancies to prevent deletion
$msg = '';
$obj = new CLink();
$canDelete = $obj->canDelete($msg, $link_id);
// load the record data
$obj = null;
if (!db_loadObject($q->prepare(), $obj) && $link_id > 0) {
    $AppUI->setMsg('Link');
    $AppUI->setMsg("invalidID", UI_MSG_ERROR, true);
    $AppUI->redirect();
}
// setup the title block
$ttl = $link_id ? "Edit Link" : "Add Link";
$titleBlock = new CTitleBlock($ttl, 'folder5.png', $m, "{$m}.{$a}");
$titleBlock->addCrumb("?m={$m}", "links list");
$canDelete = getPermission($m, 'delete', $link_id);
if ($canDelete && $link_id > 0) {
    $titleBlock->addCrumbDelete('delete link', $canDelete, $msg);
}
开发者ID:illuminate3,项目名称:dotproject,代码行数:31,代码来源:addedit.php


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