Esempio n. 1
0
 function render_tr(&$item, $style = "")
 {
     global $PH;
     $str_date = '';
     $str_name = '';
     $str_url = '';
     if ($i = DbProjectItem::getById($item->id)) {
         if ($i->modified) {
             $mod_date = $i->modified;
             $str_date = renderDateHtml($mod_date);
             if ($i->modified_by) {
                 if ($person = Person::getVisibleById($i->modified_by)) {
                     $str_name = asHtml($person->name);
                     $str_url = $person->getLink();
                 }
             }
             print '<td><span class=date>' . $str_date . '</span><br><span class="sub who">' . __('by') . ' ' . $str_url . '</span></td>';
         } else {
             print "<td class='nowrap'>&nbsp;</td>";
         }
     } else {
         $PH->abortWarning("Could not get modification date of the element.", ERROR_BUG);
         print "<td class='nowrap'>&nbsp;</td>";
     }
 }
Esempio n. 2
0
/**
* Person View @ingroup pages
*/
function personView()
{
    global $PH;
    global $auth;
    ### get current person ###
    $id = getOnePassedId('person', 'people_*');
    if (!($person = Person::getVisibleById($id))) {
        $PH->abortWarning("invalid person-id");
        return;
    }
    ### create from handle ###
    $PH->defineFromHandle(array('person' => $person->id));
    ## is viewed by user ##
    $person->nowViewedByUser();
    $page = new Page();
    $page->cur_tab = 'people';
    if ($person->can_login) {
        $page->title = $person->nickname;
        $page->title_minor = $person->name;
    } else {
        $page->title = $person->name;
        if ($person->category) {
            global $g_pcategory_names;
            if (isset($g_pcategory_names[$person->category])) {
                $page->title_minor = $g_pcategory_names[$person->category];
            }
        }
    }
    $page->type = __("Person");
    $page->crumbs = build_person_crumbs($person);
    $page->options = build_person_options($person);
    ### skip edit functions ###
    if ($edit = Person::getEditableById($person->id)) {
        ### page functions ###
        $page->add_function(new PageFunction(array('target' => 'taskNoteOnPersonNew', 'params' => array('person' => $person->id), 'tooltip' => __('Add task for this people (optionally creating project and effort on the fly)', 'Tooltip for page function'), 'name' => __('Add note', 'Page function person'))));
        #$page->add_function(new PageFunction(array(
        #'target'    =>'personLinkCompanies',
        #'params'    =>array('person'=>$person->id),
        #'tooltip'   =>__('Add existing companies to this person'),
        #'name'      =>__('Companies'),
        #)));
        $page->add_function(new PageFunction(array('target' => 'personEdit', 'params' => array('person' => $person->id), 'icon' => 'edit', 'tooltip' => __('Edit this person', 'Tooltip for page function'), 'name' => __('Edit', 'Page function edit person'))));
        $page->add_function(new PageFunction(array('target' => 'personEditRights', 'params' => array('person' => $person->id), 'icon' => 'edit', 'tooltip' => __('Edit user rights', 'Tooltip for page function'), 'name' => __('Edit rights', 'Page function for edit user rights'))));
        if ($person->id != $auth->cur_user->id) {
            $page->add_function(new PageFunction(array('target' => 'personDelete', 'params' => array('person' => $person->id), 'name' => __('Delete'))));
        }
        $item = ItemPerson::getAll(array('person' => $auth->cur_user->id, 'item' => $person->id));
        if (!$item || $item[0]->is_bookmark == 0) {
            #$page->add_function(new PageFunction(array(
            #    'target'    =>'itemsAsBookmark',
            #    'params'    =>array('person'=>$person->id),
            #    'tooltip'   =>__('Mark this person as bookmark'),
            #    'name'      =>__('Bookmark'),
            #)));
        } else {
            $page->add_function(new PageFunction(array('target' => 'itemsRemoveBookmark', 'params' => array('person' => $person->id), 'tooltip' => __('Remove this bookmark'), 'name' => __('Remove Bookmark'))));
        }
        if ($person->state == ITEM_STATE_OK && $person->can_login && ($person->personal_email || $person->office_email)) {
            $page->add_function(new PageFunction(array('target' => 'personSendActivation', 'params' => array('person' => $person->id))));
            $page->add_function(new PageFunction(array('target' => 'peopleFlushNotifications', 'params' => array('person' => $person->id))));
        }
    }
    ### render title ###
    echo new PageHeader();
    echo new PageContentOpen_Columns();
    ### write info block (but only for registed users)
    global $auth;
    if ($auth->cur_user->id != confGet('ANONYMOUS_USER')) {
        $block = new PageBlock(array('title' => __('Summary', 'Block title'), 'id' => 'summary'));
        $block->render_blockStart();
        echo "<div class=text>";
        if ($person->mobile_phone) {
            echo "<div class=labeled><label>" . __('Mobile', 'Label mobilephone of person') . '</label>' . asHtml($person->mobile_phone) . '</div>';
        }
        if ($person->office_phone) {
            echo "<div class=labeled><label>" . __('Office', 'label for person') . '</label>' . asHtml($person->office_phone) . '</div>';
        }
        if ($person->personal_phone) {
            echo "<div class=labeled><label>" . __('Private', 'label for person') . '</label>' . asHtml($person->personal_phone) . '</div>';
        }
        if ($person->office_fax) {
            echo "<div class=labeled><label>" . __('Fax (office)', 'label for person') . '</label>' . asHtml($person->office_fax) . '</div>';
        }
        if ($person->office_homepage) {
            echo "<div class=labeled><label>" . __('Website', 'label for person') . '</label>' . url2linkExtern($person->office_homepage) . '</div>';
        }
        if ($person->personal_homepage) {
            echo "<div class=labeled><label>" . __('Personal', 'label for person') . '</label>' . url2linkExtern($person->personal_homepage) . '</div>';
        }
        if ($person->office_email) {
            echo "<div class=labeled><label>" . __('E-Mail', 'label for person office email') . '</label>' . url2linkMail($person->office_email) . '</div>';
        }
        if ($person->personal_email) {
            echo "<div class=labeled><label>" . __('E-Mail', 'label for person personal email') . '</label>' . url2linkMail($person->personal_email) . '</div>';
        }
        if ($person->personal_street) {
            echo "<div class=labeled><label>" . __('Adress Personal', 'Label') . '</label>' . asHtml($person->personal_street) . '</div>';
        }
        if ($person->personal_zipcode) {
            echo '<div class=labeled><label></label>' . asHtml($person->personal_zipcode) . '</div>';
        }
        if ($person->office_street) {
            echo "<div class=labeled><label>" . __('Adress Office', 'Label') . '</label>' . asHtml($person->office_street) . '</div>';
        }
        if ($person->office_zipcode) {
            echo "<div class=labeled><label></label>" . asHtml($person->office_zipcode) . '</div>';
        }
        if ($person->birthdate && $person->birthdate != "0000-00-00") {
            echo "<div class=labeled><label>" . __('Birthdate', 'Label') . "</label>" . renderDateHtml($person->birthdate) . "</div>";
        }
        if ($person->last_login) {
            echo "<div class=labeled><label>" . __('Last login', 'Label') . '</label>' . renderDateHtml($person->last_login) . '</div>';
        }
        ### functions ####
        echo "</div>";
        $block->render_blockEnd();
    }
    require_once confGet('DIR_STREBER') . 'lists/list_companies.inc.php';
    $companies = $person->getCompanies();
    $list = new ListBlock_companies();
    $list->title = __('works for', 'List title');
    unset($list->columns['short']);
    unset($list->columns['homepage']);
    unset($list->columns['people']);
    unset($list->functions['companyDelete']);
    #unset($list->functions['companyNew']);
    /**
     * \todo We should provide a list-function to link more
     * people to this company. But therefore we would need to
     * pass the company's id, which is not possible right now...
     */
    $list->add_function(new ListFunction(array('target' => $PH->getPage('personLinkCompanies')->id, 'name' => __('Link Companies'), 'id' => 'personLinkCompanies', 'icon' => 'add')));
    $list->add_function(new ListFunction(array('target' => $PH->getPage('personCompaniesDelete')->id, 'name' => __('Remove companies from person'), 'id' => 'personCompaniesDelete', 'icon' => 'sub', 'context_menu' => 'submit')));
    if ($auth->cur_user->user_rights & RIGHT_PERSON_EDIT) {
        $list->no_items_html = $PH->getLink('personLinkCompanies', __('link existing Company'), array('person' => $person->id)) . " " . __("or") . " " . $PH->getLink('companyNew', __('create new'), array('person' => $person->id));
    } else {
        $list->no_items_html = __("no companies related");
    }
    #$list->no_items_html=__("no company");
    $list->render_list($companies);
    echo new PageContentNextCol();
    #--- description ----------------------------------------------------------------
    if ($person->description != "") {
        $block = new PageBlock(array('title' => __('Person details'), 'id' => 'persondetails'));
        $block->render_blockStart();
        echo "<div class=text>";
        echo wikifieldAsHtml($person, 'description');
        echo "</div>";
        $block->render_blockEnd();
    }
    /**
     *  \Note: passing colum to person->getProject is not simple...
     *  the sql-querry currently just querry project-people, which do not contain anything usefull
     *  Possible solutions:
     *   - rewrite the querry-string
     *   - rewrite all order-keys to something like company.name
     */
    $order_by = get('sort_' . $PH->cur_page->id . "_projects");
    require_once confGet('DIR_STREBER') . 'lists/list_projects.inc.php';
    $projects = $person->getProjects($order_by);
    if ($projects || $person->can_login) {
        $list = new ListBlock_projects();
        $list->title = __('works in Projects', 'list title for person projects');
        $list->id = "works_in_projects";
        unset($list->columns['date_closed']);
        unset($list->columns['date_start']);
        unset($list->columns['tasks']);
        unset($list->columns['efforts']);
        unset($list->functions['projDelete']);
        unset($list->functions['projNew']);
        if ($auth->cur_user->user_rights & RIGHT_PROJECT_CREATE) {
            $list->no_items_html = $PH->getLink('projNew', '', array());
        } else {
            $list->no_items_html = __("no active projects");
        }
        $list->render_list($projects);
    }
    require_once confGet('DIR_STREBER') . 'lists/list_tasks.inc.php';
    $list = new ListBlock_tasks(array('active_block_function' => 'list'));
    $list->query_options['assigned_to_person'] = $person->id;
    unset($list->columns['created_by']);
    unset($list->columns['planned_start']);
    unset($list->columns['assigned_to']);
    $list->title = __('Assigned tasks');
    $list->no_items_html = __('No open tasks assigned');
    if (isset($list->block_functions['tree'])) {
        unset($list->block_functions['tree']);
        $list->block_functions['grouped']->default = true;
    }
    $list->print_automatic();
    ### add company-id ###
    # note: some pageFunctions like personNew can use this for automatical linking
    #
    echo "<input type='hidden' name='person' value='{$person->id}'>";
    #echo "<a href=\"javascript:document.my_form.go.value='tasksMoveToFolder';document.my_form.submit();\">move to task-folder</a>";
    echo new PageContentClose();
    echo new PageHtmlEnd();
}
Esempio n. 3
0
/**
* show system information @ingroup pages
*/
function systemInfo()
{
    global $PH;
    require_once confGet('DIR_STREBER') . 'render/render_list.inc.php';
    $system_info = getSysInfo();
    $page = new Page();
    $page->tabs['admin'] = array('target' => "index.php?go=systemInfo", 'title' => __('Admin', 'top navigation tab'), 'bg' => "misc");
    $page->cur_tab = 'admin';
    $page->crumbs[] = new NaviCrumb(array('target_id' => 'systemInfo'));
    $page->title = __("System information");
    $page->type = __("Admin");
    #$page->title_minor=get('go');
    echo new PageHeader();
    echo new PageContentOpen();
    $block = new PageBlock(array('title' => __('Overview'), 'id' => 'overview'));
    $block->render_blockStart();
    echo "<div class=text>";
    foreach ($system_info as $label => $value) {
        echo "<div class=labeled><label>{$label}:</label> <span>{$value}</span></div>";
    }
    echo "</div>";
    global $auth;
    echo "<br>";
    echo "<h2>Timezone detection</h2>";
    echo "<div class=text>";
    echo "<ul>";
    echo "<li> time-offset for user: "******"sec";
    echo "<li> renderDateHtml(): " . renderDateHtml($auth->cur_user->last_login) . "";
    echo "<li> original db-string (should be GMT): " . $auth->cur_user->last_login;
    echo "<li> strToClienttime(): " . strToClientTime($auth->cur_user->last_login);
    echo "<li> gmdate:(strToClientTime) " . gmdate("H:i:s", strToClientTime($auth->cur_user->last_login));
    echo "<li> strToTime(): " . strToTime($auth->cur_user->last_login);
    echo "<li> date(strToTime): " . date("H:i:s", strToTime($auth->cur_user->last_login));
    echo "</ul>";
    echo "</div>";
    $block->render_blockEnd();
    echo new PageContentClose();
    echo new PageHtmlEnd();
}
Esempio n. 4
0
 function render_tr(&$obj, $style = "")
 {
     global $PH;
     global $auth;
     global $COMMENTTYPE_NAMES;
     if (!isset($obj) || !$obj instanceof Comment) {
         trigger_error("ListBlock->render_tr() called without valid object", E_USER_WARNING);
         return;
     }
     $style_cur_user = '';
     if ($obj->created_by != 0 && ($person = Person::getById($obj->created_by))) {
         if ($obj->created_by == $auth->cur_user->id) {
             $style_cur_user = '******';
         }
     }
     $column_poster = '<td class="details ' . $style_cur_user . '">';
     if ($obj->created_by != 0 && ($person = Person::getById($obj->created_by))) {
         $column_poster .= '<p class="poster">' . $person->getLink() . '</p>';
     }
     if (!$obj->view_collapsed) {
         ### time ###
         $p_time = renderDateHtml($obj->time);
         $column_poster .= "<span class=date>{$p_time}</span>";
         ### pub level if not open ###
         if ($obj->pub_level != PUB_LEVEL_OPEN) {
             global $g_pub_level_names;
             $column_poster .= "<br>(" . $g_pub_level_names[$obj->pub_level] . ')<br>';
         }
         require_once confGet('DIR_STREBER') . "db/db_itemchange.inc.php";
         $versions = ItemVersion::getFromItem($obj);
         if (count($versions) > 1) {
             $column_poster .= "<br>" . $PH->getLink('itemViewDiff', sprintf(__("version %s"), count($versions)), array('item' => $obj->id));
         }
         $column_poster .= "<div class=edit_functions>";
         # if current user is the creator of the comment
         if ($obj->created_by == $auth->cur_user->id) {
             if ($obj->isEditable()) {
                 $column_poster .= $PH->getLink('commentEdit', __('Edit'), array('comment' => $obj->id));
                 $column_poster .= $PH->getLink('commentsDelete', __('Delete'), array('comment' => $obj->id));
             }
         } else {
             ### check sufficient rights ###
             if ($parent_task = Task::getEditableById($obj->task)) {
                 # have to send the task-id otherwise the reply function doesn't work
                 $column_poster .= $PH->getLink('commentNew', __('Reply'), array('comment' => $obj->id, 'parent_task' => $obj->task));
                 if ($obj->pub_level != PUB_LEVEL_OPEN) {
                     $column_poster .= $PH->getLink('itemsSetPubLevel', __('Publish'), array('item' => $obj->id, 'item_pub_level' => PUB_LEVEL_OPEN));
                 }
             }
         }
         $column_poster .= "</div>";
     }
     $column_poster .= "</td>";
     print $column_poster;
 }
