本文整理匯總了PHP中CProject::canEdit方法的典型用法代碼示例。如果您正苦於以下問題:PHP CProject::canEdit方法的具體用法?PHP CProject::canEdit怎麽用?PHP CProject::canEdit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CProject
的用法示例。
在下文中一共展示了CProject::canEdit方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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);