Example #1
0
 /**
  * Process burndown datas when the sets is smaller than the itemCounts.
  * 
  * @param  array   $sets 
  * @param  int     $itemCounts 
  * @param  date    $begin 
  * @param  date    $end 
  * @param  string  $mode 
  * @access public
  * @return array
  */
 public function processBurnData($sets, $itemCounts, $begin, $end, $mode = 'noempty')
 {
     $burnCounts = count($sets);
     $current = helper::today();
     if ($end != '0000-00-00') {
         $period = helper::diffDate($end, $begin) + 1;
         $counts = $period > $itemCounts ? $itemCounts : $period;
     } else {
         $counts = $itemCounts;
     }
     for ($i = 0; $i < $counts - $burnCounts; $i++) {
         if (helper::diffDate($current, $end) > 0) {
             break;
         }
         if (!isset($sets[$current]) and $mode != 'noempty') {
             $sets[$current]->name = $current;
             $sets[$current]->value = '';
         }
         $nextDay = date(DT_DATE1, strtotime('next day', strtotime($current)));
         $current = $nextDay;
     }
     return $sets;
 }
Example #2
0
</th>
        <th class='w-status'><?php 
echo $lang->statusAB;
?>
</th>
      </tr>
      </thead>
      <tbody>
      <?php 
foreach ($allBugs as $bug) {
    ?>
      <?php 
    if (isset($planBugs[$bug->id])) {
        continue;
    }
    if ($bug->plan and helper::diffDate($plans[$bug->plan], helper::today()) > 0) {
        continue;
    }
    ?>
      <tr>
        <td class='text-left'>
          <input class='ml-10px' type='checkbox' name='bugs[]'  value='<?php 
    echo $bug->id;
    ?>
'/> 
          <?php 
    echo html::a($this->createLink('bug', 'view', "bugID={$bug->id}"), $bug->id);
    ?>
        </td>
        <td><span class='<?php 
    echo 'pri' . zget($lang->bug->priList, $bug->pri, $bug->pri);
Example #3
0
 /**
  * Workload report.
  * 
  * @access public
  * @return void
  */
 public function workload($begin = '', $end = '', $days = 0, $workday = 7, $dept = 0)
 {
     if ($_POST) {
         $data = fixer::input('post')->get();
         $begin = $data->begin;
         $end = $data->end;
         $dept = $data->dept;
         $days = $data->days;
         $workday = $data->workday;
     }
     $begin = $begin ? date('Y-m-d', strtotime($begin)) : date('Y-m-d', strtotime('now'));
     $end = $end ? date('Y-m-d', strtotime($end)) : date('Y-m-d', strtotime('+1 week'));
     if (!$days) {
         $diffDays = helper::diffDate($end, $begin);
         $days = round($diffDays - $diffDays / 7 * 2);
     }
     $this->view->title = $this->lang->report->workload;
     $this->view->position[] = $this->lang->report->workload;
     $this->view->workload = $this->report->getWorkload($dept);
     $this->view->users = $this->loadModel('user')->getPairs('noletter|noclosed|nodeleted');
     $this->view->depts = $this->loadModel('dept')->getOptionMenu();
     $this->view->begin = $begin;
     $this->view->end = $end;
     $this->view->days = $days;
     $this->view->workday = $workday;
     $this->view->dept = $dept;
     $this->view->allHour = $days * $workday;
     $this->view->submenu = 'staff';
     $this->display();
 }
Example #4
0
 /**
  * Process a task, judge it's status.
  * 
  * @param  object    $task 
  * @access private
  * @return object
  */
 public function processTask($task)
 {
     $today = helper::today();
     /* Delayed or not?. */
     if ($task->status !== 'done' and $task->status !== 'cancel' and $task->status != 'closed') {
         if ($task->deadline != '0000-00-00') {
             $delay = helper::diffDate($today, $task->deadline);
             if ($delay > 0) {
                 $task->delay = $delay;
             }
         }
     }
     /* Story changed or not. */
     $task->needConfirm = false;
     if ($task->storyStatus == 'active' and $task->latestStoryVersion > $task->storyVersion) {
         $task->needConfirm = true;
     }
     return $task;
 }
Example #5
0
</th>
      <th class='w-60px'>  <?php 
echo $lang->story->stageAB;
?>
</th>
    </tr>
    </thead>
    <tbody>
    <?php 
foreach ($allStories as $story) {
    ?>
    <?php 
    if (isset($planStories[$story->id])) {
        continue;
    }
    if ($story->plan and helper::diffDate($plans[$story->plan], helper::today()) > 0) {
        continue;
    }
    ?>
    <tr>
      <td class='a-left'>
        <input class='ml-10px' type='checkbox' name='stories[]'  value='<?php 
    echo $story->id;
    ?>
'/> 
        <?php 
    echo html::a($this->createLink('story', 'view', "storyID={$story->id}"), $story->id);
    ?>
      </td>
      <td><span class='<?php 
    echo 'pri' . $story->pri;
 /**
  * Get burn data for flot 
  * 
  * @param  int    $projectID 
  * @param  int    $itemCounts 
  * @access public
  * @return void
  */
 public function getBurnDataFlot($projectID = 0, $itemCounts = 30)
 {
     /* Get project and burn counts. */
     $project = $this->getById($projectID);
     $burnCounts = $this->dao->select('count(*) AS counts')->from(TABLE_BURN)->where('project')->eq($projectID)->fetch('counts');
     /* If the burnCounts > $itemCounts, get the latest $itemCounts records. */
     $sql = $this->dao->select('date AS name, `left` AS value')->from(TABLE_BURN)->where('project')->eq((int) $projectID);
     if ($burnCounts > $itemCounts) {
         $sets = $sql->orderBy('date DESC')->limit($itemCounts)->fetchAll('name');
         $sets = array_reverse($sets);
     } else {
         /* The burnCounts < itemCounts, after getting from the db, padding left dates. */
         $sets = $sql->orderBy('date ASC')->fetchAll('name');
         $current = helper::today();
         if ($project->end != '0000-00-00') {
             $period = helper::diffDate($project->end, $project->begin) + 1;
             $counts = $period > $itemCounts ? $itemCounts : $period;
         } else {
             $counts = $itemCounts;
         }
         for ($i = 0; $i < $counts - $burnCounts; $i++) {
             if (helper::diffDate($current, $project->end) > 0) {
                 break;
             }
             if (!isset($sets[$current])) {
                 $sets[$current]->name = $current;
                 $sets[$current]->value = '';
             }
             $nextDay = date(DT_DATE1, strtotime('next day', strtotime($current)));
             $current = $nextDay;
         }
     }
     $count = 0;
     foreach ($sets as $set) {
         $set->name = (string) strtotime("{$set->name} UTC") . '000';
         $count++;
     }
     $sets['count'] = $count;
     return $sets;
 }
<?php

$properties = $this->loadModel('api')->getLicenses();
$html = '';
if ($properties['expireDate'] != 'All Life') {
    $expireDays = helper::diffDate($properties['expireDate'], date('Y-m-d'));
    if ($expireDays <= 7 and $expireDays >= 0) {
        $html = sprintf($lang->user->expireWaring, $expireDays);
    }
}
?>
<script>
$(function()
{
    $('#poweredby').append(<?php 
echo json_encode($html);
?>
);
})
</script>
Example #8
0
 private function processInfo($info)
 {
     $today = helper::today();
     /* Delayed or not?. */
     if ($info->deadline != '0000-00-00') {
         $delay = helper::diffDate($today, $info->deadline);
         if ($delay > 0) {
             $info->delay = $delay;
         }
     }
     return $info;
 }