本文整理汇总了PHP中CTask::canDelete方法的典型用法代码示例。如果您正苦于以下问题:PHP CTask::canDelete方法的具体用法?PHP CTask::canDelete怎么用?PHP CTask::canDelete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTask
的用法示例。
在下文中一共展示了CTask::canDelete方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DBQuery
$q =& new DBQuery();
$perms =& $AppUI->acl();
$q->addTable('tasks');
$q->leftJoin('users', 'u1', 'u1.user_id = task_owner');
$q->leftJoin('projects', 'p', 'p.project_id = task_project');
$q->leftJoin('task_log', 'tl', 'tl.task_log_task = task_id');
$q->addWhere('task_id = ' . $task_id);
$q->addQuery('tasks.*');
$q->addQuery('project_name, project_color_identifier');
$q->addQuery('u1.user_username as username');
$q->addQuery('ROUND(SUM(task_log_hours),2) as log_hours_worked');
$q->addGroup('task_id');
// check if this record has dependencies to prevent deletion
$msg = '';
$obj = new CTask();
$canDelete = $obj->canDelete($msg, $task_id);
//$obj = null;
$sql = $q->prepare();
$q->clear();
if (!db_loadObject($sql, $obj, true, false)) {
$AppUI->setMsg('Task');
$AppUI->setMsg("invalidID", UI_MSG_ERROR, true);
$AppUI->redirect();
} else {
$AppUI->savePlace();
}
if (!$obj->canAccess($AppUI->user_id)) {
$AppUI->redirect("m=public&a=access_denied");
}
// retrieve any state parameters
if (isset($_GET['tab'])) {
示例2: die
<?php
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly.');
}
// @todo convert to template
$task_id = (int) w2PgetParam($_GET, 'task_id', 0);
$task_log_id = (int) w2PgetParam($_GET, 'task_log_id', 0);
$tab = $AppUI->processIntState('TaskLogVwTab', $_GET, 'tab', 0);
$obj = new CTask();
if (!$obj->load($task_id)) {
$AppUI->redirect(ACCESS_DENIED);
}
$canEdit = $obj->canEdit();
$canDelete = $obj->canDelete();
/**
* Clear any reminders
* @todo THIS SHOULD NOT HAPPEN HERE.. VIEWING SHOULD BE IDEMPOTENT
*/
$reminded = (int) w2PgetParam($_GET, 'reminded', 0);
if ($reminded) {
$obj->clearReminder();
}
//check permissions for the associated project
$canReadProject = canView('projects', $obj->task_project);
$users = $obj->assignees($task_id);
// setup the title block
$titleBlock = new w2p_Theme_TitleBlock('View Task', 'icon.png', $m);
$titleBlock->addCell();
if ($canReadProject) {
$titleBlock->addCrumb('?m=projects&a=view&project_id=' . $obj->task_project, 'view this project');