• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Relation类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Relation的典型用法代码示例。如果您正苦于以下问题:PHP Relation类的具体用法?PHP Relation怎么用?PHP Relation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: updateRelation

 public function updateRelation(Relation $relation)
 {
     try {
         $relation->setLastModification(time());
         $this->dao->update($relation);
     } catch (Exception $e) {
         throw new EyePeopleException('Unable to update Relation ' . $relation->getId(), 0, $e);
     }
 }
开发者ID:DavidGarciaCat,项目名称:eyeos,代码行数:9,代码来源:SQLRelationsProvider.php


示例2: actionAdd

 public function actionAdd()
 {
     $model = new Relation();
     if (($data = Yii::app()->getRequest()->getPost('Relation')) !== null) {
         $model->setAttributes($data);
         if ($model->validate()) {
             if ($model->addRelation()) {
                 $this->send(ERROR_NONE, 'success');
             }
         } else {
             $this->error->capture($model);
         }
     }
     $this->render('add', array('relation' => $model));
 }
开发者ID:tiger2soft,项目名称:travelman,代码行数:15,代码来源:RelationController.php


示例3: prepareRelation

 public function prepareRelation(Relation $relation)
 {
     $object = new ReflectionObject($relation);
     $properties = $object->getProperties();
     $cols = array();
     $cons = $relation->getContraints();
     foreach ($properties as $propertie) {
         $name = $propertie->getName();
         $docm = $propertie->getDocComment();
         preg_match("/@var (?P<type>\\w+) (?P<null>\\w+)/", $docm, $resp);
         array_push($cols, array('name' => $name, 'type' => $resp['type'], 'null' => $resp['null']));
     }
     $rname = strtolower(get_class($relation));
     array_push($this->prepareds, array('rname' => $rname, 'cols' => $cols, 'cons' => $cons));
 }
开发者ID:exildev,项目名称:corvus,代码行数:15,代码来源:RelationFactory.php


示例4: DelPair

function DelPair($relationName, $srcConcept, $srcAtom, $tgtConcept, $tgtAtom)
{
    if (func_num_args() != 5) {
        throw new Exception("Wrong number of arguments supplied for function DelPair(): " . func_num_args() . " arguments", 500);
    }
    Notifications::addLog("DelPair({$relationName},{$srcConcept},{$srcAtom},{$tgtConcept},{$tgtAtom})", 'ExecEngine');
    try {
        $database = Database::singleton();
        // Check if relation signature exists: $relationName[$srcConcept*$tgtConcept]
        $relation = Relation::isCombination($relationName, $srcConcept, $tgtConcept);
        $srcAtoms = explode('_AND', $srcAtom);
        $tgtAtoms = explode('_AND', $tgtAtom);
        if (count($srcAtoms) > 1) {
            throw new Exception('DelPair function call has more than one src atom', 501);
        }
        // 501: Not implemented
        if (count($tgtAtoms) > 1) {
            throw new Exception('DelPair function call has more than one tgt atom', 501);
        }
        // 501: Not implemented
        foreach ($srcAtoms as $a) {
            foreach ($tgtAtoms as $b) {
                $database->editDelete($relation, false, $a, $srcConcept, $b, $tgtConcept, 'ExecEngine');
            }
        }
        return 'Tuple (' . $srcAtom . ' - ' . $tgtAtom . ') deleted from ' . $relationName . '[' . $srcConcept . '*' . $tgtConcept . ']';
    } catch (Exception $e) {
        Notifications::addError('DelPair: ' . $e->getMessage());
    }
}
开发者ID:4ZP6Capstone2015,项目名称:Capstone,代码行数:30,代码来源:insDelPairAtom.php


示例5: save

 public function save($con = null, $parent = null)
 {
     try {
         $con = Propel::getConnection();
         $con->begin();
         if (!$this->getId()) {
             $this->setId(Document::getGenericDocument($this)->getId());
         }
         parent::save($con);
         // create relationship
         if (!$parent && !Document::getParentOf($this->getId())) {
             $parent = Rootfolder::getRootfolder($this);
         }
         Relation::saveRelation($parent, $this);
         $con->commit();
         if (sfConfig::get('sf_cache_relations')) {
             Tagrelation::updateTagRelationCache();
         }
         Document::cacheObj($this, get_class($this));
         return true;
     } catch (Exception $e) {
         $con->rollback();
         throw $e;
     }
 }
