Exemplo n.º 1
0
    /**
     * Genère des inputs type checkbox à partir des enregistrements de la requete $sql
     * @param string $sql requête SQL
     * @param string $pk nom du champ clé primaire
     * @param string $libelle nom du champ contenant la valeur à afficher à côté du checkbox
     * @param string $name contenu de l'attribut name de la balise <input>
     * @param int $idsel identifiant de l'enregistrement à pré-cocher
     */
    public static function CHECKBOX_from_table($sql, $pk, $libelle, $name, $idsel = "")
    {
        $result = self::$con->query($sql);
        while ($row = $result->fetch_assoc()) {
            $sel = '';
            if (is_array($idsel)) {
                foreach ($idsel as $cle => $valeur) {
                    if ($row[$pk] == $valeur) {
                        $sel = " checked ";
                    }
                }
            } else {
                $sel = $idsel == $row[$pk] ? " checked " : "";
            }
            ?>
						<input value="<?php 
            echo $row[$pk];
            ?>
" type="checkbox" name="<?php 
            echo $name;
            ?>
[]"
							id="<?php 
            echo $row[$libelle];
            ?>
" <?php 
            echo $sel;
            ?>
>
						<label for="<?php 
            echo $row[$libelle];
            ?>
"><?php 
            echo $row[$libelle];
            ?>
</label>
						<br>
						
						<?php 
        }
        //FIN WHILE
    }
/**
 * Löscht entweder eine Projekt zu Ressource oder Phase zu Ressource Zuordnung
 * @param type $username
 * @param type $passwort
 * @param type $projektRessource
 * @return \SoapFault 
 */
function deleteProjektRessource($username, $passwort, $projektRessource)
{
    if (!($user = check_user($username, $passwort))) {
        return new SoapFault("Server", "Invalid Credentials");
    }
    $recht = new benutzerberechtigung();
    $recht->getBerechtigungen($user);
    // if(!$rechte->isBerechtigt('planner', null, 'sui'))
    //	return new SoapFault("Server", "Sie haben keine Berechtigung zum Speichern von Projekten.");
    $ressource = new ressource();
    if ($projektRessource->projektphase_id != '') {
        // von Projektphase löschen
        if ($ressource->deleteFromPhase($projektRessource->ressource_id, $projektRessource->projektphase_id)) {
            return "Erfolg";
        } else {
            return "Fehler beim Löschen";
        }
    } else {
        // von Projekt löschen
        if ($ressource->deleteFromProjekt($projektRessource->ressource_id, $projektRessource->projekt_kurzbz)) {
            return "Erfolg";
        } else {
            return "Fehler beim Löschen";
        }
    }
}
Exemplo n.º 3
0
 /**
  * Execute a SSH command
  *
  * @param string $cmd The SSH command
  *
  * @return string The output
  */
 protected function exec($cmd)
 {
     return $this->con->exec($cmd);
 }
