Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

working on logtimes views and sidebars for messages, logtime and project

  • Loading branch information...
commit b0423ef047c3d0f95078f016a041cd8a99d3bf11 1 parent cb0c931
Filippo authored
Showing with 363 additions and 115 deletions.
  1. +11 −0 apps/fe/lib/myUser.class.php
  2. BIN  data/phpcollab_unit_test.db
  3. +40 −0 plugins/idProjectManagementPlugin/lib/components/phpCollabComponents.php
  4. +2 −0  plugins/idProjectManagementPlugin/lib/model/doctrine/PluginIssue.class.php
  5. +30 −5 plugins/idProjectManagementPlugin/lib/model/doctrine/PluginLogTimeTable.class.php
  6. +5 −0 plugins/idProjectManagementPlugin/lib/model/doctrine/PluginProfile.class.php
  7. +16 −0 plugins/idProjectManagementPlugin/lib/model/doctrine/PluginProjectTable.class.php
  8. +10 −2 plugins/idProjectManagementPlugin/lib/model/doctrine/PluginProjectUser.class.php
  9. +1 −2  plugins/idProjectManagementPlugin/lib/model/doctrine/PluginProjectUserTable.class.php
  10. +13 −5 plugins/idProjectManagementPlugin/modules/idIssue/actions/components.class.php
  11. +41 −5 plugins/idProjectManagementPlugin/modules/idLogtime/actions/actions.class.php
  12. +35 −0 plugins/idProjectManagementPlugin/modules/idLogtime/actions/components.class.php
  13. +17 −1 plugins/idProjectManagementPlugin/modules/idLogtime/config/view.yml
  14. +11 −7 plugins/idProjectManagementPlugin/modules/idLogtime/templates/_form.php
  15. 0  ...jectManagementPlugin/modules/{idProject/templates/_showSidebar.php → idLogtime/templates/_sidebar.php}
  16. +11 −8 plugins/idProjectManagementPlugin/modules/idLogtime/templates/editSuccess.php
  17. +9 −6 plugins/idProjectManagementPlugin/modules/idLogtime/templates/indexSuccess.php
  18. +73 −0 plugins/idProjectManagementPlugin/modules/idLogtime/templates/reportSuccess.php
  19. +5 −7 plugins/idProjectManagementPlugin/modules/idMessage/actions/components.class.php
  20. +0 −1  plugins/idProjectManagementPlugin/modules/idMessage/config/view.yml
  21. +6 −14 plugins/idProjectManagementPlugin/modules/idProject/actions/components.class.php
  22. +1 −1  plugins/idProjectManagementPlugin/modules/idProject/config/view.yml
  23. +3 −17 plugins/idProjectManagementPlugin/modules/idProject/templates/_sidebar.php
  24. +1 −1  plugins/idProjectManagementPlugin/modules/idProject/templates/staffListSuccess.php
  25. +16 −27 test/functional/fe/idProjectIssueLogTimeReportTest.php
  26. +1 −1  test/functional/fe/idProjectLogtimeEditTest.php
  27. +2 −2 test/functional/fe/idProjectLogtimeViewByUserTest.php
  28. +3 −3 test/unit/pluginProjectUserTest.php
