本文整理汇总了PHP中CProject::canDelete方法的典型用法代码示例。如果您正苦于以下问题:PHP CProject::canDelete方法的具体用法?PHP CProject::canDelete怎么用?PHP CProject::canDelete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CProject
的用法示例。
在下文中一共展示了CProject::canDelete方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CDate
}
if ($obj->project_actual_end_date) {
$date = new CDate($obj->project_actual_end_date);
$obj->project_actual_end_date = $date->format(FMT_DATETIME_MYSQL);
}
// let's check if there are some assigned departments to project
//部门分配
if (!dPgetParam($_POST, "project_departments", 0)) {
//返回一个部门的id
$obj->project_departments = implode(",", dPgetParam($_POST, "dept_ids", array()));
}
$del = dPgetParam($_POST, 'del', 0);
// prepare (and translate) the module name ready for the suffix
if ($del) {
$project_id = dPgetParam($_POST, 'project_id', 0);
$canDelete = $obj->canDelete($msg, $project_id);
if (!$canDelete) {
$AppUI->setMsg($msg, UI_MSG_ERROR);
$AppUI->redirect();
}
if ($msg = $obj->delete()) {
$AppUI->setMsg($msg, UI_MSG_ERROR);
$AppUI->redirect();
} else {
$AppUI->setMsg("Project deleted", UI_MSG_ALERT);
$AppUI->redirect("m=projects");
}
} else {
if ($msg = $obj->store()) {
$AppUI->setMsg($msg, UI_MSG_ERROR);
} else {
示例2: CProject
$canRead = $perms->checkModuleItem($m, 'view', $project_id);
$canEdit = $perms->checkModuleItem($m, 'edit', $project_id);
$canEditT = $perms->checkModule('tasks', 'add');
if (!$canRead) {
$AppUI->redirect('m=public&a=access_denied');
}
$tab = $AppUI->processIntState('ProjVwTab', $_GET, 'tab', 0);
// check if this record has dependencies to prevent deletion
$msg = '';
$project = new CProject();
// Now check if the proect is editable/viewable.
$denied = $project->getDeniedRecords($AppUI->user_id);
if (in_array($project_id, $denied)) {
$AppUI->redirect('m=public&a=access_denied');
}
$canDelete = $project->canDelete($msg, $project_id);
// get critical tasks (criteria: task_end_date)
$criticalTasks = $project_id > 0 ? $project->getCriticalTasks($project_id) : null;
// get ProjectPriority from sysvals
$projectPriority = w2PgetSysVal('ProjectPriority');
$projectPriorityColor = w2PgetSysVal('ProjectPriorityColor');
// load the record data
$project->loadFull($AppUI, $project_id);
if (!$project) {
$AppUI->setMsg('Project');
$AppUI->setMsg('invalidID', UI_MSG_ERROR, true);
$AppUI->redirect();
} else {
$AppUI->savePlace();
}
$total_hours = $project->getTotalHours();
示例3: CProject
}
$tab = $AppUI->getState('ProjVwTab') !== NULL ? $AppUI->getState('ProjVwTab') : 0;
// check if this record has dependencies to prevent deletion
$msg = '';
$obj = new CProject();
// Now check if the proect is editable/viewable.
$denied = $obj->getDeniedRecords($AppUI->user_id);
if (in_array($project_id, $denied)) {
$AppUI->setMsg('Access denied', UI_MSG_ERROR);
$AppUI->redirect();
}
$obj->load($project_id);
$isProjectManager = $AppUI->user_id == $obj->getManager();
$canEdit = $perms->checkModuleItem($m, 'edit', $project_id) && ($AppUI->user_type == SYSADMIN || $isProjectManager);
$canEditT = $obj->canCreateTasks();
$canDelete = $obj->canDelete($msg, $project_id) && ($AppUI->user_type == SYSADMIN || $AppUI->user_id == $obj->project_owner);
$canViewReport = $isProjectManager || $AppUI->user_type <= MANAGER;
// get critical tasks (criteria: task_end_date)
$criticalTasks = $project_id > 0 ? $obj->getCriticalTasks($project_id) : NULL;
// get ProjectPriority from sysvals
$projectPriority = dPgetSysVal('ProjectPriority');
$projectPriorityColor = dPgetSysVal('ProjectPriorityColor');
$working_hours = $dPconfig['daily_working_hours'] ? $dPconfig['daily_working_hours'] : 8;
$q = new DBQuery();
//check that project has tasks; otherwise run seperate query
$q->addTable('tasks');
$q->addQuery('COUNT(distinct tasks.task_id) AS total_tasks');
$q->addWhere('task_project = ' . $project_id);
$hasTasks = $q->loadResult();
$q->clear();
// load the record data
示例4: die
<?php
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly.');
}
// @todo convert to template
$project_id = (int) w2PgetParam($_GET, 'project_id', 0);
$project = new CProject();
if (!$project->load($project_id)) {
$AppUI->redirect(ACCESS_DENIED);
}
$canEdit = $project->canEdit();
$canDelete = $project->canDelete();
$tab = $AppUI->processIntState('ProjVwTab', $_GET, 'tab', 0);
//TODO: is this different from the above checks for some reason?
// Now check if the project is editable/viewable.
$denied = $project->getDeniedRecords($AppUI->user_id);
if (in_array($project_id, $denied)) {
$AppUI->redirect(ACCESS_DENIED);
}
// get critical tasks (criteria: task_end_date)
$criticalTasks = $project_id > 0 ? $project->getCriticalTasks($project_id) : null;
// create Date objects from the datetime fields
$end_date = intval($project->project_end_date) ? new w2p_Utilities_Date($project->project_end_date) : null;
$actual_end_date = null;
if (isset($criticalTasks)) {
$actual_end_date = intval($criticalTasks[0]['task_end_date']) ? new w2p_Utilities_Date($criticalTasks[0]['task_end_date']) : null;
}
$style = $actual_end_date > $end_date && !empty($end_date) ? 'style="color:red; font-weight:bold"' : '';
// setup the title block
$titleBlock = new w2p_Theme_TitleBlock('View Project', 'icon.png', $m);
示例5: CDate
if ($obj->project_end_date) {
$date = new CDate($obj->project_end_date);
$obj->project_end_date = $date->format(FMT_DATETIME_MYSQL);
}
if ($obj->project_actual_end_date) {
$date = new CDate($obj->project_actual_end_date);
$obj->project_actual_end_date = $date->format(FMT_DATETIME_MYSQL);
}
// let's check if there are some assigned departments to project
if (!dPgetParam($_POST, "project_departments", 0)) {
$obj->project_departments = implode(",", dPgetParam($_POST, "dept_ids", array()));
}
$del = dPgetParam($_POST, 'del', 0);
// prepare (and translate) the module name ready for the suffix
if ($del) {
if (!$obj->canDelete($msg)) {
$AppUI->setMsg($msg, UI_MSG_ERROR);
$AppUI->redirect();
}
if ($msg = $obj->delete()) {
$AppUI->setMsg($msg, UI_MSG_ERROR);
$AppUI->redirect();
} else {
$AppUI->setMsg("Project deleted", UI_MSG_ALERT);
$AppUI->redirect("m=projects");
}
} else {
if ($msg = $obj->store()) {
$AppUI->setMsg($msg, UI_MSG_ERROR);
} else {
$isNotNew = @$_POST['project_id'];