public function getInstance($id = NULL)
 {
     if ($id != NULL) {
         return parent::getInstance("code='" . $id . "'");
     } else {
         $uc = new Usecase();
         $uc->setAvancement(0);
         return $uc;
     }
 }
 public function _updateAction($post)
 {
     $object = $this->getInstance($post["id"]);
     $this->setValuesToObject($object);
     if ($post["id"]) {
         try {
             $object->save();
             $msg = new DisplayedMessage($this->model . " `{$object}` mis à jour");
         } catch (\Exception $e) {
             $msg = new DisplayedMessage("Impossible de modifier l'instance de " . $this->model, "danger");
         }
     } else {
         try {
             $object->save();
             $msg = new DisplayedMessage("Instance de " . $this->model . " `{$object}` ajoutée");
         } catch (\Exception $e) {
             $msg = new DisplayedMessage("Impossible d'ajouter l'instance de " . $this->model, "danger");
         }
     }
     try {
         $a = 0;
         $usecase = Usecase::findFirst("code='" . $object->getCodeUseCase() . "'");
         $taches = Tache::find("codeUseCase LIKE '" . $object->getCodeUseCase() . "'");
         foreach ($taches as $tache) {
             $a += $tache->getAvancement();
         }
         $a = $a / count($taches);
         $usecase->setAvancement($a);
         $usecase->save();
     } catch (\Exception $e) {
         $msg = new DisplayedMessage("Impossible de modifier l'avancement de la  UseCase " . $usecase, "danger");
     }
     return $msg;
 }
