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

PHP group类代码示例

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

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



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

示例1: create

 public function create()
 {
     $model = new group();
     $model->addgroup($_POST["lakeHostGroup"]);
     /*** Redirect User to Group/Index ***/
     header("location: index.php?rt=group/index");
 }
开发者ID:AvenZrk,项目名称:nhlakes_unhm,代码行数:7,代码来源:group.php


示例2: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $group = new group();
     $group->name = $request->input('name');
     $group->body = $request->input('body');
     $group->group_type = $request->input('group_type');
     if ($request->get('address')) {
         $group->address = $request->input('address');
         if (!$group->geocode()) {
             flash()->error(trans('messages.address_cannot_be_geocoded'));
         } else {
             flash()->info(trans('messages.ressource_geocoded_successfully'));
         }
     }
     if ($group->isInvalid()) {
         // Oops.
         return redirect()->action('GroupController@create')->withErrors($group->getErrors())->withInput();
     }
     $group->save();
     // handle cover
     if ($request->hasFile('cover')) {
         Storage::disk('local')->makeDirectory('groups/' . $group->id);
         Image::make($request->file('cover'))->widen(800)->save(storage_path() . '/app/groups/' . $group->id . '/cover.jpg');
         Image::make($request->file('cover'))->fit(300, 200)->save(storage_path() . '/app/groups/' . $group->id . '/thumbnail.jpg');
     }
     // make the current user a member of the group
     $membership = \App\Membership::firstOrNew(['user_id' => $request->user()->id, 'group_id' => $group->id]);
     $membership->notification_interval = 60 * 24;
     // default to daily interval
     $membership->membership = \App\Membership::MEMBER;
     $membership->save();
     return redirect()->action('MembershipController@settings', [$group->id]);
 }
开发者ID:philippejadin,项目名称:Mobilizator,代码行数:38,代码来源:GroupController.php


示例3: person_rm_groups

function person_rm_groups($groups)
{
    foreach ($groups as $i => $groupdata) {
        $group = new group($groupdata['id']);
        $group->delete();
    }
}
开发者ID:BackupTheBerlios,项目名称:infoschool-svn,代码行数:7,代码来源:person_rm.php


示例4: getGroup

 function getGroup()
 {
     $groupid = $this->getGroupID();
     if ($groupid != false) {
         $group = new group($this->getGroupID());
         if ($group->getID() != false) {
             //valid group
             return $group;
         }
     }
     return false;
 }
开发者ID:Kapulara,项目名称:MineProject,代码行数:12,代码来源:user.php


示例5: save

 private static function save($group_id, $group_name)
 {
     if ($group_id * 1 === -1) {
         $group = new group();
         $group->name = $group_name;
         $group->insert();
     } else {
         $group = new group();
         $group->id = $group_id;
         $group->name = $group_name;
         $group->update();
     }
 }
开发者ID:hurricanetx,项目名称:holmes-bi,代码行数:13,代码来源:group.php


示例6: search

 public function search($params)
 {
     $query = group::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $dataProvider->setSort(['defaultOrder' => ['parentId' => SORT_ASC, 'name' => SORT_ASC]]);
     $query->andFilterWhere([group::tableName() . '.status' => '1']);
     if (!($this->load($params) && $this->validate())) {
         $query->joinWith(['parent']);
         return $dataProvider;
     }
     /*$query->andFilterWhere([
           'Id' => $this->Id,
           'createdon' => $this->createdon,
       ]);//*/
     $query->andFilterWhere(['like', group::tableName() . '.name', $this->name]);
     //->andFilterWhere(['like', 'parentId', $this->ParentGroup])
     //->andFilterWhere(['like', 'status', $this->status]);
     if ($this->parentGroup != '' && strtolower($this->parentGroup) != 'root') {
         $query->joinWith(['parent' => function ($q) {
             $q->where('parent.name LIKE "%' . $this->parentGroup . '%" ');
         }]);
     } else {
         if (strtolower($this->parentGroup) == 'root') {
             $query->andFilterWhere([group::tableName() . '.parentId' => 0]);
         }
     }
     return $dataProvider;
 }
开发者ID:rajanishtimes,项目名称:basicyii,代码行数:28,代码来源:GroupSearch.php


