本文整理汇总了PHP中ProjectMilestones::getActiveMilestonesByUser方法的典型用法代码示例。如果您正苦于以下问题:PHP ProjectMilestones::getActiveMilestonesByUser方法的具体用法?PHP ProjectMilestones::getActiveMilestonesByUser怎么用?PHP ProjectMilestones::getActiveMilestonesByUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectMilestones
的用法示例。
在下文中一共展示了ProjectMilestones::getActiveMilestonesByUser方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getActiveMilestones
/**
* Return all active milestones assigned to this user
*
* @param void
* @return array
*/
function getActiveMilestones() {
if (is_null($this->all_active_milestons)) {
$this->all_active_milestons = ProjectMilestones::getActiveMilestonesByUser($this);
} // if
return $this->all_active_milestons;
} // getActiveMilestones
示例2: get_ext_values
private function get_ext_values($field, $manager = null)
{
$values = array(array('id' => '', 'name' => '-- ' . lang('select') . ' --'));
if ($field == 'company_id' || $field == 'assigned_to_company_id') {
$companies = Companies::getVisibleCompanies(logged_user());
foreach ($companies as $company) {
$values[] = array('id' => $company->getId(), 'name' => $company->getName());
}
} else {
if ($field == 'user_id' || $field == 'created_by_id' || $field == 'updated_by_id' || $field == 'assigned_to_user_id' || $field == 'completed_by_id') {
$users = Users::getVisibleUsers(logged_user());
foreach ($users as $user) {
$values[] = array('id' => $user->getId(), 'name' => $user->getDisplayName());
}
} else {
if ($field == 'milestone_id') {
$milestones = ProjectMilestones::getActiveMilestonesByUser(logged_user());
foreach ($milestones as $milestone) {
$values[] = array('id' => $milestone->getId(), 'name' => $milestone->getName());
}
} else {
if ($field == 'workspace') {
$workspaces = logged_user()->getWorkspaces(false, 0);
foreach ($workspaces as $ws) {
$values[] = array('id' => $ws->getId(), 'name' => $ws->getName());
}
} else {
if ($field == 'tag') {
$tags = Tags::getTagNames();
foreach ($tags as $tag) {
$values[] = array('id' => $tag['name'], 'name' => $tag['name']);
}
} else {
if ($field == 'object_subtype') {
$object_types = ProjectCoTypes::findAll(array('conditions' => !is_null($manager) ? "`object_manager`='{$manager}'" : ""));
foreach ($object_types as $object_type) {
$values[] = array('id' => $object_type->getId(), 'name' => $object_type->getName());
}
}
}
}
}
}
}
return $values;
}
示例3: select_milestone
/**
* Renders select milestone box
*
* @param string $name
* @param Project $project
* @param integer $selected ID of selected milestone
* @param array $attributes Array of additional attributes
* @return string
* @throws InvalidInstanceError
*/
function select_milestone($name, $context = null, $selected = null, $attributes = null) {
if(is_array($attributes)) {
if(!isset($attributes['class'])) $attributes['class'] = 'select_milestone';
} else {
$attributes = array('class' => 'select_milestone');
}
$options = array(option_tag(lang('none'), 0));
$milestones = ProjectMilestones::getActiveMilestonesByUser(logged_user(), $context);
if(is_array($milestones)) {
foreach($milestones as $milestone) {
$option_attributes = $milestone->getId() == $selected ? array('selected' => 'selected') : null;
$options[] = option_tag($milestone->getObjectName(), $milestone->getId(), $option_attributes);
}
}
return select_box($name, $options, $attributes);
} // select_milestone
示例4: get_ext_values
private function get_ext_values($field, $manager = null)
{
$values = array(array('id' => '', 'name' => '-- ' . lang('select') . ' --'));
if ($field == 'contact_id' || $field == 'created_by_id' || $field == 'updated_by_id' || $field == 'assigned_to_contact_id' || $field == 'completed_by_id' || $field == 'approved_by_id') {
$users = Contacts::getAllUsers();
foreach ($users as $user) {
$values[] = array('id' => $user->getId(), 'name' => $user->getObjectName());
}
} else {
if ($field == 'milestone_id') {
$milestones = ProjectMilestones::getActiveMilestonesByUser(logged_user());
foreach ($milestones as $milestone) {
$values[] = array('id' => $milestone->getId(), 'name' => $milestone->getObjectName());
}
/*} else if($field == 'object_subtype'){
$object_types = ProjectCoTypes::findAll(array('conditions' => (!is_null($manager) ? "`object_manager`='$manager'" : "")));
foreach($object_types as $object_type){
$values[] = array('id' => $object_type->getId(), 'name' => $object_type->getName());
}*/
}
}
return $values;
}
示例5: select_milestone
/**
* Renders select milestone box
*
* @param string $name
* @param Project $project
* @param integer $selected ID of selected milestone
* @param array $attributes Array of additional attributes
* @return string
* @throws InvalidInstanceError
*/
function select_milestone($name, $context = null, $selected = null, $attributes = null)
{
if (!isset($attributes['template_milestone'])) {
$milestones = ProjectMilestones::getActiveMilestonesByUser(logged_user(), $context);
} else {
//add conditions
if (isset($attributes['template_id']) && $attributes['template_id'] != 0) {
$tmp_id = $attributes['template_id'];
$conditions = '(`session_id` = 0 AND `template_id` = ' . $tmp_id . ' OR `session_id` = ' . logged_user()->getId() . ')';
} else {
$conditions = '`session_id` = ' . logged_user()->getId();
}
$milestones = TemplateMilestones::findAll(array('conditions' => $conditions));
}
if (is_array($attributes)) {
if (!isset($attributes['class'])) {
$attributes['class'] = 'select_milestone';
}
} else {
$attributes = array('class' => 'select_milestone');
}
$options = array(option_tag(lang('none'), 0));
if (is_array($milestones)) {
foreach ($milestones as $milestone) {
$option_attributes = $milestone->getId() == $selected ? array('selected' => 'selected') : null;
$options[] = option_tag($milestone->getObjectName(), $milestone->getId(), $option_attributes);
}
}
return select_box($name, $options, $attributes);
}
示例6: select_milestone
/**
* Renders select milestone box
*
* @param string $name
* @param Project $project
* @param integer $selected ID of selected milestone
* @param array $attributes Array of additional attributes
* @return string
* @throws InvalidInstanceError
*/
function select_milestone($name, $project = null, $selected = null, $attributes = null)
{
if (is_array($attributes)) {
if (!isset($attributes['class'])) {
$attributes['class'] = 'select_milestone';
}
} else {
$attributes = array('class' => 'select_milestone');
}
// if
$options = array(option_tag(lang('none'), 0));
if ($project) {
$milestones = $project->getOpenMilestones();
} else {
$milestones = ProjectMilestones::getActiveMilestonesByUser(logged_user());
}
if (is_array($milestones)) {
if ($selected) {
//Fixes bug: If task is in a subworkspace of it's milestone's workspace, and user is standing on it, the assigned milestone is set to none when task is edited.
$is_in_array = false;
foreach ($milestones as $milestone) {
if ($milestone->getId() == $selected) {
$is_in_array = true;
}
}
if (!$is_in_array) {
$milestone = ProjectMilestones::findById($selected);
if ($milestone) {
$milestones[] = $milestone;
}
}
}
foreach ($milestones as $milestone) {
$option_attributes = $milestone->getId() == $selected ? array('selected' => 'selected') : null;
$options[] = option_tag($milestone->getName(), $milestone->getId(), $option_attributes);
}
// foreach
}
// if
return select_box($name, $options, $attributes);
}