View
11 apps/fe/lib/myUser.class.php
@@ -247,4 +247,15 @@ public function countMyIssuesForProject($project_id)
return Doctrine::getTable('Issue')->countIssuesAssignedToUserByProject($this->getGuardUser()->Profile->id, $project_id);
}
+ public function getRoleByProject($project_id)
+ {
+ $this->getProfile()->getRoleByProject($project_id);
+ }
+
+ public function getMyTotalLogtimeForIssue($issue_id)
+ {
+ $logtime = Doctrine::getTable('LogTime')->getLogTimeForIssueByUser($issue_id, $this->getGuardUser()->getProfile()->getId());
+ return $logtime[0]['logtimes'];
+ }
+
}
View
BIN  data/phpcollab_unit_test.db
Binary file not shown
View
40 plugins/idProjectManagementPlugin/lib/components/phpCollabComponents.php
@@ -0,0 +1,40 @@
+<?php
+
+abstract class phpCollabComponents extends sfComponents
+{
+ /**
+ * Retrieve parameter £parameter_name from request
+ * and returns the result of apply php function empty()
+ *
+ * @param string $parameter_name
+ */
+ protected function isRequestFieldEmpty($parameter_name)
+ {
+ $value = $this->getRequest()->getParameter($parameter_name);
+ return empty($value);
+ }
+
+
+ protected function retrieveProject($project_identifier = 'project_id')
+ {
+ if(!$this->isRequestFieldEmpty($project_identifier))
+ {
+ return Doctrine::getTable('Project')->findOneBy('id', $this->getRequestParameter($project_identifier));
+ }
+ }
+
+ protected function retrieveProjectReport(Project $project)
+ {
+ $reports = Doctrine::getTable('Project')->getReportsOnProjectsWithEffortChart(array($project));
+ return (count($reports) > 0) ? $reports[$this->project->id] : null;
+ }
+
+ protected function retrieveProjectByIssue()
+ {
+ if(!$this->isRequestFieldEmpty('issue_id'))
+ {
+ return Doctrine::getTable('Project')->getProjectFromIssueId($this->getRequest()->getParameter('issue_id'));
+ }
+ }
+}
+
View
2  plugins/idProjectManagementPlugin/lib/model/doctrine/PluginIssue.class.php
@@ -49,6 +49,8 @@ public function hasComments()
public function getTotalLogTime()
{
+ $this->refreshRelated('logtimes');
+
$total_log_time = 0;
foreach ($this->logtimes as $logtime_entry)
{
View
35 plugins/idProjectManagementPlugin/lib/model/doctrine/PluginLogTimeTable.class.php
@@ -4,15 +4,27 @@
*/
class PluginLogTimeTable extends Doctrine_Table
{
- public function getLogTimeByIssueAndProfile($issue_id, $profile_id)
+ public function getLogTimeForIssueByUser($issue_id, $profile_id)
+ {
+ return $this->getQueryForLogtimesForIssueByUser($issue_id, $profile_id)->
+ select('SUM(lt.log_time) as logtimes')->
+ execute(array(), Doctrine::HYDRATE_ARRAY);
+ }
+
+ protected function getQueryForLogtimesForIssueByUser($issue_id, $profile_id)
{
return Doctrine_Query::create()
->from('LogTime lt')
->leftJoin('lt.issue i')
->leftJoin('lt.profile p')
->addWhere('lt.profile_id = ? ',$profile_id)
- ->addWhere('lt.issue_id = ? ',$issue_id)
- ->execute();
+ ->addWhere('lt.issue_id = ? ',$issue_id);
+ }
+
+ public function getLogTimeByIssueAndProfile($issue_id, $profile_id)
+ {
+ return $this->getQueryForLogtimesForIssueByUser($issue_id, $profile_id)
+ ->execute();
}
public function getQueryForAllLogTimes()
@@ -24,15 +36,28 @@ public function getQueryForAllLogTimes()
->orderBy('lt.created_at DESC');
}
- public function getQueryForAllLogTimeFronProject($project_id)
+ public function getQueryForAllLogTimeFromProject($project_id)
{
return $this->getQueryForAllLogTimes()
->where('i.project_id = ? ', $project_id);
}
+ public function getQueryForAllLogTimeFromProjectAndIssue($project_id, $issue_id)
+ {
+ return $this->getQueryForAllLogTimes()
+ ->where('i.project_id = ? ', $project_id)
+ ->andWhere('i.id = ? ', $issue_id);
+ }
+
+ public function getQueryForUserLogTimeFromProjectAndIssue($profile_id, $project_id, $issue_id)
+ {
+ return $this->getQueryForAllLogTimeFromProjectAndIssue($project_id, $issue_id)
+ ->andWhere('p.id = ? ', $profile_id);
+ }
+
public function getLogtimeForProjectByUser($project_id)
{
- return $this->getQueryForAllLogTimeFronProject($project_id)
+ return $this->getQueryForAllLogTimeFromProject($project_id)
->execute();
}
}
View
5 plugins/idProjectManagementPlugin/lib/model/doctrine/PluginProfile.class.php
@@ -38,4 +38,9 @@ public function getShortName()
$user = $this->getUser();
return ucfirst($this->getFirstName()).' '. ucfirst(substr($this->getLastName(),0,1)).'.';
}
+
+ public function getRoleByProject($project_id)
+ {
+ return ProjectUser::getRoleByProfileIdAndProjectId($this->getId(), $project_id);
+ }
}
View
16 plugins/idProjectManagementPlugin/lib/model/doctrine/PluginProjectTable.class.php
@@ -206,4 +206,20 @@ public function getReportsOnProjectsWithEffortChart($projects, $limit = 3)
return $reports;
}
+ public function getProjectFromIssueId($issue_id)
+ {
+ if(!is_null($issue_id))
+ {
+ return $this->createQuery()->
+ from('Project as p')->
+ leftJoin('p.Issues i')->
+ leftJoin('p.users u')->
+ leftJoin('p.trackers t')->
+ leftJoin('p.Milestones mil')->
+ leftJoin('p.Messages mes')->
+ where('i.id = ?', $issue_id)->
+ fetchOne();
+ }
+ }
+
}
View
12 plugins/idProjectManagementPlugin/lib/model/doctrine/PluginProjectUser.class.php
@@ -21,10 +21,18 @@
*/
abstract class PluginProjectUser extends BaseProjectUser
{
- public static $roles = array('admin' => 1, 'developer' => 2, 'project manager' => 3, 'customer' => 4);
+ public static $roles = array('admin' => 1,
+ 'developer' => 2,
+ 'project manager' => 3,
+ 'customer' => 4);
public static function getRoleByProfileIdAndProjectId($profile_id, $project_id)
{
- return Doctrine::getTable('ProjectUser')->getRoleByProfileIdAndRojectId($profile_id, $project_id);
+ $code = Doctrine::getTable('ProjectUser')->getRoleByProfileIdAndProjectId($profile_id, $project_id);
+ if($code)
+ {
+ $roles = array_flip(self::$roles);
+ return $roles[$code];
+ }
}
}
View
3  plugins/idProjectManagementPlugin/lib/model/doctrine/PluginProjectUserTable.class.php
@@ -21,8 +21,7 @@
*/
class PluginProjectUserTable extends Doctrine_Table
{
-
- public function getRoleByProfileIdAndRojectId($profile_id, $project_id)
+ public function getRoleByProfileIdAndProjectId($profile_id, $project_id)
{
$result = $this->createQuery()->where('project_id = '. $project_id)->addWhere('profile_id = '. $profile_id)->fetchOne(array(), Doctrine::HYDRATE_ARRAY);
if (is_array($result))
View
18 plugins/idProjectManagementPlugin/modules/idIssue/actions/components.class.php
@@ -14,18 +14,26 @@
/**
* idDashboardComponents components
*/
-class idIssueComponents extends sfComponents
+class idIssueComponents extends phpCollabComponents
{
public function executeSidebar()
{
- $this->project = Doctrine::getTable('Project')->findOneBy('id', $this->getRequestParameter('project_id'));
- $reports = Doctrine::getTable('Project')->getReportsOnProjectsWithEffortChart(array($this->project));
-
- $this->project_report = (count($reports) > 0) ? $reports[$this->project->id] : null;
+ if($this->isRequestFieldEmpty('project_id'))
+ {
+ return sfView::NONE;
+ }
+
+ $this->project = $this->retrieveProject();
+ $this->project_report = $this->retrieveProjectReport($this->project);
}
public function executeShowSidebar()
{
+ if($this->isRequestFieldEmpty('issue_id'))
+ {
+ return sfView::NONE;
+ }
+
$this->issue = Doctrine::getTable('Issue')->getIssueById($this->getRequest()->getParameter('issue_id'));
}
}
View
46 plugins/idProjectManagementPlugin/modules/idLogtime/actions/actions.class.php
@@ -26,6 +26,8 @@ public function executeIndex(sfWebRequest $request)
$this->form = new LogTimeForm();
$this->form->setDefault('created_at', date('Y-m-d H:i:s', time()));
+
+ $this->setTemplate('report');
}
public function executeAddToIssue(sfWebRequest $request)
@@ -67,21 +69,53 @@ private function checkUserAgainstIssueAndProject(sfWebRequest $request)
return $issue;
}
+ /**
+ * report for single issue and sigle user
+ *
+ * @param sfWebRequest $request
+ */
public function executeReportForActualUser(sfWebRequest $request)
{
$this->forwardUnless($this->getUser()->hasCredential('idLogotime-ReadReport'), sfConfig::get('sf_secure_module'), sfConfig::get('sf_secure_action'));
$this->issue = $this->checkUserAgainstIssueAndProject($request);
-
- $this->logtime_report = Doctrine::getTable('LogTime')->getLogTimeByIssueAndProfile($this->issue->id, $this->getUser()->getGuardUser()->Profile->id);
+
+ $this->pager = new sfDoctrinePager('LogTime',10);
+ $this->pager->setQuery(Doctrine::getTable('LogTime')->getQueryForUserLogTimeFromProjectAndIssue($this->getUser()->getGuardUser()->getProfile()->getId(), $this->issue->project_id, $this->issue->id));
+ $this->pager->setMaxPerPage(sfConfig::get('mod_maxperpage_logtime', 10));
+ $this->pager->setPage($this->getRequestParameter('page',1));
+ $this->pager->init();
+
+ $this->total_time = $this->getUser()->getMyTotalLogtimeForIssue($this->issue->id);
+
+ $this->setTemplate('report');
}
+ /**
+ * report for single issue and multiple users
+ *
+ * @param sfWebRequest $request
+ */
public function executeReportForAllUsers(sfWebRequest $request)
{
$this->forwardUnless($this->getUser()->hasCredential('idLogotime-ReadReportForAllUsers'), sfConfig::get('sf_secure_module'), sfConfig::get('sf_secure_action'));
$this->issue = $this->checkUserAgainstIssueAndProject($request);
- $this->logtime_report = $this->issue->logtimes;
+
+ $this->pager = new sfDoctrinePager('LogTime',10);
+ $this->pager->setQuery(Doctrine::getTable('LogTime')->getQueryForAllLogTimeFromProjectAndIssue($this->issue->project_id, $this->issue->id));
+ $this->pager->setMaxPerPage(sfConfig::get('mod_maxperpage_logtime', 10));
+ $this->pager->setPage($this->getRequestParameter('page',1));
+ $this->pager->init();
+
+ $this->total_time = $this->issue->getTotalLogTime();
+
+ $this->setTemplate('report');
}
-
+
+ /**
+ * list of all the logtimes of a project
+ *
+ * @param sfWebRequest $request
+ */
public function executeReportAllUsersForProject(sfWebRequest $request)
{
$this->forwardUnless($this->getUser()->hasCredential('idLogotime-ReadReportForAllUsers'), sfConfig::get('sf_secure_module'), sfConfig::get('sf_secure_action'));
@@ -92,7 +126,7 @@ public function executeReportAllUsersForProject(sfWebRequest $request)
$this->form->setDefault('created_at', date('Y-m-d H:i:s', time()));
$this->pager = new sfDoctrinePager('LogTime',10);
- $this->pager->setQuery(Doctrine::getTable('LogTime')->getQueryForAllLogTimeFronProject($this->project->id));
+ $this->pager->setQuery(Doctrine::getTable('LogTime')->getQueryForAllLogTimeFromProject($this->project->id));
$this->pager->setMaxPerPage(sfConfig::get('mod_maxperpage_logtime', 10));
$this->pager->setPage($this->getRequestParameter('page',1));
$this->pager->init();
@@ -128,6 +162,8 @@ public function executeEdit(sfWebRequest $request)
$this->forward404Unless($log_time = Doctrine::getTable('LogTime')->
findOneBy('id', $request->getParameter('id')),
sprintf('Object log_time does not exist (%s).', array($request->getParameter('id'))));
+
+ $this->project = $log_time->getIssue()->getProject();
$this->form = new LogTimeForm($log_time);
}
View
35 plugins/idProjectManagementPlugin/modules/idLogtime/actions/components.class.php
@@ -0,0 +1,35 @@
+<?php
+/**
+ * This file is part of the phpCollab3 package.
+ * (c) 2009 Ideato s.r.l. <phpcollab@ideato.it>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ *
+ * idLogtimeComponents
+ *
+ * @package phpCollab3
+ * @subpackage idProjectManagementPlugin Modules
+ */
+
+/**
+ * idLogtimeComponents class for components in idLogtime modules templates
+ *
+ * @package phpCollab3
+ * @subpackage idProjectManagementPlugin Modules
+ * @author Filippo (p16) De Santis <fd@ideato.it>
+ */
+class idLogtimeComponents extends phpCollabComponents
+{
+ public function executeSidebar()
+ {
+ if($this->isRequestFieldEmpty('issue_id'))
+ {
+ return sfView::NONE;
+ }
+
+ $this->project = $this->retrieveProjectByIssue();
+ $this->project_report = $this->retrieveProjectReport($this->project);
+ }
+}
+?>
View
18 plugins/idProjectManagementPlugin/modules/idLogtime/config/view.yml
@@ -1,5 +1,21 @@
-default:
+reportSuccess:
+ components:
+ sidebar: [idLogtime, sidebar]
+
+newSuccess:
+ components:
+ sidebar: []
+
+editSuccess:
components:
sidebar: []
+indexSuccess:
+ components:
+ sidebar: []
+
+default:
+ components:
+ sidebar: [idMessage, sidebar]
+
javascripts: [jquery-1.4.2.min.js, log_time_form_show.js]
View
18 plugins/idProjectManagementPlugin/modules/idLogtime/templates/_form.php
@@ -26,12 +26,16 @@
</li>
</ul>
<div class="clear"></div>
- <div class="span-7 prepend-1 confirm-box">
- <?php if (!$form->getObject()->isNew()): ?>
- &nbsp;<?php echo link_to('Delete', 'idLogtime/delete?id='.$form->getObject()->getId(), array('method' => 'delete', 'confirm' => 'Are you sure?')) ?>
- <?php endif; ?>
- <?php echo link_to('Cancel', '@index_logtime'); ?>
- <input type="submit" value="Save" />
+ <div class="confirm-box">
+ <div class="span-7 prepend-1">
+ <input type="submit" value="Save" class="button block-green medium-round"/>
+ </div>
+ <div class="span-8">&nbsp;
+ <?php echo $form->renderHiddenFields() ?>
+ </div>
+ <div class="span-6 right last append-1">
+ <?php echo link_to('Cancel', (isset($referer) && !empty($referer)) ? $referer : '@index_logtime', array('class' => 'button block-red medium-round')); ?>
+ </div>
+ <div class="clear"></div>
</div>
- <?php echo $form->renderHiddenFields() ?>
</form>
View
0  ...ugin/modules/idProject/templates/_showSidebar.php → ...ntPlugin/modules/idLogtime/templates/_sidebar.php
File renamed without changes
View
19 plugins/idProjectManagementPlugin/modules/idLogtime/templates/editSuccess.php
@@ -1,13 +1,16 @@
<?php slot('title', __('Edit Logtime')) ?>
-<div class="block" id="block-forms">
- <?php include_partial('create_logtime_menu'); ?>
- <div class="content">
- <h2 class="title"><?php echo !$form->getObject()->isNew() ? __('Edit tracker') : __('Create new tracker'); ?></h2>
- <div class="inner">
-
- <?php include_partial('form', array('form' => $form)) ?>
+<div id="content" class="span-23">
+ <?php if(isset($project)): ?>
+ <?php include_partial('idProject/sub_menu', array('project' => $project))?>
+ <?php endif; ?>
+ <div class="span-full">
+ <div class="title">
+ <span>Edit logtime</span>
+ </div>
+ <div id="log-time-form">
+ <?php include_partial('idLogtime/form', array('form' => $form, 'referer' => $referer)) ?>
</div>
</div>
-</div>
+</div>
View
15 plugins/idProjectManagementPlugin/modules/idLogtime/templates/indexSuccess.php
@@ -4,12 +4,15 @@
<div class="span-full">
<div class="title">
<span>Time</span>
- <a id="add-log-time"class="button block-green medium-round" href="<?php echo url_for('@new_logtime') ?>">Add</a>
- </div>
-
- <div id="log-time">
- <?php include_partial('idLogtime/form', array('form' => $form)) ?>
+ <?php if(isset($form)): ?>
+ <a id="add-log-time"class="button block-green medium-round" href="<?php echo url_for('@new_logtime') ?>">Add</a>
+ <?php endif; ?>
</div>
+ <?php if(isset($form)): ?>
+ <div id="log-time">
+ <?php include_partial('idLogtime/form', array('form' => $form)) ?>
+ </div>
+ <?php endif; ?>
<?php if (count($pager->getResults()) !== false && count($pager->getResults()) == 0): ?>
<div class="span-full">
@@ -53,7 +56,7 @@
<?php if($pager->haveToPaginate()): ?>
<div class="span-full pagenation">
<ul>
- <?php echo pager_navigation_log_time($pager, '@index_logtime') ?>
+ <?php echo pager_navigation_log_time($pager, $sf_request->getUri()) ?>
</ul>
</div>
<?php endif; ?>
View
73 plugins/idProjectManagementPlugin/modules/idLogtime/templates/reportSuccess.php
@@ -0,0 +1,73 @@
+<?php slot('title', __('Manage time')) ?>
+
+<div id="content" class="span-23">
+ <?php if(isset($issue)): ?>
+ <?php include_partial('idProject/sub_menu', array('project' => $issue->getProject()))?>
+ <?php endif; ?>
+
+ <div class="span-full">
+ <div class="title">
+ <span>Time</span>
+ <?php if(isset($form)): ?>
+ <a id="add-log-time"class="button block-green medium-round" href="<?php echo url_for('@new_logtime') ?>">Add</a>
+ <?php endif; ?>
+ </div>
+ <?php if(isset($form)): ?>
+ <div id="log-time">
+ <?php include_partial('idLogtime/form', array('form' => $form)) ?>
+ </div>
+ <?php endif; ?>
+
+ <?php if(isset($issue)):?>
+ <div class="span-full" id="total_log_time">
+ Total log time for issue <?php echo link_to('#'.$issue->id, '@show_issue?project_id='.$issue->project_id.'&issue_id='.$issue->id) ?>: <?php echo $total_time ?>
+ </div>
+ <?php endif; ?>
+
+ <?php if (count($pager->getResults()) !== false && count($pager->getResults()) == 0): ?>
+ <div class="span-full">
+ <p>No results.</p>
+ </div>
+ <?php else: ?>
+ <div class="span-full">
+ <div class="menu">
+ <div class="span-3">Name</div>
+ <div class="span-9">Description</div>
+ <div class="span-3">Date</div>
+ <div class="span-2">Time</div>
+ <div class="span-4 prepend-1 last"><span>Issue/Project</span></div>
+ </div>
+ <ul class="action time">
+ <?php foreach ($pager->getResults() as $log_time): ?>
+ <li class="icon-time span-22 last">
+ <ul>
+ <li class="span-3"><?php echo $log_time->getProfile()->getShortName() ?></li>
+ <li class="span-9"><strong>&nbsp;<?php echo $log_time->getComment() ?></strong></li>
+ <li class="span-3"><?php echo format_date($log_time->getCreatedAt(), 'MMMM dd yyyy', $sf_user->getCulture()) ?></li>
+ <li class="span-2"><?php echo $log_time->getLogTime() ?></li>
+ <li class="span-5 last">
+ <?php echo link_to($log_time->getIssue(), '@show_issue?project_id='.$log_time->getIssue()->getProjectId().'&issue_id='.$log_time->getIssue()->getId()); ?><br/>
+ (<?php echo $log_time->getIssue()->getProject()->getName(); ?> )
+ </li>
+ <li class="edit-delete">
+ <?php if($sf_user->hasCredential('idLogtime-Edit')): ?>
+ <?php echo link_to(__('Edit'), '@edit_logtime?id='.$log_time->getId()) ?>&nbsp;&nbsp;
+ <?php echo link_to(__('Delete'), '@delete_logtime?id='.$log_time->getId(), array('confirm' => __('Do you really want to delete this log?'))) ?>
+ <?php endif; ?>
+ </li>
+ </ul>
+ </li>
+ <?php endforeach; ?>
+ </ul>
+ <div class="notice clear">Time under projects is to be sorted by date, time under the users time sheet can be sorted by project.</div>
+ </div>
+ <?php endif; ?>
+ </div>
+ <?php if($pager->haveToPaginate()): ?>
+ <div class="span-full pagenation">
+ <ul>
+ <?php echo pager_navigation_log_time($pager, $sf_request->getUri()) ?>
+ </ul>
+ </div>
+ <?php endif; ?>
+</div>
View
12 plugins/idProjectManagementPlugin/modules/idMessage/actions/components.class.php
@@ -19,19 +19,17 @@
* @subpackage idProjectManagementPlugin Modules
* @author Filippo (p16) De Santis <fd@ideato.it>
*/
-class idMessageComponents extends sfComponents
+class idMessageComponents extends phpCollabComponents
{
public function executeSidebar()
{
- $this->project = Doctrine::getTable('Project')->findOneById($this->getRequest()->getParameter('project_id'));
- $reports = Doctrine::getTable('Project')->getReportsOnProjectsWithEffortChart(array($this->project));
-
- if (!isset($reports[$this->project->id]))
+ if($this->isRequestFieldEmpty('project_id'))
{
return sfView::NONE;
}
-
- $this->project_report = $reports[$this->project->id];
+
+ $this->project = $this->retrieveProject();
+ $this->project_report = $this->retrieveProjectReport($this->project);
}
}
?>
View
1  plugins/idProjectManagementPlugin/modules/idMessage/config/view.yml
@@ -1,4 +1,3 @@
default:
components:
sidebar: [idMessage, sidebar]
- javascripts: [../CommentPlugin/js/jquery-1.3.2.min.js]
View
20 plugins/idProjectManagementPlugin/modules/idProject/actions/components.class.php
@@ -19,21 +19,17 @@
* @subpackage idProjectManagementPlugin Modules
* @author Filippo (p16) De Santis <fd@ideato.it>
*/
-class idProjectComponents extends sfComponents
+class idProjectComponents extends phpCollabComponents
{
public function executeSidebar()
{
- }
-
- public function executeShowSidebar()
- {
- $this->project = Doctrine::getTable('Project')->findOneById($this->getRequest()->getParameter('id'));
- $reports = Doctrine::getTable('Project')->getReportsOnProjectsWithEffortChart(array($this->project));
-
- if (isset($reports[$this->project->id]))
+ if($this->isRequestFieldEmpty('id'))
{
- $this->project_report = $reports[$this->project->id];
+ return sfView::NONE;
}
+
+ $this->project = $this->retrieveProject('id');
+ $this->project_report = $this->retrieveProjectReport($this->project);
}
public function executeIndexSidebar()
@@ -44,10 +40,6 @@ public function executeIndexSidebar()
$project_filters = $this->getRequest()->getParameter('project_filters');
$this->form->bind($project_filters);
}
-
- $project_ids = $this->getUser()->getMyProjectsIds();
- $logs = Doctrine::getTable('EventLog')->retrieveLastLoggedEventFromProjects($project_ids);
- $this->recent_events = LogDecorator::decorateCollectionToArray($logs);
}
}
?>
View
2  plugins/idProjectManagementPlugin/modules/idProject/config/view.yml
@@ -1,6 +1,6 @@
showSuccess:
components:
- sidebar: [idProject, showSidebar]
+ sidebar: [idProject, sidebar]
indexSuccess:
components:
View
20 plugins/idProjectManagementPlugin/modules/idProject/templates/_sidebar.php
@@ -1,18 +1,4 @@
-<div id="sidebar">
- <div class="block">
- <h3><?php echo __('Simple Block') ?></h3>
- <div class="content">
- <p><?php echo __('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.') ?></p>
- </div>
- </div>
- <div class="block notice">
- <h4><?php echo __('Notice Title') ?></h4>
- <p><?php echo __('Morbi posuere urna vitae nunc. Curabitur ultrices, lorem ac aliquam blandit, lectus eros hendrerit eros, at eleifend libero ipsum hendrerit urna. Suspendisse viverra. Morbi ut magna. Praesent id ipsum. Sed feugiat ipsum ut felis. Fusce vitae nibh sed risus commodo pulvinar. Duis ut dolor. Cras ac erat pulvinar tortor porta sodales. Aenean tempor venenatis dolor.') ?></p>
- </div>
- <div class="block">
- <div class="sidebar-block">
- <h4><?php echo __('Sidebar Inner block Title') ?></h4>
- <p><?php echo __('Morbi posuere urna vitae nunc. Curabitur ultrices, lorem ac <a href="#">aliquam blandit</a>, lectus eros hendrerit eros, at eleifend libero ipsum hendrerit urna. Suspendisse viverra. Morbi ut magna. Praesent id ipsum. Sed feugiat ipsum ut felis. Fusce vitae nibh sed risus commodo pulvinar. Duis ut dolor. Cras ac erat pulvinar tortor porta sodales. Aenean tempor venenatis dolor.') ?></p>
- </div>
- </div>
+<div class="span-8 prepend-1 last" id="sidebar">
+ <div class="title"><span>Project</span></div>
+ <?php include_partial('idDashboard/project_report', array('project_id' => $project->id, 'project_report' => $project_report)) ?>
</div>
View
2  plugins/idProjectManagementPlugin/modules/idProject/templates/staffListSuccess.php
@@ -29,7 +29,7 @@
<?php echo mail_to($member->email) ?>
</span>
</div>
- <div class="span-4 last"> Role for this project??? </div>
+ <div class="span-4 last"><?php echo $member->getRoleByProject($project->id)?></div>
</div>
<?php endforeach; ?>
</div>
View
43 test/functional/fe/idProjectIssueLogTimeReportTest.php
@@ -61,17 +61,12 @@
end()->
with('response')->begin()->
- //debug()->
isStatusCode('200')->
- checkElement('table.table tr th:contains("Date")')->
- checkElement('table.table tr th:contains("Logtime")')->
-
- checkElement('table.table tr.odd td', '/'.date('Y-m-d', strtotime('-2 days')).'/', array('position' => 1))->
- checkElement('table.table tr.odd td', '/12/', array('position' => 2))->
- checkElement('table.table tr.even td', '/'.date('Y-m-d', strtotime('today')).'/', array('position' => 1))->
- checkElement('table.table tr.even td', '/0.5/', array('position' => 2))->
- checkElement('table.table tr.odd td', '/'.date('Y-m-d', strtotime('today')).'/', array('position' => 5))->
- checkElement('table.table tr.odd td', '/1.1/', array('position' => 6))->
+ checkElement('ul li.icon-time ul li:contains("'.date('F d Y', strtotime('today')).'")')->
+ checkElement('ul li.icon-time ul li:contains("'.date('F d Y', strtotime('-2 days')).'")')->
+ checkElement('ul li.icon-time ul li:contains("1.1")')->
+ checkElement('ul li.icon-time ul li:contains("0.5")')->
+ checkElement('ul li.icon-time ul li:contains("12")')->
checkElement('#total_log_time', '/13.6/')->
@@ -103,16 +98,13 @@
with('response')->begin()->
isStatusCode('200')->
- checkElement('table.table tr th:contains("Date")')->
- checkElement('table.table tr th:contains("Logtime")')->
-
- checkElement('table.table tr.odd td', '/'.date('Y-m', strtotime('today')).'/', array('position' => 1))->
- checkElement('table.table tr.odd td', '/1.2/', array('position' => 2))->
-
+ checkElement('ul li.icon-time ul li:contains("'.date('F d Y', strtotime('today')).'")')->
+ checkElement('ul li.icon-time ul li:contains("1.2")')->
+
checkElement('#total_log_time', '/1.2/')->
end()->
- click('Go back to issue')->
+ click('#69')->
click('All users log time report')->
@@ -124,16 +116,13 @@
with('response')->begin()->
isStatusCode('200')->
- checkElement('table.table tr th:contains("User")')->
- checkElement('table.table tr th:contains("Date")')->
- checkElement('table.table tr th:contains("Logtime")')->
-
- checkElement('table.table tr.odd td', '/paul/', array('position' => 1))->
- checkElement('table.table tr.odd td', '/'.date('Y-m', strtotime('today')).'/', array('position' => 2))->
- checkElement('table.table tr.odd td', '/1.2/', array('position' => 3))->
- checkElement('table.table tr.even td', '/prog/', array('position' => 1))->
- checkElement('table.table tr.even td', '/'.date('Y-m-d', strtotime('-1 days')).'/', array('position' => 2))->
- checkElement('table.table tr.even td', '/1.3/', array('position' => 3))->
+
+ checkElement('ul li.icon-time ul li:contains("'.date('F d Y', strtotime('today')).'")')->
+ checkElement('ul li.icon-time ul li:contains("Prog P.")')->
+ checkElement('ul li.icon-time ul li:contains("1.2")')->
+ checkElement('ul li.icon-time ul li:contains("'.date('F d Y', strtotime('-1 day')).'")')->
+ checkElement('ul li.icon-time ul li:contains("1.3")')->
+ checkElement('ul li.icon-time ul li:contains("Paul M.")')->
checkElement('#total_log_time', '/2.5/')->
View
2  test/functional/fe/idProjectLogtimeEditTest.php
@@ -33,7 +33,7 @@
isParameter('action', 'edit')->
end()->
- click('Cancel')->
+ get('/en/idLogtime')->
with('request')->begin()->
isParameter('module', 'idLogtime')->
View
4 test/functional/fe/idProjectLogtimeViewByUserTest.php
@@ -14,8 +14,8 @@
click('My log time report')->
with('response')->begin()->
- checkElement('td:contains("'.date('Y-m-d', strtotime("-2 days")).'")')->
- checkElement('td:contains("12.0 hours")')->
+ checkElement('ul li:contains("'.date('F d Y', strtotime("-2 days")).'")')->
+ checkElement('ul li:contains("12.0")')->
end()
;
View
6 test/unit/pluginProjectUserTest.php
@@ -13,10 +13,10 @@
$t->is($role, false);
$role = ProjectUser::getRoleByProfileIdAndProjectId(8, 3);
-$t->is($role, ProjectUser::$roles['customer']);
+$t->is($role, 'customer');
$role = ProjectUser::getRoleByProfileIdAndProjectId(7, 1);
-$t->is($role, ProjectUser::$roles['project manager']);
+$t->is($role, 'project manager');
$role = ProjectUser::getRoleByProfileIdAndProjectId(3, 3);
-$t->is($role, ProjectUser::$roles['developer']);
+$t->is($role, 'developer');
Please sign in to comment.
Something went wrong with that request. Please try again.