Exemple #1
0
 public function __construct(\Fp\Core\Init $O)
 {
     $this->O = $O;
     $this->prefix = $O->glob('prefix');
     $dbLink = Db::get_link();
     /*
      * Groupe
      */
     $shema = array('table' => $this->prefix . $this->table_Group, 'options' => array('auto_increment' => 1), 'column' => array('gid' => array('type' => 'bigint', 'primary' => 1, 'sortable' => 1, 'searchable' => 1), 'name' => array('type' => 'varchar', 'unique' => 1, 'sortable' => 1, 'searchable' => 1), 'timestamp' => array('type' => 'timestamp')));
     $this->tableGroup = Table::setTable($dbLink, $shema);
     $this->dbGroup = new Table_query($this->tableGroup, 'g');
     /*
      * Zone
      */
     $shemaZone = array('table' => 'permissions_zone', 'options' => array('auto_increment' => 1), 'column' => array('zid' => array('type' => 'bigint', 'primary' => 1, 'sortable' => 1, 'searchable' => 1), 'name' => array('type' => 'varchar', 'unique' => 1, 'sortable' => 1, 'searchable' => 1), 'timestamp' => array('type' => 'timestamp', 'sortable' => 1, 'searchable' => 1)));
     $this->tableZone = Table::setTable($dbLink, $shemaZone);
     $this->dbZone = new Table_query($this->tableZone, 'z');
     /*
      * GroupUser
      */
     $shemaGroupUser = array('table' => 'permissions_group_user', 'column' => array('gid' => array('type' => 'bigint', 'primary' => 1, 'sortable' => 1, 'searchable' => 1), 'uid' => array('type' => 'bigint', 'sortable' => 1, 'searchable' => 1), 'permission' => array('type' => 'int'), 'timestamp' => array('type' => 'timestamp', 'sortable' => 1, 'searchable' => 1)));
     $this->tableGroupUser = Table::setTable($dbLink, $shemaGroupUser);
     $this->dbGroupUser = new Table_query($this->tableGroupUser, 'gu');
     $this->dbGroupUser->innerJoin($this->tableGroup, 'g', 'gu.gid=g.gid ');
     /*
      * Group Zone
      */
     $shemaGroupZone = array('table' => 'permissions_group_zone', 'column' => array('gid' => array('type' => 'bigint', 'primary' => 1, 'sortable' => 1, 'searchable' => 1), 'zid' => array('type' => 'bigint', 'sortable' => 1, 'searchable' => 1), 'permission' => array('type' => 'int', 'sortable' => 1, 'searchable' => 1), 'timestamp' => array('type' => 'timestamp', 'sortable' => 1, 'searchable' => 1)));
     $this->tableGroupZone = Table::setTable($dbLink, $shemaGroupZone);
     $this->dbGroupZone = new Table_query($this->tableGroupZone, 'gz');
     $this->dbGroupZone->innerJoin($this->tableGroup, 'g', 'gz.gid=g.gid ');
     $this->dbGroupZone->innerJoin($this->tableZone, 'z', 'gz.zid=z.zid ');
 }
