Exemplo n.º 1
0
 /**
  *	Return groups list
  *
  *	@param		linkField		string		descendent_id|ancestor_id
  *	@return		RM_Store_iRequest<RM_User_Group>
  */
 public function getGroupList($linkField = '')
 {
     $query = $this->_storage['group']->createQuery('f');
     $aliases = array();
     if ($linkField) {
         # add tree
         $this->tree->addTreeToQuery($query, $aliases, qw2("self-alias>t self-prefix> self-field>{$linkField} join-table>f"));
     }
     return $this->_storage['group']->request($query, $aliases);
 }
Exemplo n.º 2
0
 /**
  *	Returns tickets list
  *
  *	@param		linkField		string		descendent_id|ancestor_id
  *	@return		RM_Store_iRequest<RM_Ticket_Object>
  */
 public function getList($linkField = '')
 {
     $query = $this->_storage['ticket']->createQuery('d');
     $aliases = array();
     if ($linkField) {
         # add tree
         $this->tree->addTreeToQuery($query, $aliases, qw2("self-alias>t self-prefix> self-field>{$linkField} join-table>d"));
     }
     /*		$aliases['tlevel'] = M('Db')->field('t','level');
     		$aliases['anc'] = M('Db')->field('t','ancestor_id');
     		$aliases['dsc'] = M('Db')->field('t','descendent_id');
     		$query->what("$aliases[tlevel] as tlevel");
     		$query->what("$aliases[anc] as anc");
     		$query->what("$aliases[dsc] as dsc");*/
     return $this->_storage['ticket']->request($query, $aliases);
 }
Exemplo n.º 3
0
 /**
  *	Return enitity list
  *
  *	@param		linkField		string		descendent_id|ancestor_id
  *	@return		RM_Store_iRequest<RM_Forum_Entity(Theme|Topic|Comment)>
  */
 public function getList($linkField = '')
 {
     $query = $this->_entity->createQuery('f');
     $aliases = array();
     if ($linkField) {
         $this->tree->addTreeToQuery($query, $aliases, qw2("self-alias>t self-prefix> self-field>{$linkField} join-table>f"));
         $query->what('t.level');
     }
     $permConf = qw2('self-alias>p self-prefix>access_ join-table>f');
     $permConf['permissions'] = qw2('ri>READ');
     if ($this->_usePermissions) {
         # check permission in query
         $binds = M('Permission')->addPermissionToQuery($query, $aliases, $permConf);
     }
     $request = $this->_entity->request($query, $aliases, M('Store')->factoryData($this->entityFactory, qw2('level>level')));
     if ($this->_usePermissions) {
         $request->filter('access_ri=?', $binds['ri'][0], $binds['ri'][1], PERM_ALLOW);
     }
     return $request;
 }
Exemplo n.º 4
0
<?php

require_once dirname(__FILE__) . "/../../init.php";
#строим дерево
function _____getRootNodes()
{
    $q = M('Db')->createQuery('panelie_role')->what('*')->where('parent_id = 0');
    return $r = M('Store')->requestQuery(M('Store')->factoryObject(), $q);
}
$tree = new RM_Tree_Db('panelie_role_tree', '_____getRootNodes');
$tree->rebuildTree('panelie_role', 'id', 'parent_id');