function render_tr(&$obj, $style = "")
 {
     if (!isset($obj) || !$obj instanceof Project) {
         trigger_error("ListBlock->render_tr() called without valid object", E_USER_WARNING);
         return;
     }
     $sum = 0.0;
     $sum_sal = 0.0;
     $sum_all = 0.0;
     $sum_cal = 0.0;
     $diff_value = false;
     if ($effort_people = Effort::getEffortPeople(array('project' => $obj->id))) {
         foreach ($effort_people as $ep) {
             if ($person = Person::getVisibleById($ep->person)) {
                 /*if($obj->getStatus()){
                 			$sum_sal = Effort::getSumEfforts(array('project'=>$obj->id, 'person'=>$person->id, 'status'=>$obj->status));
                 		}
                 		else{*/
                 $sum_sal = Effort::getSumEfforts(array('project' => $obj->id, 'person' => $person->id));
                 #}
                 if ($sum_sal) {
                     $sum = round($sum_sal / 60 / 60, 1) * 1.0;
                     if ($pp = $obj->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 ($effort_tasks = Effort::getEffortTasks(array('project' => $obj->id))) {
         foreach ($effort_tasks as $et) {
             if ($task = Task::getById($et->task)) {
                 if ($task->calculation) {
                     $sum_cal += $task->calculation;
                 }
             }
         }
     }
     if ($sum_all && $sum_cal) {
         $max_length_value = 3;
         $get_percentage = $sum_all / $sum_cal * 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>";
     }
 }
Ejemplo n.º 2
0
 function render_tr(&$item, $style = "")
 {
     global $PH;
     ## notification on change ##
     if ($notification_items = ItemPerson::getAll(array('item' => $item->id, 'notify_on_change' => 1))) {
         print '<td><img title="' . __('Notify on change') . '" src="' . getThemeFile("icons/monitored.png") . '"></td>';
     } else {
         if ($notification_items = ItemPerson::getAll(array('item' => $item->id, 'notify_if_unchanged_min' => NOTIFY_1DAY))) {
             print '<td><img title="' . __('Notify on change') . '" src="' . getThemeFile("icons/monitored.png") . '"></td>';
         } else {
             print "<td>&nbsp;</td>";
         }
     }
 }
Ejemplo n.º 3
0
 function render_tr(&$obj, $style = "")
 {
     if (!isset($obj) || !$obj instanceof Effort) {
         trigger_error("ListBlock->render_tr() called without valid object", E_USER_WARNING);
         return;
     }
     if ($obj->as_duration) {
         echo "<td>-</td>";
     } else {
         $tmp = mysqlDatetime2utc($obj->time_start);
         $day_time_start = confGet('DAYGRAPH_START_HOUR') * 60 * 60;
         $day_time_end = confGet('DAYGRAPH_END_HOUR') * 60 * 60;
         $stretch = confGet('DAYGRAPH_WIDTH') / ($day_time_end - $day_time_start);
         $time_start = round(($tmp['hour'] * 60 * 60 + $tmp['min'] * 60 + $tmp['sec'] - $day_time_start) * $stretch, 0);
         if ($time_start < 0) {
             $time_start = 0;
         }
         $tmp = mysqlDatetime2utc($obj->time_end);
         $time_end = round(($tmp['hour'] * 60 * 60 + $tmp['min'] * 60 + $tmp['sec'] - $day_time_start) * $stretch, 0);
         if ($time_end < $time_start) {
             $time_end = 0;
         }
         $time_len = $time_end - $time_start;
         echo "<td>";
         echo "<nobr>";
         echo "<img src='" . getThemeFile("img/pixel.gif") . "' style='width:{$time_start}px;height:3px;'>";
         echo "<img src='" . getThemeFile("img/pixel.gif") . "' style='width:{$time_len}px;height:12px;background-color:#f00;'>";
         echo "</nobr>";
         echo "</td>";
     }
 }
Ejemplo n.º 4
0
 function render_tr(&$obj, $style = "")
 {
     global $PH;
     if (!isset($obj) || !$obj instanceof Comment) {
         trigger_error("ListBlock->render_tr() called without valid object", E_USER_WARNING);
         return;
     }
     global $auth;
     if ($obj->created_by == $auth->cur_user->id) {
         $column_text = '<td class="comment_text by_cur_user">';
     } else {
         $column_text = "<td class=comment_text>";
     }
     $column_text .= "<div class=comment_block style='padding-left:" . $obj->level * 2.0 . "em'>";
     if ($obj->view_collapsed) {
         $column_text .= $PH->getLink('commentToggleViewCollapsed', "<img src=\"" . getThemeFile("img/toggle_folder_closed.gif") . "\">", array('comment' => $obj->id), NULL, true);
         $column_text .= "<span class=title>" . $PH->getLink('commentView', $obj->name, array('comment' => $obj->id)) . "</span>";
         if ($obj->num_children) {
             $column_text .= "<span class=children> (";
             if ($obj->num_children == 1) {
                 $column_text .= __("1 sub comment");
             } else {
                 $column_text .= printf(__("%s sub comments"), $obj->num_children);
             }
             $column_text .= ")</span>";
         }
     } else {
         $column_text .= $PH->getLink('commentToggleViewCollapsed', "<img src=\"" . getThemeFile("img/toggle_folder_open.gif") . "\">", array('comment' => $obj->id), NULL, true);
         $column_text .= "<span class=title>" . $PH->getLink('commentView', $obj->name, array('comment' => $obj->id)) . "</span>";
         require_once confGet('DIR_STREBER') . 'render/render_wiki.inc.php';
         $project = Project::getVisibleById($obj->project);
         $obj->nowViewedByUser();
         ### editable? ###
         $editable = false;
         if ($obj->created_by == $auth->cur_user->id) {
             #if($pp= $obj->getProjectPerson()) {
             #    if($pp->level_edit < $obj->pub_level) {
             $editable = true;
             #   }
             #}
         }
         $diz = wikifieldAsHtml($obj, 'description');
         if ($diz) {
             $column_text .= "<div class=comment_text>{$diz}</div>";
         }
     }
     $column_text .= "</div>";
     $column_text .= "</td>";
     print $column_text;
 }
Ejemplo n.º 5
0
function ProjView()
{
    global $PH;
    global $auth;
    require_once confGet('DIR_STREBER') . "render/render_wiki.inc.php";
    ### get current project ###
    $id = getOnePassedId('prj', 'projects_*');
    if ($project = Project::getEditableById($id)) {
        $editable = true;
    } else {
        if ($project = Project::getVisibleById($id)) {
            $editable = false;
        } else {
            $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 = __("Project overview");
    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");
        }
    }
    ### page functions ###
    if ($project->isPersonVisibleTeamMember($auth->cur_user)) {
        if ($editable) {
            $page->add_function(new PageFunction(array('target' => 'projEdit', 'params' => array('prj' => $project->id), 'icon' => 'edit', 'tooltip' => __('Edit this project'), 'name' => __('Edit project'))));
        }
        /*
        $item = ItemPerson::getAll(array(
            'person'=>$auth->cur_user->id,
            'item'=>$project->id
        ));
        if((!$item) || ($item[0]->is_bookmark == 0)){
            $page->add_function(new PageFunction(array(
                'target'    =>'itemsAsBookmark',
                'params'    =>array('proj'=>$project->id),
                'tooltip'   =>__('Mark this project as bookmark'),
                'name'      =>__('Bookmark'),
            )));
        }
        else{
            $page->add_function(new PageFunction(array(
                'target'    =>'itemsRemoveBookmark',
                'params'    =>array('proj'=>$project->id),
                'tooltip'   =>__('Remove this bookmark'),
                'name'      =>__('Remove Bookmark'),
            )));
        }
        */
        /*
        if($project->state == 1) {
                $page->add_function(new PageFunction(array(
                    'target'=>'projDelete',
                    'params'=>array('prj'=>$project->id),
                    'icon'=>'delete',
                    'tooltip'=>__('Delete this project'),
                    'name'=>__('Delete')
                )));
        }
        */
        #$page->add_function(new PageFunctionGroup(array(
        #    'name'      => __('new')
        #)));
        /*
        $page->add_function(new PageFunction(array(
            'target'    =>'projAddPerson',
            'params'    =>array('prj'=>$project->id),
            'icon'      =>'add',
            'tooltip'   =>__('Add person as team-member to project'),
            'name'      =>__('Team member')
        )));
        */
        if ($project->settings & PROJECT_SETTING_ENABLE_TASKS) {
            $page->add_function(new PageFunction(array('target' => 'taskNew', 'params' => array('prj' => $project->id), 'icon' => 'new', 'tooltip' => __('Create task'), 'name' => __('New task'))));
        }
        if ($project->settings & PROJECT_SETTING_ENABLE_BUGS) {
            $page->add_function(new PageFunction(array('target' => 'taskNewBug', 'params' => array('prj' => $project->id, 'add_issue' => 1), 'icon' => 'new', 'tooltip' => __('Create task with issue-report'), 'name' => __('New bug'))));
        }
        $page->add_function(new PageFunction(array('target' => 'taskNewDocu', 'params' => array('prj' => $project->id), 'icon' => 'new', 'tooltip' => __('Create wiki documentation page or start discussion topic'), 'name' => __('New topic'))));
        if ($project->settings & PROJECT_SETTING_ENABLE_EFFORTS && $auth->cur_user->settings & USER_SETTING_ENABLE_EFFORTS) {
            $page->add_function(new PageFunction(array('target' => 'effortNew', 'params' => array('prj' => $project->id), 'icon' => 'loghours', 'tooltip' => __('Book effort for this project'), 'name' => __('Book effort'))));
        }
    }
    $url = $PH->getUrl("projViewAsRSS", array('prj' => $project->id));
    $page->extra_header_html .= '<link rel="alternate" type="application/rss+xml" title="' . asHtml($project->name) . ' ' . __("News") . '"' . ' href="' . $url . '" />';
    ### render title ###
    echo new PageHeader();
    echo new PageContentOpen_Columns();
    measure_stop('current milestone');
    require_once confGet('DIR_STREBER') . 'blocks/current_milestone_block.inc.php';
    $block = new CurrentMilestoneBlock($project);
    $block->render();
    measure_stop('current milestone');
    measure_start('team');
    require_once confGet('DIR_STREBER') . 'lists/list_docustructure.inc.php';
    if (Task::getDocuTasks($project->id, 0)) {
        $list = new Block_DocuNavigation(array('project_id' => $project->id));
        $list->print_all();
    }
    #--- list team -----------------------------------------------------------
    /*
    {
    
        $list= new ListBlock_projectTeam();
        $list->title= __('Team members');
        $list->show_icons=true;
        $list->active_block_function = 'list';
        $list->print_automatic($project);
    }
    measure_stop('team');
    */
    echo new PageContentNextCol();
    echo "<div class=description>";
    echo wikifieldAsHtml($project, 'description', array('empty_text' => "[quote]" . __("This project does not have any text yet.\nDoubleclick here to add some.") . "[/quote]"));
    echo "</div>";
    #--- news -----------------------------------------------------------
    if ($project->settings & PROJECT_SETTING_ENABLE_NEWS) {
        require_once confGet('DIR_STREBER') . './blocks/project_news_block.inc.php';
        print new ProjectNewsBlock($project);
    }
    require_once confGet('DIR_STREBER') . './lists/list_recentchanges.inc.php';
    printRecentChanges(array($project), false);
    /*
    measure_start('changes');
    {
        require_once(confGet('DIR_STREBER') . './lists/list_changes.inc.php');
    
        $list= new ListBlock_changes();
        $list->query_options['date_min']= $auth->cur_user->last_logout;
        $list->query_options['not_modified_by']= $auth->cur_user->id;
        $list->query_options['project']= $project->id;
        //$list->print_automatic($project);
        $list->print_automatic();
    }
    measure_stop('changes');
    */
    echo "<br><br>";
    # @@@ hack for firefox overflow problems
    ### HACKING: 'add new task'-field ###
    $PH->go_submit = 'taskNew';
    echo '<input type="hidden" name="prj" value="' . $project->id . '">';
    #$rss_url = confGet('SELF_PROTOCOL').'://'.confGet('SELF_URL');
    #$rss_url = str_replace("index.php", "rss/", $rss_url);
    #$prj_id  = $this->page->options[0]->target_params['prj'];
    $url = $PH->getUrl('projViewAsRSS', array('prj' => $project->id));
    echo "<a style='margin:0px; border-width:0px;' href='{$url}' target='_blank'>" . "<img style='margin:0px; border-width:0px;' src='" . getThemeFile("icons/rss_icon.gif") . "'>" . "</a>";
    echo new PageContentClose();
    echo new PageHtmlEnd();
}
Ejemplo n.º 6
0
/**
* generates an image with a number that is computed as: @ingroup pages
*
*  substr(md5( $key . $auth->cur_user->identifier ), 0, 5)
*
* With captcha tests, the key is been sent in a CRC-protected hidden field.
*/
function imageRenderCaptcha()
{
    global $auth;
    if ($key = get('key')) {
        $md5 = md5($key . $auth->cur_user->identifier);
    } else {
        $md5 = "---";
    }
    $ResultStr = substr($md5, 0, 5);
    //trim 5 digit
    $BgImage = imagecreatefrompng(getThemeFile("img/bg_captcha.png"));
    //image create by existing image and as back ground
    list($width, $height, $type, $attr) = getimagesize(getThemeFile("img/bg_captcha.png"));
    $TextColor = imagecolorallocate($BgImage, 247, 250, 249);
    //text color-white
    imagestring($BgImage, 3, 50, 9, $ResultStr, $TextColor);
    $NewImage = imagecreatetruecolor($width * 0.5, $height * 0.5);
    #imagecopyresampled($NewImage, $BgImage, 0, 0, 0, 0, $width * 0.5, $height * 0.5, $width, $height);
    #imageantialias($NewImage, true );
    $_SESSION['key'] = $ResultStr;
    // carry the data through session
    header("Content-type: image/jpeg");
    // out out the image
    imagejpeg($BgImage);
    //Output image to browser
}
Ejemplo n.º 7
0
 function render_tr(&$task, $style = "")
 {
     global $PH;
     global $g_resolve_reason_names;
     if (!isset($task) || !is_object($task)) {
         trigger_error("ListBlock->render_tr() called without valid object", E_USER_WARNING);
         return;
     }
     $buffer = '';
     ### collapsed view ###
     $html_link = '<b>' . $task->getLink(false, false) . '</b>';
     if ($task->view_collapsed) {
         $buffer .= $PH->getLink('taskToggleViewCollapsed', "<img src=\"" . getThemeFile("img/toggle_folder_closed.gif") . "\">", array('tsk' => $task->id), NULL, true) . $html_link;
     } else {
         $buffer .= $PH->getLink('taskToggleViewCollapsed', "<img src=\"" . getThemeFile("img/toggle_folder_open.gif") . "\">", array('tsk' => $task->id), NULL, true) . $html_link . '<br>';
         $editable = false;
         if (Task::getEditableById($task->id)) {
             $editable = true;
         }
         $buffer .= "<div class=description>";
         $buffer .= wikifieldAsHtml($task, 'description');
         $buffer .= "</div>";
     }
     echo '<td>' . $buffer . '</td>';
 }
Ejemplo n.º 8
0
 function render_tr(&$person, $style = "")
 {
     global $PH;
     global $g_prio_names;
     $projects = $person->getProjects();
     print "<td>";
     if ($projects) {
         $str_delimiter = "";
         foreach ($projects as $p) {
             $tooltip = "";
             if (isset($g_prio_names[$p->prio])) {
                 $tooltip = 'title="' . sprintf(__('Priority is %s'), $g_prio_names[$p->prio]) . '"';
             }
             $img_prio = "<img {$tooltip} src=\"" . getThemeFile("img/prio_{$p->prio}.png") . "\">";
             $link = $PH->getLink('projView', $p->getShort(), array('prj' => $p->id));
             print $str_delimiter . $img_prio . $link;
             $str_delimiter = ", ";
         }
     }
     print "</td>";
 }
Ejemplo n.º 9
0
 public function __toString()
 {
     global $auth;
     $onload_javascript = $this->page->extra_onload_js;
     ### include theme-config ###
     if ($theme_config = getThemeFile("theme_config.inc.php")) {
         require_once $theme_config;
     }
     ### Set uft8
     header("Content-type: text/html; charset=utf-8");
     ### Disable page caching ###
     header("Expires: -1");
     header("Cache-Control: post-check=0, pre-check=0");
     header("Pragma: no-cache");
     header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
     $title = asHtml($this->page->title) . '/' . asHtml($this->page->title_minor) . ' - ' . confGet('APP_NAME');
     $buffer = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">' . '<html>' . '<head>' . '<meta http-equiv="Content-type" content="text/html; charset=utf-8">';
     if (isset($auth->cur_user->language)) {
         $buffer .= '<meta http-equiv="Content-Language" content="' . $auth->cur_user->language . '">';
     }
     $buffer .= '<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">' . '<META HTTP-EQUIV="EXPIRES" CONTENT="-1">' . '<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">' . '<link rel="SHORTCUT ICON" href="./favicon.ico">' . "<title>{$title}</title>";
     /**
      * use Starlight syntax highlighting if enabled and client uses Gecko
      */
     if (confGet('LINK_STAR_LIGHT') && preg_match("/Gecko/i", getServerVar('HTTP_USER_AGENT'), $matches)) {
         $buffer .= "<link rel=\"stylesheet\" href=\"themes/starlight/star-light.css\" type=\"text/css\"/>";
     }
     $buffer .= "<link rel=\"stylesheet\" title=\"top\" media=\"screen\" type=\"text/css\" href=\"" . getThemeFile("styles.css") . "?v=" . confGet('STREBER_VERSION') . "\">";
     $buffer .= "<!--[if IE]><link rel=\"stylesheet\" title=\"ie\" media=\"screen\" type=\"text/css\" href=\"" . getThemeFile("styles_ie.css") . "?v=" . confGet('STREBER_VERSION') . "\"><![endif]-->";
     ### link print-style ###
     if (confGet('LINK_STYLE_PRINT')) {
         $buffer .= "<link rel=\"stylesheet\" media=\"print, embossed\" type=\"text/css\" href=\"" . getThemeFile("styles_print.css") . "?v=" . confGet('STREBER_VERSION') . "\">";
     }
     ### Add iphone layout hints
     if (stristr(getServerVar('HTTP_USER_AGENT'), "iPhone")) {
         $buffer .= '<meta name = "viewport"  content = "initial-scale = 0.7, user-scalable = no">';
         $buffer .= '<link rel="stylesheet"  media="screen" type="text/css" href="' . getThemeFile("iphone.css") . "?v=" . confGet('STREBER_VERSION') . '">';
         $onload_javascript = 'window.scrollTo(0, 1);';
     }
     $buffer .= '<script type="text/javascript" src="js/jquery-1.8.2.js"></script>' . '<script type="text/javascript" src="js/jquery.jeditable.1.5.x.js"></script>' . '<script type="text/javascript" src="js/misc.js' . "?v=" . confGet('STREBER_VERSION') . '"></script>' . '<script type="text/javascript" src="js/listFunctions.js' . "?v=" . confGet('STREBER_VERSION') . '"></script>';
     if ($this->page->use_autocomplete) {
         $buffer .= '<script type="text/javascript" src="js/jquery.autocomplete.1.0.2.js' . "?v=" . confGet('STREBER_VERSION') . '"></script>';
         $buffer .= '<link rel="stylesheet" type="text/css" href="' . getThemeFile("jquery.autocomplete.css") . '?v=' . confGet('STREBER_VERSION') . '" />';
     }
     $buffer .= '
     <script type="text/javascript">
     ';
     if (confGet('TASKDETAILS_IN_SIDEBOARD')) {
         $buffer .= "var g_enable_sideboard= true;";
     } else {
         $buffer .= "var g_enable_sideboard= false;";
     }
     ### assemble onLoad function
     $buffer .= '
     <!--
         //------ on load -------
         $(document).ready(function(){
     ';
     $buffer .= $onload_javascript;
     if ($this->page->use_autocomplete) {
         $buffer .= 'initAutocompleteFields();';
     }
     if ($this->page->autofocus_field) {
         $buffer .= "\r\ndocument.my_form." . $this->page->autofocus_field . ".focus();\r\ndocument.my_form." . $this->page->autofocus_field . ".select();";
     }
     $buffer .= 'initContextMenus();';
     if ($q = get('q')) {
         $q = asCleanString($q);
         if ($ar = explode(" ", $q)) {
             foreach ($ar as $q2) {
                 if ($q2) {
                     $buffer .= "highlightWord(document.getElementsByTagName('body')[0],'{$q2}'); ";
                 }
             }
         } else {
             $buffer .= "highlightWord(document.getElementsByTagName('body')[0],'{$q}'); ";
         }
     }
     $buffer .= "misc();\r\n                   listFunctions();\r\n\r\n            });\r\n\r\n        //-->\r\n        </script>" . "<script type=\"text/javascript\" src=\"js/contextMenus.js\"></script>" . "<script type=\"text/javascript\" src=\"js/searchhi.js\"></script>" . "<script type=\"text/javascript\">\r\n            cMenu.menus=new Object();\r\n        </script>";
     /**
      * for notes on searchi see: http://www.kryogenix.org/code/browser/searchhi/
      */
     ### add calendar-functions for form-pages ###
     # NOTE: including calendar tremedously increases loading time!
     if ($this->page->use_jscalendar) {
         $buffer .= '<style type="text/css">@import url(' . getThemeFile('/calendar-win2k-1.css') . ');</style>' . '<script type="text/javascript" src="js/calendar.js"></script>' . '<script type="text/javascript" src="js/lang/calendar-en.js"></script>' . '<script type="text/javascript" src="js/calendar-setup.js"></script>' . '<script type="text/javascript" src="js/dragslider.js"></script>';
     }
     ### add extra html ###
     $buffer .= $this->page->extra_header_html;
     $buffer .= "\r\n        </head>";
     $buffer .= '<body ';
     global $PH;
     if (isset($PH->cur_page_id)) {
         $buffer .= "class=\"{$PH->cur_page_id}\"";
     }
     #$buffer.="updateTableColor();";
     $buffer .= '>';
     # close body tag & onload
     $buffer .= "<div class=\"noscript\"><noscript>";
     $buffer .= __("This page requires java-script to be enabled. Please adjust your browser-settings.");
     $buffer .= "</noscript></div><div id=\"outer\">";
     return $buffer;
 }
Ejemplo n.º 10
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;
     }
     $link = $PH->getLink('taskViewAsDocu', $task->name, array('tsk' => $task->id));
     $toggle = '';
     if ($task->category == TCATEGORY_FOLDER) {
         if ($task->view_collapsed) {
             $toggle = $PH->getLink('taskToggleViewCollapsed', '<img src="' . getThemeFile("img/toggle_folder_closed.gif") . '">', array('tsk' => $task->id), 'folder_collapsed', true);
         } else {
             $toggle = $PH->getLink('taskToggleViewCollapsed', '<img src="' . getThemeFile("img/toggle_folder_open.gif") . '">', array('tsk' => $task->id), 'folder_open', true);
         }
     }
     $html_indention = '';
     if ($task->level) {
         $no_folder = $task->category == TCATEGORY_FOLDER ? 0 : 1;
         $html_indention = "style='padding-left:" . 1.2 * ($no_folder + intval($task->level)) . "em;'";
     }
     echo "<td {$html_indention}>{$toggle}{$link}</td>";
 }
Ejemplo n.º 11
0
 /**
  * overwrites block function
  * called by render_blockEnd()
  */
 function render_blockFooter()
 {
     global $PH;
     #echo "x6</div>x7";  #close block_content
     #echo "</div>";  #close block_content
     #--- footer extras ----
     $context_menu_def = "";
     $context_menu_rows = "";
     if ($this->show_footer && ($this->show_pages || $this->show_functions || $this->show_icons)) {
         echo "<div class=block_footer>";
         #--- icons --------
         if ($this->show_icons && $this->functions) {
             echo "<span class=icons>";
             foreach ($this->functions as $f) {
                 if ($f->icon) {
                     $tooltip = $f->tooltip ? "title='" . asHtml($f->tooltip) . "'" : "title='" . asHtml($f->name) . "'";
                     echo "<a {$tooltip} href=\"javascript:document.my_form.go.value='{$f->target}';document.my_form.submit();\"><img src='" . getThemeFile('icons/' . $f->icon . ".gif") . "'></a>";
                 } else {
                     echo "&nbsp;";
                 }
             }
             echo "</span>";
         }
         #--- text-labels --------
         if (!$this->show_icons && $this->functions) {
             echo "<span class=list_functions>";
             foreach ($this->functions as $f) {
                 if ($f->label) {
                     $tooltip = $f->tooltip ? "title='" . asHtml($f->tooltip) . "'" : "title='" . asHtml($f->name) . "'";
                     echo "<a {$tooltip} href=\"javascript:document.my_form.go.value='{$f->target}';document.my_form.submit();\">" . asHtml($f->label) . "</a>";
                 }
             }
             echo "</span>";
         }
         #--- menu ------------------
         if ($this->show_functions && $this->functions && $this->show_icons) {
             $name_select = "select_" . $this->id;
             $flag_visible = false;
             # only show if contains at least one function
             $buffer = "";
             $buffer .= "<span class=functions>";
             $buffer .= "";
             $buffer .= "<select class=menu name='{$name_select}' size=1 onChange=\"javascript:document.my_form.go.value=document.my_form.{$name_select}.options[document.my_form.{$name_select}.selectedIndex].value;document.my_form.submit();\">";
             $buffer .= "<option value='home' selected>" . __("do...") . "</option>";
             foreach ($this->functions as $f) {
                 if (!$f->icon) {
                     $buffer .= "<option value='{$f->target}'>{$f->name}</option>";
                     $flag_visible = true;
                 }
             }
             $buffer .= "</select>";
             $buffer .= "</span>";
             if ($flag_visible) {
                 echo $buffer;
             }
         }
         #--- footerlinks -----------
         if ($this->footer_links) {
             echo "<span class='links'>";
             foreach ($this->footer_links as $fl) {
                 echo $fl;
             }
             echo "</span>";
         }
         #--- summary --------------------
         echo "<span class=summary>&nbsp;{$this->summary}</span>\n";
         #if($this->show_pages) {
         #    echo "<span class=items>20 of 234&nbsp;&nbsp;&nbsp;</span>";
         #    echo "<span class=pages>  Page 1 2 3 4</span>";
         #}
         echo "</div><!-- end list footer-->";
     }
     foreach ($this->functions as $f) {
         if ($f->context_menu) {
             $context_menu_def .= "{type:'submit', name:'{$f->name}',   go:'{$f->target}'},\n";
             $context_menu_rows .= "<tr><td class=menuItem>{$f->name}</td></tr>\n";
         }
     }
     #parent::render_blockEnd();
     #--- write context-menu-definition -------------
     if ($context_menu_def) {
         echo "<script  type='text/javascript'>\r\n                    cMenu.menus['{$this->id}']=\r\n                    {   menuID:'contextMenu_{$this->id}',\r\n                        items:[\r\n                        {$context_menu_def}\r\n                    ] };</script>";
         echo "\n<div id='contextMenu_{$this->id}' class='contextMenus' onclick='hideContextMenus( )'" . " onmouseup='execMenu(event)' onmouseover='toggleHighlight(event)'" . " onmouseout='toggleHighlight(event)' style='display:none'>" . "<table><tbody>" . $context_menu_rows . "</tbody></table>" . "</div> <!-- end context-menu-->";
     }
 }
 function render_th()
 {
     if ($this->key == "_select_col_") {
         $title = __("Select / Deselect");
         echo "<th class=select_col title='{$title}' style='width:1%'>";
         echo "<a href='#'>";
         echo "<img src=\"" . getThemeFile("img/list_check_range.png") . "\">";
         echo "</a>";
         echo "</th>";
     }
 }
Ejemplo n.º 13
0
 function render_tr(&$obj, $style = "")
 {
     if (!isset($obj) || !$obj instanceof Effort) {
         trigger_error("ListBlock->render_tr() called without valid object", E_USER_WARNING);
         return;
     }
     if ($obj->as_duration) {
         echo "<td>-</td>";
     } else {
         /*if($obj->getStatus()){
         			$sum_task = Effort::getSumEfforts(array('project'=>$obj->project, 'task'=>$obj->task, 'status'=>$obj->status));
         			$sum_proj = Effort::getSumEfforts(array('project'=>$obj->project, 'status'=>$obj->status));
         		}
         		else{*/
         $sum_task = Effort::getSumEfforts(array('project' => $obj->project, 'task' => $obj->task));
         $sum_proj = Effort::getSumEfforts(array('project' => $obj->project));
         #}
         if ($sum_task && $sum_proj) {
             $max_length_value = 3;
             $get_percentage = $sum_task / $sum_proj * 100;
             $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;'>";
             echo " " . round($get_percentage, 1) . "%";
             echo "</nobr>";
             echo "</td>";
         } else {
             echo "<td>-</td>";
         }
     }
 }