本文整理汇总了PHP中Group::setId方法的典型用法代码示例。如果您正苦于以下问题:PHP Group::setId方法的具体用法?PHP Group::setId怎么用?PHP Group::setId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Group
的用法示例。
在下文中一共展示了Group::setId方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addGroup
/**
* Adds a new group.
*
* Called when this component receives an HTTP POST request to
* /group(/).
* The request body should contain a JSON object representing
* the group's attributes.
*/
public function addGroup($callName, $input, $params = array())
{
$positive = function ($input) {
// sets the new auto-increment id
$obj = new Group();
$obj->setId($input[0]->getInsertId());
return array("status" => 201, "content" => $obj);
};
return $this->_component->callSqlTemplate('out', dirname(__FILE__) . '/Sql/AddGroup.sql', array('values' => $input->getInsertData()), 201, $positive, array(), 'Model::isProblem', array(new Group()));
}
示例2: Group
/**
* Internal function to return a Group object from a row.
* @param $row array
* @return Group
*/
function &_returnGroupFromRow(&$row)
{
$group = new Group();
$group->setId($row['group_id']);
$group->setAboutDisplayed($row['about_displayed']);
$group->setSequence($row['seq']);
$group->setContext($row['context']);
$group->setAssocType($row['assoc_type']);
$group->setAssocId($row['assoc_id']);
$this->getDataObjectSettings('group_settings', 'group_id', $row['group_id'], $group);
HookRegistry::call('GroupDAO::_returnGroupFromRow', array(&$group, &$row));
return $group;
}
示例3: add
/**
* Save new user at db
* If gid not exist than create new group with gid
* @return bool
*/
public function add()
{
if (!$this->checkRequiredAttribute()) {
return false;
}
// this is not fully correct
$groupManager = new Group($this->connector);
if (!$groupManager->checkExist($this->attributes['gid'])) {
$groupManager->setId($this->attributes['gid']);
$groupManager->save();
}
if (!$groupManager->checkExist($this->attributes['gid'])) {
$this->errors['gid'] = 'Can\'t get group id';
return false;
}
return $this->save();
}
示例4: Add
public static function Add($group_name)
{
$group = new Group();
$group->name = $group_name;
$con = new DbConnection();
$query = "INSERT INTO groups (group_name) VALUES (?)";
$st = $con->prepare($query);
$st->bind_param("s", $group_name);
$st->execute();
$con->close();
$con = new DbConnection();
$query = "SELECT group_id FROM groups WHERE group_name = ?";
$st2 = $con->prepare($query);
$st2->bind_param("s", $group_name);
$st2->bind_result($g_id);
$st2->execute();
if ($st2->fetch()) {
$group->setId($g_id);
}
$con->close();
return $group;
}
示例5: filterFontsByGroup
/**
* @param type $groupId
* @param ArrayObject $fonts
* @return ArrayObject
*/
private function filterFontsByGroup($groupId, ArrayObject $fonts)
{
$group = new Group();
$group->setId($groupId);
return $group->filterFontsByGroup($fonts);
}
示例6: find
function find($criteria = null, $order = null, $limit = 1000, $from = 0)
{
$result = $this->database->query($this->buildFindQuery($criteria, $order, $limit, $from));
if (!is_null($result->getError())) {
return $result->getError();
}
$groups = array();
while ($row = $result->fetchRow()) {
$group = new Group();
$value = $row[0];
$group->setId($value);
$value = $row[1];
$group->setOwner($value);
$value = $row[2];
$group->setName($value);
$value = $row[3];
$group->setDescription($value);
$value = $row[4];
$group->setPeriod_from($value);
$value = $row[5];
$group->setPeriod_to($value);
$value = $row[6];
$group->setProjects($value);
$value = $row[7];
$group->setR_date($value);
$value = $row[8];
$group->setR_user($value);
if ($order != null) {
array_push($groups, $group);
} else {
$groups[$group->getId()] = $group;
}
}
return $groups;
}
示例7: actionSaveGroup
function actionSaveGroup($currentUser)
{
$backUrl = $this->context->getFlowScopeAttr("backUrl");
$group = new Group();
$groupErrs = array();
$group->setId($this->context->getRequestAttr("id"));
$group->setName($this->context->getRequestAttr("name"));
if (!is_null($group->getName())) {
$group->setName(trim($group->getName()));
if (strlen($group->getName()) < 1) {
$group->setName(null);
}
}
if (is_null($group->getName())) {
$groupErrs["name"] = "field.error.empty";
}
$group->setDescription($this->context->getRequestAttr("description"));
if (!is_null($group->getDescription())) {
$group->setDescription(trim($group->getDescription()));
if (strlen($group->getDescription()) < 1) {
$group->setDescription(null);
}
}
$projects = $this->context->getRequestAttr("projects");
if (!is_null($projects)) {
$projects = json_encode($projects);
$group->setProjects($projects);
} else {
$group->setProjects(json_encode(array()));
}
$timeZone = new DateTimeZone("Europe/Vilnius");
$time = new DateTime("now", $timeZone);
$group->setOwner($currentUser->getId());
$group->setR_date($time->format("Y-m-d H:i:s"));
$group->setR_user($currentUser->getId());
$this->context->setFlashScopeAttr("group", $group);
$this->context->setFlashScopeAttr("groupErrs", $groupErrs);
if (count($groupErrs) >= 1) {
if (!is_null($backUrl)) {
header("Location: " . $backUrl);
return true;
}
return false;
}
$store = $this->storeGroup($group);
if (!$store) {
if (!is_null($backUrl)) {
header("Location: " . $backUrl);
return true;
}
return false;
}
$this->context->setRequestScopeAttr("success", "groups.success.stored");
$this->context->setFlashScopeAttr("viewGroup", $group);
$this->cancelGroupEdit();
if (!is_null($backUrl)) {
header("Location: " . $backUrl);
return true;
}
return false;
}
示例8: getGroups
/**
* Get array of all own groups.
*
* @return array of \Newsletter2Go\Group
*/
public function getGroups()
{
$groupsarray = array();
$groups = $this->handleGetRequest('/de/api/get/groups/', null);
foreach ($groups as $key => $val) {
$grp = new Group();
$grp->setId($key);
$grp->setName($val);
$groupsarray[] = $grp;
}
return $groupsarray;
}
示例9: Collection
<?php
require_once "DomainObject.php";
require_once "Collection.php";
require_once "Group.php";
require_once "Student.php";
$collection = new Collection();
$s = new Student();
$s->setId(1);
$g = new Group();
$g->setId(2);
$s->setGroup($g);
$collection->add($s);
$s = new Student();
$s->setId(2);
$g = new Group();
$g->setId(4);
$s->setGroup($g);
$collection->add($s);
$collection->add($g);
foreach ($collection as $item) {
print_r($item);
echo "<hr>";
}
示例10: die
/**
* Finish the installation - create owner company and administrator
*
* @param void
* @return null
*/
function complete_installation()
{
if (Companies::getOwnerCompany() instanceof Company) {
die('Owner company already exists');
// Somebody is trying to access this method even if the user already exists
}
// if
$form_data = array_var($_POST, 'form');
tpl_assign('form_data', $form_data);
if (array_var($form_data, 'submited') == 'submited') {
try {
$admin_password = trim(array_var($form_data, 'admin_password'));
$admin_password_a = trim(array_var($form_data, 'admin_password_a'));
if (trim($admin_password) == '') {
throw new Error(lang('password value required'));
}
// if
if ($admin_password != $admin_password_a) {
throw new Error(lang('passwords dont match'));
}
// if
DB::beginWork();
Users::delete();
// clear users table
Companies::delete();
// clear companies table
// Create the administrator user
$administrator = new User();
$administrator->setId(1);
$administrator->setCompanyId(1);
$administrator->setUsername(array_var($form_data, 'admin_username'));
$administrator->setEmail(array_var($form_data, 'admin_email'));
$administrator->setPassword($admin_password);
$administrator->setCanEditCompanyData(true);
$administrator->setCanManageConfiguration(true);
$administrator->setCanManageSecurity(true);
$administrator->setCanManageWorkspaces(true);
$administrator->setCanManageContacts(true);
$administrator->setCanManageTemplates(true);
$administrator->setCanManageReports(true);
$administrator->setCanManageTime(true);
$administrator->setCanAddMailAccounts(true);
$administrator->setAutoAssign(false);
$administrator->setPersonalProjectId(1);
$administrator->setType('admin');
$administrator->save();
$group = new Group();
$group->setName('administrators');
$group->setAllPermissions(true);
$group->setId(Group::CONST_ADMIN_GROUP_ID);
$group->save();
$group_user = new GroupUser();
$group_user->setGroupId(Group::CONST_ADMIN_GROUP_ID);
$group_user->setUserId($administrator->getId());
$group_user->save();
$project = new Project();
$project->setId(1);
$project->setP1(1);
$project->setName(new_personal_project_name($administrator->getUsername()));
$project->setDescription(lang('files'));
$project->setCreatedById($administrator->getId());
$project->save();
$project_user = new ProjectUser();
$project_user->setProjectId($project->getId());
$project_user->setUserId($administrator->getId());
$project_user->setCreatedById($administrator->getId());
$project_user->setAllPermissions(true);
$project_user->save();
// Create a company
$company = new Company();
$company->setId(1);
$company->setClientOfId(0);
$company->setName(array_var($form_data, 'company_name'));
$company->setCreatedById(1);
$company->save();
DB::commit();
$this->redirectTo('access', 'login');
} catch (Exception $e) {
tpl_assign('error', $e);
DB::rollback();
}
// try
}
// if
}