public function getAttendanceValue($name)
 {
     if ($this->isAttendanceBySubject()) {
         return $this->getValue($name);
     } else {
         return AbsenceTypePeer::retrieveByPK($this->getValue($name))->getValue();
     }
 }
 protected function execute($arguments = array(), $options = array())
 {
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection();
     // add your code here
     $c = new Criteria();
     $c->addAscendingOrderByColumn(AbsenceTypePeer::VALUE);
     $c->addAscendingOrderByColumn(AbsenceTypePeer::ID);
     foreach (AbsenceTypePeer::doSelect($c) as $key => $absence_type) {
         $absence_type->setOrder($key);
         $absence_type->save();
     }
 }
Esempio n. 3
0
  /**
   * Afficher un tag HTML pour la liste des types d'absence (select)
   * Les options possibles : id pour l'identifiant du select, name pour son name et selected pour vérifier le quel doit apparaitre en selected
   *
   * @param array $options id, name, selected
   * @return string Liste deroulante des types d'absences
   */
  public static function AfficherListeDeroulanteTypes($options){
    $criteria = new Criteria();
    $criteria->addAscendingOrderByColumn(AbsenceTypePeer::ORDRE);
    $liste = AbsenceTypePeer::doSelect($criteria);

    $_id        = isset($options["id"]) ? $options["id"] : 'idTypes';
    $_name      = isset($options["name"]) ? $options["name"] : 'nametypes';
    $_selected  = isset($options["selected"]) ? $options["selected"] : '';
    $_class     = isset($options["class"]) ? ' class="'.$options["class"].'"' : '';

    $retour = '<select id="'.$_id.'" name="'.$_name.'"'.$_class.'>'."\n";
    $retour .= '<option value="0">---</option>'."\n";
    foreach($liste as $type){
      $aff_selected = '';
      if ($type->getId() == $_selected){
        $aff_selected = ' selected="selected"';
      }
      $retour .= '<option value="'.$type->getId().'"'.$aff_selected.'>'.$type->getNom().'</option>'."\n";
    }
    $retour .= '</select>'."\n";

    return $retour;
  }
 protected function getAbsencesType($name, $method)
 {
     $criteria = new Criteria();
     $criteria->add(AbsenceTypePeer::NAME, $name)->add(AbsenceTypePeer::METHOD, $method);
     return AbsenceTypePeer::doSelectOne($criteria);
 }
 protected function getNonExistentAbsenceTypeId()
 {
     $c = new Criteria();
     $c->addSelectColumn(AbsenceTypePeer::ID);
     $stmt = AbsenceTypePeer::doSelectStmt($c);
     $ids = $stmt->fetchAll(PDO::FETCH_COLUMN, 0);
     sort($ids);
     return array_pop($ids) + 1;
 }
Esempio n. 6
0
    } // switch

    if ($del) {
      $effacer = 'ok';
    }else{
      $effacer = 'no';
    }

  }

  /******************* LISTER ******************************/
      $c = new Criteria();
      $c->addAscendingOrderByColumn('ordre');
  switch($type_req){
    case 'types':
    $tout = AbsenceTypePeer::doSelect($c);
      break;
    case 'motifs':
    $tout = AbsenceMotifPeer::doSelect($c);
      break;
    case 'actions':
    $tout = AbsenceActionPeer::doSelect($c);
      break;
    case 'justifications':
    $tout = AbsenceJustificationPeer::doSelect($c);
      break;
    default:
    $tout = NULL;
  } // switch

}catch(exception $e){