本文整理汇总了PHP中ProjectMilestones::find方法的典型用法代码示例。如果您正苦于以下问题:PHP ProjectMilestones::find方法的具体用法?PHP ProjectMilestones::find怎么用?PHP ProjectMilestones::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectMilestones
的用法示例。
在下文中一共展示了ProjectMilestones::find方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getProjectMilestones
static function getProjectMilestones($project = null, $order = null, $orderdir = 'DESC', $tag = null, $assigned_to_company = null, $assigned_to_user = null, $assigned_by_user = null, $pending = false, $is_template = false, $archived = false)
{
// default
$order_by = '`due_date` ASC';
if ($project instanceof Project) {
$pids = $project->getAllSubWorkspacesQuery(!$archived);
$projectstr = " AND " . self::getWorkspaceString($pids);
} else {
$projectstr = "";
}
if ($tag == '' || $tag == null) {
$tagstr = "";
} else {
$tagstr = " AND (select count(*) from " . TABLE_PREFIX . "tags where " . TABLE_PREFIX . "project_milestones.id = " . TABLE_PREFIX . "tags.rel_object_id and " . TABLE_PREFIX . "tags.tag = " . DB::escape($tag) . " and " . TABLE_PREFIX . "tags.rel_object_manager ='ProjectMilestones' ) > 0 ";
}
$assignedToStr = "";
if ($assigned_to_company) {
$assignedToStr .= " AND `assigned_to_company_id` = " . DB::escape($assigned_to_company) . " ";
}
if ($assigned_to_user) {
$assignedToStr .= " AND `assigned_to_user_id` = " . DB::escape($assigned_to_user) . " ";
}
$assignedByStr = "";
if ($assigned_by_user) {
$assignedByStr .= " AND (`created_by_id` = " . DB::escape($assigned_by_user) . " OR `updated_by_id` = " . DB::escape($assigned_by_user) . ") ";
}
if ($pending) {
$pendingstr = " AND `completed_on` = " . DB::escape(EMPTY_DATETIME) . " ";
} else {
$pendingstr = "";
}
if ($pending) {
$pendingstr = " AND `completed_on` = " . DB::escape(EMPTY_DATETIME) . " ";
} else {
$pendingstr = "";
}
if ($archived) {
$archived_cond = " AND `archived_by_id` <> 0";
} else {
$archived_cond = " AND `archived_by_id` = 0";
}
$permissionstr = ' AND ( ' . permissions_sql_for_listings(ProjectMilestones::instance(), ACCESS_LEVEL_READ, logged_user()) . ') ';
$otherConditions = $projectstr . $tagstr . $assignedToStr . $assignedByStr . $permissionstr . $pendingstr . $archived_cond;
$conditions = array(' `is_template` = ' . DB::escape($is_template) . $otherConditions);
$milestones = ProjectMilestones::find(array('conditions' => $conditions, 'order' => $order_by));
if (!is_array($milestones)) {
$milestones = array();
}
return $milestones;
}