Esempio n. 5
0
 function render_tr(&$task, $style = "")
 {
     global $PH;
     if (!isset($task) || !is_object($task)) {
         trigger_error("ListBlock->render_tr() called without valid object", E_USER_WARNING);
         return;
     }
     $buffer = renderDateHtml($task->time_released);
     #if($html_due && $task->status < STATUS_CLOSED) {
     #    $buffer.= '<br><span class=sub>('. $html_due .')</span>';
     #}
     #if($this->parent_block->sum_estimated_max) {
     #    $buffer.= '<br><span class=sub>'
     #           .  sprintf(__('%s required'), renderEstimatedDuration(($this->parent_block->sum_estimated_max + $this->parent_block->sum_estimated_min) /2))
     #           .  '</span>';
     #}
     echo '<td class=nowrap>' . $buffer . '</td>';
 }
 function render_tr(&$r, $style = "")
 {
     if ($r instanceof SearchResult) {
         if (isset($r->item)) {
             if ($r->item->modified_by) {
                 if ($person = Person::getVisibleById($r->item->modified_by)) {
                     print '<td><span class=date>' . renderDateHtml($r->item->modified) . '</span><br><span class="sub who">' . __('by') . ' ' . $person->getLink() . '</span></td>';
                     return;
                 }
             } else {
                 print '<td><span class=date>' . renderDateHtml($r->item->modified) . '</span></td>';
             }
         }
         print "<td></td>";
     } else {
         trigger_error('ListBlockCol_ChangesDate() requires instance of SearchResult', E_USER_WARNING);
         print "<td></td>";
     }
 }
