当前位置: 首页>>代码示例>>PHP>>正文


PHP Organization::get_org_parents方法代码示例

本文整理汇总了PHP中Organization::get_org_parents方法的典型用法代码示例。如果您正苦于以下问题:PHP Organization::get_org_parents方法的具体用法?PHP Organization::get_org_parents怎么用?PHP Organization::get_org_parents使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Organization的用法示例。


在下文中一共展示了Organization::get_org_parents方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: format_query_radix

 /**
  * Format the value returned from rec_query() into an array radix.
  *
  * @param Doctrine_Query $q
  * @return array $radix
  */
 protected function format_query_radix(Doctrine_Query $q)
 {
     $q2 = $q->copy()->select('org_id');
     $rs = $q2->fetchArray();
     // also select all parent orgs
     $ids = array();
     foreach ($rs as $org) {
         $parent_ids = Organization::get_org_parents($org['org_id']);
         $ids = array_merge($ids, $parent_ids);
         $ids[] = $org['org_id'];
     }
     $q->orWhereIn('o.org_id', $ids);
     $q->removeDqlQueryPart('limit');
     // now get the radix
     $this->_fields['org_parent_id'] = 1;
     $this->_fields['org_id'] = 1;
     $radix = parent::format_query_radix($q);
     // display organizations as a tree
     return $this->get_tree_data($radix);
 }
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:26,代码来源:orgtree.php

示例2: get_authz

 /**
  * Get authorization object for this User.
  *   array(org_id => bitmask-role)
  *
  * This represents the Organization Asset authz.  That is, explicit roles
  * cascade both up and down the Org tree.  Explicit roles will always
  * override implicit ones.
  *
  * @return array
  */
 public function get_authz()
 {
     if ($this->authz) {
         return $this->authz;
     }
     // reset
     $this->authz = array();
     $this->authz_up = array();
     // sort orgs, and calculate authz
     $sorted = Organization::sort_by_depth($this->UserOrg, 'uo_org_id');
     foreach ($sorted as $uo) {
         if ($uo->uo_status == UserOrg::$STATUS_ACTIVE) {
             $children = Organization::get_org_children($uo->uo_org_id);
             $bitmask = $uo->AdminRole->get_bitmask();
             foreach ($children as $org_id) {
                 $this->authz[$org_id] = $bitmask;
                 $this->authz_up[$org_id] = $bitmask;
             }
             // get upwards-authz
             $parents = Organization::get_org_parents($uo->uo_org_id);
             foreach ($parents as $org_id) {
                 $curr = isset($this->authz_up[$org_id]) ? $this->authz_up[$org_id] : 0;
                 $this->authz_up[$org_id] = max(array($bitmask, $curr));
             }
         }
     }
     return $this->authz;
 }
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:38,代码来源:User.php

示例3: air_update

 /**
  * Update
  *
  * @param ProjectOrg $rec
  * @param array      $data
  */
 protected function air_update($rec, $data)
 {
     if (isset($data['user_uuid'])) {
         $u = AIR2_Record::find('User', $data['user_uuid']);
         if (!$u) {
             throw new Rframe_Exception(Rframe::BAD_DATA, 'Invalid user_uuid');
         }
         // user in org, and has W/M role
         $org_and_parents = Organization::get_org_parents($rec->porg_org_id);
         $org_and_parents[] = $rec->porg_org_id;
         $in_org = false;
         foreach ($u->UserOrg as $uo) {
             $r = $uo->AdminRole->ar_code;
             if (in_array($uo->uo_org_id, $org_and_parents)) {
                 if ($r == 'W' || $r == 'M') {
                     $in_org = true;
                     break;
                 }
             }
         }
         if (!$in_org) {
             throw new Rframe_Exception(Rframe::BAD_DATA, 'ContactUser not Writer/Manager for organization');
         }
         // set
         $rec->porg_contact_user_id = $u->user_id;
     }
 }
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:33,代码来源:organization.php