示例#3
0
 public function usecasesAction()
 {
     $usecases = Usecase::find();
     foreach ($usecases as $usecase) {
         echo $usecase->getNom() . " " . $usecase->getDeveloppeur()->getIdentite() . "<br>";
     }
 }
 public function tachesAction($code = NULL)
 {
     $taches = Tache::find("codeUseCase='" . $code . "'");
     $usecase = Usecase::findFirst("code='" . $code . "'");
     $n = $usecase->getNbreTache();
     if ($n == 1) {
         $this->jquery->click("." . $taches[0]->getId(), "\$('#modifier-" . $taches[0]->getId() . "').slideToggle('slow');\$('#supprimer-" . $taches[0]->getId() . "').slideToggle('slow');\$('#icon-" . $taches[0]->getId() . "').slideToggle('fast');");
     } else {
         for ($i = 0; $i < $n; $i++) {
             if ($i == 0) {
                 $Apr = $taches[$i + 1]->getId();
                 $this->jquery->click("." . $taches[$i]->getId(), "\$('#modifier-" . $Apr . "').hide();\$('#supprimer-" . $Apr . "').hide();\$('#icon-" . $Apr . "').hide();\$('#modifier-" . $taches[$i]->getId() . "').slideToggle('slow');\$('#supprimer-" . $taches[$i]->getId() . "').slideToggle('slow');\$('#icon-" . $taches[$i]->getId() . "').slideToggle('fast');");
             } elseif ($i == $n - 1) {
                 $Avt = $taches[$i - 1]->getId();
                 $this->jquery->click("." . $taches[$i]->getId(), "\$('#modifier-" . $Avt . "').hide();\$('#supprimer-" . $Avt . "').hide();\$('#icon-" . $Avt . "').hide();\$('#modifier-" . $taches[$i]->getId() . "').slideToggle('slow');\$('#supprimer-" . $taches[$i]->getId() . "').slideToggle('slow');\$('#icon-" . $taches[$i]->getId() . "').slideToggle('fast');");
             } else {
                 $Apr = $taches[$i + 1]->getId();
                 $Avt = $taches[$i - 1]->getId();
                 $this->jquery->click("." . $taches[$i]->getId(), "\$('#modifier-" . $taches[$i]->getId() . "').slideToggle('slow');\$('#supprimer-" . $taches[$i]->getId() . "').slideToggle('slow');\$('#icon-" . $taches[$i]->getId() . "').slideToggle('fast');\$('#modifier-" . $Apr . "').hide(100);\$('#modifier-" . $Avt . "').hide(100);\$('#supprimer-" . $Apr . "').hide(100);\$('#supprimer-" . $Avt . "').hide(100);\$('#icon-" . $Apr . "').hide();\$('#icon-" . $Avt . "').hide();");
             }
         }
     }
     $this->jquery->click(".tache", "\$('#modifier-" . $usecase->getCode() . "').hide(400);");
     $this->jquery->getOnClick(".modifier-" . $usecase->getCode(), "", "#modifier-" . $usecase->getCode(), array("attr" => "data-ajax", "jsCallback" => "\$('#modifier-" . $usecase->getCode() . "').show(400);"));
     $this->jquery->click(".ajouter", "\$('#modifier-" . $usecase->getCode() . "').hide(400);");
     $this->jquery->getOnClick(".ajouter", "", "#modifier-" . $usecase->getCode(), array("attr" => "data-ajax", "jsCallback" => "\$('#modifier-" . $usecase->getCode() . "').show(400);"));
     $this->jquery->getOnclick(".supprimer", "", "#supprimer-" . $usecase->getCode(), array("attr" => "data-ajax", "jsCallback" => "\$('#supprimer-" . $usecase->getCode() . "').show(400);"));
     $this->jquery->compile($this->view);
     $this->view->setVars(array("taches" => $taches, "code" => $code, "n" => $i, "usecase" => $usecase));
 }
 public function usecaseAction($code)
 {
     $usecase = Usecase::findFirst("code='" . $code . "'");
     $array = $usecase->toArray();
     $array["nbTaches"] = $usecase->getNbTache();
     print_r(json_encode($array));
     $this->view->disable();
 }
 public function ajouterAction($code)
 {
     $usecase = Usecase::findFirst("code='" . $code . "'");
     $this->view->setVars(array("usecase" => $usecase));
     $this->jquery->postFormOnClick(".validate", "Taches/insert", "frmajouter", "#autreAjouter" . $usecase->getCode());
     $this->jquery->click(".validate", "\$('#modifier-" . $usecase->getCode() . "').hide('400')");
     $this->jquery->click(".cancel", "\$('#modifier-" . $usecase->getCode() . "').hide('400')");
     $this->jquery->compile($this->view);
 }
 public function ProjectsAction($id = NULL)
 {
     $user = User::findFirst("id=" . $id);
     $uses = Usecase::find("idDev=" . $id);
     foreach ($u as $uses) {
         //progressbar
         $avancement = $u->getAvancement();
         $this->jquery->bootstrap()->htmlProgressbar($u->getCode(), "success", $avancement)->setStriped(true)->setActive(true)->showcaption(true);
     }
     $this->jquery->compile($this->view);
     $this->view->setVars(array("user" => $user, "usecases" => $uses, "siteUrl" => $this->url->getBaseUri(), "baseHref" => $this->dispatcher->getControllerName()));
 }
示例#8
0
 /**
  * Execute the usecase that the controller prepared.
  * @throws HTTP_Exception_400
  * @throws HTTP_Exception_403
  * @throws HTTP_Exception_404
  * @return void
  */
 protected function _execute_usecase()
 {
     try {
         // Attempt to execute the usecase to get the response
         $this->_response_payload = $this->_usecase->interact();
     } catch (Ushahidi\Core\Exception\NotFoundException $e) {
         throw new HTTP_Exception_404($e->getMessage());
     } catch (Ushahidi\Core\Exception\AuthorizerException $e) {
         throw new HTTP_Exception_403($e->getMessage());
     } catch (Ushahidi\Core\Exception\ValidatorException $e) {
         throw new HTTP_Exception_400('Validation Error: \':errors\'', [':errors' => implode(', ', Arr::flatten($e->getErrors()))]);
     } catch (\InvalidArgumentException $e) {
         throw new HTTP_Exception_400('Bad request: :error', [':error' => $e->getMessage()]);
     }
 }
 public function ProjectsAction($id = NULL)
 {
     $user = User::findFirst("id=" . $id);
     $p = Projet::find("idAuthor=" . $id);
     //calcul du poids de chaque projet
     foreach ($p as $projet) {
         $u = Usecase::find("idProjet=" . $projet->getId());
         $totalPoid = 0;
         $avancement = 0;
         $avancementFinal = 0;
         $TempsEcoule = 0;
         $tempsTotal = 0;
         $TempsEcoule = time() - strtotime($projet->getDateLancement());
         $TempsEcoule = floor($TempsEcoule / 86400);
         $tempsTotal = strtotime($projet->getDateFinPrevue()) - strtotime($projet->getDateLancement());
         $tempsTotal = $tempsTotal / 86400;
         $TempsEcoule = $TempsEcoule / $tempsTotal;
         $TempsEcoule = floor($TempsEcoule * 100);
         foreach ($u as $usecase) {
             $totalPoid = $totalPoid + $usecase->getPoids();
             if ($usecase->getAvancement() == 100) {
                 $avancement = $avancement + $usecase->getPoids();
             }
         }
         $avancementFinal = $avancement / $totalPoid;
         $avancementFinal = $avancementFinal * 100;
         $avancementFinal = floor($avancementFinal);
         $colorProgressBar = "";
         if ($avancementFinal >= $TempsEcoule) {
             $colorProgressBar = "success";
         } elseif ($projet->getJourRestant() == 0) {
             $colorProgressBar = "danger";
         } else {
             $colorProgressBar = "warning";
         }
         $this->jquery->bootstrap()->htmlProgressbar($projet->getId(), $colorProgressBar, $avancementFinal)->setStriped(true)->setActive(true)->showcaption(true);
     }
     $this->jquery->getOnClick(".ouvrir", "", "#content", array("attr" => "data-ajax"));
     $this->jquery->getOnClick(".precedent", "", "#content", array("attr" => "data-ajax"));
     $this->jquery->compile($this->view);
     $this->view->pick("author/projects");
     $this->view->setVars(array("user" => $user, "projects" => $p, "siteUrl" => $this->url->getBaseUri(), "baseHref" => $this->dispatcher->getControllerName()));
 }
 public function equipeAction($id = NULL)
 {
     $devs = User::find();
     $p = Projet::findFirst("id=" . $id);
     $usecases = Usecase::find("idProjet=" . $p->getId());
     $dev = array();
     $poids = array();
     $totalUc = 0;
     foreach ($usecases as $uc) {
         $totalUc = $totalUc + $uc->getPoids();
     }
     foreach ($usecases as $uc) {
         $u = User::findFirst("id=" . $uc->getIdDev());
         $dev[$u->getId()] = $u;
         $poids[$u->getId()] = $poids[$u->getId()] + $uc->getPoids();
     }
     foreach ($devs as $de) {
         $poids[$de->getId()] = floor($poids[$de->getId()] / $totalUc * 100);
     }
     $this->view->setVars(array("dev" => $dev, "poids" => $poids, "p" => $totalUc));
 }
	public function deletePostAfterConfirm($request, $response)
	{/*{{{*/
		$usecase = Usecase::getById($request->usecaseid);
		$taskItemCnt = $usecase->getTaskItemCnt();
		
		UsecaseClient::getInstance()->deleted4Case($request->usecaseid, $this->tester);
		
		$preMsg = "用例物理删除,id=".$usecase->id." ; 级联删除任务项数:$taskItemCnt ";
		$response->setRedirect($response->router->urlfor('usecase/listoffunpoint', array('funpointid'=>$usecase->funpoint->id, 'preMsg'=>$preMsg)));
	}/*}}}*/
示例#12
0
 public function getAvancement()
 {
     $id = $this->getId();
     $ucs = Usecase::find("idProjet=" . $id);
     $ucTotal = 0;
     foreach ($ucs as $uc) {
         $ucTotal += $uc->getPoids();
     }
     //poid uc
     $avancement = 0;
     foreach ($ucs as $uc) {
         $poidRel = $uc->getPoids() / $ucTotal * 100;
         $avancement += $poidRel * ($uc->getAvancement() / 100);
         ceil($avancement);
     }
     return round($avancement);
 }
				<?php if($aFunpoint->id != $taskItem->usecase->funpoint->id){ ?>
					<a href='/taskitem/next?testTaskId=<?=$testTask->id ?>&funpointId=<?=$funpointId ?>'>功能点<?=$programId_i.'.'.$moduleId_i.'.'.$funpoint_i;?>:<?=$aFunpoint->name?></a>
				<?php }else{ ?>
					功能点<?=$programId_i.'.'.$moduleId_i.'.'.$funpoint_i;?>:<?=$aFunpoint->name?>
				<?php }?>
				</span>
				<?php echo $testTask->getSumInfoStr4Funpoint($arr3);?>
				
				<?php if( $aFunpoint->id != $taskItem->usecase->funpoint->id){
						echo '</div>';
						continue; 
					} ?>

				<div class='greenBorderDiv'>
				<?php foreach($arr3 as $usecaseId => $aTaskItem){
					$aUsecase = Usecase::getById($usecaseId);
					$borderColor = '#FFF';
					if($aTaskItem->id == $taskItem->id)
					{
						$borderColor = '#00F';
					}
				?>
					<div class='fl' style='border:2px solid <?=$borderColor ?>;padding:2px;margin:2px;background-color: <?=$aTaskItem->getResultBackgroundColor();?>;' ><a title="<?=$aTaskItem->id?>:<?=strip_tags($aUsecase->title);?>" href="/taskitem/next?taskItemId=<?=$aTaskItem->id?>"><?=$testTask->getPos($aTaskItem);?> <?=$aTaskItem->getResultDesc();?></a></div>
				<?php } ?>
					<div class='cb'></div>
				</div>
			</div>
			
		<?php }?>
		
	</div>
 public function manageTasksAction($id = null, $idUc = null)
 {
     $tache = Tache::findFirst($id);
     if (!$tache) {
         $tache = new Tache();
         $tache->setAvancement(0);
         $tache->setCodeUseCase($idUc);
     }
     $users = User::find("idRole<>3");
     $this->view->setVars(array("tache" => $tache, "users" => $users, "baseHref" => $this->url->getBaseUri()));
     $_SESSION['bread']['object'] = $tache;
     $this->jquery->exec("\$('input[type=\"range\"]').rangeslider({\n  \t\t\t\t\t\t\t\tpolyfill: false,\n\t\t\t\t\t\t\t\tonSlide: function(position, value) {\n\t\t\t\t\t\t\t\t\t\$('.avancementTasks').html(value.toString()+'%');\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t});", true);
     $this->view->pick("projects/manageTasks");
     $this->jquery->postFormOnClick(".validateTasks", "Taches/updateFromProject", "frmTasks", ".content");
     $this->jquery->click(".cancelTask", "\$('.tasks').hide();");
     $this->jquery->compile($this->view);
     $uc = Usecase::findFirst("code='" . $tache->getCodeUseCase() . "'");
     $_SESSION['bread']['object'] = Projet::findFirst($uc->getIdProjet());
 }
示例#15
0
	<th>标题:</th>
	<td><input type="text" id="title" name="title" size=70 value="<?=$usecase->title;?>" class="f14 h25"/></td>
</tr>

<tr>
	<th>步骤:</th>
	<td><textarea name="step" rows="9" cols="60"><?=Usecase::filterStr($usecase->step);?></textarea></td>
</tr>

<tr>
	<th>预期结果:</th>
	<td><textarea name="expectresult" rows="6" cols="56"><?=Usecase::filterStr($usecase->expectresult);?></textarea></td>
</tr>
<tr>
	<th>相关用例:</th>
	<td><textarea name="relateusecaseids" rows="3" cols="65"><?=Usecase::filterStr($usecase->relateusecaseids);?></textarea></td>
</tr>

<tr>
	<th>附件:</th>
	<td>
<div class="att">
<?php
		foreach($attachments as $a)	
		{
			$aUrl = TuClient::getInstance()->getUrl($a->filePath);
		?>
			<span style='margin-left:10px'><input type='hidden' name='attachmentids[]' value='<?=$a->id?>'/><img src='http://i1.hdfimg.com/zixun/images/icoico.gif' />&nbsp;
			<a class='blue' target='_blank' href='<?=$aUrl?>'><?=$a->fileName?></a>&nbsp;&nbsp;&nbsp;
			<a class='deleteatt' href='javascript:void(0)'>删除</a></span> <br/>
<?php