Esempio n. 7
0
 function render_tr(&$task, $style = "")
 {
     global $PH;
     if (!isset($task) || !is_object($task)) {
         trigger_error("ListBlock->render_tr() called without valid object", E_USER_WARNING);
         return;
     }
     ### days left ###
     $due_str = $task->planned_end;
     $html_due = '';
     if ($due_str == "0000-00-00" || $due_str == "0000-00-00 00:00:00") {
         $html_due = '';
     } else {
         $due_days = floor((strToGMTime($task->planned_end) - time()) / 24 / 60 / 60) + 1;
         if ($due_days == 0) {
             $html_due = __("Due Today");
         } else {
             if ($due_days < 0) {
                 $class = 'overDue';
                 $html_due = '<span class=overdue>' . sprintf(__("%s days late"), -$due_days) . '</span>';
             } else {
                 $html_due = sprintf(__("%s days left"), $due_days);
             }
         }
     }
     $buffer = renderDateHtml($task->planned_end);
     if ($html_due && $task->status < STATUS_CLOSED) {
         $buffer .= '<br><span class=sub>(' . $html_due . ')</span>';
     }
     if ($this->parent_block->sum_estimated_max) {
         $buffer .= '<br><span class=sub>' . sprintf(__('%s required'), renderEstimatedDuration(($this->parent_block->sum_estimated_max + $this->parent_block->sum_estimated_min) / 2 - ($this->parent_block->sum_completion_max + $this->parent_block->sum_completion_min) / 2)) . '</span>';
     }
     echo '<td class=nowrap>' . $buffer . '</td>';
 }
