public static function getAllActif () { $parents = parent::getAllActif(); $return = array (); foreach ($parents as $parent) { if ($parent->estResponsable()) $return[] = Responsable::getById($parent->getIdUtilisateur()); } return $return; }
public function findAll() { $reponse = $this->db->query(self::FIND_ALL); $responsables = array(); while ($data = $reponse->fetch()) { $responsable = new Responsable(); $responsable->setId($data['NUMERO_RESPONSABLE']); $responsable->setPrenom($data['PRENOM_RESPONSABLE']); $responsable->setNom($data['NOM_RESPONSABLE']); $responsable->setFonction($data['FONCTION']); array_push($responsables, $responsable); } $reponse->closeCursor(); return $responsables; }
/** * Iniciar Traspaso */ public function actionCreate() { date_default_timezone_set('America/Caracas'); $fecha = date('Y-m-d H:i:s'); $bien = new Bienmueble(); $user_id = Yii::app()->user->getId(); $user = Usuario::model()->findbyPk($user_id); $dp_id = $user->dependencia_id; $emisores = Responsable::model()->findByDp($dp_id, 0); $receptores = Responsable::model()->findByDp($dp_id, 1); if (!isset(Yii::app()->session['tid'])) { $model = new BmTraspaso(); $model->dependencia_id = $dp_id; $model->status_id = 1; $model->fecha = $fecha; $model->emisor_id = $emisores['id']; if ($model->save()) { Yii::app()->session['tid'] = $model->id; $this->render('create', array('model' => $model, 'bien' => $bien, 'emisores' => $emisores, 'receptores' => $receptores)); } else { // Flujo en caso de error fatal $dataProvider = new CActiveDataProvider('BmTraspaso'); $this->render('index', array('dataProvider' => $dataProvider)); } } else { $model = $this->loadModel(Yii::app()->session['tid']); if (isset($_POST['BmTraspaso'])) { $model->scenario = 'update'; $model->attributes = $_POST['BmTraspaso']; $data = BmTraspaso::model()->getTotal($model->id); $model->cantidad_total = $data['cantidad_total']; $model->total = $data['total']; if ($model->validate() && $model->update()) { $this->redirect(array('enviar', 'id' => $model->id)); } } $this->render('create', array('model' => $model, 'bien' => $bien, 'emisores' => $emisores, 'receptores' => $receptores)); } }
public function getResponsable(){ return Responsable::getById($this->getIdResponsable()); }
/** * */ public function listaResponsable() { $unResponsable = new Responsable(); $resultado = $unResponsable->responsables(); echo $resultado; }
/** * Deletes a particular model. * If deletion is successful, the browser will be redirected to the 'admin' page. * @param integer $id the ID of the model to be deleted */ public function actionEliminar($id) { $eliminadas = 0; $fallos = 0; $model = PersonaData::model()->findByPk($id); $personas = Persona::model()->findAll(array('condition' => 'pdata_id=' . $model->id)); foreach ($personas as $persona) { $existeR = Responsable::model()->exists('persona_id=' . $persona->id); $existeT = BmTraspaso::model()->exists('emisor_id=' . $persona->id . ' OR receptor_id=' . $persona->id); $existeF = FBm3::model()->exists('observador_id=' . $persona->id); if (!$existeR && !$existeT && !$existeF) { $persona->delete(); $eliminadas++; } else { $fallos++; } } if ($fallos == 0) { $model->delete(); $this->redirect(array('index')); } else { Yii::app()->user->setFlash('error', 'No puede efectuarse la operación. Existen registros que utilizan este dato.'); $this->redirect(array('view', 'pid' => $model->id)); } }
); $this->menu=array( array('label'=>'Listar Proyecto','url'=>array('index')), array('label'=>'Crear Proyecto','url'=>array('create')), ); $this->widget('bootstrap.widgets.TbGridView',array( 'id'=>'proyecto-grid', 'dataProvider'=>$model->search(), 'filter'=>$model, 'columns'=>array( 'id', 'nombre', 'descripcion', 'fechaInicio_ft', 'fechaFin_ft', array('name'=>'responsable_did', 'value'=>'$data->responsable->nombre', 'filter'=>CHtml::listData(Responsable::model()->findAll(), 'id', 'nombre'),), /* array('name'=>'estatus_did', 'value'=>'$data->estatus->nombre', 'filter'=>CHtml::listData(Estatus::model()->findAll(), 'id', 'nombre'),), */ array( 'class'=>'bootstrap.widgets.TbButtonColumn', ), ), )); ?>
public function actionGenerar($formulario) { $meses = Mes::model()->findAll(); $user_id = Yii::app()->user->getId(); $user = Usuario::model()->findbyPk($user_id); $dp_id = $user->dependencia_id; date_default_timezone_set('America/Caracas'); $anho_actual = date('Y'); $i = 0; $t_anho = $anho_actual; $anhos = array(); while ($t_anho > 2011) { $anhos[$i] = $t_anho; $i++; $t_anho--; } switch ($formulario) { case 1: $model = new Fbm1(); $model->dependencia_id = $dp_id; if (isset($_POST['Fbm1'])) { $fecha = date('Y-m-d H:i:s'); $responsable = Responsable::model()->findByAttributes(array('dependencia_id' => $model->dependencia_id, 'status_id' => 1)); $model->attributes = $_POST['Fbm1']; if (isset($responsable) && $model->validate()) { $model->anho = $anhos[$model->anho]; $data = $model->getData(); $mes = Mes::model()->find(array('condition' => 'id=' . $model->mes_id)); $info = Dependencia::model()->getInfo($model->dependencia_id); $header = array(); if ($model->informativo == 1) { $header['columna'] = 4; $header['formulario'] = 1; } else { $header['columna'] = 5; $header['formulario'] = 2; } $header['dependencia'] = $info['dp']; $header['estado'] = 'BOLIVARIANO DE MIRANDA'; $header['municipio'] = 'SUCRE'; $header['servicio'] = $info['servicio']; $header['direccion'] = $info['direccion_corta']; $header['fecha'] = $mes->descripcion . '/' . $model->anho; $header['responsable'] = $responsable->persona->pdata->nombre; $header['cargo'] = $responsable->persona->cargo->descripcion; $this->render('pdf', array('header' => $header, 'data' => $data)); } } break; case 2: $model = new Fbm2(); $model->dependencia_id = $dp_id; if (isset($_POST['Fbm2'])) { $fecha = date('Y-m-d H:i:s'); $responsable = Responsable::model()->findByAttributes(array('dependencia_id' => $model->dependencia_id)); $model->attributes = $_POST['Fbm2']; if (isset($responsable) && $model->validate()) { $model->anho = $anhos[$model->anho]; $data = $model->getData(); $mes = Mes::model()->find(array('condition' => 'id=' . $model->mes_id)); $info = Dependencia::model()->getInfo($model->dependencia_id); $header = array(); $header['columna'] = 6; $header['formulario'] = 3; $header['responsable'] = $responsable->persona->pdata->nombre; $header['cargo'] = $responsable->persona->cargo->descripcion; $header['dependencia'] = $info['dp']; $header['estado'] = 'BOLIVARIANO DE MIRANDA'; $header['municipio'] = 'SUCRE'; $header['servicio'] = $info['servicio']; $header['direccion'] = $info['direccion_corta']; $header['fecha'] = $mes->descripcion . '/' . $model->anho; $this->render('pdf', array('header' => $header, 'data' => $data)); } } break; case 3: $this->redirect(array('/fbm3/index')); break; case 4: $model = new Fbm4(); $model->dependencia_id = $dp_id; if (isset($_POST['Fbm4'])) { $fecha = date('Y-m-d H:i:s'); $responsable = Responsable::model()->findByAttributes(array('dependencia_id' => $model->dependencia_id)); $model->attributes = $_POST['Fbm4']; if (isset($responsable) && $model->validate()) { $model->anho = $anhos[$model->anho]; $data = $model->getData(); $mes = Mes::model()->find(array('condition' => 'id=' . $model->mes_id)); $info = Dependencia::model()->getInfo($model->dependencia_id); $header = array(); $header['columna'] = 6; $header['formulario'] = 5; $header['responsable'] = $responsable->persona->pdata->nombre; $header['cargo'] = $responsable->persona->cargo->descripcion; $header['dependencia'] = $info['dp']; $header['estado'] = 'BOLIVARIANO DE MIRANDA'; $header['municipio'] = 'SUCRE'; $header['servicio'] = $info['servicio']; $header['direccion'] = $info['direccion_corta']; $header['fecha'] = $mes->descripcion . '/' . $model->anho; $header['hoja'] = $mes->id; $this->render('pdf4', array('header' => $header, 'data' => $data)); } else { echo 1; exit; } } break; } $this->render('generar', array('model' => $model, 'meses' => $meses, 'anhos' => $anhos)); }
<?php /** * Created by PhpStorm. * User: Jean-Baptiste * Date: 17/05/2016 * Time: 22:26 */ header('content-type: text/html; charset=utf-8'); require_once '../Require/Objects.php'; if (isset($_GET['action']) && !empty($_GET['action'])) { switch ($_GET['action']) { case "getEleves": $idResponsable = $_GET['idResponsable']; $leResponsable = Responsable::getById($idResponsable); $lesEleves = $leResponsable->getEleves(); $retour = array(); foreach ($lesEleves as $eleve) { $retour[] = $eleve->toArray(); } echo preg_replace('/u([\\da-fA-F]{4})/', '&#x\\1;', str_replace('\\u', 'u', json_encode($retour))); break; } }
public function updateResponsablePersona(Responsable $entity, Persona $responsablePersona) { $entity->setResponsablePersona($responsablePersona->getId()); return $this->persistenceManager->update($entity); }
$eleve = Eleve::getById($_GET['idEleve']); $return = array(); $responsables = $eleve->getResponsables(); foreach ($responsables as $responsable){ $return[] = $responsable->toArray(); } echo json_encode($return); break; case 'addResponsable': $eleve = Eleve::getById($_GET['idEleve']); $responsable = Responsable::getById($_GET['idResponsable']); $eleveResponsable = EleveResponsable::getByEleveResponsable($eleve->getIdEleve(), $responsable->getIdResponsable()); if (!$eleveResponsable->getIdEleve()){ $eleveResponsable->setIdEleve($eleve->getIdEleve()); $eleveResponsable->setIdResponsable($responsable->getIdResponsable()); if ($eleveResponsable->insert()){ echo json_encode('true'); } } break; case 'delResponsable': $eleve = Eleve::getById($_GET['idEleve']); $responsable = Responsable::getById($_GET['idResponsable']); $eleveResponsable = EleveResponsable::getByEleveResponsable($eleve->getIdEleve(), $responsable->getIdResponsable()); if ($eleveResponsable->getIdEleve()){ if ($eleveResponsable->delete()){ echo json_encode('true'); } } break; }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = Responsable::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<?php $eleves = Eleve::getAllActif(); foreach ($eleves as $e) { echo "<option value='" . $e->getIdEleve() . "'>" . $e->getLibelleUtilisatur() . "</option>"; } ?> </select> </td> </tr> <tr> <td>Parent</td> <td> <select id="inputResponsable" name="inputResponsable"> <option value=""></option> <?php $responsables = Responsable::getAllActif(); foreach ($responsables as $r) { echo "<option value='" . $r->getIdResponsable() . "'>" . $r->getLibelleUtilisatur() . "</option>"; } ?> </select> </td> </tr> <tr> <td></td> <td> <span id="btAjouter">Ajouter</span> <span id="btSupprimer">Supprimer</span> </td> </tr>
<td><input type="submit" id="submitButton" name="btSubmit" value="Valider"></td> </tr> </table> </form> </fieldset> <?php } ?> <br/> <?php $CarnetLiaisonAll = array (); if ($utilisateur->estProfesseur() || $utilisateur->estResponsable()) { $CarnetLiaisonAll = CarnetLiaison::getByIdRedacteur($utilisateur->getIdUtilisateur()); } if ($utilisateur->estResponsable()){ $CarnetLiaisonAll = CarnetLiaison::getByEleves(Responsable::getById($utilisateur->getIdUtilisateur())->getEleves()); } if ($utilisateur->estAdministrateur()) { $CarnetLiaisonAll = CarnetLiaison::getAll(); } foreach ($CarnetLiaisonAll as $carnetLiaison) { ?> <fieldset style="width: 80%; margin: auto;"> <legend>Message du <strong><?php echo $carnetLiaison->afficheDateRedaction(); ?></strong> concernant <strong><?php echo $carnetLiaison->getEleve()->getNomUtilisateur() . ' ' . $carnetLiaison->getEleve()->getPrenomUtilisateur(); ?></strong></legend> Auteur : <?php echo $carnetLiaison->getRedacteur()->getNomUtilisateur() . ' ' . $carnetLiaison->getRedacteur()->getPrenomUtilisateur(); ?></br> Message : </br><textarea rows="10" cols="60" readonly><?php echo $carnetLiaison->getContenuCarnetLiaison() ?></textarea> <?php if ($carnetLiaison->estReponse()) { ?> </br><span id="textReponse<?php echo $carnetLiaison->getIdReponse(); ?>" class="reponse" idReponse="<?php echo $carnetLiaison->getIdReponse(); ?>">Voir le Message anterieur.</span>
public function setResponsable(Responsable $v = null) { if ($v === null) { $this->setFkResponsableId(0); } else { $this->setFkResponsableId($v->getId()); } $this->aResponsable = $v; if ($v !== null) { $v->addRelRolresponsableResponsable($this); } return $this; }
public static function addInstanceToPool(Responsable $obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getId(); } self::$instances[$key] = $obj; } }
/** * Listar algunos Reserva dado el $reservaResponsableId * * @param $reservaResponsableId * @param $performSize * @param $firstResultNumber * @param $numResults */ public function listReservasByReservaResponsableId($reservaResponsableId, $performSize = false, $firstResultNumber = null, $numResults = null, $orderBy = null, $orderPriority = SQL_ASCENDING_ORDER) { $objBean = new ResponsableBean($this->persistenceManager); $obj = new Responsable(); $obj->setId($reservaResponsableId); # Validamos los campos if ($firstResultNumber !== null && !EntityValidator::validatePositiveNumber($firstResultNumber)) { throw new Exception(SALAS_COMP_ALERT_E_VALIDATION_FAIL, $this->ID + 103); } if (!EntityValidator::validateGlobalOrderPriority($orderPriority)) { throw new Exception(SALAS_COMP_ALERT_E_VALIDATION_FAIL, $this->ID + 105); } if (!EntityValidator::validateId($reservaResponsableId)) { throw new Exception(SALAS_COMP_ALERT_E_VALIDATION_FAIL, $this->ID + 107); } # Verificamos que la entidad exista if (!$objBean->getResponsable($obj)) { throw new Exception(SALAS_COMP_ALERT_E_ENTITY_NOT_FOUND_FAIL, $this->ID + 109); } # Listamos las entidades if ($performSize) { $this->lastRequestSize = $this->reservaBean->countGetReservasByReservaResponsable($obj); } return ReservaDTO::loadFromEntities($this->reservaBean->listReservasByReservaResponsable($obj, $firstResultNumber, $numResults, $orderBy, $orderPriority)); }
<?php /** * Created by PhpStorm. * User: Jean-Baptiste * Date: 05/08/2015 * Time: 17:44 */ ?> <i id="reduction" class="fa fa-arrow-circle-o-left"></i> <div id="menuContent"> <a href="../Intranet/MesInformations.php">Modifier mes informations</a><br/><br/> <?php if ($utilisateur->estResponsable()) { $utilisateur = Responsable::getById($utilisateur->getIdUtilisateur()); $eleves = $utilisateur->getEleves(); if (count($eleves) > 0) { echo "Enfant Sélectionné :<br/>"; if (count($eleves) == 1) { echo '<span hidden id="idEnfant">' . $eleves[0]->getIdUtilisateur() . '</span>'; echo $eleves[0]->getNomUtilisateur() . " " . $eleves[0]->getPrenomUtilisateur(); } else { ?> <span hidden id="idEnfant"><?php echo $eleves[0]->getIdUtilisateur(); ?></span> <select id="choixEnfant"> <?php foreach ($eleves as $eleve) { echo "<option value='" . $eleve->getIdEleve() . "'>" . $eleve->getNomUtilisateur() . " " . $eleve->getPrenomUtilisateur() . "</option>"; } ?>
/** * Updates a particular model * @param integer $id the ID of the model to be updated * @redirected to'view' page. */ public function actionUpdate($id) { $model = $this->loadModel($id); if (isset($_POST['Fbm3'])) { $model->attributes = $_POST['Fbm3']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $responsables = Responsable::model()->findAll(); $profesiones = Profesion::model()->findAll(); $dps = Dependencia::model()->findAll(); $generos = Sexo::model()->findAll(); $this->render('update', array('model' => $model, 'responsables' => $responsables, 'profesiones' => $profesiones, 'dps' => $dps, 'generos' => $generos)); }
public static function toEntity(ResponsableDTO $responsableDTO) { $responsable = new Responsable(); $responsable->setId($responsableDTO->getId()); $responsable->setResponsableFacultad($responsableDTO->getResponsableFacultad()); $responsable->setResponsableAsignatura($responsableDTO->getResponsableAsignatura()); $responsable->setResponsablePersona($responsableDTO->getResponsablePersona()); return $responsable; }
public function updateReservaResponsable(Reserva $entity, Responsable $reservaResponsable) { $entity->setReservaResponsable($reservaResponsable->getId()); return $this->persistenceManager->update($entity); }
<div class="clearfix"> <?php echo $form->label($model,'fechaFin_ft'); ?> <div class="input"> <?php echo $form->textField($model,'fechaFin_ft'); ?> </div> </div> <div class="clearfix"> <?php echo $form->label($model,'responsable_did'); ?> <div class="input"> <?php echo $form->dropDownList($model,"responsable_did",CHtml::listData(Responsable::model()->findAll(), 'id', 'nombre')); ?> </div> </div> <div class="clearfix"> <?php echo $form->label($model,'estatus_did'); ?> <div class="input"> <?php echo $form->dropDownList($model,"estatus_did",CHtml::listData(Estatus::model()->findAll(), 'id', 'nombre')); ?> </div> </div> <div class="form-actions"> <?php $this->widget('bootstrap.widgets.TbButton', array( 'buttonType'=>'submit', 'type'=>'primary', 'label'=>'Search',
/** * Eliminar un Responsable Dado el $responsableId * * @param $responsableId */ public function removeResponsable($responsableId) { $reservaBean = new ReservaBean($this->persistenceManager); $responsable = new Responsable(); $responsable->setId($responsableId); # Validamos los campos if (!EntityValidator::validateId($responsableId)) { throw new Exception(SALAS_COMP_ALERT_E_VALIDATION_FAIL, $this->ID + 103); } # Verificamos que la entidad exista. if (!$this->responsableBean->getResponsable($responsable)) { throw new Exception(SALAS_COMP_ALERT_E_ENTITY_NOT_FOUND_FAIL, $this->ID + 104); } # Verificamos que la entidad no esté siendo utilziada en alguna otra. # Verificamos que la entidad no esté siendo utilziada en Reserva->reservaResponsable $reservas = $reservaBean->getReservasByReservaResponsable($responsable); if (count($reservas) > 0) { throw new Exception(SALAS_COMP_ALERT_E_PERSISTENCE_REMOVE_LINKED_FAIL, $this->ID + 102); } # Eliminamos la entidad if (!$this->responsableBean->removeResponsable($responsable)) { throw new Exception(SALAS_COMP_ALERT_E_PERSISTENCE_REMOVE_FAIL, $this->ID + 105); } }
} else $maj = $personne->update(); if ($maj){ if ($fonction['Administrateur'] && !$personne->estAdministrateur()){ $admin = new Administrateur(); $admin->setIdAdministrateur($personne->getIdUtilisateur()); $admin->insertOnly(); } if ($fonction['Professeur'] && !$personne->estProfesseur()){ $prof = new Professeur(); $prof->setIdProfesseur($personne->getIdUtilisateur()); $prof->insertOnly(); } if ($fonction['Responsable'] && !$personne->estResponsable()){ $resp = new Responsable(); $resp->setIdResponsable($personne->getIdUtilisateur()); $resp->insertOnly(); } if ($fonction['Eleve']){ $eleve = new Eleve(); $eleve->setIdEleve($personne->getIdUtilisateur()); $eleve->setIdNiveau($_POST['niveauEleve']); $eleve->insertOnly(); } } } if (isset($_POST['btActive'])) { $personne = Utilisateur::getById($_POST['idUtilisateur']);