/**
  * Factory method for instantiating ListBlock without using new.
  * @return ListBlock
  */
 static function make()
 {
     $args = func_get_args();
     $blocks = new ListBlock();
     $blocks->add($args, self::APPEND);
     return $blocks;
 }
 function testAppendFail()
 {
     $block = new ListBlock();
     try {
         $block->append(false);
         $this->fail('Should throw exception!');
     } catch (InputTypeCheckException $e) {
         $this->assertTrue(true);
     } catch (Exception $e) {
     }
 }
 public function __construct($args = NULL)
 {
     global $PH;
     parent::__construct();
     $this->id = 'comments';
     $this->no_items_html = $PH->getLink('commentNew');
     $this->title = __("Comments");
     #--- columns ----
     $this->add_col(new ListBlockCol_CommentPoster());
     $this->add_col(new ListBlockCol_CommentText());
     ### functions
     $this->add_function(new ListFunction(array('target' => $PH->getPage('itemsAsBookmark')->id, 'name' => __('Mark as bookmark'), 'id' => 'itemsAsBookmark', 'context_menu' => 'submit')));
     /**
     * NOTE the following functions only work if quick-edit
     * form is shown (so not for folders). I am not sure, if
     * we need this function.
     *
     
     $this->add_function(new ListFunction(array(
         'target'=>$PH->getPage('taskCollapseAllComments')->id,
         'name'  =>__('Shrink All Comments'),
         'id'    =>'commentsCollapseView',
         'label' => __('Collapse All Comments'),
         'context_menu'=>'submit',
     )));
     $this->add_function(new ListFunction(array(
         'target'=>$PH->getPage('taskExpandAllComments')->id,
         'name'  =>__('Expand All Comments'),
         'id'    =>'commentsExpandViesw',
         'label' => __('Expand All Comments'),
         'context_menu'=>'submit',
     )));
     */
 }
 function renderListHtml(&$efforts = NULL)
 {
     $this->render_header();
     if (!$efforts && $this->no_items_html) {
         $this->render_tfoot_empty();
     } else {
         $this->render_thead();
         $sum = 0.0;
         foreach ($efforts as $e) {
             $this->render_trow($e);
         }
         /*if($efforts[0]->getStatus()){
         			$sum_proj = Effort::getSumEfforts(array('project'=>$efforts[0]->project, 'status'=>$efforts[0]->status));
         		}
         		else{*/
         $sum_proj = Effort::getSumEfforts(array('project' => $efforts[0]->project));
         #}
         if ($sum_proj) {
             $sum += $sum_proj / 60 / 60 * 1.0;
         }
         $sum = round($sum, 1);
         $this->summary = sprintf(__("Total effort sum: %s hours"), $sum);
         $this->render_tfoot();
         parent::render_blockEnd();
     }
 }
 public function __construct($args = NULL)
 {
     parent::__construct($args);
     global $PH;
     global $auth;
     $this->id = 'bookmarks';
     $this->title = __('Your bookmarks');
     $this->no_items_html = __("You have no bookmarks");
     $this->show_icons = true;
     $this->add_col(new ListBlockColSelect());
     $this->add_col(new ListBlockCol_ItemType());
     $this->add_col(new ListBlockCol_ItemMonitored());
     #$this->add_col(new ListBlockCol_ItemStatus());
     #$this->add_col(new ListBlockCol_ItemState());
     #$this->add_col(new ListBlockCol_ItemProjectName());
     $this->add_col(new ListBlockCol_ItemName());
     $this->add_col(new ListBlockCol_ItemComment());
     $this->add_col(new ListBlockCol_ItemRemind());
     #$this->add_col(new ListBlockCol_ItemModifier());
     $this->add_col(new ListBlockCol_ItemModified());
     $this->add_function(new ListFunction(array('target' => $PH->getPage('itemBookmarkEdit')->id, 'name' => __('Edit bookmark'), 'id' => 'itemBookmarkEdit', 'icon' => 'edit', 'context_menu' => 'submit')));
     $this->add_function(new ListFunction(array('target' => $PH->getPage('itemsRemoveBookmark')->id, 'name' => __('Remove bookmark'), 'id' => 'itemsRemoveBookmark', 'context_menu' => 'submit')));
     ### block style functions ###
     $this->add_blockFunction(new BlockFunction(array('target' => 'changeBlockStyle', 'key' => 'list', 'name' => __('List', 'List sort mode'), 'params' => array('style' => 'list', 'block_id' => $this->id, 'page_id' => $PH->cur_page->id), 'default' => true)));
     $this->groupings = new BlockFunction_grouping(array('target' => 'changeBlockStyle', 'key' => 'grouped', 'name' => __('Grouped', 'List sort mode'), 'params' => array('style' => 'grouped', 'block_id' => $this->id, 'page_id' => $PH->cur_page->id)));
     $this->add_blockFunction($this->groupings);
     ### list groupings ###
     $this->groupings->groupings = array(new ListGroupingType());
 }
 function renderListHtml(&$project = NULL)
 {
     $this->render_header();
     if (!$project && $this->no_items_html) {
         $this->render_tfoot_empty();
     } else {
         $this->render_thead();
         $this->render_trow($project);
         $this->render_tfoot();
         parent::render_blockEnd();
     }
 }
 function renderListHtml(&$efforts = NULL)
 {
     $this->render_header();
     if (!$efforts && $this->no_items_html) {
         $this->render_tfoot_empty();
     } else {
         $this->render_thead();
         foreach ($efforts as $e) {
             $this->render_trow($e);
         }
         $this->render_tfoot();
         parent::render_blockEnd();
     }
 }
 public function __construct($args = NULL)
 {
     parent::__construct($args);
     global $PH;
     global $auth;
     $this->id = 'forwarded_tasks';
     $this->title = __('Your demand notes');
     $this->no_items_html = __('You have no demand notes');
     $this->show_icons = true;
     $this->add_col(new ListBlockCol_ForwardedTaskStatus());
     $this->add_col(new ListBlockCol_ForwardedTaskName());
     $this->add_col(new ListBlockCol_ForwardedTaskComment());
     $this->add_col(new ListBlockCol_ForwardedTaskModified());
 }
 public function __construct($args = NULL)
 {
     parent::__construct($args);
     $this->id = 'projects';
     $this->title = "related Projects";
     $this->add_col(new ListBlockColSelect());
     $this->add_col(new ListBlockColPrio(array('key' => 'prio', 'name' => "P", 'tooltip' => __("Project priority (the icons have tooltips, too)"), 'sort' => 1)));
     $this->add_col(new ListBlockColStatus(array('key' => 'status', 'name' => "S", 'tooltip' => __("Task-Status"), 'sort' => 0)));
     $this->add_col(new ListBlockColMethod(array('id' => 'company', 'key' => 'c.name', 'name' => __("Company"), 'tooltip' => __("Company"), 'func' => 'getCompanyLink')));
     /*$this->add_col( new ListBlockColFormat(array(
           'key'=>'short',
           'name'=>"Name Short",
           'tooltip'=>"Shortnames used in other lists",
           'sort'=>0,
           'format'=>'<nobr><a href="index.php?go=projView&amp;prj={?id}">{?short}</a></nobr>'
       )));*/
     $this->add_col(new ListBlockCol_ProjectName());
     /*$this->add_col( new ListBlockColFormat(array(
           'key'=>'name',
           'name'=>__("Project"),
           'tooltip'=>__("Task name. More Details as tooltips"),
           'width'=>'30%',
           'sort'=>0,
           'format'=>'<a href="index.php?go=projView&amp;prj={?id}">{?name}</a>'
       )));
       */
     $this->add_col(new ListBlockColFormat(array('key' => 'status_summary', 'name' => __("Status Summary"), 'tooltip' => __("Short discription of the current status"), 'format' => '{?status_summary}')));
     $this->add_col(new ListBlockCol_ProjectPeople());
     $this->add_col(new ListBlockCol_ProjectEffortSum());
     $this->add_col(new ListBlockColMethod(array('name' => __("Tasks"), 'tooltip' => __("Number of open Tasks"), 'sort' => 0, 'func' => 'getNumTasks', 'style' => 'right', 'id' => 'tasks')));
     $this->add_col(new ListBlockColDate(array('key' => 'date_start', 'name' => __("Opened"), 'tooltip' => __("Day the Project opened"), 'sort' => 0)));
     $this->add_col(new ListBlockColDate(array('key' => 'date_closed', 'name' => __("Closed"), 'tooltip' => __("Day the Project state changed to closed"), 'sort' => 0)));
     #---- functions ------------------------
     global $PH;
     $this->add_function(new ListFunction(array('target' => $PH->getPage('projEdit')->id, 'name' => __('Edit project'), 'id' => 'projEdit', 'icon' => 'edit', 'context_menu' => 'submit')));
     $this->add_function(new ListFunction(array('target' => $PH->getPage('projDelete')->id, 'name' => __('Delete project'), 'id' => 'projDelete', 'icon' => 'delete')));
     $this->add_function(new ListFunction(array('target' => $PH->getPage('effortNew')->id, 'name' => __('Log hours for a project'), 'id' => 'effortNew', 'context_menu' => 'submit', 'icon' => 'loghours')));
     $this->add_function(new ListFunction(array('target' => $PH->getPage('projChangeStatus')->id, 'name' => __('Open / Close'), 'id' => 'projOpenClose', 'context_menu' => 'submit')));
     $this->add_function(new ListFunction(array('target' => $PH->getPage('projNew')->id, 'name' => __('Create new project'), 'id' => 'projNew', 'icon' => 'new', 'context_menu' => 'submit')));
     $this->add_function(new ListFunction(array('target' => $PH->getPage('projCreateTemplate')->id, 'name' => __('Create Template'), 'id' => 'projCreateTemplate', 'dropdown_menu' => true, 'context_menu' => 'submit')));
     $this->add_function(new ListFunction(array('target' => $PH->getPage('projNewFromTemplate')->id, 'name' => __('Project from Template'), 'id' => 'projNewFromTemplate', 'dropdown_menu' => true)));
     $this->add_function(new ListFunction(array('target' => $PH->getPage('itemsAsBookmark')->id, 'name' => __('Mark as bookmark'), 'id' => 'itemsAsBookmark', 'context_menu' => 'submit')));
     ### block style functions ###
     $this->add_blockFunction(new BlockFunction(array('target' => 'changeBlockStyle', 'key' => 'list', 'name' => __('List', 'List sort mode'), 'params' => array('style' => 'list', 'block_id' => $this->id, 'page_id' => $PH->cur_page->id), 'default' => true)));
     $this->groupings = new BlockFunction_grouping(array('target' => 'changeBlockStyle', 'key' => 'grouped', 'name' => __('Grouped', 'List sort mode'), 'params' => array('style' => 'grouped', 'block_id' => $this->id, 'page_id' => $PH->cur_page->id)));
     $this->add_blockFunction($this->groupings);
     ### list groupings ###
     $this->groupings->groupings = array(new ListGroupingStatus(), new ListGroupingPrio(), new ListGroupingCompany());
 }
 /**
  *  constructor
  */
 public function __construct(Project $project)
 {
     parent::__construct();
     $this->title = __('Folders');
     if (!$project) {
         trigger_error("ListBlock_taskfolders() needs project-object as argument", E_USER_WARNING);
     }
     $this->task_folders = $project->getFolders();
     #--- render nothing if no folders ---
     if (!count($this->task_folders)) {
         $this->hidden = true;
     }
     #--- in taskView highlight current task ---
     global $PH;
     if ($PH->cur_page_id == 'taskView') {
         $task_id = get('tsk');
         $cur_task = Task::getById($task_id);
         if (!$cur_task) {
             $PH->abortWarning("invalid task-id");
             #@@@ not good inside lists / render Exception might be more appropriate
             return;
         }
         #--- use parent, if not a folder for itself ------
         if (!$cur_task->category == TCATEGORY_FOLDER) {
             $cur_task = Task::getById($cur_task->parent_task);
         }
         if ($cur_task && is_object($cur_task)) {
             $this->cur_task_id = $cur_task->id;
         }
     }
     #--- create task for project-root---
     $task_none = new Task(array('name' => "..none::"));
     $task_none->id = 0;
     $task_none->project = $project->id;
     array_unshift($this->task_folders, $task_none);
     #--- add columns --------------------------------------------------------
     $this->add_col(new ListBlockColSelect());
     $this->add_col(new ListBlockCol_TaskName(array('use_short_names' => true, 'indention' => true, 'use_collapsed' => true, 'show_toggles' => false)));
     $this->add_col(new ListBlockColMethod(array('name' => __("Tasks"), 'tooltip' => __("Number of subtasks"), 'sort' => 0, 'func' => 'getNumSubtasks', 'style' => 'right')));
     #$this->add_col( new ListBlockCol_TaskSumEfforts());
     #--- functions ----------------------------------------
     ### functions ###
     $this->add_function(new ListFunction(array('target' => $PH->getPage('taskEdit')->id, 'name' => __('Edit'), 'id' => 'taskEdit', 'icon' => 'edit', 'context_menu' => 'submit')));
     $this->add_function(new ListFunction(array('target' => $PH->getPage('taskNewFolder')->id, 'name' => __('New'), 'id' => 'taskNewFolder', 'icon' => 'new', 'tooltip' => __('Create new folder under selected task'))));
     $this->add_function(new ListFunction(array('target' => $PH->getPage('tasksMoveToFolder')->id, 'name' => __('Move selected to folder'), 'id' => 'tasksMoveToFolder', 'context_menu' => 'submit', 'dropdown_menu' => 0)));
     $this->add_function(new ListFunction(array('target' => $PH->getPage('effortNew')->id, 'name' => __('Log hours for select tasks'), 'id' => 'effortNew', 'icon' => 'loghours', 'context_menu' => 'submit')));
 }
 public function __construct($args = NULL)
 {
     parent::__construct($args);
     $this->id = 'companies';
     $this->title = __("related companies");
     $this->add_col(new ListBlockColSelect());
     $this->add_col(new ListBlockColFormat(array('key' => 'short', 'name' => __("Name Short"), 'tooltip' => __("Shortnames used in other lists"), 'sort' => 0, 'format' => '<nobr><a href="index.php?go=companyView&amp;company={?id}">{?short}</a></nobr>')));
     $this->add_col(new ListBlockCol_CompanyName());
     $this->add_col(new ListBlockColFormat(array('key' => 'phone', 'name' => __("Phone"), 'tooltip' => __("Phone-Number"), 'format' => '<nobr>{?phone}</nobr>')));
     $this->add_col(new ListBlockColLinkExtern(array('key' => 'homepage', 'name' => "Homepage")));
     $this->add_col(new ListBlockColMethod(array('name' => __("Proj"), 'tooltip' => __("Number of open Projects"), 'func' => 'getNumOpenProjects', 'style' => 'right')));
     $this->add_col(new ListBlockColMethod(array('name' => __("People"), 'id' => "people", 'tooltip' => __("People working for this person"), 'sort' => 0, 'style' => 'nowrap', 'func' => 'getPersonLinks')));
     /*$this->add_col( new ListBlockCol_ProjectEffortSum);
     
         	$this->add_col( new ListBlockColMethod(array(
         		'name'=>"Tasks",
         		'tooltip'=>"Number of open Tasks",
         		'sort'=>0,
         		'func'=>'getNumTasks',
                 'style'=>'right'
         	)));
        		$this->add_col( new ListBlockColDate(array(
     			'key'=>'date_start',
     			'name'=>"Opened",
     			'tooltip'=>"Day the Project opened",
     			'sort'=>0,
     		)));
        		$this->add_col( new ListBlockColDate(array(
     			'key'=>'date_closed',
     			'name'=>"Closed",
     			'tooltip'=>"Day the Project state changed to closed",
     			'sort'=>0,
     		)));
             */
     #---- functions ----
     global $PH;
     $this->add_function(new ListFunction(array('target' => $PH->getPage('companyEdit')->id, 'name' => __('Edit company'), 'id' => 'companyEdit', 'icon' => 'edit', 'context_menu' => 'submit')));
     $this->add_function(new ListFunction(array('target' => $PH->getPage('companyDelete')->id, 'name' => __('Delete company'), 'id' => 'companyDelete', 'icon' => 'delete')));
     $this->add_function(new ListFunction(array('target' => $PH->getPage('companyNew')->id, 'name' => __('Create new company'), 'id' => 'companyNew', 'icon' => 'new', 'context_menu' => 'submit')));
     $this->add_function(new ListFunction(array('target' => $PH->getPage('itemsAsBookmark')->id, 'name' => __('Mark as bookmark'), 'id' => 'itemsAsBookmark', 'context_menu' => 'submit')));
 }
