phpCollab Community
Discuss everything phpCollab!

The forums are currently in READ-ONLY mode while we upgrade the forums.
Home » Development » Modifications » [MOD] Subtasks on Home Page
[MOD] Subtasks on Home Page [message #7712] Wed, 28 June 2006 00:54 Go to next message
rcave is currently offline  rcave
Messages: 13
Registered: June 2006
phpCollab guest
Since dracono's file attachments for the subtasks mod disappeared with the forum move (see http://www.php-collab.org/community/index.php?t=msg&th=2 033), here are my code changes to view subtasks on the home page. It's too bad that the phpCollab project is running on fumes as it's a great Open Source applicaiton.

All changes were made to phpCollab 2.5 rc3

============================
database change
============================

Alter the sorting table - here is the mysql SQL:
ALTER TABLE sorting ADD column home_subtasks varchar(155) default NULL;


============================
includes/settings.php
============================

Under comment "# show items for home" add:
$showHomeSubtasks =  "true";


============================
languages/lang_en.php
(or comparable languages file)
============================

Add:
$strings["my_subtasks"] = "My Subtasks";


============================
includes/request.class.php
============================

Find:
function openSorting($querymore,$start="",$rows="")

Inside the while loop and at the bottom, add:
$this->sor_home_subtasks[] = ($row[27]);


=============================
general/home.php
=============================

Before:
/**
 * start to show the discussion block
 */

if ($showHomeDiscussions)


Add the following:
Note: I couldn't get the palette icons to work correctly (you need both variables for a task id and subtask id but can only provide one variable), so I removed the icons.

// Subtasks start
/**
* start to show the subtask
*/
if ($showHomeSubtasks)
{
    $block2a = new block();

    $block2a->form = "xwbR";
    $block2a->openForm("../general/home.php?".session_name()."=".session_id()."#".$block2a->form."Anchor");

    $block2a->headingToggle($strings["my_subtasks"]);

// Can't get this working as you need to have a "id=$id&task=$tid" in the link
/*
    $block2a->openPaletteIcon();
    $block2a->paletteIcon(0,"remove",$strings["delete"]);
    //$block2a->paletteIcon(1,"copy",$strings["copy"]);
    //$block2a->paletteIcon(2,"export",$strings["export"]);
    $block2a->paletteIcon(3,"info",$strings["view"]);
    $block2a->paletteIcon(4,"edit",$strings["edit"]);
    $block2a->closePaletteIcon();
*/
    $block2a->sorting("home_subtasks",$sortingUser->sor_home_subtasks[0],"subtas.name ASC",$sortingFields = array(0=>"subtas.name",1=>"subtas.priority",2=>"subtas.status",3=>"subtas.completion",4=>"subtas.due_date",5=>"mem.login",6=>"subtas.task",7=>"subtas.published"));

    $tmpquery = "WHERE subtas.assigned_to = '$idSession'";

    $listSubtasks = new request();
    $listSubtasks->openSubtasks($tmpquery);
    $comptListSubtasks = count($listSubtasks->subtas_id);

    for ($i=0;$i<$comptListSubtasks;$i++) {
        $subtasks .= $listSubtasks->subtas_task[$i];
        if ($i != $comptListSubtasks-1) {
            $subtasks .= ",";
        }
    }

    if ($subtasks != "") {
        $tmpquery = "WHERE subtas.assigned_to = '$idSession' AND subtas.status IN(0,2,3) AND tas.status IN(0,2,3) ORDER BY $block2a->sortingValue";
    }

    $listTasks = new request();
    $listTasks->openSubtasks($tmpquery);
    $comptListTasks = count($listTasks->subtas_id);

    if ($comptListTasks != "0")
    {
        $block2a->openResults();

        $block2a->labels($labels = array(0=>$strings["name"],1=>$strings["priority"],2=>$strings["status"],3=>$strings["completion"],4=>$strings["due_date"],5=>$strings["assigned_by"],6=>$strings["task"],7=>$strings["published"]),"true");

    for ($i=0;$i<$comptListTasks;$i++)
    {
    if ($listTasks->subtas_due_date[$i] == "")
    {
        $listTasks->subtas_due_date[$i] = $strings["none"];
    }
    $idStatus = $listTasks->subtas_status[$i];
    $idPriority = $listTasks->subtas_priority[$i];
    $idPublish = $listTasks->subtas_published[$i];
    $complValue = ($listTasks->subtas_completion[$i]>0) ? $listTasks->subtas_completion[$i]."0 %": $listTasks->subtas_completion[$i]." %";

    //skip completed tasks
    //28/05/03 Florian DECKERT
    if ($idStatus == 1) continue;

    $block2a->openRow();
    $block2a->checkboxRow($listTasks->subtas_id[$i]);

    if ($listTasks->subtas_assigned_to[$i] == "0")
    {
        $block2a->cellRow($blockPage->buildLink("../subtasks/viewsubtask.php?id=".$listTasks->subtas_id[$i]."&task=".$listTasks->subtas_task[$i],$listTasks->subtas_name[$i],in)." -> ".$strings["subtask"]);
    }
    else
    {
        $block2a->cellRow($blockPage->buildLink("../subtasks/viewsubtask.php?id=".$listTasks->subtas_id[$i]."&task=".$listTasks->subtas_task[$i],$listTasks->subtas_name[$i],in));
    }
    $block2a->cellRow("<img src=\"../themes/".THEME."/gfx_priority/".$idPriority.".gif\" alt=\"\"> ".$priority[$idPriority]);
    $block2a->cellRow($status[$idStatus]);
    $block2a->cellRow($complValue);

    if ($listTasks->subtas_due_date[$i] <= $date && $listTasks->subtas_completion[$i] != "10") {
        $block2a->cellRow("<b>".$listTasks->subtas_due_date[$i]."</b>");
    } else {
        $block2a->cellRow($listTasks->subtas_due_date[$i]);
    }

    $block2a->cellRow($blockPage->buildLink($listTasks->subtas_mem2_email_work[$i],$listTasks->subtas_mem2_login[$i],mail));
    $block2a->cellRow($listTasks->subtas_tas_name[$i]);
    if ($sitePublish == "true")
    {
        $block2a->cellRow($statusPublish[$idPublish]);
    }
    $block2a->closeRow();
    }
    $block2a->closeResults();
    }
    else
    {
        $block2a->noresults();
    }
    $block2a->closeToggle();
    $block2a->closeFormResults();
// Can't get this working as you need to have a "id=$id&task=$tid" in the link
/*
    $block2a->openPaletteScript();
    $block2a->paletteScript(0,"remove","../subtasks/deletesubtasks.php?id=$id","false,true,true",$strings["delete"]);
    //$block2a->paletteScript(1,"copy","../subtasks/editsubtask.php?docopy=true","false,true,false",$strings["copy"]);
    //$block2a->paletteScript(2,"export","export.php?","false,true,true",$strings["export"]);
    $block2a->paletteScript(3,"info","../subtasks/viewsubtask.php?id=$id","false,true,false",$strings["view"]);
    $block2a->paletteScript(4,"edit","../subtasks/editsubtask.php?id=$id","false,true,true",$strings["edit"]);
    $block2a->closePaletteScript($comptListTasks,$listTasks->subtas_id);
*/

}

// Subtasks end
Re: [MOD] Subtasks on Home Page [message #7728 is a reply to message #7712] Wed, 19 July 2006 11:50 Go to previous messageGo to next message
fvandijk
Messages: 11
Registered: July 2006
phpCollab guest
Many thanks for this mod. Much needed and works like a charm. Now I only have to find out how to have phases, tasks and subtasks sorted on name instead of systemnumber.

Any idea if this has been worked on before?
Re: [MOD] Subtasks on Home Page [message #7729 is a reply to message #7728] Wed, 19 July 2006 20:37 Go to previous messageGo to next message
rcave is currently offline  rcave
Messages: 13
Registered: June 2006
phpCollab guest
Have you tried clicking on the column name? It should sort ASC/DESC based on the column that you select. An arrow will appear next to the column name to signify the sort.
Re: [MOD] Subtasks on Home Page [message #7770 is a reply to message #7712] Thu, 10 August 2006 11:08 Go to previous message
fvandijk
Messages: 11
Registered: July 2006
phpCollab guest
I meant in the project_site module, which does not have that functionality. I've already changed some things in doclist.php (see topic [MOD] documents) to get to what I intended, but I still need some pointers there.
Previous Topic: [MOD] projects site: documents list as a tree view
Next Topic: [MOD] Add a shared team/client tasks calendar. *VERSION 3*
Goto Forum:
  


Current Time: Thu Jun 20 08:29:46 CEST 2013

Total time taken to generate the page: 0.21571 seconds