本文整理匯總了PHP中Group::insert方法的典型用法代碼示例。如果您正苦於以下問題:PHP Group::insert方法的具體用法?PHP Group::insert怎麽用?PHP Group::insert使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Group
的用法示例。
在下文中一共展示了Group::insert方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: newGroup
function newGroup()
{
if (isset($_POST['saveChanges'])) {
$results = array();
$results['pageTitle'] = 'New Group';
// User has posted the new group form: save the new group in the db
$group = new Group();
$group->storeFormValues($_POST);
$group->insert();
header("Location: index.php?action=listUser&success=groupCreated&newGroup=" . $group->id);
} else {
// the new group form was not submitted, return to the user listing page
header("Location: index.php?action=listUser");
}
}
示例2: update_group
/**
* Update a group
* @return Group instance
*/
function update_group($name, $label, $ns, Userfilter $filter)
{
$gf = new GroupFilter(new GFC_Name($name));
$g = $gf->get(true);
if ($g instanceof Group) {
echo 'Updating ' . $label . ' (' . $name . ', ' . $g->id() . ') ';
$g->select(GroupSelect::castes());
} else {
echo 'Creating ' . $label . ' (' . $name . ') ';
$g = new Group();
$g->insert();
$g->ns($ns);
$g->name($name);
$g->label($label);
}
$c = $g->caste(Rights::member());
$c->select(CasteSelect::base());
$c->userfilter($filter);
$c->compute();
echo '... ' . $c->users()->count() . ' member(s)' . "\n";
return $g;
}
示例3: Template_Helper
* For the full copyright and license information,
* please see the COPYING and AUTHORS files
* that were distributed with this source code.
*/
require_once __DIR__ . '/../../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('manage/groups.tpl.html');
Auth::checkAuthentication();
$role_id = Auth::getCurrentRole();
if ($role_id < User::ROLE_MANAGER) {
Misc::setMessage(ev_gettext('Sorry, you are not allowed to access this page.'), Misc::MSG_ERROR);
$tpl->displayTemplate();
exit;
}
if (@$_POST['cat'] == 'new') {
$res = Group::insert();
Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the group was added successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to add the new group.'), Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'update') {
$res = Group::update();
Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the group was updated successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to update the group.'), Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'delete') {
Group::remove();
}
if (@$_GET['cat'] == 'edit') {
$info = Group::getDetails($_GET['id']);
$tpl->assign('info', $info);
$user_options = User::getActiveAssocList(Auth::getCurrentProject(), User::ROLE_CUSTOMER, false, $_GET['id']);
} else {
$user_options = User::getActiveAssocList(Auth::getCurrentProject(), User::ROLE_CUSTOMER, true);
}
if (@$_GET['show_customers'] == 1) {
示例4: createGroup
function createGroup()
{
$results = array();
$results['pageTitle'] = " Add an activity | Dating website";
if ($_POST) {
$group = new Group($_POST);
$group->icon_link = DEFAULT_IMAGE_LOCATION;
$group->status = "pending";
$arr = explode(",", $_POST['blah']);
$group->per2Id = $arr[0];
$group->per3Id = $arr[1];
if ($arr[0] != $arr[1]) {
if ($group1 = Group::getByMembers($group->adminId, $arr[0], $arr[1])) {
$results['successMessage'] = "failed adding group already exists";
require TEMPLATE_PATH . "/home.php";
} else {
if ($group->insert()) {
$results['successMessage'] = "Added group successfully.";
$request = new Request();
$request->type = "accept";
$request->sentById = $group->id;
$request->status = "pending";
$request->sentToId = $group->per2Id;
if ($request->insert()) {
$results['requestMessage'] = "a request has been sent successfully";
}
$request1 = new Request();
$request1->type = "accept";
$request1->sentById = $group->id;
$request1->status = "pending";
$request1->sentToId = $group->per3Id;
if ($request1->insert()) {
$results['requestMessage1'] = "a request has been sent successfully";
}
//header('Location: ' . $_SERVER['HTTP_REFERER']);
require TEMPLATE_PATH . "/home.php";
} else {
$results['successMessage'] = "failed adding group .";
require TEMPLATE_PATH . "/home.php";
//echo "fail";
}
}
} else {
$results['successMessage'] = "failed adding group same persons selected.";
require TEMPLATE_PATH . "/home.php";
}
} else {
require TEMPLATE_PATH . "/home.php";
}
}
示例5: dirname
<?php
// Initialize the Yellow Duck Framework
require_once dirname(__FILE__) . '/../../YDFramework2/YDF2_init.php';
YDConfig::set('YD_DATABASEOBJECT_PATH', YD_SELF_DIR . YD_DIRDELIM . 'includes');
YDInclude('Group.php');
$group = new Group();
// Let's truncate the table before
$group->executeSql('TRUNCATE ' . $group->getTable());
// Let's begin
echo "<h1>Let's add some Groups</h1>";
$group->name = 'Yellow Duck Framework Group';
$group->date = date('Ymd');
// today
$id = $group->insert();
echo '<p>The "' . $group->name . '" have ID = ' . $id . '.</p>';
$group->reset();
// deletes all information in the object
$group->name = 'Beautiful Group';
$group->date = '20050412';
$group->insert();
// let's not get the ID here, it's already set
echo '<p>The "' . $group->name . '" have ID = ' . $group->id . '.</p>';
$group->reset();
$group->name = 'Yo! Ugly Group';
$group->date = '19001231';
$group->insert();
echo '<p>The "' . $group->name . '" have ID = ' . $group->id . '.</p>';
echo "<p>Oops... it's not " . substr($group->date, 0, 4) . " but 1999. Let's <b>update</b> it.</p>";
$group->date = '19991231';
$group->update();
示例6: Template_API
include_once APP_INC_PATH . "class.auth.php";
include_once APP_INC_PATH . "class.user.php";
include_once APP_INC_PATH . "class.group.php";
include_once APP_INC_PATH . "class.project.php";
include_once APP_INC_PATH . "db_access.php";
$tpl = new Template_API();
$tpl->setTemplate("manage/index.tpl.html");
Auth::checkAuthentication(APP_COOKIE);
$tpl->assign("type", "groups");
$role_id = Auth::getCurrentRole();
if ($role_id == User::getRoleID('administrator') || $role_id == User::getRoleID('manager')) {
if ($role_id == User::getRoleID('administrator')) {
$tpl->assign("show_setup_links", true);
}
if (@$HTTP_POST_VARS["cat"] == "new") {
$tpl->assign("result", Group::insert());
} elseif (@$HTTP_POST_VARS["cat"] == "update") {
$tpl->assign("result", Group::update());
} elseif (@$HTTP_POST_VARS["cat"] == "delete") {
Group::remove();
}
if (@$HTTP_GET_VARS["cat"] == "edit") {
$info = Group::getDetails($HTTP_GET_VARS["id"]);
$tpl->assign("info", $info);
}
$user_options = User::getActiveAssocList(false, NULL, false, false, true);
if (@$HTTP_GET_VARS['show_customers'] == 1) {
$show_customer = true;
} else {
$show_customer = false;
}
示例7: insert
public function insert($id = null)
{
if ($id == null) {
XDB::execute('INSERT INTO account SET perms = "user"');
$this->id = XDB::insertId();
} else {
XDB::execute('INSERT INTO account SET uid = {?}, perms= "user"', $id);
$this->id = $id;
}
$group = new Group();
$group->insert(null, 'user');
$group->ns(Group::NS_USER);
$group->name('user_' . $this->id());
$group->leavable(false);
$group->visible(false);
$group->label('Groupe personnel de ' . $this->fullName());
XDB::execute('UPDATE account SET `group` = {?} WHERE uid = {?}', $group->id(), $this->id());
$group->caste(Rights::admin())->addUser($this);
$group->caste(Rights::restricted())->addUser($this);
$this->group = $group;
}
示例8: UserFilter
$temp->name('temp');
$temp->label('Temporary');
$temp->external(0);
$temp->leavable(0);
$temp->visible(0);
// Admins(temp) = Members(webmasters)
$temp->caste(Rights::admin())->userfilter(new UserFilter(new UFC_Group($webmasters, Rights::member())));
$g = new Group();
$g->insert();
$g->name('qdj');
$g->ns(Group::NS_FREE);
$g->label('Question Du Jour');
$g->external(0);
$g->leavable(0);
$g->visible(1);
// Admins(qdj) = Members(webmasters) the time of the conversion
$g->caste(Rights::admin())->userfilter(new UserFilter(new UFC_Group($webmasters, Rights::member())));
$g = new Group();
$g->insert();
$g->name('postit');
$g->label('Post-It');
// Admins(postit) = Members(webmasters) the time of the conversion
$g->caste(Rights::admin())->userfilter(new UserFilter(new UFC_Group($webmasters, Rights::member())));
$g = new Group();
$g->insert();
$g->name('licenses');
$g->label('Licenses');
// Admins(postit) = Members(webmasters) the time of the conversion
$g->caste(Rights::admin())->userfilter(new UserFilter(new UFC_Group($webmasters, Rights::member())));
echo "Added Fkz Microcosmos \n";
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
示例9: Group
function handler_group_insert($page)
{
$group = new Group();
$group->insert();
$group->caste(Rights::admin())->addUser(S::user());
S::logger()->log("groups/insert", array('gid' => $group->id()));
pl_redirect('groups/admin/' . $group->id());
}
示例10: Group
$emails = $_POST["users"];
// Desempaqueta la lista de correos electrónicos
} else {
$emails = "";
}
session_start();
// Inicia o reinicia la sesión
$group = new Group();
// Crea un [Grupo]
$user = new User();
// Crea un [Usuario]
$userSession = $user->getLoggedInUser();
// Devuelve el [Usuario] en sesión
$group->admin = $userSession->id;
// El atributo admin de [Grupo] toma el valor del identificador de $userSession
$group->group_name = $group_name;
// El atributo group_name de [Grupo] toma el valor de $group_name
$group->insert();
// Inserta en la BD el [Grupo]
$group->insertUser($userSession->emailAddress);
// Insserta en la BD al administrador como miembro de [Grupo]
if ($emails != "") {
foreach ($emails as $email) {
// Para cada correo recibido introduce al [Usuario] de este como miembro de [Grupo]
//Comprobar que el email está bien formado
if (preg_match("^[a-z0-9,!#\$%&'\\*\\+/=\\?\\^_`\\{\\|}~-]+(\\.[a-z0-9,!#\$%&'\\*\\+/=\\?\\^_`\\{\\|}~-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*\\.([a-z]{2,})\$^", $email['email'])) {
$group->insertUser($email['email']);
}
}
}
echo "success";
示例11: addGroup
function addGroup()
{
global $tool, $propertyForm;
$newGroup = new Group();
$tempInfo = array();
$key = array("name", "desc", "access");
foreach ($key as $index => $key) {
$tempInfo[$key] = htmlspecialchars(trim($_POST[$key]), ENT_QUOTES);
}
//add slashes to these 2 to make sure it does not display wrongly
$tempInfo[name] = addslashes($tempInfo[name]);
$tempInfo[desc] = addslashes($tempInfo[desc]);
//checks if the name is empty, if not set all the names and insert them
if ($newGroup->set_name($tempInfo[name])) {
//set all the values to the query
$newGroup->set_description($tempInfo[desc]);
$newGroup->set_access_level($tempInfo[access]);
$newGroup->set_ldap_group_name($tempInfo[ldap]);
//if the insert is sucessful reload the page with the new values
if ($newGroup->insert()) {
$status = "success";
echo "<script language='javascript'>LoadPage(\"configurations.php?action=groupManage&mode=edit&add=" . $status . "\", 'settingsInfo');</script>";
//echo "<meta http-equiv=\"REFRESH\" content=\"0;url=".$_SERVER['PHP_SELF']."?action=userManage&add=$status\">";
} else {
$propertyForm->error("Warning: Failed to add group. Reason: " . $newGroup->get_error(), $_GET['ID']);
}
} else {
$propertyForm->error("Warning: Failed to add group. Reason: " . $newGroup->get_error(), $_GET['ID']);
}
}