开发者ID:kotow,项目名称:work,代码行数:25,代码来源:Tag.php


示例6: save

 public function save($con = null, $parent = null)
 {
     try {
         $con = Propel::getConnection();
         $con->begin();
         if (!$this->getId()) {
             $genDoc = Document::getGenericDocument($this);
             $genDoc->setPublicationStatus("WAITING");
             $genDoc->save();
             $this->setId($genDoc->getId());
         }
         parent::save($con);
         // create relationship
         if (!$parent && !Document::getParentOf($this->getId())) {
             $parent = Rootfolder::getRootfolder($this);
         }
         Relation::saveRelation($parent, $this);
         $con->commit();
         Document::cacheObj($this, get_class($this));
         return true;
     } catch (Exception $e) {
         $con->rollback();
         throw $e;
     }
 }
开发者ID:kotow,项目名称:work,代码行数:25,代码来源:Newsletter.php


示例7: render

 function render()
 {
     $param['network_id'] = PA::$network_info->network_id;
     $res = Network::get_members($param);
     $links['registered_users'] = count($res['users_data']);
     $this->email_domain_array = $this->get_email_by_domain($res['users_data']);
     $this->blog_post = Content::load_content_id_array(0, NULL, TRUE, 'ALL', 'created', 'DESC');
     $image_array = Image::load_images();
     $this->images = count($image_array);
     $this->profile_views = User::get_profile_view_stats('profile_visitor_count');
     $this->profile_visits_by_user = User::get_profile_view_stats('profile_visited_count');
     $relationship_stats = array();
     $maximum_relation = 0;
     $minimum_relation = 0;
     $average_relation = 0;
     $relationship_stats = Relation::relation_stats();
     if (count($relationship_stats) > 0) {
         $maximum_relation = max($relationship_stats);
         $minimum_relation = min($relationship_stats);
         $average_relation = array_sum($relationship_stats) / count($relationship_stats);
     }
     $this->relationship_stats = array('min' => $minimum_relation, 'max' => $maximum_relation, 'avg' => $average_relation);
     $this->inner_HTML = $this->generate_inner_html($links);
     $content = parent::render();
     return $content;
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:26,代码来源:MISReportModule.php


示例8: save

 public function save($con = null, $parent = null)
 {
     try {
         $con = Propel::getConnection();
         $con->begin();
         if (!$this->getId()) {
             $this->setId(Document::getGenericDocument($this)->getId());
         }
         parent::save($con);
         // create relationship
         if (!$parent && !Document::getParentOf($this->getId())) {
             $parent = Rootfolder::getRootfolder($this);
         }
         Relation::saveRelation($parent, $this);
         $con->commit();
         Document::cacheObj($this, get_class($this));
         // get Lists object
         if (!$parent) {
             $parent = Document::getParentOf($this->getId());
         }
         // update list cache
         if (get_class($parent) == "Lists") {
             Lists::updateListCache($parent->getListId());
         }
         return true;
     } catch (Exception $e) {
         $con->rollback();
         throw $e;
     }
 }
开发者ID:kotow,项目名称:work,代码行数:30,代码来源:Listitem.php


示例9: getRelationModel

 public static function getRelationModel($id, $relationType)
 {
     $model = Relation::where('model_name', $relationType)->where('model_id', $id)->first();
     if ($model) {
         return $relationType::find($model->relation_id);
     }
     return null;
 }
开发者ID:trantung,项目名称:company,代码行数:8,代码来源:CommonSite.php


示例10: parse_rule

 /**
  * @param string $rules
  *
  * @return Relation[][]
  */
 private static function parse_rule($rules)
 {
     $rules = self::extract_rule($rules);
     array_walk_recursive($rules, function (&$rule) {
         $rule = Relation::from($rule);
     });
     return $rules;
 }
开发者ID:icanboogie,项目名称:cldr,代码行数:13,代码来源:Rule.php


示例11: getAffectedInvConjunctIds

 public static function getAffectedInvConjunctIds($fullRelationSignature)
 {
     $allRelations = Relation::getAllRelations();
     if (!array_key_exists($fullRelationSignature, $allRelations)) {
         throw new Exception("Relation \\'{$fullRelationSignature}\\' does not exists in allRelations", 500);
     }
     return (array) $allRelations[$fullRelationSignature]['affectedInvConjunctIds'];
 }
开发者ID:4ZP6Capstone2015,项目名称:Capstone,代码行数:8,代码来源:Relation.php


示例12: delete

 public function delete($con = null)
 {
     $originalCacheRelations = sfConfig::get('sf_cache_relations');
     sfConfig::set('sf_cache_relations', false);
     try {
         $docId = $this->getId();
         $con = Propel::getConnection();
         $con->begin();
         // delete child relation
         $c = new Criteria();
         $c->add(RelationPeer::ID2, $docId);
         $relations = RelationPeer::doSelect($c);
         foreach ($relations as $relation) {
             $relation->delete(null, sfConfig::get('sf_cache_relations'));
             //$relation->delete();
         }
         // delete parent relations
         $children = Document::getChildrenOf($docId);
         foreach ($children as $child) {
             $relation = new Relation();
             $relation->setId1($docId);
             $relation->setId2($child->getId());
             $child->delete();
             $relation->delete();
         }
         // delete any tags for this document
         $c = new Criteria();
         $c->add(TagrelationPeer::ID, $docId);
         $tagRelations = TagrelationPeer::doSelect($c);
         foreach ($tagRelations as $tag) {
             $tag->delete();
         }
         parent::delete();
         $con->commit();
     } catch (Exception $e) {
         $con->rollback();
         throw $e;
     }
     // set 'sf_cache_relations' it's original value
     sfConfig::set('sf_cache_relations', $originalCacheRelations);
     if ($originalCacheRelations) {
         Relation::updateRelationCache();
     }
     return true;
 }
开发者ID:kotow,项目名称:work,代码行数:45,代码来源:Document.php


示例13: follow

 public function follow($user2_id)
 {
     $relation = Relation::where('user1_id', '=', $this->id)->where('user2_id', '=', $user2_id)->get()->first();
     if ($relation) {
         return $relation->type;
     } else {
         return 0;
     }
 }
开发者ID:huuson94,项目名称:btlwebapp,代码行数:9,代码来源:User.php


示例14: getArray

 private function getArray(CDbCriteria $criteria)
 {
     $result = Relation::model()->findAll($criteria);
     $users = array();
     foreach ($result as $value) {
         array_push($users, $value->subUserId);
     }
     return array_values($users);
 }
开发者ID:tiger2soft,项目名称:travelman,代码行数:9,代码来源:RelationComponent.php


示例15: run

 public function run()
 {
     try {
         // 共通設定取得
         $base_dir = dirname(__FILE__) . '/../';
         $config = new Config($base_dir);
         $debug = $config->get_param('debug');
         // レポート用オブジェクト
         $report = new Report($config);
         // メンバー一覧のオブジェクト
         $member = new Member($config);
         // 担当者マスターの差分を取得する。
         $member->get_diff();
         $this->mail_body .= $member->print_diff();
         // プロジェクト一覧のオブジェクト
         $project = new Project($config);
         // プロジェクトマスターの差分を取得する。
         $project->get_diff();
         $this->mail_body .= $project->print_diff();
         // 担当プロジェクトのオブジェクト
         $relation = new Relation($config);
         // 担当プロジェクトの差分を取得する。
         $relation->set_member($member);
         $relation->set_project($project);
         $relation->get_diff();
         $this->mail_body .= $relation->print_diff();
         // BackLogIDが入力されているにもかかわらず担当者名が未入力のデータを検出する。
         $this->mail_body .= $relation->validate();
         // 複数コンテンツ障害の配信先
         // 全社向け
         $multi_alert = new MultiAlert($config);
         $multi_alert->set_mode('all');
         $multi_alert->set_project($project);
         $multi_alert->set_member($member);
         $multi_alert->get_diff();
         $this->mail_body .= $multi_alert->print_diff();
         // コンテンツ事業部向け
         $multi_alert = new MultiAlert($config);
         $multi_alert->set_mode('contents');
         $multi_alert->set_project($project);
         $multi_alert->set_member($member);
         $multi_alert->get_diff();
         $this->mail_body .= $multi_alert->print_diff();
         // レポート
         $report->out($this->mail_body);
         // 古いファイルを削除
         Util::remove_old_file($config->get_param('data_dir'), $config->get_param('keep_file_days'));
     } catch (Exception $e) {
         $member->remove();
         $project->remove();
         $relation->remove();
         $multi_alert->remove();
         if ($debug) {
             print $e->getMessage() . PHP_EOL;
         } else {
             $report->out($e->getMessage());
         }
     }
 }
开发者ID:cy-daisuke-senmyou,项目名称:SukumeRequestChecker,代码行数:59,代码来源:Main.php


示例16: render

 function render()
 {
     if ($this->view_type == 'all') {
         $this->Paging["count"] = Network::get_members(array('network_id' => $this->network_info->network_id, 'cnt' => TRUE));
         $param = array('show' => $this->Paging["show"], 'page' => $this->Paging["page"], 'network_id' => $this->network_info->network_id);
         $users_info = Network::get_members($param);
         $this->links = $users_info['users_data'];
     } else {
         if ($this->view_type == 'relations' || $this->view_type == 'in_relations') {
             $extra = unserialize($this->network_info->extra);
             $this->reciprocated_relationship_set = FALSE;
             $this->relations = FALSE;
             if (@$extra['reciprocated_relationship'] == NET_YES) {
                 $this->reciprocated_relationship_set = TRUE;
                 $this->relations = TRUE;
             }
             $users_info = Relation::get_all_user_relations($this->uid, $no_of_relations = 0, FALSE, $this->Paging["show"], $this->Paging["page"], 'created', 'DESC', 'internal', null, PA::$network_info->network_id);
             $this->Paging["count"] = count($users_info);
             $this->title = __("View all ");
             if ($_SESSION['user']['id'] == $this->uid) {
                 $this->title .= "my";
             } else {
                 $this->title .= $this->page_user . ' \'s';
             }
             $this->title .= " friends";
             $this->sub_title = $this->title;
             $this->links = $users_info;
         }
     }
     if ($this->gid) {
         $group = ContentCollection::load_collection((int) $this->gid, @PA::$login_uid);
         $this->Paging["count"] = $group->get_members(TRUE);
         $members = $group->get_members(FALSE, $this->Paging["show"], $this->Paging["page"]);
         $this->title = sprintf(__("View All %s Members"), __(PA::$group_noun));
         if (is_array($members)) {
             foreach ($members as $member) {
                 // load user info
                 $user = new User();
                 $user->load((int) $member['user_id']);
                 $u = array('user_id' => $user->user_id, 'user_id' => $user->user_id, 'first_name' => $user->first_name, 'last_name' => $user->last_name, 'display_name' => $user->display_name, 'email' => $user->email, 'picture' => $user->picture, 'login_name' => $user->login_name, 'created' => $user->created);
                 if (!empty(PA::$config->useTypedGroups)) {
                     require_once 'api/Entity/TypedGroupEntityRelation.php';
                     // see if we have a special relation of this user to the group
                     list($relType, $u['membertype']) = TypedGroupEntityRelation::get_relation_to_group($member['user_id'], (int) $this->gid);
                 }
                 $tmp_arr[] = $u;
             }
             $this->links = $tmp_arr;
         }
     }
     $this->inner_HTML = $this->generate_inner_html();
     $content = parent::render();
     return $content;
 }
开发者ID:Cyberspace-Networks,项目名称:CoreSystem,代码行数:54,代码来源:CNViewAllMembersModule.php


示例17: setup_module

function setup_module($column, $module, $obj)
{
    global $is_member, $is_admin, $group_data, $gid;
    $obj->gid = $gid;
    switch ($module) {
        case 'MembersFacewallModule':
            $group = new Group();
            $group->collection_id = $gid;
            $group->is_active = ACTIVE;
            $members = $group->get_members($cnt = FALSE, 5, 1, 'created', 'DESC', FALSE);
            if (is_array($members)) {
                $count = count($members);
                $group_members = members_to_array($members);
                $users_data = array();
                foreach ($members as $member) {
                    $count_relations = Relation::get_relations($member['user_id'], APPROVED, PA::$network_info->network_id);
                    $user = new User();
                    $user->load((int) $member['user_id']);
                    $login_name = $user->login_name;
                    $user_picture = $user->picture;
                    $users_data[] = array('user_id' => $member['user_id'], 'picture' => $user_picture, 'login_name' => $login_name, 'no_of_relations' => count($count_relations));
                }
                $users = array('users_data' => $users_data, 'total_users' => $count);
            }
            $obj->links = $users;
            $obj->gid = $gid;
            break;
        case 'ImagesModule':
            $obj->block_type = 'Gallery';
            $obj->page = 'grouppage';
            $obj->title = 'Group Gallery';
            $obj->group_details['collection_id'] = $group_data->collection_id;
            break;
        case 'GroupForumModule':
            if ($group_data->reg_type == REG_INVITE) {
                if (!$is_member && !$is_admin) {
                    return "skip";
                }
            }
            $obj->is_member = $is_member;
            $obj->is_admin = $is_admin;
            $obj->group_details = $group_data;
            break;
        case 'RecentPostModule':
            $obj->type = 'group';
            $obj->gid = $_REQUEST['gid'];
            break;
    }
}
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:49,代码来源:forum_home.php


示例18: __construct

 /**
  * The default constructor for MembersFacewallModule class.
  * It initializes the default values of vars
  */
 function __construct()
 {
     $this->title = __("Members");
     $this->html_block_id = "members";
     $this->view_all_url = 'view_all_members.php';
     $users = Network::get_members(array('page' => 1, 'show' => 5, 'network_id' => PA::$network_info->network_id));
     $total_users = count($users['users_data']);
     // counting no of relation of each user
     for ($i = 0; $i < $total_users; $i++) {
         $count_relations = Relation::get_relations($users['users_data'][$i]['user_id']);
         $users['users_data'][$i]['no_of_relations'] = count($count_relations);
     }
     $this->links = $users;
     $this->sort_by = TRUE;
 }
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:19,代码来源:MembersFacewallModule.php


示例19: actionUpdate

 public function actionUpdate()
 {
     $this->layout = Yum::module()->adminLayout;
     $model = $this->loadModel();
     $this->performAjaxValidation($model, 'yum-role-form');
     if (isset($_POST['YumRole'])) {
         $model->attributes = $_POST['YumRole'];
         $model->users = $_POST['YumRole'];
         $model->users = Relation::retrieveValues($_POST);
         if ($model->validate() && $model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('update', array('model' => $model));
 }
开发者ID:Canyian,项目名称:yii-user-management-facebook,代码行数:15,代码来源:YumRoleController.php


示例20: handle_field_param

 function handle_field_param($data)
 {
     global $login_uid, $page_uid;
     if (isset($login_uid)) {
         $Image_owner = $login_uid == $data->author_id ? TRUE : FALSE;
         $relations_ids = Relation::get_all_relations((int) $data->author_id);
         $user_in_relation = array();
         foreach ($relations_ids as $ids) {
             $user_in_relation['friends_id'][] = $ids['user_id'];
             /*
                      if(!empty($ids['in_family']))
                      $user_in_relation['in_family'][] = $ids['in_family'];*/
         }
     }
     // No one can view the media
     $param = FALSE;
     $network_owner = PA::$network_info->owner_id;
     switch ($data->file_perm) {
         case NONE:
             if (isset($login_uid) && $Image_owner || $login_uid == SUPER_USER_ID || $login_uid == $network_owner) {
                 $param = TRUE;
             }
             break;
         case ANYONE:
             $param = TRUE;
             break;
         case WITH_IN_DEGREE_1:
             if (isset($login_uid) && (in_array($login_uid, $user_in_relation['friends_id']) || $Image_owner || $login_uid == SUPER_USER_ID || $login_uid == $network_owner)) {
                 $param = TRUE;
             }
             break;
             /*
                  case IN_FAMILY:
                      if (isset($login_uid) &&(is_array($user_in_relation)) && (in_array($login_uid,$user_in_relation['in_family']) || ($Image_owner)) ) {
                        $param = TRUE;
                      }
                   break;*/
     }
     // When user wants to see the Group image
     if (isset($login_uid) && isset($_GET['gid'])) {
         $is_author_member = $this->is_author_group_member($login_uid, $_GET['gid']);
         // any group member can view group gallery!
         if ($is_author_member) {
             $param = TRUE;
         }
     }
     return $param;
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:48,代码来源:MediaFullViewModule.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Relationship类代码示例发布时间:2022-05-23
下一篇:
PHP RelatedListViewSession类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap