public function executeListCustom(sfWebRequest $request) { $q = Doctrine_core::getTable('Report')->getCustomReportsByUserQuery($request->getParameterHolder()->getAll()); $this->pager = new sfDoctrinePager('Report', sfConfig::get('app_report_max_on_list')); $this->pager->setQuery(Doctrine_core::getTable('Report')->getCustomReportsByUserQuery($request->getParameterHolder()->getAll())); $this->pager->setPage($request->getParameter('page', 1)); $this->pager->init(); }
public function checkNumberCharges($validator, $values, $arguments) { try { // checking if user_id or vehicles_list pass the validation $v = $arguments['user_id']->clean($values['user_id']); $v = $arguments['vehicles_list']->clean($values['vehicles_list']); } catch (Exception $exc) { // if we are here, there were validation errors. So we don't check if the range is ok. return $values; } $pv = $this->processValues($values); $q = Doctrine_Core::getTable('Charge')->getAllByUserAndVehiclesQuery($pv['user_id'], $pv['vehicles_list']); $q = Doctrine_core::getTable('Charge')->addRangeQuery($q, $pv); $count = $q->count(); if ($count == 0) { throw new sfValidatorError($validator, 'No charges can be retrieved within the range defined in this form. Please define another range.'); } return $values; }
public function executeGetUnexecFunctions(sfWebRequest $request) { $this->forward404unless($request->isXmlHttpRequest()); $this->checkProject($request); //Recherche du projet concerné $this->checkProfile($request, $this->ei_project); //Recherche du profil $this->checkCampaign($request, $this->ei_project); // Recherche de la camapagne. $this->checkCampaignExecution($request, $this->ei_project, $this->ei_campaign); // Recherche de l'exécution de camapagne. $this->unexecFunctions = Doctrine_core::getTable("EiCampaignExecution")->getUnExecutedFunctions($this->project_id, $this->project_ref, $this->campaign_execution_id); $partialResults = $this->urlParameters; $partialResults['ei_campaign'] = $this->ei_campaign; $partialResults['campaign_execution'] = $this->campaign_execution; $partialResults['unexecFunctions'] = $this->unexecFunctions; return $this->renderText(json_encode(array('html' => $this->getPartial("eicampaignexecution/unexecutedFunctions", $partialResults), 'success' => true))); return sfView::NONE; }
public static function createNewLink(KalFunction $kal_fonction, EiSubject $bug, $automate = false, Doctrine_Connection $conn = null) { if ($conn == null) { $conn = Doctrine_Manager::connection(); } $newLink = new EiSubjectFunctions(); $newLink->setKalFunction($kal_fonction); $newLink->setSubjectId($bug->getId()); $newLink->setAutomate($automate); $currentLink = Doctrine_core::getTable('EiSubjectFunctions')->findOneBySubjectIdAndFunctionIdAndFunctionRef($bug->getId(), $kal_fonction->getFunctionId(), $kal_fonction->getFunctionRef()); if ($currentLink == null) { $newLink->save($conn); //La liaison n'existe pas: on la crée. } if ($currentLink != null && !$currentLink->getAutomate()) { $currentLink->setAutomate($automate); //La liaison existe mais n'est pas forte: on la rend forte. $currentLink->save($conn); } }
public function executeUpdate(sfWebRequest $request) { $this->forward404unless($request->isXmlHttpRequest()); $this->checkProject($request); $this->checkProfile($request, $this->ei_project); $this->checkFunction($request, $this->ei_project); $this->success = false; /* Vérification du package par défaut de l'utilisateur */ $this->defPack = Doctrine_Core::getTable('EiUserDefaultPackage')->findOneByProjectIdAndProjectRefAndUserIdAndUserRef($this->ei_project->getProjectId(), $this->ei_project->getRefId(), $this->ei_user->getUserId(), $this->ei_user->getRefId()); if ($this->defPack == null) { return $this->renderText(json_encode(array('html' => "You have to set default intervention before.Please do it and try again ...", 'is_default_intervention_null' => true, 'success' => $this->success))); } $this->node_function = Doctrine_core::getTable("EiTree")->findOneByObjIdAndRefObjAndTypeAndProjectIdAndProjectRef($this->function_id, $this->function_ref, "Function", $this->project_id, $this->project_ref); $this->forward404Unless($this->node_function); $this->ei_parent_tree = $this->node_function->getNodeParent(); $this->form = new KalFunctionForm($this->kal_function); $this->processForm($request, $this->form); if ($this->success) { $this->kal_function = Doctrine_Core::getTable("KalFunction")->findOneByFunctionIdAndFunctionRef($this->function_id, $this->function_ref); $mainInfParams = $this->urlParameters; $mainInfParams['kal_function'] = $this->kal_function; $this->html = $this->getPartial('mainInf', $mainInfParams); return $this->renderText(json_encode(array('html' => $this->getPartial('mainInf', $mainInfParams), 'success' => $this->success))); } else { return $this->renderText(json_encode(array('html' => $this->html, 'success' => $this->success))); } return sfView::NONE; }
public function executeShow(sfWebRequest $request) { $this->setProjetAndProfil($request); if ($this->profile_id == 0 || $this->profile_ref == 0) { return $this->redirect('@project_first_load?project_id=' . $this->project_id . '&project_ref=' . $this->project_ref); } if ($this->ei_project == null) { $this->forward404('Project not found'); } $this->guardUser = $this->getUser()->getGuardUser(); //Si un seul résultat est trouvé , on redirige vers l //Création des statuts par défaut du projet $this->ei_project->createDefaultStates(); /* On récupère tous les statuts de bugs différent de "Close" et on les passe en paramètre pour la recherche */ $states = Doctrine_Core::getTable('EiSubjectState')->getSubjectStateForProjectQuery($this->ei_project->getProjectId(), $this->ei_project->getRefId())->execute(); $this->projectBugsStates = $states; $stateTabTodolist = array(); if (count($states) > 0) { foreach ($states as $i => $state) { if ($state->getDisplayInTodolist()) { $stateTabTodolist[$i] = $state->getId(); } //Statuts de bug à ramener dans la todolist utilisateur } } /* Récupération des livraisons ouvertes dans l'ordre décroissante des date de livraison */ // $this->openDeliveries = $this->checkOpenDeliveries($this->ei_project); /* Recherche de la prochaine livraison */ //Récupération des livraisons ouvertes du projet $dashBoardProjDels = Doctrine_core::getTable('EiDelivery')->getDashBoardProjDels($this->ei_project->getProjectId(), $this->ei_project->getRefId(), $this->guardUser->getId()); $conn = Doctrine_Manager::connection(); $projDelIds = $conn->fetchAll("select d.id from ei_delivery d inner join ei_delivery_state ds on d.delivery_state_id=ds.id where ds.close_state=0 and d.project_id=" . $this->ei_project->getProjectId() . " and d.project_ref=" . $this->ei_project->getRefId() . " order by d.delivery_date desc;"); if (count($projDelIds) > 0) { //Des livraisons existent sur le projet $tabDels = array(); if (count($dashBoardProjDels) > 0) { foreach ($projDelIds as $projDelId) { foreach ($dashBoardProjDels as $del) { if ($projDelId['id'] == $del['d_id']) { $tabDels[$projDelId['id']][$del['st_id']] = $del; } } } } $this->tabDels = $tabDels; } /* Récupération des bugs à traiter de l'utilisateur courant par type "kalifast" , "defects" , etc ... dans la limite de 10 chacun */ $this->searchSubjectCriteriaToDoList = array(); $this->searchSubjectCriteriaToDoList['assignment'] = $this->guardUser->getUsername(); $this->searchSubjectCriteriaToDoList['state'] = $stateTabTodolist; if (count($stateTabTodolist) > 0) { //Statuts de bug à ramener dans la todolist utilisateur $this->kalifastUserBugs = $this->checkKalifastUserBugs($this->ei_project, $this->searchSubjectCriteriaToDoList); $this->defectsUserBugs = $this->checkDefectsUserBugs($this->ei_project, $this->searchSubjectCriteriaToDoList); $this->serviceRequestUserBugs = $this->checkServiceRequestUserBugs($this->ei_project, $this->searchSubjectCriteriaToDoList); $this->enhancementUserBugs = $this->checkEnhancementUserBugs($this->ei_project, $this->searchSubjectCriteriaToDoList); } $this->cleanDeliveryAndSubjectSessions(); //On néttoie les variables de session des livraisons et des sujets en cas de changement du projet courant }
public function executeListLinkByRelation(sfWebRequest $request) { $links = Doctrine_core::getTable('peanutLink')->getItemsByRelation($this->getRequestParameter('relation')); $items = $this->_processing($request, $links); $this->items = $items; }
public function createClone($new_name) { $conn = Doctrine_Manager::connection(); // Tout est dans une transaction pour eviter d'effectuer une partie des opérations try { $conn->beginTransaction(); //Copie du scénario $copie = $this->createCopie($new_name, $conn); //Pour chaque version racine du scénario, on clone la version racine et ensuite on change les ei_scenario_id par l'id_clone $root_versions = Doctrine_core::getTable('EiVersion')->findByEiScenarioId($this->getId()); //throw new Exception($copie->getId()); if ($root_versions->getFirst()) { //S'il existe un version racine foreach ($root_versions as $root_version) { $root_version->createClone($root_version->getLibelle(), null, $conn, $copie->getId()); } } $this->createProfilScenarioForClone($copie, $conn); $conn->commit(); return $copie; } catch (Exception $e) { $conn->rollBack(); throw $e; } return null; }
public function getLastIterationForProfile(EiProfil $ei_profile, Doctrine_Connection $conn = null) { if ($conn == null) { $conn = Doctrine_Manager::connection(); } return Doctrine_core::getTable("EiIteration")->getLastIterationForProfile($this->getProjectId(), $this->getProjectRef(), $this->getId(), $ei_profile->getProfileId(), $ei_profile->getProfileRef(), $conn); }
public function getExecutionDetails($execution_id) { $res = Doctrine_core::getTable("EiCampaignExecution")->getExecutionDetails($execution_id); if (count($res) > 0) { return $this->campaign_execution = $res[0]; } return array(); }
public function executeIsDeliveryClosed(sfWebRequest $request) { if (!$request->isXmlHttpRequest()) { $this->forward404("Can't call this action..."); } $this->checkProject($request); //Récupération du projet $this->checkProfile($request, $this->ei_project); //Récupération du profil courant $this->checkDelivery($request, $this->ei_project); $state = Doctrine_core::getTable('EiDeliveryState')->findOneById($this->ei_delivery->getDeliveryStateId()); if ($state->getCloseState()) { return $this->renderText(json_encode(array('html' => "Delivery is closed", 'success' => true))); } else { return $this->renderText(json_encode(array('html' => "Delivery is open", 'success' => false))); } return sfView::NONE; }
public function getEiSubjects() { return Doctrine_core::getTable('EiSubject')->findByPackageRefAndPackageId($this->getTicketRef(), $this->getTicketId()); }
'titulo_posgrado' : '<?= $educacional["titulo_posgrado"] ?>', 'ocupacion' : '<?= $educacional["ocupacion"] ?>', 'cambios' : '<?= $educacional["cambios"] ?>' }; $(document).ready(function(){ $("#domicilioAnterior input").attr("disabled",true); }); </script> <? } $listadoSexos = Doctrine_Core::getTable('Sexo')->findAll()->getData(); $listadoEC = Doctrine_Core::getTable('EstadoCivil')->findAll()->getData(); $paises = Doctrine_Core::getTable('Pais')->findAll()->getData(); $provincias = Doctrine_core::getTable('Provincia')->findAll()->getData(); ?> <script type="text/javascript"> $(document).ready(function(){ //$("#formTramite").form(); $("select, input:text, input:checkbox, input:radio, input:file, input:submit, textarea").uniform(); /* * ESTO SE CORRE SOLO SI * SE VA A EDITAR UN TRAMITE */ if (typeof ente != "undefined") { $.each(ente,function(k,v){ $("input[name='"+k+"']").val(v);
public function getSemesterPrerequisiteCourseIdsArray($semesterCoursesArray = null, $departmentId = NULL) { $q = Doctrine_Query::create()->from('RelatedCourses')->whereIn('course_id', $semesterCoursesArray); $q->execute(); ##Prerequisite courses are courseCodes here, so for each course codes find related courseIds if ($q->count() != 0) { $prerequisiteCourseNumbersArray = array(); foreach ($q->execute() as $spCourses) { $prerequisiteCourseNumbersArray[] = $spCourses->getPrerequisiteCourseNumber(); } return Doctrine_core::getTable('Course')->getCourseIdsArrayByCourseNumbersArray($departmentId, $prerequisiteCourseNumbersArray); } else { return null; } }
public function executeCreate(sfWebRequest $request) { $this->checkProject($request); $this->checkProfile($request, $this->ei_project); $this->checkEiScenario($request, $this->ei_project); /* On recherche le package par défaut. S'il n'est pas définit , on le spécifie à l'utilisateur au lieu de lui retourner le formulaire */ $this->searchDefPackAndRedirect(); if (!($request->isMethod(sfRequest::POST) || $request->isXmlHttpRequest())) { $this->forward404("Request error ..."); } //vérification des paramètres. $this->getUrlParameters($request); $this->ei_block_root = Doctrine_Core::getTable('EiBlock')->getEiBlockRoot($this->ei_scenario_id); if (!$this->ei_block_root) { return $this->createJSONErrorResponse("The version could not be created. Scenario's root block not found."); } $ei_blocks = Doctrine_Core::getTable('EiVersionStructure')->getEiBlocksTree($this->ei_block_root->getId(), EiVersionStructure::getBlockTypes()); //création de la version $ei_version = new EiVersion(); $ei_version->setEiScenarioId($this->ei_scenario_id); $ei_version->setEiScenarioBlocks($ei_blocks); $ei_version->setOldVersionId($this->ei_block_root->getEiVersionId()); $this->form = new EiVersionForm($ei_version, array('ei_scenario_package' => new EiScenarioPackage())); $ei_scenario_package_form = $request->getParameter($this->form->getName()); $ei_scenario_package_datas = $ei_scenario_package_form['ei_scenario_package']; if ($ei_scenario_package_datas['package_id'] != null && $ei_scenario_package_datas['package_ref'] != null) { $this->ei_package = Doctrine_core::getTable('EiTicket')->findOneByTicketIdAndTicketRef($ei_scenario_package_datas['package_id'], $ei_scenario_package_datas['package_ref']); /* On recherche si pour le package par défaut et le scénario , il existe une version */ $this->ei_scenario_package = Doctrine_Core::getTable('EiScenarioPackage')->findOneByEiScenarioIdAndPackageIdAndPackageRef($this->ei_scenario_id, $ei_scenario_package_datas['package_id'], $ei_scenario_package_datas['package_ref']); } else { //Erreur dû au fait qu'on ne permet pas la création d'une version sans spécification de package throw new Exception('No package set for version !'); } $this->processForm($request, $this->form); $this->setTemplate('new'); }
public function executeIsAutomate(sfWebRequest $request) { $this->checkProject($request); //Récupération du projet $this->checkProfile($request, $this->ei_project); //Récupération du profil courant $this->step_type_id = intval($request->getParameter('step_type_id')); if ($this->step_type_id == null) { $this->forward404('Step type parameter is NULL'); } $stepType = Doctrine_core::getTable('EiCampaignGraphType')->findOneByProjectIdAndProjectRefAndId($this->project_id, $this->project_ref, $this->step_type_id); if ($stepType == null) { $this->forward404('Step type not found'); } if ($stepType->getAutomate()) { return $this->renderText(json_encode(array('html' => "Is automatizable", 'success' => true))); } else { return $this->renderText(json_encode(array('html' => "Is not automatizable", 'success' => false))); } }
public function getVoitureByModele($id) { return Doctrine_core::getTable('MobilyrentModele')->find($id); }