示例4: air_query

 /**
  * Query
  *
  * @param array $args
  * @return Doctrine_Query $q
  */
 protected function air_query($args = array())
 {
     $q = Doctrine_Query::create()->from('User u');
     $q->leftJoin('u.UserOrg uo WITH uo.uo_home_flag = true');
     $q->leftJoin('uo.Organization o');
     $q->leftJoin('u.UserEmailAddress e with e.uem_primary_flag = true');
     $q->leftJoin('u.UserPhoneNumber p with p.uph_primary_flag = true');
     $q->leftJoin("u.Avatar av WITH av.img_ref_type = ?", 'A');
     $q->leftJoin('u.CreUser cu');
     $q->leftJoin('u.UpdUser uu');
     // flatten
     $q->addSelect('e.uem_address as uem_address');
     $q->addSelect('p.uph_number as uph_number');
     $q->addSelect('p.uph_ext as uph_ext');
     $q->addSelect('uo.uo_user_title as uo_user_title');
     $q->addSelect('o.org_uuid as org_uuid');
     $q->addSelect('o.org_name as org_name');
     $q->addSelect('o.org_display_name as org_display_name');
     $q->addSelect('o.org_html_color as org_html_color');
     // sort by some home_org first
     if (isset($args['sort_home'])) {
         $q->addSelect("(o.org_name = '{$args['sort_home']}') as myhome");
         $q->addOrderBy('myhome desc');
     }
     // restrict to some home_org
     if (isset($args['home_org'])) {
         $q->addWhere("o.org_name = '{$args['home_org']}'");
     }
     // status and type
     if (isset($args['status'])) {
         air2_query_in($q, $args['status'], 'u.user_status');
     }
     if (isset($args['type'])) {
         air2_query_in($q, $args['type'], 'u.user_type');
     }
     // text filter
     $str = isset($args['filter']) ? $args['filter'] : false;
     if ($str && strlen($str) > 0) {
         $usrs = "u.user_username LIKE '{$str}%' OR u.user_first_name " . "LIKE '{$str}%' OR u.user_last_name LIKE '{$str}%'";
         $orgs = "o.org_display_name LIKE '{$str}%' OR o.org_name LIKE '{$str}%'";
         $titles = "uo.uo_user_title LIKE '{$str}%'";
         $emails = "e.uem_address LIKE '{$str}%'";
         $q->addWhere("(({$usrs}) OR ({$orgs}) OR ({$titles}) OR ({$emails}))");
     }
     // exclude users belonging to an organization
     if (isset($args['excl_org'])) {
         $conn = AIR2_DBManager::get_connection();
         $orgq = "select z.org_id from organization z where z.org_uuid = ?";
         $excl = "select uo_user_id from user_org where uo_org_id = ({$orgq})";
         $exclude = $conn->fetchColumn($excl, array($args['excl_org']), 0);
         if (count($exclude) > 0) {
             $q->whereNotIn('u.user_id', $exclude);
         }
     }
     // users that are eligible contacts for an organization
     if (isset($args['incl_contact_org'])) {
         $org = AIR2_Record::find('Organization', $args['incl_contact_org']);
         if (!$org) {
             throw new Rframe_Exception(Rframe::BAD_DATA, 'invalid incl_contact_org');
         }
         $orgids = Organization::get_org_parents($org->org_id);
         $orgids[] = $org->org_id;
         // assemble query
         $orgids = implode(',', $orgids);
         $orgids = "uo_org_id in ({$orgids})";
         $arids = "select ar_id from admin_role where ar_code in ('M','W')";
         $arids = "uo_ar_id in ({$arids})";
         $uids = "select uo_user_id from user_org where {$orgids} and {$arids}";
         $q->addWhere("u.user_id in ({$uids})");
     }
     return $q;
 }
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:78,代码来源:user.php


注:本文中的Organization::get_org_parents方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。