Esempio n. 8
0
 /**
  * render completely (overwrites original ListBlock::render())
  */
 public function renderListHtml(&$tasks = NULL)
 {
     global $PH;
     require_once confGet('DIR_STREBER') . 'render/render_wiki.inc.php';
     $this->render_header();
     if ($this->groupings) {
         $this->groupings->getActiveFromCookie();
     }
     /**
      * for rendering undefined wiki-links we need to know the
      * project of each task. This is used for caching:
      */
     $last_project_id = 0;
     $project = NULL;
     /**
      * @@@ dummy rending of filters. Should later be placed at ListBlock()
      */
     /*if($this->filters) {
           echo '<span class=filters>Filters:';
           foreach($this->filters as $f) {
               echo '<span class=filter>'.$f->render().'</span> ';
           }
           echo '</span>';
       }
       */
     $style = '';
     if (!$tasks && $this->no_items_html) {
         $this->render_tfoot_empty();
     } else {
         ### render table lines ###
         $this->render_thead();
         $count_estimated = 0;
         $last_group = NULL;
         foreach ($tasks as $t) {
             ### grouped style ###
             if ($this->groupings && $this->active_block_function == 'grouped') {
                 $gr = $this->groupings->active_grouping_key;
                 if ($t->project != $last_project_id) {
                     $project = Project::getVisibleById($t->project);
                     $last_project_id = $t->project;
                 }
                 if ($gr == 'parent_task') {
                     if ($t->category == TCATEGORY_FOLDER) {
                         echo '<tr class=group><td colspan=' . count($this->columns) . '>';
                         #. $this->groupings->active_grouping_obj->render($t)
                         ### toggle ###
                         $description = '';
                         if ($t->view_collapsed) {
                             $toggle = $PH->getLink('taskToggleViewCollapsed', '<img src="' . getThemeFile("img/toggle_folder_closed.gif") . '">', array('tsk' => $t->id), 'folder_collapsed', true);
                             ### number of subtasks with folded ###
                             $description = '<span class=diz>( ' . sprintf(__('%s hidden'), $t->getNumSubtasks()) . ')</span>';
                         } else {
                             $toggle = $PH->getLink('taskToggleViewCollapsed', '<img src="' . getThemeFile("img/toggle_folder_open.gif") . '">', array('tsk' => $t->id), 'folder_open', true);
                         }
                         echo $toggle;
                         if ($parents = $t->getFolderLinks(false)) {
                             echo $parents . '<em>&gt;</em>';
                         }
                         echo $t->getLink();
                         echo $description;
                         echo '</td></tr>';
                         continue;
                     }
                 } else {
                     if ($last_group != $t->{$gr}) {
                         echo '<tr class=group><td colspan=' . count($this->columns) . '>' . $this->groupings->active_grouping_obj->render($t) . '</td></tr>';
                         $last_group = $t->{$gr};
                     }
                 }
             }
             $style = $t->category == TCATEGORY_FOLDER ? ' isFolder' : '';
             ### done ###
             if (@intval($t->status) >= STATUS_COMPLETED) {
                 $style .= ' isDone';
             } else {
                 $count_estimated += $t->estimated;
             }
             $this->render_trow($t, $style);
             ### render additional information ###
             if ($this->groupings && $this->active_block_function == 'grouped') {
                 echo '<tr class=details><td colspan=' . count($this->columns) . '>';
                 $html_buffer = '';
                 if ($t->issue_report) {
                     $ir = Issue::getById($t->issue_report);
                 } else {
                     $ir = NULL;
                 }
                 global $g_severity_names;
                 global $g_reproducibility_names;
                 global $g_prio_names;
                 global $g_status_names;
                 #if($t->prio != PRIO_NORMAL && isset($g_prio_names[$t->prio]))  {
                 #    echo "<p>".$g_prio_names[$t->prio]."</p>";
                 #}
                 if ($ir && $ir->severity && isset($g_severity_names[$ir->severity])) {
                     $html_buffer .= "<p>" . $g_severity_names[$ir->severity] . "</p>";
                 }
                 if ($ir && $ir->version) {
                     $html_buffer .= "<p>" . $ir->version . "</p>";
                 }
                 if ($ir && $ir->production_build) {
                     $html_buffer .= "<p>" . $ir->production_build . "</p>";
                 }
                 if ($ir && $ir->reproducibility && isset($g_reproducibility_names[$ir->reproducibility])) {
                     $html_buffer .= "<p>" . $g_reproducibility_names[$ir->reproducibility] . "</p>";
                 }
                 if ($t->status != STATUS_OPEN && $t->status != STATUS_NEW && isset($g_status_names[$t->status])) {
                     $html_buffer .= "<p>" . $g_status_names[$t->status] . "</p>";
                 }
                 echo '<div class=severity>';
                 if ($html_buffer) {
                     echo $html_buffer;
                 } else {
                     echo '&nbsp;';
                     # dummy content to keep floating
                 }
                 echo '</div>';
                 echo '<div class=description>&nbsp;';
                 if ($t->description) {
                     echo "<p>" . wikifieldAsHtml($t, 'description') . "</p>";
                 }
                 ### steps ###
                 if ($ir && isset($ir->steps_to_reproduce) && $ir->steps_to_reproduce) {
                     echo "<p>" . wikifieldAsHtml($ir, 'steps_to_reproduce') . "</p>";
                 }
                 if ($ir && isset($ir->expected_result) && $ir->expected_result) {
                     echo "<p>" . wikifieldAsHtml($ir, 'expected_result') . "</p>";
                 }
                 if ($ir && isset($ir->suggested_solution) && $ir->suggested_solution) {
                     echo "<p>" . wikifieldAsHtml($ir, 'suggested_solution') . "</p>";
                 }
                 echo '&nbsp;</div>';
                 echo '<div class=steps>';
                 if ($c = $t->getLatestComment()) {
                     echo "<p>" . __('Latest Comment') . " ";
                     if ($person = Person::getVisibleById($c->created_by)) {
                         echo __("by") . ' ' . $person->getLink();
                     }
                     echo " (" . renderDateHtml($c->modified) . "):";
                     echo "</p>";
                     if ($c->name) {
                         echo '<p>' . asHtml($c->name) . '</p>';
                     }
                     if ($c->description) {
                         #echo "<p>". wikifieldAsHtml($c->description, $project). "</p>";
                         echo "<p>" . wikifieldAsHtml($c, "description") . "</p>";
                     }
                 }
                 echo '&nbsp;</div>';
                 echo '<div class=assigned_to>';
                 $people = $t->getAssignedPeople();
                 if ($people) {
                     $sep = '';
                     echo "<p>" . __('for') . " ";
                     foreach ($people as $p) {
                         echo $sep . $p->getLink();
                         $sep = ', ';
                     }
                     echo "</p>";
                 }
                 echo '</div>';
                 echo '</td></tr>';
             }
         }
         #$this->render_trow($t);
         if ($this->show_summary) {
             $this->summary = sprintf(__("%s open tasks / %s h"), count($tasks), $count_estimated);
         } else {
             $this->summary = '';
         }
         $this->render_tfoot();
         $this->render_blockEnd();
     }
 }