Exemplo n.º 4
0
    public function get($planet_id, $nocache = false)
    {
        if ($nocache == true) {
            $this->instance = array();
        }
        $needToSave = false;
        if (isset($this->instance[$planet_id])) {
            return $this->instance[$planet_id];
        }
        $res = $this->redis->hgetall("ressource_" . $planet_id);
        if (count($res) > 0) {
            $json = $res['json'];
        } else {
            $req = $this->db->query('SELECT r.`id`, r.`user_id`, r.`planet_id`, r.`last_date`, r.`energie`, r.`metaux`, r.`cristaux`, 
											r.`population`, r.`tetranium`,
											r.`metaux_grow`, r.`cristaux_grow`, r.`population_grow`, r.`tetranium_grow`, r.`metaux_productivity`, 
											r.`cristaux_productivity`, r.`tetranium_productivity`, r.`limit_cristaux`, r.`limit_population`, 
											r.`limit_metaux`, r.`limit_tetranium`, r.`debris_cristal`, r.`debris_tetranium`, r.`debris_metal`,
											t.`race`
									FROM `ressources` r
										LEFT JOIN user t ON t.user_id = r.user_id
									WHERE r.`planet_id` = "' . $planet_id . '"');
            $race = $req->row['race'];
            unset($req->row['race']);
            $json = json_encode($req->row);
            if ($this->users->isLogged() && $_SESSION['user']['planet_id'] == $planet_id) {
                $needToSave = true;
            }
            $terrains = $this->db->query('SELECT pt.* FROM `planete_type_link` ptl LEFT JOIN `planete_type` pt ON pt.`id` = ptl.`id_planet_type` WHERE ptl.`id_planet` = "' . $planet_id . '"');
            $metaux = 0;
            $cristaux = 0;
            $tetranium = 0;
            if ($terrains->count > 0) {
                foreach ($terrains->rows as $t) {
                    $metaux += $t['metal'];
                    $cristaux += $t['cristal'];
                    $tetranium += $t['tetranium'];
                }
            }
            $terrains = array('metaux' => $metaux, 'cristaux' => $cristaux, 'tetranium' => $tetranium);
        }
        $r = new ressource($json);
        if (isset($race) && $race == "mineur") {
            $r->bonusRaideur();
        }
        if (isset($terrains)) {
            $r->growTerrains($terrains);
        }
        $this->instance[$planet_id] = $r;
        if ($needToSave) {
            self::saveRedis($this->instance[$planet_id]->getDatas());
        }
        return $this->instance[$planet_id];
    }
 }
 $projektphase = new projektphase();
 if (!$projektphase->getProjektphasen($projekt_kurzbz)) {
     die("Fehler beim laden der Phasen");
 }
 // Offene Projekttasks - > current_date - ORDER BY Ende - LIMIT 3
 $projekttasksOffen = new projekttask();
 if (!$projekttasksOffen->getProjekttasksForStatusbericht($projekt_kurzbz)) {
     die("Fehler beim laden der Tasks");
 }
 // Projektphasen nur 1. Ebene - keine Unterphasen
 $projektphasenStatusbericht = new projektphase();
 if (!$projektphasenStatusbericht->getProjektphasen($projekt_kurzbz, true)) {
     die("Fehler beim laden der Phasen");
 }
 $ressource = new ressource();
 if (!$ressource->getProjectRessourcen($projekt_kurzbz)) {
     die("Fehler beim laden der Ressourcen");
 }
 $oBestellung = new wawi_bestellung();
 $oBestellung->getBestellungProjekt($projekt_kurzbz);
 // Kosten aller dem Projekt zugeordneten Bestellungen
 $projekt_kosten = 0;
 foreach ($oBestellung->result as $bestellung) {
     $brutto = $bestellung->getBrutto($bestellung->bestellung_id);
     if ($brutto == '') {
         $brutto = '0';
     }
     $projekt_kosten += $brutto;
 }
 // berechne den Projektfortschritt [GesamtFortschrittPhasen / AnzahlPhasen]
         $ressource_uphasen->getPhaseRessourcen($uphase->projektphase_id);
         echo '              <unterphase>';
         echo '                  <phase_bezeichnung><![CDATA[' . $uphase->bezeichnung . ']]></phase_bezeichnung>';
         echo '                  <phase_beschreibung><![CDATA[' . $uphase->beschreibung . ']]></phase_beschreibung>';
         echo '                  <phase_beginn><![CDATA[' . $datum->formatDatum($uphase->start, 'd.m.Y') . ']]></phase_beginn>';
         echo '                  <phase_end><![CDATA[' . $datum->formatDatum($uphase->ende, 'd.m.Y') . ']]></phase_end>';
         echo '                  <phase_budget><![CDATA[' . $uphase->budget . ']]></phase_budget>';
         echo '                  <phase_ressourcen>';
         foreach ($ressource_uphasen->result as $res_phase) {
             echo '                  <ressource><bezeichnung><![CDATA[' . $res_phase->bezeichnung . ']]></bezeichnung></ressource>';
         }
         echo '                  </phase_ressourcen>';
         $utasks = new projekttask();
         $utasks->getProjekttasks($uphase->projektphase_id);
         foreach ($utasks->result as $task) {
             $ressource_task = new ressource();
             $ressource_task->load($task->ressource_id);
             echo '              <task>';
             echo '                  <task_bezeichnung><![CDATA[' . $task->bezeichnung . ']]></task_bezeichnung>';
             echo '                  <task_beschreibung><![CDATA[' . $task->beschreibung . ']]></task_beschreibung>';
             echo '                  <task_ende><![CDATA[' . $datum->formatDatum($task->ende, 'd.m.Y') . ']]></task_ende>';
             echo '                  <task_ressource><![CDATA[' . $ressource_task->bezeichnung . ']]></task_ressource>';
             echo '              </task>';
         }
         echo '              </unterphase>';
     }
     echo '          </phase>';
 }
 echo '      </phasen>';
 echo '  </projekt>';
 echo '</projekte>';