Exemple #12
0
 public function __construct($args = NULL)
 {
     parent::__construct($args);
     global $PH;
     $this->id = 'files';
     $this->title = "Files";
     $this->query_options['order_by'] = "created";
     $this->query_options['latest_only'] = true;
     ### columns ###
     $this->add_col(new ListBlockColSelect());
     $this->add_col(new ListBlockCol_FileThumbnail());
     $this->add_col(new ListBlockCol_FileName());
     $this->add_col(new ListBlockColFormat(array('key' => 'version', 'name' => __("Version"), 'sort' => 0, 'format' => '{?version}')));
     $this->add_col(new ListBlockCol_CreatedBy());
     $this->add_col(new ListBlockColDate());
     $this->add_col(new ListBlockCol_FileSummary());
     ### functions ###
     $this->add_function(new ListFunction(array('target' => $PH->getPage('fileEdit')->id, 'name' => __('Edit file'), 'id' => 'fileEdit', 'icon' => 'edit', 'context_menu' => 'submit')));
     $this->add_function(new ListFunction(array('target' => $PH->getPage('filesDelete')->id, 'name' => __('Delete'), 'id' => 'filesDelete', 'icon' => 'delete', 'context_menu' => 'submit')));
     $this->add_function(new ListFunction(array('target' => $PH->getPage('filesMoveToFolder')->id, 'name' => __('Move files'), 'id' => 'filesMoveToFolder', 'context_menu' => 'submit')));
     $this->add_function(new ListFunction(array('target' => $PH->getPage('itemsAsBookmark')->id, 'name' => __('Mark as bookmark'), 'id' => 'itemsAsBookmark', 'context_menu' => 'submit')));
     /*
     $this->add_function(new ListFunction(array(
         'target'=>$PH->getPage('fileNew')->id,
         'name'  =>__('New file'),
         'id'    =>'fileNew',
         'icon'  =>'new',
         'context_menu'=>'submit',
     )));
     */
     ### block style functions ###
     $this->add_blockFunction(new BlockFunction(array('target' => 'changeBlockStyle', 'key' => 'list', 'name' => __('List', 'List sort mode'), 'params' => array('style' => 'list', 'block_id' => $this->id, 'page_id' => $PH->cur_page->id), 'default' => true)));
     $this->groupings = new BlockFunction_grouping(array('target' => 'changeBlockStyle', 'key' => 'grouped', 'name' => __('Grouped', 'List sort mode'), 'params' => array('style' => 'grouped', 'block_id' => $this->id, 'page_id' => $PH->cur_page->id)));
     $this->add_blockFunction($this->groupings);
     ### list groupings ###
     $this->groupings->groupings = array(new ListGroupingStatus(), new ListGroupingMimetype(), new ListGroupingCreatedBy(), new ListGroupingParentItem());
 }
 public function __construct($args = NULL)
 {
     parent::__construct($args);
     $this->id = 'tasks';
     $this->title = "Versions";
     $this->active_block_function = 'list';
     $this->add_col(new ListBlockColSelect());
     #$this->add_col( new ListBlockColPrio());
     #$this->add_col( new ListBlockColStatus());
     $this->add_col(new ListBlockCol_VersionName());
     $this->add_col(new ListBlockCol_TimeReleased());
     /*$this->add_col( new ListBlockColFormat(array(
           'key'=>'short',
           'name'=>"Name Short",
           'tooltip'=>"Shortnames used in other lists",
           'sort'=>0,
           'format'=>'<nobr><a href="index.php?go=projView&amp;prj={?id}">{?short}</a></nobr>'
       )));*/
     /*$this->add_col( new ListBlockColFormat(array(
           'key'=>'name',
           'name'=>__("Version"),
           'tooltip'=>__("Task name. More Details as tooltips"),
           'width'=>'30%',
           'sort'=>0,
           'format'=>'<a href="index.php?go=projView&amp;prj={?id}">{?name}</a>'
       )));*/
     #---- functions ------------------------
     global $PH;
     ### functions ###
     $this->add_function(new ListFunction(array('target' => $PH->getPage('taskEdit')->id, 'name' => __('Edit'), 'id' => 'taskEdit', 'icon' => 'edit', 'context_menu' => 'submit')));
     $this->add_function(new ListFunction(array('target' => $PH->getPage('itemsAsBookmark')->id, 'name' => __('Mark as bookmark'), 'id' => 'itemsAsBookmark', 'context_menu' => 'submit')));
     $this->query_options['category'] = TCATEGORY_VERSION;
     #$this->query_options['is_released_min']= RELEASED_UPCOMMING;
     $this->query_options['status_min'] = 0;
     $this->query_options['status_max'] = 200;
     $this->query_options['order_by'] = 'created DESC';
 }
 public function __construct($args = NULL)
 {
     parent::__construct($args);
     global $PH;
     global $auth;
     $this->id = 'allchanges';
     $this->title = __("Changes");
     $this->id = "allchanges";
     $this->no_items_html = __('Nothing has changed.');
     $this->add_col(new ListBlockColSelect());
     ## from list_projectchanages.inc.php ##
     $this->add_col(new ListBlockCol_ChangesByPerson());
     $this->add_col(new ListBlockCol_ChangesEditType());
     $this->add_col(new ListBlockCol_ChangesItemType());
     $this->add_col(new ListBlockCol_AllChangesItemName());
     $this->add_col(new listBlockColDate(array('key' => 'modified', 'name' => __('modified'))));
     ### block style functions ###
     $this->add_blockFunction(new BlockFunction(array('target' => 'changeBlockStyle', 'key' => 'list', 'name' => __('List', 'List sort mode'), 'params' => array('style' => 'list', 'block_id' => $this->id, 'page_id' => $PH->cur_page->id), 'default' => true)));
     $this->groupings = new BlockFunction_grouping(array('target' => 'changeBlockStyle', 'key' => 'grouped', 'name' => __('Grouped', 'List sort mode'), 'params' => array('style' => 'grouped', 'block_id' => $this->id, 'page_id' => $PH->cur_page->id)));
     $this->add_blockFunction($this->groupings);
     ### list groupings ###
     $this->groupings->groupings = array(new ListGroupingModifiedBy(), new ListGroupingItemType());
 }