Exemple #2
0
 public function __construct(\Fp\Core\Init $O)
 {
     $this->O = $O;
     $this->namespace = $this->type_node = get_called_class();
     $dbLink = $O->db();
     /* Db 2 */
     $tabledbNode = $this->O->glob('prefix') . 'node';
     $columndbNode = array('id_node', 'type_node', 'uid', 'gid', 'zid', 'etat', 'rank', 'data', 'date_creation', 'date_modification', 'date_publication');
     $this->tableNode = Table::set($dbLink, $tabledbNode, $columndbNode);
     $this->tableNode->setPrimary('id_node');
     $this->tableNode->setUnique(array());
     $this->tableNode->setSortable(array('id_node', 'uid', 'gid', 'zid', 'etat', 'rank', 'type_node', 'date_creation', 'date_modification', 'date_publication'));
     $this->tableNode->setSearchable(array('id_node' => 'bigint', 'uid' => 'bigint', 'gid' => 'bigint', 'type_node' => 'varchar', 'date_creation' => 'timestamp', 'date_modification' => 'timestamp', 'date_publication' => 'timestamp'));
     $this->tableNode->setAutoIncrement(true);
     $this->dbNode = new Table_query($this->tableNode, 'n');
     //relation 1:n
     $tableRelation = $this->O->glob('prefix') . 'node_relation';
     $columnRelation = array('id_node_parent', 'id_node_enfant', 'position');
     $this->tableRelation = Table::set($dbLink, $tableRelation, $columnRelation);
     $this->tableRelation->setPrimary('id_node_parent');
     $this->tableRelation->setUnique(array());
     $this->tableRelation->setSortable(array('id_node_parent', 'position', 'id_node_enfant'));
     $this->tableRelation->setSearchable(array('id_node_parent' => 'bigint', 'position' => 'int', 'id_node_enfant' => 'bigint'));
     $this->tableRelation->setAutoIncrement();
     $this->dbNodeRelation = new Table_query($this->tableRelation, 'r');
     $this->dbNodeRelation->innerJoin($this->tableNode, 'n', ' n.id_node=r.id_node_parent ');
     $this->dbNodeRelation->selectColumn("n.*");
     //link 1:1
     $tableLink = $this->O->glob('prefix') . 'node_link';
     $columnLink = array('id_node_1', 'id_node_2', 'position');
     $this->tableLink = Table::set($dbLink, $tableLink, $columnLink);
     $this->tableLink->setPrimary('id_node_1');
     $this->tableLink->setUnique(array());
     $this->tableLink->setSortable(array('id_node_1', 'id_node_2', 'position'));
     $this->tableLink->setSearchable(array('id_node_1' => 'bigint', 'id_node_2' => 'bigint', 'position' => 'int'));
     $this->tableLink->setAutoIncrement();
     $this->dbNodeLink = new Table_query($this->tableLink, 'l');
     $this->dbNodeLink->selectColumn("l.*");
     //table media
     $tableMedia = $this->O->glob('prefix') . 'media_files';
     $columnMedia = array('id_media', 'file_protocol', 'file_name', 'file_type', 'file_subtype', 'file_size', 'file_md5', 'file_date', 'ip', 'uid');
     $this->tableMedia = Table::set($dbLink, $tableMedia, $columnMedia);
     $this->tableMedia->setPrimary('id_media');
     $this->tableMedia->setUnique(array());
     $this->tableMedia->setSortable(array('id_media', 'file_name', 'type', 'subtype', 'date', 'uid', 'size'));
     $this->tableMedia->setSearchable(array('id_media' => 'bigint', 'file_name' => 'varchar', 'type' => 'varchar', 'subtype' => 'varchar', 'date' => 'date', 'uid' => 'bigint', 'size' => 'bigint'));
     $this->tableMedia->setAutoIncrement(true);
     $this->dbMedia = new Table_query($this->tableMedia, 'media');
     $tableMedia = $this->O->glob('prefix') . 'node_media';
     $columnMedia = array('id', 'id_node', 'id_media', 'position');
     $this->tableNodeMedia = Table::set($dbLink, $tableMedia, $columnMedia);
     $this->tableNodeMedia->setPrimary('id');
     $this->tableNodeMedia->setUnique(array('id_node', 'id_media'));
     $this->tableNodeMedia->setSortable(array('id_node', 'position', 'id_media'));
     $this->tableNodeMedia->setSearchable(array('id_node' => 'bigint', 'position' => 'int', 'id_media' => 'bigint'));
     $this->tableNodeMedia->setAutoIncrement();
     $this->dbNodeMedia = new Table_query($this->tableNodeMedia, 'nm');
     $this->dbNodeMedia->innerJoin($this->tableMedia, 'media', ' media.id_media=nm.id_media ');
     // node Tags
     $tableNodeTags = $this->O->glob('prefix') . 'node_tags';
     $columnNodeTags = array('id_node', 'tag', 'priority');
     $this->tableNodeTags = Table::set($dbLink, $tableNodeTags, $columnNodeTags);
     $this->tableNodeTags->setPrimary('tags');
     $this->tableNodeTags->setUnique(array());
     $this->tableNodeTags->setSortable(array('id_node', 'tag'));
     $this->tableNodeTags->setSearchable(array('tag' => 'varchar', 'id_node' => 'bigint', 'priority' => 'int'));
     $this->tableNodeTags->setAutoIncrement();
     $this->dbNodeTags = new Table_query($this->tableNodeTags, 'tags');
     // node revisions
     $table = 'node_revisions';
     $column = array('id_version', 'id_node', 'uid', 'label', 'comment', 'md5', 'date_revision', 'data');
     $this->tableNodeRevisions = Table::set($dbLink, $table, $column);
     $this->tableNodeRevisions->setPrimary('id_version');
     $this->tableNodeRevisions->setUnique(array());
     $this->tableNodeRevisions->setSortable(array('id_version', 'id_node', 'uid', 'label', 'date_revision'));
     $this->tableNodeRevisions->setSearchable(array('id_version' => 'bigint', 'id_node' => 'bigint', 'uid' => 'bigint', 'label' => 'varchar', 'date_revision' => 'timestamp'));
     $this->tableNodeRevisions->setAutoIncrement(true);
     $this->dbNodeRevisions = new Table_query($this->tableNodeRevisions, 'revisions');
     $shemaNodeDataBlob = array('table' => 'node_data_blob', 'column' => array('id_node_data_blob' => array('type' => 'bigint', 'primary' => 1, 'sortable' => 1, 'searchable' => 1), 'id_node' => array('type' => 'bigint', 'sortable' => 1, 'searchable' => 1), 'key_name' => array('type' => 'varchar', 'sortable' => 1, 'searchable' => 1), 'data' => array('type' => 'longblob')));
     $this->tableNodeDataBlob = Table::setTable($dbLink, $shemaNodeDataBlob);
     $this->tableNodeDataBlob->setPrimary('id_node_data_blob');
     $this->tableNodeDataBlob->setAutoIncrement(true);
     $this->dbNodeDataBlob = new Table_query($this->tableNodeDataBlob);
     $shemaNodeDataChar = array('table' => 'node_data_char', 'column' => array('id_node_data_char' => array('type' => 'bigint', 'primary' => 1, 'sortable' => 1, 'searchable' => 1), 'id_node' => array('type' => 'bigint', 'sortable' => 1, 'searchable' => 1), 'key_name' => array('type' => 'varchar', 'sortable' => 1, 'searchable' => 1), 'data' => array('type' => 'varchar', 'sortable' => 1, 'searchable' => 1)));
     $this->tableNodeDataChar = Table::setTable($dbLink, $shemaNodeDataChar);
     $this->tableNodeDataChar->setPrimary('id_node_data_char');
     $this->tableNodeDataChar->setAutoIncrement(true);
     $this->dbNodeDataChar = new Table_query($this->tableNodeDataChar);
     $this->config();
 }