Exemplo n.º 7
0
 /**
  * Internal Constructor
  *
  * Constructor of the entry. Sets up the distinguished name and the entries
  * attributes.
  * You should not call this method manually! Use {@link Net_LDAP2_Entry::createFresh()}
  * or {@link Net_LDAP2_Entry::createConnected()} instead!
  *
  * @param Net_LDAP2|ressource|array $ldap Net_LDAP2 object, ldap-link ressource or array of attributes
  * @param string|ressource          $entry Either a DN or a LDAP-Entry ressource
  *
  * @access protected
  * @return none
  */
 public function __construct($ldap, $entry = null)
 {
     parent::__construct('Net_LDAP2_Error');
     // set up entry resource or DN
     if (is_resource($entry)) {
         $this->_entry = $entry;
     } else {
         $this->_dn = $entry;
     }
     // set up LDAP link
     if ($ldap instanceof Net_LDAP2) {
         $this->_ldap = $ldap;
         $this->_link = $ldap->getLink();
     } elseif (is_resource($ldap)) {
         $this->_link = $ldap;
     } elseif (is_array($ldap)) {
         // Special case: here $ldap is an array of attributes,
         // this means, we have no link. This is a "virtual" entry.
         // We just set up the attributes so one can work with the object
         // as expected, but an update() fails unless setLDAP() is called.
         $this->setAttributes($ldap);
     }
     // if this is an entry existing in the directory,
     // then set up as old and fetch attrs
     if (is_resource($this->_entry) && is_resource($this->_link)) {
         $this->_new = false;
         $this->_dn = @ldap_get_dn($this->_link, $this->_entry);
         $this->setAttributes();
         // fetch attributes from server
     }
 }
Exemplo n.º 8
0
 public function executeCommand($command)
 {
     $this->ssh->connect($this->getHost(), $this->getPort());
     $this->ssh->authenticate($this->getUser(), $this->getPublicKey(), $this->getPrivateKey());
     return $this->ssh->execute('cd ' . $this->getDir() . ' && ' . $command);
 }
Exemplo n.º 9
0
$oRdf->sendHeader();
$lastPT = null;
foreach ($projekttask_obj->result as $projekttask) {
    $i = $oRdf->newObjekt($projekttask->projekttask_id);
    $oRdf->obj[$i]->setAttribut('projekttask_id', $projekttask->projekttask_id);
    $oRdf->obj[$i]->setAttribut('projektphase_id', $projekttask->projektphase_id);
    $oRdf->obj[$i]->setAttribut('bezeichnung', $projekttask->bezeichnung);
    $oRdf->obj[$i]->setAttribut('beschreibung', $projekttask->beschreibung);
    $oRdf->obj[$i]->setAttribut('aufwand', $projekttask->aufwand);
    $oRdf->obj[$i]->setAttribut('mantis_id', $projekttask->mantis_id);
    $oRdf->obj[$i]->setAttribut('scrumsprint_id', $projekttask->scrumsprint_id);
    $oRdf->obj[$i]->setAttribut('erledigt', $projekttask->erledigt ? 'true' : 'false');
    $oRdf->obj[$i]->setAttribut('projekttask_fk', $projekttask->projekttask_fk);
    $ressource_bezeichnung = '-';
    if ($projekttask->ressource_id != '') {
        $ressource = new ressource();
        $ressource->load($projekttask->ressource_id);
        $ressource_bezeichnung = $ressource->bezeichnung;
    }
    $oRdf->obj[$i]->setAttribut('ressource_bezeichnung', $ressource_bezeichnung);
    $oRdf->obj[$i]->setAttribut('ressource_id', $projekttask->ressource_id);
    $oRdf->obj[$i]->setAttribut('ende', $datum_obj->formatDatum($projekttask->ende, 'd.m.Y'));
    if ($projekttask->projekttask_fk != '') {
        $oRdf->addSequence($projekttask->projekttask_id, $projekttask->projekttask_fk);
    } else {
        $oRdf->addSequence($projekttask->projekttask_id);
    }
}
$oRdf->sendRdfText();
?>
>>>>>>> fee287127566cd5d18c55b556d178b661711c694