Esempio n. 9
0
/**
* Edit several efforts @ingroup pages
*/
function effortViewMultiple()
{
    global $PH;
    global $auth;
    require_once confGet('DIR_STREBER') . 'render/render_wiki.inc.php';
    ### get effort ####
    $ids = getPassedIds('effort', 'efforts_*');
    if (!$ids) {
        $PH->abortWarning(__("Select one or more efforts"));
        return;
    }
    $number = 0;
    $sum = 0;
    $count = 0;
    foreach ($ids as $id) {
        if ($e = Effort::getEditableById($id)) {
            ## array with all efforts ##
            $e_array[] = $e;
            ## array with all effort ids (for Effort::getMinMaxTime())##
            $e_ids[] = $e->id;
            ## is viewed by user ##
            $e->nowViewedByUser();
            ## number of efforts ##
            $number++;
            ## sum of all efforts ##
            $sum += round((strToGMTime($e->time_end) - strToGMTime($e->time_start)) / 60 / 60, 1);
            ### check project of first effort
            if (count($e_array) == 1) {
                if (!($project = Project::getVisibleById($e->project))) {
                    $PH->abortWarning('could not get project');
                }
            } else {
                $count = 0;
                ### check if the efforts are related to the same task ###
                if ($e->task != $e_array[0]->task) {
                    $count++;
                }
            }
        } else {
            $PH->abortWarning(__("You do not have enough rights"), ERROR_RIGHTS);
        }
    }
    $page = new Page();
    $page->cur_tab = 'projects';
    $page->cur_crumb = 'effortViewMultiple';
    $page->crumbs = build_project_crumbs($project);
    $page->options = build_projView_options($project);
    $type = __('Multiple Efforts', 'page type');
    ## same tasks ##
    if ($count == 0) {
        $task = $e_array[0]->task ? Task::getVisibleById($e_array[0]->task) : NULL;
        if ($task) {
            $folder = $task->getFolderLinks() . "<em>&gt;</em>" . $task->getLink();
            $page->type = $folder . "<em>&gt;</em>" . $type;
        } else {
            $page->type = $type;
        }
    } else {
        $page->type = $project->getLink() . "<em>&gt;</em>" . $type;
    }
    $page->title = __('Multiple Efforts');
    $page->title_minor = __('Overview');
    ### render title ###
    echo new PageHeader();
    echo new PageContentOpen();
    ### summary ###
    ### title ###
    echo '<div class="text"><h3>' . __('summary') . "</h3></div>";
    ### content ###
    $block = new PageBlock(array('title' => __('Information'), 'id' => 'info'));
    $block->render_blockStart();
    echo '<div class="text">';
    if ($number) {
        echo "<div class=labeled><label>" . __('Number of efforts', 'label') . "</label>" . asHtml($number) . "</div>";
    }
    if ($sum) {
        echo "<div class=labeled><label>" . __('Sum of efforts', 'label') . "</label>" . asHtml($sum) . " h</div>";
    }
    $content['e_ids'] = $e_ids;
    $time = Effort::getMinMaxTime($content);
    if ($time) {
        $line = "<div class=labeled><label>" . __('from', 'time label') . "</label>" . renderDateHtml($time[0]) . "</div>";
        $line .= "<div class=labeled><label>" . __('to', 'time label') . "</label>" . renderDateHtml($time[1]) . "</div>";
        echo $line;
    } else {
        echo "<div class=labeled><label>" . __('Time', 'label') . "</label>" . __('not available') . "</div>";
    }
    echo "</div>";
    $block->render_blockEnd();
    ### start to list efforts ###
    foreach ($e_array as $effort) {
        ### title ###
        echo '<div class="text"><h3>' . asHtml($effort->name) . "</h3></div>";
        $block = new PageBlock(array('title' => __('Details'), 'id' => 'details' . $effort->id));
        $block->render_blockStart();
        echo '<div class="text">';
        if ($project) {
            echo "<div class=labeled><label>" . __('Project', 'label') . "</label>" . $project->getLink(false) . "</div>";
        }
        $task = $effort->task ? Task::getVisibleById($effort->task) : NULL;
        if ($task) {
            if ($task->parent_task != 0) {
                $folder = $task->getFolderLinks(false) . "<em> &gt; </em>" . $task->getLink(false);
                echo "<div class=labeled><label>" . __('Task', 'label') . "</label>" . $folder . "</div>";
            } else {
                echo "<div class=labeled><label>" . __('Task', 'label') . "</label>" . $task->getLink(false) . "</div>";
            }
        } else {
            echo "<div class=labeled><label>" . __('Task', 'label') . "</label>" . __('No task related') . "</div>";
        }
        if (!($person = Person::getById($effort->person))) {
            echo "<div class=labeled><label>" . __('Created by', 'label') . "</label>" . __('not available') . "</div>";
        } else {
            echo "<div class=labeled><label>" . __('Created by', 'label') . "</label>" . $person->getLink() . "</div>";
        }
        if ($effort) {
            $duration = round((strToGMTime($effort->time_end) - strToGMTime($effort->time_start)) / 60 / 60, 1) . " h";
            if ($effort->as_duration) {
                echo "<div class=labeled><label>" . __('Created at', 'label') . "</label>" . renderDateHtml($effort->time_start) . "</div>";
                echo "<div class=labeled><label>" . __('Duration', 'label') . "</label>" . asHtml($duration) . "</div>";
            } else {
                echo "<div class=labeled><label>" . __('Time start', 'label') . "</label>" . renderTimestampHtml($effort->time_start) . "</div>";
                echo "<div class=labeled><label>" . __('Time end', 'label') . "</label>" . renderTimestampHtml($effort->time_end) . "</div>";
                echo "<div class=labeled><label>" . __('Duration', 'label') . "</label>" . asHtml($duration) . "</div>";
            }
        }
        echo "</div>";
        $block->render_blockEnd();
        $block = new PageBlock(array('title' => __('Description'), 'id' => 'description' . $effort->id));
        $block->render_blockStart();
        if ($effort->description != "") {
            echo '<div class="text">';
            echo wikifieldAsHtml($effort, 'description');
            ### update task if relative links have been converted to ids ###
            if (checkAutoWikiAdjustments()) {
                $effort->description = applyAutoWikiAdjustments($effort->description);
                $effort->update(array('description'), false);
            }
            echo "</div>";
        } else {
            if ($auth->cur_user->user_rights & RIGHT_PROJECT_ASSIGN) {
                echo '<div class="empty">' . $PH->getLink('effortEdit', '', array('effort' => $effort->id)) . "</div>";
            } else {
                echo '<div class="text">' . __('No description available') . "</div>";
            }
        }
        $block->render_blockEnd();
    }
    echo new PageContentClose();
    echo new PageHtmlEnd();
}
Esempio n. 10
0
 function render_tr(&$file, $style = "")
 {
     global $PH;
     if (!isset($file) || !$file instanceof File) {
         return;
     }
     #$buffer = $PH->getLink('fileView',__("Details"), array('file'=>$file->id),'item file');
     $buffer = '';
     if ($file->mimetype == 'image/png' || $file->mimetype == 'image/x-png' || $file->mimetype == 'image/jpeg' || $file->mimetype == 'image/pjpeg' || $file->mimetype == 'image/jpg' || $file->mimetype == 'image/gif') {
         if ($author = Person::getVisibleById($file->created_by)) {
             $author_name = $author->nickname;
         } else {
             $author_name = "???";
         }
         $buffer .= "<span class=sub><a " . "title='" . sprintf(__("creatd on %s", "date a file was created"), renderDate($file->created)) . "' " . "target='blank' " . "href='" . $PH->getUrl('fileDownloadAsImage', array('file' => $file->id)) . "' " . "><img class='left' title='" . asHtml($file->name) . "' alt='" . asHtml($file->name) . "' " . "src='" . $file->getCachedUrl(100) . "'" . "><br>" . "" . asHtml($file->name) . "</a>" . "</span>" . "<br>" . "<span class=sub title='" . __('click to show details') . "'>" . $PH->getLink('fileView', '#' . $file->id, array('file' => $file->id)) . ' ' . sprintf(__('by %s', 'person who uploaded a file'), $author_name) . ', ' . renderFilesize($file->filesize) . "<br>" . "</span>";
     } else {
         $buffer .= "<b>" . $PH->getLink('fileDownload', $file->name, array('file' => $file->id)) . "</b>" . "<br>" . "<span class=sub>" . $file->filesize . " bytes" . " / " . sprintf(__("ID %s"), $file->id) . " / " . renderDateHtml($file->created) . "</span>" . "<br>" . "<span class=sub>" . $PH->getLink('fileView', __('Show Details'), array('file' => $file->id)) . "</span>";
     }
     print "<td class='attachment_summary'>{$buffer}</td>";
 }
