本文整理汇总了PHP中Project::getVisibleById方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::getVisibleById方法的具体用法?PHP Project::getVisibleById怎么用?PHP Project::getVisibleById使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Project
的用法示例。
在下文中一共展示了Project::getVisibleById方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: projViewFiles
function projViewFiles()
{
global $PH;
global $auth;
require_once confGet('DIR_STREBER') . "render/render_wiki.inc.php";
### get current project ###
$id = getOnePassedId('prj', 'projects_*');
$project = Project::getVisibleById($id);
if (!$project || !$project->id) {
$PH->abortWarning(__("invalid project-id"));
return;
}
### define from-handle ###
$PH->defineFromHandle(array('prj' => $project->id));
## is viewed by user ##
$project->nowViewedByUser();
## next milestone ##
$next = $project->getNextMilestone();
$page = new Page();
$page->crumbs = build_project_crumbs($project);
$page->options = build_projView_options($project);
$page->cur_tab = 'projects';
$page->title = $project->name;
$page->title_minor = __("Downloads");
if ($project->status == STATUS_TEMPLATE) {
$page->type = __("Project Template");
} else {
if ($project->status >= STATUS_COMPLETED) {
$page->type = __("Inactive Project");
} else {
$page->type = __("Project", "Page Type");
}
}
### render title ###
echo new PageHeader();
echo new PageContentOpen();
measure_stop('init2');
measure_start('info');
$block = new PageBlock(array('id' => 'support'));
$block->render_blockStart();
echo "<div class=text>";
if ($task = Task::getVisibleById(3645)) {
echo wikifieldAsHtml($task, 'description');
}
echo "</div>";
$block->render_blockEnd();
echo new PageContentClose();
echo new PageHtmlEnd();
}
示例2: initRecipientProjects
private function initRecipientProjects()
{
### recently assigned to projects ###
$this->projects = array();
# keep for later reference
$this->projects_new = array();
foreach ($this->recipient->getProjectPeople() as $pp) {
if ($project = Project::getVisibleById($pp->project)) {
if ($project->state) {
$this->projects[] = $project;
if (strToGMTime($pp->created) > strToGMTime($this->recipient->notification_last)) {
$this->projects_new[] = $project;
}
}
}
}
}
示例3: newEffortFromTimeTracking
function newEffortFromTimeTracking()
{
global $PH;
global $auth;
require_once confGet('DIR_STREBER') . 'db/class_effort.inc.php';
$time_end = intval(get('effort_end_seconds'));
if ($time_end == 0) {
$time_end = null;
}
$new_effort = new Effort(array('id' => 0, 'time_start' => getGMTString(get('effort_start_seconds')), 'time_end' => getGMTString($time_end), 'name' => get('description'), 'billing' => get('billing'), 'productivity' => get('productivity')));
### get project ###
$new_effort->project = get('effort_project_id');
if (!($project = Project::getVisibleById($new_effort->project))) {
$PH->abortWarning(__("Could not get project of effort"));
}
if (!$project->isPersonVisibleTeamMember($auth->cur_user)) {
$PH->abortWarning("ERROR: Insufficient rights");
}
### link to task ###
$task_id = get('effort_task_id');
if (!(is_null($task_id) || $task_id == 0)) {
if ($task_id == 0) {
$new_effort->task = 0;
} else {
if ($task = Task::getVisibleById($task_id)) {
$new_effort->task = $task->id;
}
}
} else {
if (get('task_name') != "") {
### create new task
$newtask = new Task(array('id' => 0, 'name' => get('task_name'), 'project' => $project->id));
$newtask->insert();
$new_effort->task = $newtask->id;
}
}
### get person ###
$new_effort->person = $auth->cur_user->id;
### go back to from if validation fails ###
$failure = false;
if (strToGMTime($new_effort->time_end) - strToGMTime($new_effort->time_start) < 0) {
$failure = true;
new FeedbackWarning(__("Cannot start before end."));
}
### write to db ###
$new_effort->insert();
### display taskView ####
if (!$PH->showFromPage()) {
$PH->show('projView', array('prj' => $effort->project));
}
}
示例4: ajaxListProjectFolders
/**
* Returns a list of folders for the given project.
* This is used for picking the destination folder for moving tasks across
* projects.
*/
function ajaxListProjectFolders()
{
global $PH;
global $auth;
require_once confGet('DIR_STREBER') . 'std/class_changeline.inc.php';
require_once confGet('DIR_STREBER') . 'lists/list_recentchanges.inc.php';
require_once confGet('DIR_STREBER') . 'render/render_block.inc.php';
require_once confGet('DIR_STREBER') . 'lists/list_taskfolders.inc.php';
require_once confGet('DIR_STREBER') . 'lists/list_comments.inc.php';
require_once confGet('DIR_STREBER') . 'lists/list_tasks.inc.php';
header("Content-type: text/html; charset=utf-8");
### get project ####
$project_id = getOnePassedId('prj');
if (!($project = Project::getVisibleById($project_id))) {
echo __("requested invalid project");
exit;
//$PH->abortWarning("task without project?", ERROR_BUG);
}
$list = new ListBlock_tasks();
$list->query_options['show_folders'] = true;
$list->query_options['folders_only'] = true;
$list->query_options['project'] = $project->id;
$list->groupings = NULL;
$list->block_functions = NULL;
$list->id = 'folders';
unset($list->columns['status']);
unset($list->columns['date_start']);
unset($list->columns['days_left']);
unset($list->columns['created_by']);
unset($list->columns['label']);
unset($list->columns['project']);
$list->functions = array();
$list->active_block_function = 'tree';
$list->print_automatic($project, NULL);
echo __("(or select nothing to move to project root)") . "<br> ";
echo "<input type=hidden name='project' value='{$project->id}'>";
}
示例5: getEditableById
/**
* query if editable for current user
*/
static function getEditableById($id)
{
$id = intval($id);
global $auth;
if ($auth->cur_user->user_rights & RIGHT_PROJECT_EDIT) {
return Project::getVisibleById($id, NULL, false);
}
return NULL;
}
示例6: getLatestComment
function getLatestComment($args = array())
{
if ($project = Project::getVisibleById($this->project)) {
$args['on_task'] = $this->id;
$args['order_by'] = 'created ASC';
#$args['limit']= 1;
$comments = $project->getComments($args);
if ($comments) {
return $comments[0];
}
return NULL;
}
}
示例7: renderListCsv
function renderListCsv($list = NULL)
{
if (!count($list)) {
return;
}
## header ##
$ids = array();
$count = 0;
foreach ($list[0]->fields as $field_name => $field) {
if ($field->export) {
switch ($field->type) {
case 'FieldString':
case 'FieldInt':
case 'FieldDatetime':
case 'FieldText':
$ids[] = $field_name;
$count++;
break;
case 'FieldInternal':
if ($field_name == 'task') {
$ids[] = 'task_id';
$ids[] = 'task_name';
} else {
if ($field_name == 'person') {
$ids[] = 'person_id';
$ids[] = 'person_name';
} else {
if ($field_name == 'project') {
$ids[] = 'project_id';
$ids[] = 'project_name';
} else {
$ids[] = $field_name;
}
}
}
break;
default:
break;
}
}
}
## list ##
$values = array();
foreach ($list as $row) {
foreach ($list[0]->fields as $field_name => $field) {
if ($field->export) {
switch ($field->type) {
case 'FieldText':
case 'FieldString':
$values[] = $this->cleanForCSV($row->{$field_name});
break;
case 'FieldInternal':
if ($field_name == 'task') {
$values[] = $row->{$field_name};
if ($task = Task::getVisibleById($row->{$field_name})) {
$values[] = $this->cleanForCSV($task->name);
} else {
$values[] = '';
}
} else {
if ($field_name == 'person') {
$values[] = $row->{$field_name};
if ($person = Person::getVisibleById($row->{$field_name})) {
$values[] = $this->cleanForCSV($person->name);
} else {
$values[] = '-';
}
} else {
if ($field_name == 'project') {
$values[] = $row->{$field_name};
if ($project = Project::getVisibleById($row->{$field_name})) {
$values[] = $this->cleanForCSV($project->name);
} else {
$values[] = '';
}
} else {
$values[] = $row->{$field_name};
}
}
}
break;
case 'FieldInt':
case 'FieldDatetime':
#$values[] = addslashes($row->$field_name,"\0..\37");
$values[] = $row->{$field_name};
break;
default:
break;
}
}
}
}
## export function ##
exportToCSV($ids, $values);
}
示例8: render_tr
function render_tr(&$obj, $style = "")
{
if (!isset($obj) || !$obj instanceof Effort) {
trigger_error("ListBlock->render_tr() called without valid object", E_USER_WARNING);
return;
}
$sum = 0.0;
$sum_sal = 0.0;
$sum_all = 0.0;
$diff_value = false;
if ($obj->as_duration) {
echo "<td>-</td>";
} else {
if ($effort_people = Effort::getEffortPeople(array('project' => $obj->project, 'task' => $obj->task))) {
foreach ($effort_people as $ep) {
if ($person = Person::getVisibleById($ep->person)) {
/*if($obj->getStatus()){
$sum_sal = Effort::getSumEfforts(array('project'=>$obj->project, 'task'=>$obj->task, 'person'=>$person->id, 'status'=>$obj->status));
}
else{*/
$sum_sal = Effort::getSumEfforts(array('project' => $obj->project, 'task' => $obj->task, 'person' => $person->id));
#}
if ($sum_sal) {
$sum = round($sum_sal / 60 / 60, 1) * 1.0;
if ($project = Project::getVisibleById($obj->project)) {
if ($pp = $project->getProjectPeople(array('person_id' => $person->id))) {
if ($pp[0]->salary_per_hour) {
$sum_all = $sum * $pp[0]->salary_per_hour;
} else {
$sum_all = $sum * $person->salary_per_hour;
}
} else {
$sum_all = $sum * $person->salary_per_hour;
}
}
//$sum_all += ($sum * $person->salary_per_hour);
}
}
}
}
if ($task = Task::getVisibleById($obj->task)) {
if ($sum_all && $task->calculation) {
$max_length_value = 3;
$get_percentage = $sum_all / $task->calculation * 100;
if ($get_percentage > 100) {
$diff = $get_percentage - 100;
$get_percentage = 100;
$diff_value = true;
}
$show_rate = $get_percentage * $max_length_value;
echo "<td>";
echo "<nobr>";
echo "<img src='" . getThemeFile("img/pixel.gif") . "' style='width:{$show_rate}px;height:12px;background-color:#f00;'>";
if ($diff_value) {
$show_rate = $diff * $max_length_value;
echo "<img src='" . getThemeFile("img/pixel.gif") . "' style='width:{$show_rate}px;height:12px;background-color:#ff9900;'>";
echo " " . round($get_percentage, 1) . "% / " . round($diff, 1) . " %";
} else {
echo " " . round($get_percentage, 1) . "%";
}
echo "</nobr>";
echo "</td>";
} else {
echo "<td>-</td>";
}
} else {
echo "<td>-</td>";
}
}
}
示例9: getObjectById
/**
* returns visible object of correct type by an itemId
*
* this is useful, eg. if you when to access common parameters like name,
* regardless of the object's type.
*
* DbProjectItem::getById() would only load to basic fields. Getting the
* complete date required check for type.
*
* @NOTE: This function causes a awkward dependency to classes derived from
* DbProjectItem. It's somehow weird, that this method is placed inside the
* parent class.
*/
public static function getObjectById($id)
{
$id = intval($id);
if (!($item = DbProjectItem::getById($id))) {
return NULL;
}
if ($type = $item->type) {
switch ($type) {
case ITEM_TASK:
require_once "db/class_task.inc.php";
$item_full = Task::getVisibleById($item->id);
break;
case ITEM_COMMENT:
require_once "db/class_comment.inc.php";
$item_full = Comment::getVisibleById($item->id);
break;
case ITEM_PERSON:
require_once "db/class_person.inc.php";
$item_full = Person::getVisibleById($item->id);
break;
case ITEM_EFFORT:
require_once "db/class_effort.inc.php";
$item_full = Effort::getVisibleById($item->id);
break;
case ITEM_FILE:
require_once "db/class_file.inc.php";
$item_full = File::getVisibleById($item->id);
break;
case ITEM_PROJECT:
require_once "db/class_project.inc.php";
$item_full = Project::getVisibleById($item->id);
break;
case ITEM_COMPANY:
require_once "db/class_company.inc.php";
$item_full = Company::getVisibleById($item->id);
break;
case ITEM_VERSION:
require_once "db/class_task.inc.php";
$item_full = Task::getVisibleById($item->id);
break;
default:
$item_full = NULL;
}
return $item_full;
}
}
示例10: render_tr
function render_tr(&$task, $style = "nowrap")
{
global $PH;
if (!isset($task) || !$task instanceof Task) {
return;
}
### task with zero-id is project-root ###
if (!$task->id) {
$link = $PH->getLink('projView', "...project...", array('prj' => $task->project));
echo '<td><b>' . $link . "</b></td>";
} else {
$name = $task->name;
if (!$name) {
$name = __("- no name -", "in task lists");
}
$html_details = '';
if ($this->parent_block->show_project_folder && ($project = Project::getVisibleById($task->project))) {
if ($tmp = $task->getFolderLinks(true, $project)) {
$html_details .= __('in', 'very short for IN folder...') . ' ' . $tmp;
}
} else {
if ($tmp = $task->getFolderLinks()) {
$html_details .= __('in', 'very short for IN folder...') . ' ' . $tmp;
}
}
$isDone = $task->status >= STATUS_COMPLETED ? 'isDone' : '';
$link = $PH->getLink('taskView', $name, array('tsk' => $task->id));
#echo "<td class=taskwithfolder><span class='name $isDone'>{$link}</span><br><span class=sub>$html_details</span></td>";
echo "<td class=taskwithfolder><span class='{$isDone}'>{$link}</span><br><span class=sub>{$html_details}</span></td>";
}
measure_stop('col_taskname');
}
示例11: initPageForEffort
/**
* Initialize a page for displaying effort related content
*
* - inits:
* - breadcrumps
* - options
* - current section
* - navigation
* - pageType (including task folders)
* - pageTitle (as Task title)
*/
function initPageForEffort($page, $effort, $project = NULL)
{
global $PH;
$crumbs = array();
if (!$project) {
$project = Project::getVisibleById($effort->project);
}
$task = Task::getVisibleById($effort->task);
$page->cur_crumb = 'projViewEfforts';
$page->crumbs = build_project_crumbs($project);
$page->options = build_projView_options($project);
$page->cur_tab = 'projects';
if ($effort->name) {
$page->title = $effort->name;
} else {
$page->title = __('Effort');
}
$page->title_minor_html = $PH->getLink('effortView', sprintf('#%d', $effort->id), array('effort' => $effort->id));
global $g_status_names;
$type = "";
if ($task) {
if ($folder = $task->getFolderLinks()) {
$type = $folder . " > ";
}
$type .= $task->getLink() . ' > ';
}
$type .= __('Effort');
$page->type = $type;
}
示例12: personRegisterSubmit
//.........这里部分代码省略.........
/**
* \todo actually this should be mb_strtolower, but this is not installed by default
*/
if ($person->nickname != strtolower($person->nickname)) {
new FeedbackMessage(__("Nickname has been converted to lowercase"));
$person->nickname = strtolower($person->nickname);
}
if ($p2 = Person::getByNickname($t_nickname)) {
# another person with this nick?
if ($p2->id != $person->id) {
new FeedbackWarning(__("Nickname has to be unique"));
$person->fields['nickname']->required = true;
$flag_ok = false;
}
}
}
### password entered? ###
$t_password1 = get('person_password1');
$t_password2 = get('person_password2');
$flag_password_ok = true;
if (($t_password1 || $t_password2) && $t_password1 != "__dont_change__") {
### check if password match ###
if ($t_password1 !== $t_password2) {
new FeedbackWarning(__("Passwords do not match"));
$person->fields['password']->required = true;
$flag_ok = false;
$flag_password_ok = false;
$person->cookie_string = $auth->cur_user->calcCookieString();
}
}
### check if password is good enough ###
$password_length = strlen($t_password1);
$password_count_numbers = strlen(preg_replace('/[\\d]/', '', $t_password1));
$password_count_special = strlen(preg_replace('/[\\w]/', '', $t_password1));
$password_value = -7 + $password_length + $password_count_numbers * 2 + $password_count_special * 4;
if ($password_value < confGet('CHECK_PASSWORD_LEVEL')) {
new FeedbackWarning(__("Password is too weak (please add numbers, special chars or length)"));
$flag_ok = false;
$flag_password_ok = false;
}
if ($flag_password_ok) {
$person->password = md5($t_password1);
}
if (!validateFormCaptcha()) {
new FeedbackWarning(__("Please copy the text from the image."));
$flag_ok = false;
}
### repeat form if invalid data ###
if (!$flag_ok) {
$PH->show('personRegister', NULL, $person);
exit;
}
/**
* store indentifier-string for login from notification & reminder - mails
*/
$person->identifier = $person->calcIdentifierString();
### insert new object ###
if ($person->settings & USER_SETTING_NOTIFICATIONS && $person->can_login) {
$person->settings |= USER_SETTING_SEND_ACTIVATION;
new FeedbackHint(sprintf(__("A notification / activation will be mailed to <b>%s</b> when you log out."), $person->name) . " " . sprintf(__("Read more about %s."), $PH->getWikiLink('notifications')));
}
$person->notification_last = getGMTString(time() - $person->notification_period * 60 * 60 * 24 - 1);
$person->cookie_string = $person->calcCookieString();
if ($person->insert()) {
new FeedbackHint(__("Thank you for registration! After your request has been approved by a moderator, you will can an email."));
### link to a company ###
if ($c_id = get('company')) {
require_once confGet('DIR_STREBER') . 'db/class_company.inc.php';
if ($c = Company::getVisibleById($c_id)) {
require_once confGet('DIR_STREBER') . 'db/class_employment.inc.php';
$e = new Employment(array('id' => 0, 'person' => $person->id, 'company' => $c->id));
$e->insert();
}
}
## assigne to project ##
require_once confGet('DIR_STREBER') . 'db/class_projectperson.inc.php';
$prj_num = confGet('REGISTER_NEW_USERS_TO_PROJECT');
global $g_user_profile_names;
if (isset($prj_num)) {
if ($prj_num != -1) {
if ($p = Project::getVisibleById($prj_num)) {
$prj_person = new ProjectPerson(array('person' => $person->id, 'project' => $p->id, 'name' => $g_user_profile_names[$person->profile]));
$prj_person->insert();
}
}
}
new FeedbackMessage(sprintf(__('Person %s created'), $person->getLink()));
### automatically login ###
$foo = array('login_name' => $person->nickname, 'login_password_md5' => $person->password);
addRequestVars($foo);
$PH->show('loginFormSubmit', array());
exit;
} else {
new FeedbackError(__("Could not insert object"));
}
### display fromPage ####
if (!$PH->showFromPage()) {
$PH->show('home', array());
}
}
示例13: itemBookmarkEditMultiple
/**
* edit several bookmarks @ingroup pages
*/
function itemBookmarkEditMultiple($thebookmarks = NULL)
{
global $PH;
global $auth;
global $g_notitychange_period;
$is_already_bookmark = array();
$bookmarks = array();
$items = array();
$edit_fields = array('notify_if_unchanged', 'notify_on_change');
$different_fields = array();
# hash containing fieldnames which are different in bookmarks
if (!$thebookmarks) {
$item_ids = getPassedIds('bookmark', 'bookmarks_*');
foreach ($item_ids as $is) {
if ($bookmark = ItemPerson::getAll(array('item' => $is, 'person' => $auth->cur_user->id))) {
if ($item = DbProjectItem::getById($bookmark[0]->item)) {
$bookmarks[] = $bookmark[0];
$items[] = $item;
$is_already_bookmark[$bookmark[0]->id] = true;
}
}
}
} else {
$item_ids = $thebookmarks;
foreach ($item_ids as $is) {
if ($bookmark = ItemPerson::getAll(array('item' => $is, 'person' => $auth->cur_user->id, 'is_bookmark' => 0))) {
if ($item = DbProjectItem::getById($bookmark[0]->item)) {
$bookmarks[] = $bookmark[0];
$items[] = $item;
$is_already_bookmark[$bookmark[0]->id] = false;
}
} elseif ($bookmark = ItemPerson::getAll(array('item' => $is, 'person' => $auth->cur_user->id, 'is_bookmark' => 1))) {
if ($item = DbProjectItem::getById($bookmark[0]->item)) {
$bookmarks[] = $bookmark[0];
$items[] = $item;
$is_already_bookmark[$bookmark[0]->id] = true;
}
} else {
$date = getGMTString();
$bookmark = new ItemPerson(array('id' => 0, 'item' => $is, 'person' => $auth->cur_user->id, 'is_bookmark' => 1, 'notify_if_unchanged' => 0, 'notify_on_change' => 0, 'created' => $date));
if ($item = DbProjectItem::getById($is)) {
$bookmarks[] = $bookmark;
$items[] = $item;
$is_already_bookmark[$bookmark->id] = false;
}
}
}
}
if (!$items) {
$PH->abortWarning(__("Please select some items"));
}
$page = new Page();
$page->cur_tab = 'home';
$page->options = array(new NaviOption(array('target_id' => 'itemBookmarkEdit', 'name' => __('Edit bookmarks'))));
$page->type = __('Edit multiple bookmarks', 'page title');
$page->title = sprintf(__('Edit %s bookmark(s)'), count($items));
$page->title_minor = __('Edit');
echo new PageHeader();
echo new PageContentOpen();
echo "<ol>";
foreach ($items as $item) {
## get item name ##
$str_link = '';
if ($type = $item->type) {
switch ($type) {
case ITEM_TASK:
require_once "db/class_task.inc.php";
if ($task = Task::getVisibleById($item->id)) {
$str_link = $task->getLink(false);
}
break;
case ITEM_COMMENT:
require_once "db/class_comment.inc.php";
if ($comment = Comment::getVisibleById($item->id)) {
$str_link = $comment->getLink(false);
}
break;
case ITEM_PERSON:
require_once "db/class_person.inc.php";
if ($person = Person::getVisibleById($item->id)) {
$str_link = $person->getLink(false);
}
break;
case ITEM_EFFORT:
require_once "db/class_effort.inc.php";
if ($e = Effort::getVisibleById($item->id)) {
$str_link = $e->getLink(false);
}
break;
case ITEM_FILE:
require_once "db/class_file.inc.php";
if ($f = File::getVisibleById($item->id)) {
$str_link = $f->getLink(false);
}
break;
case ITEM_PROJECT:
require_once "db/class_project.inc.php";
//.........这里部分代码省略.........
示例14: itemViewDiff
/**
* renders a comparision between two versions of an item @ingroup pages
*/
function itemViewDiff()
{
global $PH;
global $auth;
require_once confGet('DIR_STREBER') . 'render/render_wiki.inc.php';
### get task ####
$item_id = get('item');
if (!($item = DbProjectItem::getObjectById($item_id))) {
$PH->abortWarning("invalid item-id", ERROR_FATAL);
}
if (!($project = Project::getVisibleById($item->project))) {
$PH->abortWarning("this item has an invalid project id", ERROR_DATASTRUCTURE);
}
require_once confGet('DIR_STREBER') . "db/db_itemchange.inc.php";
$versions = ItemVersion::getFromItem($item);
$date1 = get('date1');
$date2 = get('date2');
if (!$date1) {
#if(count($versions) > 1) {
# if($auth->cur_user->last_logout < $versions[count($versions)-2]->date_to)
# {
# $date1 = $auth->cur_user->last_logout;
# }
# else {
# $date1 = $versions[count($versions)-2]->date_from;
# }
#}
#else {
foreach (array_reverse($versions) as $v) {
if ($v->author == $auth->cur_user->id) {
$date1 = $v->date_from;
break;
}
}
#}
}
if (!$date2) {
$date2 = getGMTString();
}
$page = new Page();
$page->cur_tab = 'projects';
$page->crumbs = build_project_crumbs($project);
$page->options = build_projView_options($project);
$page->title = $item->name;
$page->title_minor = __('changes');
$page->add_function(new PageFunction(array('target' => 'itemView', 'params' => array('item' => $item->id), 'icon' => 'edit', 'name' => __('View item'))));
### render title ###
echo new PageHeader();
echo new PageContentOpen();
if ($date1 > $date2) {
new FeedbackMessage(__("date1 should be smaller than date2. Swapped"));
$t = $date1;
$date1 = $date2;
$date2 = $t;
}
if (count($versions) == 1) {
echo __("item has not been edited history");
} else {
$old_version = NULL;
$version_right = NULL;
$version_left = $versions[0];
foreach ($versions as $v) {
if ($v->date_from <= $date1) {
$version_left = $v;
}
if ($v->date_from >= $date2) {
if (isset($version_right)) {
if ($version_right->date_from > $v->date_from) {
$version_right = $v;
}
} else {
$version_right = $v;
}
}
}
if (!isset($version_right)) {
$version_right = $versions[count($versions) - 1];
}
$options_left = array();
$options_right = array();
### list versions left ###
for ($i = 0; $i < count($versions) - 1; $i++) {
$v = $versions[$i];
if ($person = Person::getVisibleById($v->author)) {
$author = $person->name;
} else {
$author = __('unknown');
}
if ($v->version_number == $version_left->version_number) {
$str_link = $PH->getUrl('itemViewDiff', array('item' => $item->id, 'date1' => $versions[$i]->date_from, 'date2' => $versions[$i]->date_to));
$name = ' v.' . $v->version_number . ' -- ' . $author . " -- " . $v->date_from;
$options_left[] = "<option selected=1 value='" . $str_link . "'>" . $name . "</option>";
} else {
if ($v->version_number > $version_left->version_number) {
if ($v->version_number < $version_right->version_number) {
$str_link = $PH->getUrl('itemViewDiff', array('item' => $item->id, 'date1' => $versions[$i]->date_from, 'date2' => $versions[$i]->date_to));
$name = '> v.' . $v->version_number . ' -- ' . $author . " -- " . renderDate($v->date_from);
//.........这里部分代码省略.........
示例15: projViewAsRSS
/**
* Show an RSS Feed of the latest changes on a project @ingroup pages
*/
function projViewAsRSS()
{
require_once confGet('DIR_STREBER') . "std/class_rss.inc.php";
global $PH;
global $auth;
$project_id = getOnePassedId('prj', 'projects_*');
# aborts on failure
if (!($project = Project::getVisibleById($project_id))) {
echo "Project is not readable. Anonymous user active?";
exit;
}
### used cached? ###
$filepath = "_rss/proj_{$project->id}.xml";
if (file_exists($filepath) || getGMTString(filemtime($filepath)) . "<" . $project->modified) {
RSS::updateRSS($project);
}
readfile_chunked($filepath);
exit;
}