示例7: install

 static function install()
 {
     $db = Database::instance();
     $version = module::get_version("user");
     if ($version == 0) {
         $db->query("CREATE TABLE IF NOT EXISTS {users} (\n                   `id` int(9) NOT NULL auto_increment,\n                   `name` varchar(32) NOT NULL,\n                   `full_name` varchar(255) NOT NULL,\n                   `password` varchar(64) NOT NULL,\n                   `login_count` int(10) unsigned NOT NULL DEFAULT 0,\n                   `last_login` int(10) unsigned NOT NULL DEFAULT 0,\n                   `email` varchar(64) default NULL,\n                   `admin` BOOLEAN default 0,\n                   `guest` BOOLEAN default 0,\n                   `hash` char(32) default NULL,\n                   `url` varchar(255) default NULL,\n                   `locale` char(10) default NULL,\n                   PRIMARY KEY (`id`),\n                   UNIQUE KEY(`hash`),\n                   UNIQUE KEY(`name`))\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
         $db->query("CREATE TABLE IF NOT EXISTS {groups} (\n                   `id` int(9) NOT NULL auto_increment,\n                   `name` char(64) default NULL,\n                   `special` BOOLEAN default 0,\n                   PRIMARY KEY (`id`),\n                   UNIQUE KEY(`name`))\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
         $db->query("CREATE TABLE IF NOT EXISTS {groups_users} (\n                   `group_id` int(9) NOT NULL,\n                   `user_id` int(9) NOT NULL,\n                   PRIMARY KEY (`group_id`, `user_id`),\n                   UNIQUE KEY(`user_id`, `group_id`))\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
         $everybody = group::create("Everybody");
         $everybody->special = true;
         $everybody->save();
         $registered = group::create("Registered Users");
         $registered->special = true;
         $registered->save();
         $guest = user::create("guest", "Guest User", "");
         $guest->guest = true;
         $guest->remove($registered);
         $guest->save();
         $admin = user::create("admin", "Gallery Administrator", "admin");
         $admin->admin = true;
         $admin->save();
         // Let the admin own everything
         $db->update("items", array("owner_id" => $admin->id), array("owner_id" => "IS NULL"));
         module::set_version("user", 1);
         $root = ORM::factory("item", 1);
         access::allow($everybody, "view", $root);
         access::allow($everybody, "view_full", $root);
         access::allow($registered, "view", $root);
         access::allow($registered, "view_full", $root);
     }
 }
开发者ID:xafr,项目名称:gallery3,代码行数:31,代码来源:user_installer.php


示例8: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show(Request $request)
 {
     $groups = group::lists('name', 'group_id');
     $locations = location::orderBy('location_id')->lists('location', 'location_id');
     //$locations = array_merge($locations, array('0', 'National'));
     $group_id = $request->input('group_id');
     $location_id = $request->input('location_id');
     if (!isset($group_id)) {
         $group_id = 1;
     }
     if (!isset($location_id)) {
         $location_id = 0;
     }
     /*				
     $rankings = \DB::table('rankings')
     		->join('players', 'rankings.player_id', '=', 'players.player_id')
     		->join('groups', 'rankings.group_id', '=', 'groups.group_id')
     		->join('locations', 'rankings.location_id', '=', 'locations.location_id')
     		->where('ranking_date', '=', $latest_date)
     		->where('rankings.group_id', '=', $group_id)
     		->where('rankings.location_id', '=', $location_id)
     		->distinct()
     		->get();
     */
     $ranking = new Ranking();
     $rankings = $ranking->getlatestRankings($group_id, $location_id);
     return view('pages/rankings', compact('rankings', 'groups', 'locations'));
 }
开发者ID:jenidarnold,项目名称:racquetball,代码行数:34,代码来源:RankingsController.php


示例9: pg_new_edit

function pg_new_edit($pg)
{
    $group = new group();
    foreach ($pg as $gid => $persons) {
        $group->load($gid);
        if (!$group->is_head()) {
            continue;
        }
        foreach ($persons as $pid => $decision) {
            if ($decision == 0) {
                continue;
            }
            $group->del_member_request($pid);
            if ($decision == 1) {
                continue;
            }
            $group->add_member($pid);
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:infoschool-svn,代码行数:20,代码来源:pg_new.php


示例10: superuser

 function superuser($id = "")
 {
     if (!$id and $id = user::id()) {
         $id = user::id();
     }
     $userArray = user::get($id);
     if (group::superuser($userArray[group])) {
         return TRUE;
     } else {
         return FALSE;
     }
 }
开发者ID:nibble-arts,项目名称:openthesaurus,代码行数:12,代码来源:user.php


示例11: cant_view_comments_for_unviewable_items_test

 public function cant_view_comments_for_unviewable_items_test()
 {
     $root = ORM::factory("item", 1);
     $album = album::create($root, rand(), rand(), rand());
     $comment = comment::create($album, user::guest(), "text", "name", "email", "url");
     user::set_active(user::guest());
     // We can see the comment when permissions are granted on the album
     access::allow(group::everybody(), "view", $album);
     $this->assert_equal(1, ORM::factory("comment")->viewable()->where("comments.id", $comment->id)->count_all());
     // We can't see the comment when permissions are denied on the album
     access::deny(group::everybody(), "view", $album);
     $this->assert_equal(0, ORM::factory("comment")->viewable()->where("comments.id", $comment->id)->count_all());
 }
开发者ID:Okat,项目名称:gallery3,代码行数:13,代码来源:Comment_Model_Test.php


示例12: viewable_test

 public function viewable_test()
 {
     $root = ORM::factory("item", 1);
     $album = album::create($root, rand(), rand(), rand());
     $item = self::_create_random_item($album);
     user::set_active(user::guest());
     // We can see the item when permissions are granted
     access::allow(group::everybody(), "view", $album);
     $this->assert_equal(1, ORM::factory("item")->viewable()->where("id", $item->id)->count_all());
     // We can't see the item when permissions are denied
     access::deny(group::everybody(), "view", $album);
     $this->assert_equal(0, ORM::factory("item")->viewable()->where("id", $item->id)->count_all());
 }
开发者ID:scarygary,项目名称:gallery3,代码行数:13,代码来源:Item_Helper_Test.php


示例13: create

 /**
  * Create a new user.
  *
  * @param string  $name
  * @param string  $full_name
  * @param string  $password
  * @return User_Model
  */
 static function create($name, $full_name, $password)
 {
     $user = ORM::factory("user")->where("name", $name)->find();
     if ($user->loaded) {
         throw new Exception("@todo USER_ALREADY_EXISTS {$name}");
     }
     $user->name = $name;
     $user->full_name = $full_name;
     $user->password = $password;
     // Required groups
     $user->add(group::everybody());
     $user->add(group::registered_users());
     $user->save();
     return $user;
 }
开发者ID:ChrisRut,项目名称:gallery3,代码行数:23,代码来源:user.php


示例14: change_photo_no_csrf_fails_test

 public function change_photo_no_csrf_fails_test()
 {
     $controller = new Photos_Controller();
     $root = ORM::factory("item", 1);
     $photo = photo::create($root, MODPATH . "gallery/tests/test.jpg", "test", "test", "test");
     $_POST["name"] = "new name";
     $_POST["title"] = "new title";
     $_POST["description"] = "new description";
     access::allow(group::everybody(), "edit", $root);
     try {
         $controller->_update($photo);
         $this->assert_true(false, "This should fail");
     } catch (Exception $e) {
         // pass
     }
 }
开发者ID:xafr,项目名称:gallery3,代码行数:16,代码来源:Photos_Controller_Test.php


示例15: change_album_no_csrf_fails_test

 public function change_album_no_csrf_fails_test()
 {
     $controller = new Albums_Controller();
     $root = ORM::factory("item", 1);
     $this->_album = album::create($root, "test", "test", "test");
     $_POST["name"] = "new name";
     $_POST["title"] = "new title";
     $_POST["description"] = "new description";
     access::allow(group::everybody(), "edit", $root);
     try {
         $controller->_update($this->_album);
         $this->assert_true(false, "This should fail");
     } catch (Exception $e) {
         // pass
     }
 }
开发者ID:Okat,项目名称:gallery3,代码行数:16,代码来源:Albums_Controller_Test.php


示例16: save

 /**
  * Handle any business logic necessary to create or update a user.
  * @see ORM::save()
  *
  * @return ORM User_Model
  */
 public function save()
 {
     if (!$this->loaded()) {
         // New user
         $this->add(group::everybody());
         if (!$this->guest) {
             $this->add(group::registered_users());
         }
         parent::save();
         module::event("user_created", $this);
     } else {
         // Updated user
         $original = ORM::factory("user", $this->id);
         parent::save();
         module::event("user_updated", $original, $this);
     }
     return $this;
 }
开发者ID:andyst,项目名称:gallery3,代码行数:24,代码来源:user.php


示例17: print_photo

 public function print_photo($id)
 {
     access::verify_csrf();
     $item = ORM::factory("item", $id);
     access::required("view", $item);
     if (access::group_can(group::everybody(), "view_full", $item)) {
         $full_url = $item->file_url(true);
         $thumb_url = $item->thumb_url(true);
     } else {
         $proxy = ORM::factory("digibug_proxy");
         $proxy->uuid = md5(rand());
         $proxy->item_id = $item->id;
         $proxy->save();
         $full_url = url::abs_site("digibug/print_proxy/full/{$proxy->uuid}");
         $thumb_url = url::abs_site("digibug/print_proxy/thumb/{$proxy->uuid}");
     }
     $v = new View("digibug_form.html");
     $v->order_parms = array("digibug_api_version" => "100", "company_id" => module::get_var("digibug", "company_id"), "event_id" => module::get_var("digibug", "event_id"), "cmd" => "addimg", "partner_code" => "69", "return_url" => url::abs_site("digibug/close_window"), "num_images" => "1", "image_1" => $full_url, "thumb_1" => $thumb_url, "image_height_1" => $item->height, "image_width_1" => $item->width, "thumb_height_1" => $item->thumb_height, "thumb_width_1" => $item->thumb_width, "title_1" => html::purify($item->title));
     print $v;
 }
开发者ID:Okat,项目名称:gallery3,代码行数:20,代码来源:digibug.php


示例18: grouppable

function grouppable($data, $group)
{
    // Creamos un nuevo grupo.
    $group = new group(array(data_field => $group[data_field], count_field => $group[count_field], order => $group[order]));
    // Asociamos el contenido ($data) con el grupo ($group)
    foreach ($data as $el) {
        /* elm -> el identificador. /!\ Lo pasamos a minusculas para poder agrupar correctamente. 
           Ej. cosa,COSA deberian ser un mismo elm.*/
        $elm = strtolower($el[$group->dataField()]);
        // elm_qty -> cantidad
        $elm_qty = $el[$group->countField()];
        // Si existe este elemento, lo incrementamos
        if ($group->exist($elm)) {
            $group->increment($elm, $elm_qty);
        } else {
            $group->setData($elm, $elm_qty);
        }
    }
    return $group->getItems();
}
开发者ID:juanharo,项目名称:objoo,代码行数:20,代码来源:data_action.php


示例19: install

 static function install()
 {
     $db = Database::instance();
     $db->query("CREATE TABLE IF NOT EXISTS {users} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `name` varchar(32) NOT NULL,\n                 `full_name` varchar(255) NOT NULL,\n                 `password` varchar(64) NOT NULL,\n                 `login_count` int(10) unsigned NOT NULL DEFAULT 0,\n                 `last_login` int(10) unsigned NOT NULL DEFAULT 0,\n                 `email` varchar(64) default NULL,\n                 `admin` BOOLEAN default 0,\n                 `guest` BOOLEAN default 0,\n                 `hash` char(32) default NULL,\n                 `url` varchar(255) default NULL,\n                 `locale` char(10) default NULL,\n                 PRIMARY KEY (`id`),\n                 UNIQUE KEY(`hash`),\n                 UNIQUE KEY(`name`))\n               DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE IF NOT EXISTS {groups} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `name` char(64) default NULL,\n                 `special` BOOLEAN default 0,\n                 PRIMARY KEY (`id`),\n                 UNIQUE KEY(`name`))\n               DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE IF NOT EXISTS {groups_users} (\n                 `group_id` int(9) NOT NULL,\n                 `user_id` int(9) NOT NULL,\n                 PRIMARY KEY (`group_id`, `user_id`),\n                 UNIQUE KEY(`user_id`, `group_id`))\n               DEFAULT CHARSET=utf8;");
     $everybody = group::create("Everybody");
     $everybody->special = true;
     $everybody->save();
     $registered = group::create("Registered Users");
     $registered->special = true;
     $registered->save();
     $guest = user::create("guest", "Guest User", "");
     $guest->guest = true;
     $guest->remove($registered);
     $guest->save();
     $admin = user::create("admin", "Gallery Administrator", "admin");
     $admin->admin = true;
     $admin->save();
     $current_provider = module::get_var("gallery", "identity_provider");
     if (empty($current_provider)) {
         // If there is no provider defined then we are doing an initial install
         // so we need to set the provider and make the administrator own everything
         // If the installer is called and there is an identity provider, then we
         // are switching identity providers and and the event handlers will do the
         // right things
         module::set_var("gallery", "identity_provider", "user");
         // Let the admin own everything
         $db->query("update {items} set owner_id = {$admin->id}");
     }
     $root = ORM::factory("item", 1);
     access::allow($everybody, "view", $root);
     access::allow($everybody, "view_full", $root);
     access::allow($registered, "view", $root);
     access::allow($registered, "view_full", $root);
     module::set_var("user", "mininum_password_length", 5);
     module::set_version("user", 2);
 }
开发者ID:ChrisRut,项目名称:gallery3,代码行数:38,代码来源:user_installer.php


示例20: edit_group_form

 public function edit_group_form($id)
 {
     $group = group::lookup($id);
     if (empty($group)) {
         throw new Kohana_404_Exception();
     }
     print $this->_get_group_edit_form_admin($group);
 }
开发者ID:HarriLu,项目名称:gallery3,代码行数:8,代码来源:admin_users.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP h2o类代码示例发布时间:2022-05-23
下一篇:
PHP grocery_CRUD类代码示例发布时间: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