Esempio n. 11
0
/**
* view task a documentation page @ingroup pages
*/
function taskViewAsDocu()
{
    global $PH;
    global $auth;
    require_once confGet('DIR_STREBER') . 'render/render_wiki.inc.php';
    require_once confGet('DIR_STREBER') . 'db/db_itemperson.inc.php';
    ### get task ####
    $tsk = get('tsk');
    $editable = false;
    # flag, if this task can be edited
    if ($task = Task::getEditableById($tsk)) {
        $editable = true;
    } else {
        if (!($task = Task::getVisibleById($tsk))) {
            $PH->abortWarning("invalid task-id", ERROR_FATAL);
        }
    }
    if (!($project = Project::getVisibleById($task->project))) {
        $PH->abortWarning("this task has an invalid project id", ERROR_DATASTRUCTURE);
    }
    ### create from handle ###
    $from_handle = $PH->defineFromHandle(array('tsk' => $task->id));
    global $g_wiki_task;
    $g_wiki_task = $task;
    ### set up page and write header ####
    measure_start("page_render");
    $page = new Page();
    $page->use_autocomplete = true;
    initPageForTask($page, $task, $project);
    $page->title_minor_html = $PH->getLink('taskView', sprintf('#%d', $task->id), array('tsk' => $task->id));
    if ($task->state == -1) {
        $page->title_minor_html .= ' ' . sprintf(__('(deleted %s)', 'page title add on with date of deletion'), renderTimestamp($task->deleted));
    }
    ### page functions ###
    if ($project->isPersonVisibleTeamMember($auth->cur_user)) {
        ### edit ###
        if ($editable) {
            $page->add_function(new PageFunction(array('target' => 'taskEdit', 'params' => array('tsk' => $task->id), 'icon' => 'edit', 'tooltip' => __('Edit this task'), 'name' => __('Edit'))));
            $page->add_function(new PageFunction(array('target' => 'tasksMoveToFolder', 'params' => array('tsk' => $task->id), 'icon' => 'edit', 'name' => __('Move', 'page function to move current task'))));
            if ($task->state == 1) {
                $page->add_function(new PageFunction(array('target' => 'tasksDelete', 'params' => array('tsk' => $task->id), 'icon' => 'delete', 'tooltip' => __('Delete this task'), 'name' => __('Delete'))));
            } else {
                if ($task->state == -1) {
                    $page->add_function(new PageFunction(array('target' => 'tasksUndelete', 'params' => array('tsk' => $task->id), 'icon' => 'undelete', 'tooltip' => __('Restore this task'), 'name' => __('Undelete'))));
                }
            }
        }
        if ($auth->cur_user->settings & USER_SETTING_ENABLE_EFFORTS && $project->settings & PROJECT_SETTING_ENABLE_EFFORTS) {
            $page->add_function(new PageFunction(array('target' => 'effortNew', 'params' => array('parent_task' => $task->id), 'icon' => 'effort', 'name' => __('Book Effort'))));
        }
        ### new ###
        if ($task->category == TCATEGORY_FOLDER) {
            $page->add_function(new PageFunction(array('target' => 'taskNew', 'params' => array('parent_task' => $task->id, 'task_category' => TCATEGORY_DOCU, 'task_show_folder_as_documentation' => 1), 'icon' => 'edit', 'name' => __('New topic'))));
        } else {
            if ($task->parent_task) {
                $page->add_function(new PageFunction(array('target' => 'taskNew', 'params' => array('parent_task' => $task->parent_task, 'task_category' => TCATEGORY_DOCU, 'task_show_folder_as_documentation' => 1), 'icon' => 'edit', 'name' => __('New topic'))));
            } else {
                $page->add_function(new PageFunction(array('target' => 'taskNew', 'params' => array('prj' => $task->project, 'task_category' => TCATEGORY_DOCU), 'icon' => 'edit', 'name' => __('New topic'))));
            }
        }
        if ($auth->cur_user->settings & USER_SETTING_ENABLE_BOOKMARKS) {
            require_once confGet('DIR_STREBER') . 'db/db_itemperson.inc.php';
            $item = ItemPerson::getAll(array('person' => $auth->cur_user->id, 'item' => $task->id));
            if (!$item || $item[0]->is_bookmark == 0) {
                $page->add_function(new PageFunction(array('target' => 'itemsAsBookmark', 'params' => array('task' => $task->id), 'tooltip' => __('Mark this task as bookmark'), 'name' => __('Bookmark'))));
            } else {
                $page->add_function(new PageFunction(array('target' => 'itemsRemoveBookmark', 'params' => array('task' => $task->id), 'tooltip' => __('Remove this bookmark'), 'name' => __('Remove Bookmark'))));
            }
        }
    }
    ### render title ###
    echo new PageHeader();
    echo new PageContentOpen_Columns();
    require_once confGet('DIR_STREBER') . 'lists/list_docustructure.inc.php';
    $list = new Block_DocuNavigation(array('current_task' => $task));
    $list->print_all();
    $block = new PageBlock(array('id' => 'summary', 'reduced_header' => true));
    $block->render_blockStart();
    echo "<div class=text>";
    if ($person_creator = Person::getVisibleById($task->created_by)) {
        echo "<div class=labeled><label>" . __("Created", "Label in Task summary") . "</label>" . renderDateHtml($task->created) . ' / ' . $person_creator->getLink() . '</div>';
    }
    if ($person_modify = Person::getVisibleById($task->modified_by)) {
        echo "<div class=labeled><label>" . __("Modified", "Label in Task summary") . "</label>" . renderDateHtml($task->modified) . ' / ' . $person_modify->getLink() . '</div>';
    }
    require_once confGet('DIR_STREBER') . "db/db_itemchange.inc.php";
    $versions = ItemVersion::getFromItem($task);
    if (count($versions) > 1) {
        $str_version = $PH->getLink('itemViewDiff', sprintf(__("View previous %s versions"), count($versions)), array('item' => $task->id));
        echo "<div class=labeled><label></label>{$str_version}</div>";
    }
    ### publish to ###
    global $g_pub_level_names;
    if ($task->pub_level != PUB_LEVEL_OPEN && isset($g_pub_level_names[$task->pub_level])) {
        echo "<div class=labeled><label>" . __("Publish to", "Label in Task summary") . "</label>" . $g_pub_level_names[$task->pub_level];
        if ($editable) {
            echo '<br>(' . $PH->getLink('itemsSetPubLevel', __('Set to Open'), array('item' => $task->id, 'item_pub_level' => PUB_LEVEL_OPEN)) . ')';
        }
        echo "</div>";
    }
    echo "</div>";
    $block->render_blockEnd();
    require_once confGet('DIR_STREBER') . 'blocks/files_attached_to_item.inc.php';
    print new FilesAttachedToItemBlock($task);
    echo new PageContentNextCol();
    require_once confGet('DIR_STREBER') . 'db/db_itemperson.inc.php';
    if ($view = ItemPerson::getAll(array('person' => $auth->cur_user->id, 'item' => $task->id, 'feedback_requested_by' => true))) {
        if ($requested_by = Person::getPeople(array('id' => $view[0]->feedback_requested_by))) {
            echo "<div class=item_notice>";
            echo "<h3>" . sprintf(__("Your feedback is requested by %s."), asHtml($requested_by[0]->nickname)) . "</h3>";
            echo __("Please edit or comment this item.");
            echo "</div>";
        }
    }
    #$descriptionWithUpdates= $task->getTextfieldWithUpdateNotes('description');
    echo "<div class=description>";
    echo wikifieldAsHtml($task, 'description', array('empty_text' => "[quote]" . __("This topic does not have any text yet.\nDoubleclick here to add some.") . "[/quote]"));
    echo "</div>";
    ### Apply automatic link conversions
    if (checkAutoWikiAdjustments()) {
        $task->description = applyAutoWikiAdjustments($task->description);
        $task->update(array('description'), false);
    }
    require_once confGet('DIR_STREBER') . 'blocks/comments_on_item_block.inc.php';
    print new CommentsOnItemBlock($task);
    echo new PageContentClose();
    echo new PageHtmlEnd();
    measure_stop("page_render");
    $task->nowViewedByUser();
}
 public function render($args = NULL)
 {
     global $PH;
     $this->render_blockStart();
     ### client ###
     if ($this->project->company) {
         echo "<div class=labeled><label>" . __("For", "Label in Task summary") . "</label>" . $this->project->getCompanyLink() . "</div>";
     }
     global $g_status_names;
     if ($status = $g_status_names[$this->project->status]) {
         echo "<div class=labeled><label>" . __("Status", "Label in Task summary") . "</label>{$status}</div>";
     }
     echo "<div class=labeled><label>" . __("Opened", "Label in Task summary") . "</label>" . renderDateHtml($this->project->date_start) . "</div>";
     if ($this->project->date_closed != "0000-00-00") {
         echo "<div class=labeled><label>" . __("Closed", "Label in Task summary") . "</label>" . renderDateHtml($this->project->date_closed) . "</div>";
     }
     ### efforts ###
     if ($openEfforts = $this->project->getOpenEffortsSum() > 0) {
         echo "<div class=labeled><label>" . __("Open efforts", "Label in Task summary") . "</label>" . $PH->getLink('projViewEfforts', round($this->project->getOpenEffortsSum() / 60 / 60, 1) . "h", array('prj' => $this->project->id, 'preset' => 'open_efforts')) . "</div>";
     }
     /*
     ### normal tasks ###
     else {
     
         if($task->for_milestone) {
             if($milestone= Task::getVisibleById($task->for_milestone)) {
                 echo "<div class=labeled><label>".__("For Milestone","Label in Task summary")."</label>".$milestone->getLink(false)."</div>";
             }
         }
     
     
         global $g_status_names;
         if($status=$g_status_names[$task->status]) {
             echo "<div class=labeled><label>".__("Status","Label in Task summary")."</label>$status</div>";
         }
     
     
         echo "<div class=labeled><label>".__("Opened","Label in Task summary")."</label>".renderDateHtml($task->date_start)."</div>";
     
         if($task->estimated) {
             echo "<div class=labeled><label>".__("Estimated","Label in Task summary")."</label>".renderDuration($task->estimated). ' ';
     
             if($task->estimated_max) {
                 echo " ... ". renderDuration($task->estimated_max);
             }
             echo "</div>";
         }
     
         if($task->completion) {
             echo "<div class=labeled><label>".__("Completed","Label in Task summary")."</label>".$task->completion."%</div>";
         }
     
         if($task->planned_start && $task->planned_start != "0000-00-00 00:00:00") {
             echo "<div class=labeled><label>".__("Planned start","Label in Task summary")."</label>".renderTimestamp($task->planned_start)."</div>";
         }
     
         if($task->planned_end && $task->planned_end != "0000-00-00 00:00:00") {
             echo "<div class=labeled><label>".__("Planned end","Label in Task summary")."</label>".renderTimestamp($task->planned_end)."</div>";
         }
     
         if($task->date_closed !="0000-00-00") {
             echo "<div class=labeled><label>".__("Closed","Label in Task summary")."</label>". renderDateHtml($task->date_closed) . "</div>";
         }
     }
     
     if($person_creator= Person::getVisibleById($task->created_by)) {
         echo "<div class=labeled><label>".__("Created","Label in Task summary")."</label>". renderDateHtml($task->created) . ' / ' . $person_creator->getLink().'</div>' ;
     }
     
     if($person_modify= Person::getVisibleById($task->modified_by)) {
         echo "<div class=labeled><label>".__("Modified","Label in Task summary")."</label>". renderDateHtml($task->modified) . ' / ' .  $person_modify->getLink() . '</div>' ;
     }
     
     ### get version ###
     {
         require_once(confGet('DIR_STREBER') . "db/db_itemchange.inc.php");
         $versions= ItemVersion::getFromItem($task);
         if(count($versions) > 1) {
             $str_version=     $PH->getLink('itemViewDiff',
                                 sprintf(__("View previous %s versions"), count($versions)),
                                 array('item' => $task->id)
                             );
             echo "<div class=labeled><label></label>$str_version</div>";
         }
     }
     
     
     #}
     
     $sum_efforts= $task->getSumEfforts();
     if($sum_efforts) {
         echo "<div class=labeled><label>".__("Logged effort","Label in task-summary")."</label>".
         $PH->getLink('taskViewEfforts',round($sum_efforts/60/60,1), array('task'=>$task->id))
         ."</div>" ;
     }
     
     if($tps= $task->getAssignedPeople()) {
         $value="";
         $sep="";
         foreach($tps as $tp) {
             $value.= $sep . $tp->getLink();
             $sep=", ";
         }
         $label=__("Assigned to");
         echo "<div class=labeled><label>$label</label>$value</div>" ;
     
     
     }
     
     ### publish to ###
     global $g_pub_level_names;
     if($task->pub_level != PUB_LEVEL_OPEN && isset($g_pub_level_names[$task->pub_level])) {
         echo "<div class=labeled><label>".__("Publish to","Label in Task summary")."</label>".$g_pub_level_names[$task->pub_level] ;
         if($editable) {
             echo '<br>('
                 . $PH->getLink('itemsSetPubLevel',__('Set to Open'), array('item' => $task->id,'item_pub_level' => PUB_LEVEL_OPEN))
                 . ')';
         }
         echo "</div>";
     }
     */
     //echo "</div>";
     $this->render_blockEnd();
     return '';
 }
