Exemplo n.º 1
0
Arquivo: Jeu.php Projeto: laiello/ascn
    /**
     * 
     * Construit une instance de DBItem à partir
     * du nom de la classe finalement étendue.
     */
    public function __construct()
    {
        parent::__construct('jeu', queryLine('
			select *
			from jeu
			where jeu_name=\'' . strtolower(get_class($this)) . '\'
		'));
    }
Exemplo n.º 2
0
    private function updateSlots()
    {
        $this->slots = DBItem::getCollection('slot', '
			select * from slot
			where partie_id=' . $this->getID() . ' 
			order by slot_position
		');
    }
Exemplo n.º 3
0
<?php

if (array_key_exists("action", $_POST) && $_POST["action"] === "search") {
    $db = DB::getInstance();
    $where = $db->quote($_POST["field"], DB::PARAM_IDENT) . " LIKE " . $db->quote(str_replace(array("%", "*"), array("\\%", "%"), $_POST["value"]), DB::PARAM_STR);
    $temp->content .= '<h1>Search results</h1>';
    $temp->content .= DBItem::getByConditionCLASS($class, $where)->view(false, false);
} else {
    $temp->content = '<h1>Search ' . $class . '</h1>' . '<form method="POST">Search in <select name="field">';
    foreach (DBItemField::parseClass($class) as $item) {
        /* @var $item DBItemField */
        if ($item->searchable) {
            $temp->content .= '<option>' . $item->name . '</option>';
        }
    }
    $temp->content .= '</select> for <input name="value"><br><button type="submit" name="action" value="search">search</button></form>';
}
Exemplo n.º 4
0
				global $ldap;
				if ($ldap->isBound()){
					$user = LDAPUser::getById($uidNumber);
					if ($user){
						$user->view("singleLine", true);
					}
					else {
						echo "---";
					}
				}
				else {
					echo "LDAP server not available";
				}
				echo "</td></tr>";
			}'));
    $item->on("view.field.sequence", create_function('$ev', '$item = $ev->getCurrentTarget();
			if ($item instanceOf SequenceItem){
				echo "<tr><td>sequence length</td><td>" . $item->getSequenceLength() . "</td>";
			}
			else {
				echo "<tr><td>sequence length</td><td>" . strlen(preg_replace("/\\\\s/", "", $item->sequence)) . "</td>";
			}'));
    $item->on("view.fields.end", create_function('$ev', 'echo "<tr><td>edit</td><td>" . $ev->getCurrentTarget()->view("link.edit", false) . "</td>";'));
    $temp->content .= $item->view(false, false);
} else {
    $temp->content = '<h1>Choose ' . $temp->html($class) . '</h1><ul>';
    foreach (DBItem::getByConditionCLASS($class) as $item) {
        $temp->content .= '<li>' . $item->view("link", false) . '</li>';
    }
    $temp->content .= '</ul>';
}
Exemplo n.º 5
0
 public function __construct($arg = null)
 {
     parent::__construct('slot', $arg);
 }
Exemplo n.º 6
0
 public function __construct($arg = null)
 {
     parent::__construct('joueur', $arg);
 }
Exemplo n.º 7
0
<?php

if (include "login.php") {
    $temp->content .= '<h1>Enter data for new ' . $class . '</h1><form method="POST" enctype="multipart/form-data">';
    $item = DBItem::getCLASS($class, 0);
    $temp->content .= $item->view("edit", false);
    $temp->content .= '<button type="submit" name="action" value="save">save</button></form>';
    $temp->content .= '<script type="text/javascript">(function(){
		var forms = document.getElementsByTagName("form");
		forms[forms.length - 1].elements[2].select();
	})()</script>';
    if (array_key_exists("id", $_POST) && array_key_exists("action", $_POST) && $_POST["action"] === "save") {
        $item = DBItem::createCLASS($class, DBItemField::parseClass($class)->translateRequestData($_POST[$class][0]));
        if ($item->hasField("creator")) {
            $item->creator = $_SESSION["userID"];
        }
        $temp->content .= '<h1>Entry saved.</h1>';
        $temp->content .= $item->view(false, false);
    }
}