Exemple #15
0
 /**
  * Delegated implementation of the old settings hook.
  *
  * Cannot be named settings() to avoid clashing with the non-static settings()
  * method in concrete classes.
  */
 public static function settingsAdvanced()
 {
     $arguments = array('!attr' => '<code>rel="nofollow"</code>');
     $ret = array('#type' => 'checkbox', '#title' => t('Apply !attr to links on the "recent searches" and "top searches" blocks', $arguments), '#default_value' => ListBlock::isNoFollowEnabled(), '#return_value' => 1, '#description' => t('An attribute for the "a" (X)HTML alement, !attr is non-standard, but is recognized by several search engines, notably Google, MSN and Yahoo!', $arguments));
     return $ret;
 }
 public function __construct($args = NULL)
 {
     parent::__construct($args);
     $this->id = 'projectpeople';
     $this->title = __("Your related people");
     $this->add_col(new ListBlockColSelect());
     /*$this->add_col( new ListBlockColFormat(array(
     			'key'=>'nickname',
     			'name'=>"Name Short",
     			'tooltip'=>"Shortnames used in other lists",
     			'sort'=>0,
     			'format'=>'<nobr><a href="index.php?go=personView&amp;person={?id}">{?nickname}</a></nobr>'
     		)));*/
     $this->add_col(new ListBlockCol_ProjectPersonName());
     $this->add_col(new ListBlockCol_ProjectJob());
     $this->add_col(new ListBlockCol_ProjectPersonLastLogin());
     #$this->add_col( new ListBlockColFormat(array(
     #	'key'=>'role',
     #	'name'=>__("Rights"),
     #	'tooltip'=>__("People rights in this project"),
     #	'format'=>'{?role}'
     #)));
     /*
     $this->add_col( new ListBlockColFormat(array(
     			'key'=>'phone_personal',
     			'name'=>"Private",
     			'format'=>'<nobr>{?phone_personal}</nobr>'
     		)));
        		$this->add_col( new ListBlockColFormat(array(
     			'key'=>'mobile',
     			'name'=>"Mobil",
     			'format'=>'<nobr>{?phone_mobile}</nobr>'
     		)));
        		$this->add_col( new ListBlockColFormat(array(
     			'key'=>'office',
     			'name'=>"Office",
     			'format'=>'<nobr>{?phone_office}</nobr>'
     		)));
        		$this->add_col( new ListBlockColFormat(array(
     			'key'=>'tagline',
     			'name'=>"Tagline",
     			'format'=>'{?tagline}'
     		)));
         	$this->add_col( new ListBlockColMethod(array(
         		'name'=>"Companies",
         		'sort'=>0,
         		'func'=>'getCompanyLinks',
         	)));
     
     /*$this->add_col( new ListBlockCol_ProjectEffortSum);
     
         	$this->add_col( new ListBlockColMethod(array(
         		'name'=>"Tasks",
         		'tooltip'=>"Number of open Tasks",
         		'sort'=>0,
         		'func'=>'getNumTasks',
         'style'=>'right'
         	)));
        		$this->add_col( new ListBlockColDate(array(
     			'key'=>'date_start',
     			'name'=>"Opened",
     			'tooltip'=>"Day the Project opened",
     			'sort'=>0,
     		)));
        		$this->add_col( new ListBlockColDate(array(
     			'key'=>'date_closed',
     			'name'=>"Closed",
     			'tooltip'=>"Day the Project state changed to closed",
     			'sort'=>0,
     		)));
     */
     #---- functions ----
     global $PH;
     $this->add_function(new ListFunction(array('target' => $PH->getPage('projectPersonEdit')->id, 'name' => __('Edit team member'), 'id' => 'projectPersonEdit', 'icon' => 'edit', 'context_menu' => 'submit')));
     $this->add_function(new ListFunction(array('target' => $PH->getPage('projAddPerson')->id, 'name' => __('Add team member'), 'id' => 'projectPersonAdd', 'icon' => 'add', 'context_menu' => 'submit')));
     $this->add_function(new ListFunction(array('target' => $PH->getPage('projectPersonDelete')->id, 'name' => __('Remove person from team'), 'id' => 'projectPersonDelete', 'icon' => 'sub', 'context_menu' => 'submit')));
     /*$this->add_function(new ListFunction(array(
           'target'=>$PH->getPage('personDelete')->id,
           'name'  =>'Delete person',
           'id'    =>'personDelete',
           'icon'  =>'delete'
       )));
       $this->add_function(new ListFunction(array(
           'target'=>$PH->getPage('personNew')->id,
           'name'  =>'Create new person',
           'id'    =>'personNew',
           'icon'  =>'new',
           'context_menu'=>'submit',
       )));
       */
 }
 function renderListHtml(&$efforts = NULL)
 {
     $this->render_header();
     if (!$efforts && $this->no_items_html) {
         $this->render_tfoot_empty();
     } else {
         $this->render_thead();
         $sum = 0.0;
         $day_last = 0;
         ### grouping ###
         if ($this->groupings && $this->active_block_function == 'grouped' && $this->groupings->active_grouping_obj) {
             $last_group = NULL;
             $gr = $this->groupings->active_grouping_key;
             foreach ($efforts as $e) {
                 if ($last_group != $e->{$gr}) {
                     echo '<tr class=group><td colspan=' . count($this->columns) . '>' . $this->groupings->active_grouping_obj->render($e) . '</td></tr>';
                     $last_group = $e->{$gr};
                 }
                 $sum += (strToClientTime($e->time_end) - strToClientTime($e->time_start)) / 60 / 60 * 1.0;
                 /**
                  * separate new days with style
                  */
                 $day = gmdate('z', strToClientTime($e->time_end)) * 1;
                 if ($day != $day_last) {
                     $day_last = $day;
                     $this->render_trow($e, 'isNewDay');
                 } else {
                     $this->render_trow($e);
                 }
             }
         } else {
             foreach ($efforts as $e) {
                 $sum += (strToClientTime($e->time_end) - strToClientTime($e->time_start)) / 60 / 60 * 1.0;
                 /**
                  * separate new days with style
                  */
                 $day = gmdate('z', strToClientTime($e->time_end)) * 1;
                 if ($day != $day_last) {
                     $day_last = $day;
                     $this->render_trow($e, 'isNewDay');
                 } else {
                     $this->render_trow($e);
                 }
             }
         }
         $sum = round($sum, 1);
         $this->summary = sprintf(__("%s effort(s) with %s hours"), count($efforts), $sum);
         $this->render_tfoot();
         parent::render_blockEnd();
     }
 }
 function renderListHtml(&$efforts = NULL)
 {
     $this->render_header();
     if (!$efforts && $this->no_items_html) {
         $this->render_tfoot_empty();
     } else {
         $this->render_thead();
         $sum_hours = 0.0;
         foreach ($efforts as $e) {
             $this->render_trow($e);
         }
         ## sum effort hours ##
         /*{
         			if($efforts[0]->getStatus()){
         				$sum_proj = Effort::getSumEfforts(array('project'=>$efforts[0]->project, 'status'=>$efforts[0]->status));
         			}
         			else{
         				$sum_proj = Effort::getSumEfforts(array('project'=>$efforts[0]->project));
         			}
         			
         			if($sum_proj){
         				$sum_hours += $sum_proj/60/60 * 1.0;
         			}
         			
         			$sum_hours = round($sum_hours,1);
         		}*/
         $this->render_tfoot();
         parent::render_blockEnd();
     }
 }
 /**
  * render complete
  */
 public function render_list(&$tasks = NULL)
 {
     global $PH;
     require_once confGet('DIR_STREBER') . 'render/render_wiki.inc.php';
     $this->render_header();
     $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) {
             ### get subtasks if expanded
             $this->tasks_open = Task::getAll(array('for_milestone' => $t->id, 'status_min' => STATUS_NEW, 'status_max' => STATUS_COMPLETED, 'project' => $t->project, 'show_folders' => false));
             $this->tasks_closed = Task::getAll(array('for_milestone' => $t->id, 'status_min' => STATUS_APPROVED, 'status_max' => STATUS_CLOSED, 'project' => $t->project, 'show_folders' => false));
             $this->num_closed = count($this->tasks_closed);
             $this->num_open = count($this->tasks_open);
             $this->num_completed = 0;
             $this->sum_estimated_min = 0;
             $this->sum_estimated_max = 0;
             $this->sum_completion_min = 0;
             $this->sum_completion_max = 0;
             foreach ($this->tasks_open as $tt) {
                 $this->sum_estimated_min += $tt->estimated;
                 $this->sum_estimated_max += $tt->estimated_max ? $tt->estimated_max : $tt->estimated;
                 if ($tt->status > STATUS_BLOCKED) {
                     $this->num_completed++;
                     $this->sum_completion_min += $tt->estimated;
                     $this->sum_completion_max += $tt->estimated_max;
                 } else {
                     $this->sum_completion_min += $tt->estimated * $tt->completion / 100;
                 }
             }
             foreach ($this->tasks_closed as $tt) {
                 $this->sum_estimated_min += $tt->estimated;
                 $this->sum_estimated_max += $tt->estimated_max ? $tt->estimated_max : $tt->estimated;
                 $this->sum_completion_min += $tt->estimated;
                 $this->sum_completion_max += $tt->estimated_max;
             }
             if ($this->groupings && $this->active_block_function == 'grouped') {
                 $gr = $this->groupings->active_grouping_key;
                 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};
                 }
             }
             ### done ###
             if (@intval($t->status) >= STATUS_COMPLETED) {
                 $style_row = $style . ' isDone';
             } else {
                 $style_row = $style;
                 $count_estimated += $t->estimated;
             }
             $this->render_trow($t, $style_row);
         }
         $this->render_tfoot();
         parent::render_blockEnd();
     }
 }