Esempio n. 13
0
/**
* View details of a file (versions, etc) @ingroup pages
*/
function fileView()
{
    global $PH;
    global $auth;
    require_once confGet('DIR_STREBER') . 'render/render_wiki.inc.php';
    ### get object ####
    $file_id = getOnePassedId('file');
    if (!($file = File::getVisibleById($file_id))) {
        $PH->abortWarning("invalid file-id", ERROR_FATAL);
    }
    $file_org = $file->getOriginal();
    if ($file->is_latest) {
        $file_latest = $file;
    } else {
        $file_latest = $file->getLatest();
    }
    if (!($project = Project::getVisibleById($file->project))) {
        $PH->abortWarning("invalid project-id", ERROR_FATAL);
    }
    /**
     * parent item (not implemented yet)
     */
    $parent_task = NULL;
    if ($file->parent_item) {
        #trigger_error('@@@not implemented yet', E_USER_ERROR);
        if (!($parent_task = Task::getVisibleById(intval($file->parent_item)))) {
            $PH->messages[] = sprintf(__("Could not access parent task Id:%s"), $file->parent_item);
        }
    }
    ### create from handle ###
    $from_handle = $PH->defineFromHandle(array('file' => $file->id));
    ## is viewed by user ##
    $file->nowViewedByUser();
    $page = new Page();
    initPageForFile($page, $file, $project);
    #$page->title_minor=sprintf('#%d', $file_org->id);;
    if ($file->state == -1) {
        $page->title_minor = sprintf(__('(deleted %s)', 'page title add on with date of deletion'), renderTimestamp($file->deleted));
    }
    ### page functions ###
    $page->add_function(new PageFunction(array('target' => 'fileEdit', 'params' => array('file' => $file->id), 'icon' => 'edit', 'tooltip' => __('Edit this file'), 'name' => __('Edit'))));
    $page->add_function(new PageFunction(array('target' => 'filesMoveToFolder', 'params' => array("file" => $file->id), 'tooltip' => __('Move this file to another task'), 'name' => __('Move'))));
    if ($auth->cur_user->settings & USER_SETTING_ENABLE_BOOKMARKS) {
        $item = ItemPerson::getAll(array('person' => $auth->cur_user->id, 'item' => $file->id));
        if (!$item || $item[0]->is_bookmark == 0) {
            $page->add_function(new PageFunction(array('target' => 'itemsAsBookmark', 'params' => array('file' => $file->id), 'tooltip' => __('Mark this file as bookmark'), 'name' => __('Bookmark'))));
        } else {
            $page->add_function(new PageFunction(array('target' => 'itemsRemoveBookmark', 'params' => array('file' => $file->id), 'tooltip' => __('Remove this bookmark'), 'name' => __('Remove Bookmark'))));
        }
    }
    ### render title ###
    echo new PageHeader();
    echo new PageContentOpen();
    $block = new PageBlock(array('title' => __('Upload new version', 'block title'), 'id' => 'summary'));
    $block->render_blockStart();
    echo "<div class=text>";
    echo '<input type="hidden" name="MAX_FILE_SIZE" value="' . confGet('FILE_UPLOAD_SIZE_MAX') . '" />';
    echo '<input id="userfile" name="userfile" type="file" size="40" accept="*" />';
    echo '<input type="submit" value="' . __('Upload') . '" />';
    echo '</div>';
    $block->render_blockEnd();
    $block = new PageBlock(array('title' => sprintf(__('Version #%s (current): %s'), $file_latest->version, $file_latest->name), 'id' => 'description'));
    $block->render_blockStart();
    echo "<div class=text>";
    ### show thumbnail
    if ($file_latest->mimetype == "image/png" || $file_latest->mimetype == "image/x-png" || $file_latest->mimetype == "image/jpeg" || $file_latest->mimetype == "image/gif") {
        echo "<div class=image style='float:right;'><a href='index.php?go=fileDownloadAsImage&amp;file={$file_latest->id}'>";
        echo "<img src='index.php?go=fileDownloadAsImage&amp;file={$file_latest->id}&amp;max_size=128'>";
        echo "</a></div>";
    }
    if ($parent_task) {
        echo "<div class=labeled><label>" . __('For task') . "</label><span>" . $parent_task->getLink(false) . "</span></div>";
    }
    echo "<div class=labeled><label>" . __('Filesize') . "</label><span>{$file_latest->filesize} bytes</span></div>";
    echo "<div class=labeled><label>" . __('Type') . "</label><span>{$file_latest->mimetype}</span></div>";
    echo "<div class=labeled><label>" . __('Uploaded') . "</label><span>" . renderDateHtml($file_latest->created) . "</span></div>";
    if ($uploader = Person::getVisibleById($file->created_by)) {
        echo "<div class=labeled><label>" . __('Uploaded by') . "</label><span>" . $uploader->getLink() . "</span></div>";
    }
    if ($file_latest->created != $file_latest->modified) {
        echo "<div class=labeled><label>" . __('Modified') . "</label><span>" . renderDateHtml($file_latest->created) . "</span></div>";
    }
    echo "<div class=labeled><label>" . __('Download') . "</label><span>" . $PH->getLink('fileDownload', $file_latest->org_filename, array('file' => $file_latest->id)) . "</span></div>";
    $str = wikifieldAsHtml($file_latest, 'description');
    echo "<br>";
    echo "{$str}";
    echo "</div>";
    $block->render_blockEnd();
    /**
     * build list of old versions,
     * because org_file is zero for the original file, with have to append it
     */
    $old_files = File::getAll(array('latest_only' => false, 'org_file' => $file_org->id, 'order_by' => 'version DESC', 'project' => $project->id));
    if ($file_latest->id != $file_org->id) {
        $old_files[] = $file_org;
    }
    foreach ($old_files as $of) {
        if ($of->id != $file_latest->id) {
            $block = new PageBlock(array('title' => sprintf(__('Version #%s : %s'), $of->version, $of->name), 'id' => 'version_' . $of->id));
            $block->render_blockStart();
            echo "<div class=text>";
            ### show thumbnail
            if ($of->mimetype == "image/png" || $of->mimetype == "image/x-png" || $of->mimetype == "image/jpeg" || $of->mimetype == "image/gif") {
                echo "<div class=image style='float:right;'><a href='index.php?go=fileDownloadAsImage&file={$of->id}'>";
                echo "<img src='index.php?go=fileDownloadAsImage&file={$of->id}&max_size=128'>";
                echo "</a></div>";
            }
            $str = wikifieldAsHtml($of, 'description');
            echo "{$str}";
            echo "<div class=labeled><label>" . __('Filesize') . "</label><span>{$of->filesize} bytes</span></div>";
            echo "<div class=labeled><label>" . __('Type') . "</label><span>{$of->mimetype}</span></div>";
            echo "<div class=labeled><label>" . __('Uploaded') . "</label><span>" . renderDateHtml($of->created) . "</span></div>";
            #echo "<div class=labeled><label>" . __('Version') .  "</label><span>". intval($of->version) ."</span></div>";
            echo "<div class=labeled>" . $PH->getLink('fileDownload', '', array('file' => $of->id)) . "</div>";
            echo "</div>";
            $block->render_blockEnd();
        }
    }
    $PH->go_submit = 'fileUpdate';
    /**
     * list comments
     * NOTE: can files have comments?
     */
    /*
    {
        $comments= $file->getComments();
        $list=new ListBlock_comments();
        $list->no_items_html=$PH->getLink('commentNew','',array('parent_task'=>$task->id));
        $list->render_list($comments);
    }
    */
    echo '<input type="hidden" name="prj"  value="' . $file->project . '">';
    echo '<input type="hidden" name="org_file" value="' . $file->id . '">';
    /**
     * give parameter for create of new items (subtasks, efforts, etc)
     */
    #echo '<input type="hidden" name="parent_task" value="'.$task->id.'">';
    echo new PageContentClose();
    echo new PageHtmlEnd();
}
 function render_tr(&$obj, $style = "")
 {
     global $auth;
     if (!isset($obj) || !is_object($obj)) {
         trigger_error("ListBlockColDate->render_tr() called without valid object", E_USER_WARNING);
         return;
     }
     $key = $this->key;
     $value_str = renderDateHtml($obj->{$key});
     print "<td class='nowrap'>{$value_str}</td>";
 }
Esempio n. 15
0
 function render_tr(&$change_line, $style = "")
 {
     if ($change_line instanceof ChangeLine) {
         if ($change_line->person_by) {
             if ($person = Person::getVisibleById($change_line->person_by)) {
                 print '<td><span class=date>' . renderDateHtml($change_line->timestamp) . '</span><br><span class="sub who">' . __('by') . ' ' . $person->getLink() . '</span></td>';
                 return;
             }
         }
         print '<td><span class=date>' . renderDateHtml($change_line->timestamp) . '</span></td>';
     } else {
         trigger_error('ListBlockCol_ChangesDate() requires instance of ChangeLine', E_USER_WARNING);
         print "<td></td>";
     }
 }