Exemple #20
0
 public function __construct($args = NULL)
 {
     global $PH;
     parent::__construct(array());
     $this->id = 'tasks';
     $this->no_items_html = NULL;
     $this->title = __("Tasks");
     ### filter params ###
     if ($args) {
         foreach ($args as $key => $value) {
             if (!isset($this->{$key}) && !is_null($this->{$key}) && !$this->{$key} === "") {
                 trigger_error("unknown parameter", E_USER_NOTICE);
             } else {
                 $this->{$key} = $value;
             }
         }
     }
     /**
      * @@@ dummy-settings for filters
      */
     #$this->filters=array(
     #    new ListFilter_status_min(),
     #    new ListFilter_status_max(),
     #    new ListFilter_not_older(array(
     #        'not_older' => 13*25*60*60,
     #    )),
     #);
     ### columns ###
     $this->add_col(new ListBlockColSelect());
     $this->add_col(new ListBlockColPrio(array('key' => 'prio', 'name' => "P", 'tooltip' => __("Priority of task"), 'sort' => 1)));
     $this->add_col(new ListBlockColMethod(array('key' => 'project', 'name' => __('Project'), 'func' => 'getProjectLink')));
     $this->add_col(new ListBlockColStatus(array('key' => 'status', 'name' => __("Status", "Columnheader"), 'tooltip' => __("Task-Status"), 'sort' => 0)));
     $this->add_col(new ListBlockCol_TaskLabel());
     $this->add_col(new ListBlockColMethod(array('key' => 'parent_task', 'name' => __('Folder'), 'func' => 'getFolderLinks')));
     $this->add_col(new ListBlockCol_TasknameWithFolder());
     $this->add_col(new ListBlockCol_TaskName(array('use_short_names' => $this->use_short_names, 'indention' => true)));
     $this->add_col(new ListBlockCol_TaskAssignedTo(array('use_short_names' => false)));
     $this->add_col(new listBlockColDate(array('key' => 'modified', 'name' => __('Modified', 'Column header'))));
     $this->add_col(new listBlockColDate(array('key' => 'date_closed', 'name' => __('Closed'))));
     #$this->add_col( new ListBlockCol_TaskCreatedBy( array('use_short_names'=>false,'indention'=>true)));
     $this->add_col(new ListBlockColTime(array('key' => 'estimated', 'name' => __("Est."), 'tooltip' => __("Estimated time in hours"), 'sort' => 0)));
     $this->add_col(new ListBlockCol_Milestone());
     $this->add_col(new ListBlockCol_EstimatedComplete());
     $this->add_col(new ListBlockCol_DaysLeft());
     $this->add_col(new ListBlockCol_TaskSumEfforts());
     if (confget('TASK_LIST_EFFORT_RELATION_COLUMN')) {
         $this->add_col(new ListBlockCol_TaskRelationEfforts());
     }
     $this->add_col(new ListBlockColPubLevel());
     ### functions ###
     $this->add_function(new ListFunction(array('target' => $PH->getPage('taskEdit')->id, 'name' => __('Edit'), 'id' => 'taskEdit', 'icon' => 'edit', 'context_menu' => 'submit')));
     $this->add_function(new ListFunction(array('target' => $PH->getPage('taskNew')->id, 'name' => __('Add new Task'), 'id' => 'taskNew', 'icon' => 'new', 'context_menu' => 'submit')));
     $this->add_function(new ListFunction(array('target' => $PH->getPage('taskNewBug')->id, 'name' => __('Report new Bug'), 'id' => 'taskNewBug', 'icon' => 'new', 'context_menu' => 'submit', 'dropdown_menu' => false)));
     $this->add_function(new ListFunction(array('target' => $PH->getPage('commentNew')->id, 'name' => __('Add comment'), 'id' => 'commentNew', 'context_menu' => 'submit')));
     $this->add_function(new ListFunction(array('target' => $PH->getPage('tasksDelete')->id, 'name' => __('Delete'), 'id' => 'tasksDelete', 'icon' => 'delete', 'context_menu' => 'submit')));
     $this->add_function(new ListFunction(array('target' => $PH->getPage('tasksComplete')->id, 'name' => __('Status->Completed'), 'id' => 'tasksCompleted', 'icon' => 'complete', 'context_menu' => 'submit')));
     $this->add_function(new ListFunction(array('target' => $PH->getPage('tasksApproved')->id, 'name' => __('Status->Approved'), 'id' => 'tasksApproved', 'icon' => 'approve', 'context_menu' => 'submit')));
     $this->add_function(new ListFunction(array('target' => $PH->getPage('tasksClosed')->id, 'name' => __('Status->Closed'), 'id' => 'tasksClosed', 'icon' => 'close', 'context_menu' => 'submit')));
     $this->add_function(new ListFunction(array('target' => $PH->getPage('tasksMoveToFolder')->id, 'name' => __('Move tasks'), 'id' => 'tasksMoveToFolder', 'context_menu' => 'submit')));
     $this->add_function(new ListFunction(array('target' => $PH->getPage('effortNew')->id, 'name' => __('Log hours for select tasks'), 'id' => 'effortNew', 'icon' => 'loghours', 'context_menu' => 'submit')));
     $this->add_function(new ListFunction(array('target' => $PH->getPage('itemsAsBookmark')->id, 'name' => __('Mark as bookmark'), 'id' => 'itemsAsBookmark', 'context_menu' => 'submit')));
     ### block style functions ###
     $this->add_blockFunction(new BlockFunction(array('target' => 'changeBlockStyle', 'key' => 'list', 'name' => __('List', 'List sort mode'), 'params' => array('style' => 'list', 'block_id' => $this->id, 'page_id' => $PH->cur_page->id))));
     $this->add_blockFunction(new BlockFunction(array('target' => 'changeBlockStyle', 'key' => 'tree', 'name' => __('Tree', 'List sort mode'), 'params' => array('style' => 'tree', 'block_id' => $this->id, 'page_id' => $PH->cur_page->id))));
     $this->groupings = new BlockFunction_grouping(array('target' => 'changeBlockStyle', 'key' => 'grouped', 'name' => __('Grouped', 'List sort mode'), 'params' => array('style' => 'grouped', 'block_id' => $this->id, 'page_id' => $PH->cur_page->id)));
     $this->add_blockFunction($this->groupings);
     /**
      * @NOTE:
      * - if we deal with tasks of possibily multiple projects, we should list projects 
      *   in path that is shown below the task in "List" mode
      */
     if (!isset($this->filters['project'])) {
         $this->show_project_folder = true;
     }
     ### list groupings ###
     $this->groupings->groupings = array(new ListGroupingFolder(), new ListGroupingStatus(), new ListGroupingPrio(), new ListGroupingCreatedBy());
     $this->initOrderQueryOption('order_id, status, prio');
 }
 public function __construct($args = NULL)
 {
     parent::__construct($args);
     $this->id = 'people';
     $this->title = __("Your related people");
     $this->add_col(new ListBlockColSelect());
     $this->add_col(new ListBlockCol_PersonNickname());
     #$this->add_col( new ListBlockColFormat(array(
     #   'key'=>'nickname',
     #   'name'=>__("Name Short"),
     #   'tooltip'=>__("Shortnames used in other lists"),
     #   'sort'=>0,
     #   'format'=>'<nobr><a href="index.php?go=personView&amp;person={?id}">{?nickname}</a></nobr>'
     #)));
     $this->add_col(new ListBlockCol_PersonName());
     #$this->add_col( new ListBlockColFormat(array(
     #   'key'=>'name',
     #   'name'=>__("Person"),
     #   'tooltip'=>__("Task name. More Details as tooltips"),
     #   'sort'=>0,
     #   'format'=>'<nobr><span class="item person"><a class="item person" href="index.php?go=personView&amp;person={?id}">{?name}</a></span></nobr>'
     #)));
     $this->add_col(new ListBlockCol_PersonProfile());
     $this->add_col(new ListBlockColFormat(array('key' => 'personal_phone', 'name' => __("Private"), 'format' => '<nobr>{?personal_phone}</nobr>')));
     $this->add_col(new ListBlockColFormat(array('key' => 'mobile_phone', 'name' => __("Mobil"), 'format' => '<nobr>{?mobile_phone}</nobr>')));
     $this->add_col(new ListBlockColFormat(array('key' => 'office_phone', 'name' => __("Office"), 'format' => '<nobr>{?office_phone}</nobr>')));
     $this->add_col(new ListBlockColFormat(array('key' => 'tagline', 'name' => __("Tagline"), 'format' => '{?tagline}')));
     $this->add_col(new ListBlockColMethod(array('name' => __("Companies"), 'func' => 'getCompanyLinks', 'id' => 'companies')));
     $this->add_col(new ListBlockCol_PersonProjects());
     $this->add_col(new ListBlockColTimeAgo(array('name' => __("last login"), 'key' => 'last_login')));
     $this->add_col(new ListBlockCol_PersonChanges());
     /*$this->add_col( new ListBlockCol_ProjectEffortSum);
     
             $this->add_col( new ListBlockColMethod(array(
                 'name'=>"Tasks",
                 'tooltip'=>"Number of open Tasks",
                 'sort'=>0,
                 'func'=>'getNumTasks',
                 'style'=>'right'
             )));
             $this->add_col( new ListBlockColDate(array(
                 'key'=>'date_start',
                 'name'=>"Opened",
                 'tooltip'=>"Day the Project opened",
                 'sort'=>0,
             )));
             $this->add_col( new ListBlockColDate(array(
                 'key'=>'date_closed',
                 'name'=>"Closed",
                 'tooltip'=>"Day the Project state changed to closed",
                 'sort'=>0,
             )));
             */
     #---- functions ----
     global $PH;
     $this->add_function(new ListFunction(array('target' => $PH->getPage('personEdit')->id, 'name' => __('Edit person'), 'id' => 'personEdit', 'icon' => 'edit', 'context_menu' => 'submit')));
     $this->add_function(new ListFunction(array('target' => $PH->getPage('personEditRights')->id, 'name' => __('Edit user rights'), 'id' => 'personEditRights', 'context_menu' => 'submit')));
     $this->add_function(new ListFunction(array('target' => $PH->getPage('personDelete')->id, 'name' => __('Delete person'), 'id' => 'personDelete', 'icon' => 'delete')));
     $this->add_function(new ListFunction(array('target' => $PH->getPage('personNew')->id, 'name' => __('Create new person'), 'id' => 'personNew', 'icon' => 'new', 'context_menu' => 'submit')));
     $this->add_function(new ListFunction(array('target' => $PH->getPage('itemsAsBookmark')->id, 'name' => __('Mark as bookmark'), 'id' => 'itemsAsBookmark', 'context_menu' => 'submit')));
 }