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


PHP Role::getId方法代码示例

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


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

示例1: executeProcessNewOrgForm

 public function executeProcessNewOrgForm(sfWebRequest $request)
 {
     $f = $request->getParameter("organization");
     $p = Doctrine::getTable('Principal')->findOneByFedid($this->getUser()->getUsername());
     $o = new Organization();
     $o->setName($f["name"]);
     $o->setDescription($f["description"]);
     $o->setCreatedAt(date('Y-m-d H:i:s'));
     $o->save();
     $op = new OrganizationPrincipal();
     $op->setOrganization($o);
     $op->setPrincipal($p);
     $op->save();
     $i = new Invitation();
     $i->setEmail($p->getEmail());
     $i->setOrganization($o);
     $i->setUuid('1');
     $i->setCreatedAt(date('Y-m-d H:i:s'));
     $i->setAcceptAt(date('Y-m-d H:i:s'));
     $i->setCounter(1);
     $i->setInviter($p);
     $i->setPrincipal($p);
     $i->setStatus("accepted");
     $i->save();
     $r = new Role();
     $r->setName($f["role_name"]);
     $r->setOrganization($o);
     $r->setShoworder(0);
     $r->save();
     $o->setDefaultRoleId($r->getId());
     $o->save();
     $this->redirect("show/index?id=" . $o->getId());
 }
开发者ID:br00k,项目名称:yavom,代码行数:33,代码来源:actions.class.php

示例2: getId

 public function getId()
 {
     if ($this->__isInitialized__ === false) {
         return (int) $this->_identifier["id"];
     }
     $this->__load();
     return parent::getId();
 }
开发者ID:digvijaymohite,项目名称:e-tender,代码行数:8,代码来源:__CG__Role.php

示例3: testNormalRole

 public function testNormalRole()
 {
     $role = new Role($this->normalRole->getId());
     $this->player_b->addRole($role->getId());
     $this->assertFalse($role->displayAsLeader());
     $this->assertFalse($role->isProtected());
     $this->assertEquals("Sample Normal Role", $role->getName());
     $this->assertNull($role->getDisplayIcon());
     $this->assertNull($role->getDisplayColor());
     $this->assertEquals("Sample Normal Role", $role->getDisplayName());
     $this->assertEquals(-1, $role->getDisplayOrder());
     $this->assertArrayContainsModel($role, Role::getRoles($this->player_b->getId()));
     $this->wipe($role);
 }
开发者ID:kleitz,项目名称:bzion,代码行数:14,代码来源:RoleTest.php

示例4: findSingle

 /**
  * @param bool $full
  *
  * @return Role|false
  */
 public function findSingle($full = false)
 {
     $result = parent::findSingle();
     if ($result) {
         $role = new Role($result);
         if ($full === true) {
             $repo = new PermissionRepository($this->db);
             $role->setPermissions($repo->where('role_id', '=', $role->getId())->order('name', 'ASC')->find());
         }
         return $role;
     } else {
         return false;
     }
 }
开发者ID:arkuuu,项目名称:publin,代码行数:19,代码来源:RoleRepository.php

示例5: flush

 /**
  * 
  * @param Role $role
  * @return int id of the Role inserted in base. False if it didn't work.
  */
 public static function flush($role)
 {
     $roleId = $role->getId();
     $roleVar = $role->getRoleName();
     if ($roleId > 0) {
         $sql = 'UPDATE role SET' . 'role_name = ? ' . 'WHERE id_role = ?';
         $params = array('si', &$roleVar, &$roleId);
     } else {
         $sql = 'INSERT INTO role (role_name) VALUES (?)';
         $params = array('s', &$roleVar);
     }
     $idInsert = BaseSingleton::insertOrEdit($sql, $params);
     if ($idInsert !== false && $roleId > 0) {
         $idInsert = $roleId;
     }
     return $idInsert;
 }
开发者ID:Eurymone,项目名称:Student-Exam-Report-System,代码行数:22,代码来源:RoleDAL.php

示例6: array

 /**
  * Set specific role as default role
  *
  * @param void
  * @return null
  */
 function set_as_default()
 {
     if ($this->request->isSubmitted()) {
         if ($this->active_role->isNew()) {
             $this->httpError(HTTP_ERR_NOT_FOUND);
         }
         // if
         if ($this->active_role->getType() == ROLE_TYPE_PROJECT) {
             $this->httpError(HTTP_ERR_INVALID_PROPERTIES);
         }
         // if
         ConfigOptions::setValue('default_role', $this->active_role->getId());
         flash_success(':name role has been set as default', array('name' => $this->active_role->getName()));
         $this->redirectTo('admin_roles');
     } else {
         $this->httpError(HTTP_ERR_BAD_REQUEST);
     }
     // if
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:25,代码来源:RolesAdminController.class.php

示例7: getId

 public function getId()
 {
     $this->_load();
     return parent::getId();
 }
开发者ID:himel31,项目名称:doctrine2yml-zfmodules,代码行数:5,代码来源:RoleProxy.php

示例8: setRole

 /**
  * Declares an association between this object and a Role object.
  *
  * @param      Role $v
  * @return     User The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setRole(Role $v = null)
 {
     if ($v === null) {
         $this->setRoleId(NULL);
     } else {
         $this->setRoleId($v->getId());
     }
     $this->aRole = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the Role object, it will not be re-added.
     if ($v !== null) {
         $v->addUser($this);
     }
     return $this;
 }
开发者ID:lejacome,项目名称:hospital-mgt,代码行数:22,代码来源:BaseUser.php

示例9: canAccessDevelopingPage

 public static function canAccessDevelopingPage(Role $role)
 {
     switch ($role->getId()) {
         case Role::ID_SYSTEM_ADMIN:
             return true;
     }
     return false;
 }
开发者ID:larryu,项目名称:magento-b2b,代码行数:8,代码来源:AccessControl.php

示例10: construct

 /**
  * Convenience method to construct a new instance. 
  * 
  * @param \User $callingUser {@link \User} who creates/updates this record.
  * @param \Role $role The target {@link \Role} 
  * @param string $newStatus
  * @return \self
  */
 public static function construct(\User $callingUser, \Role $role, $newStatus)
 {
     $rar = new self($callingUser->getId(), $callingUser->getFullName(), $role->getId(), $role->getStatus(), $newStatus, $role->getRoleType()->getId(), $role->getRoleType()->getName(), $role->getOwnedEntity()->getId(), $role->getOwnedEntity()->getType(), $role->getUser()->getId(), $role->getUser()->getFullName());
     return $rar;
 }
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:13,代码来源:RoleActionRecord.php

示例11: testRemoveGroupRoleActionIsProtected

 public function testRemoveGroupRoleActionIsProtected()
 {
     $this->logIn($this->john);
     $this->client->request('GET', "/api/groups/{$this->groupOrga->getId()}/roles/{$this->teacherRole->getId()}/remove.json");
     $this->assertEquals(403, $this->client->getResponse()->getStatusCode());
 }
开发者ID:ngydat,项目名称:CoreBundle,代码行数:6,代码来源:GroupControllerTest.php

示例12: countByRole

 /**
  * Return number of users using a specific role
  *
  * @param Role $role
  * @return integer
  */
 function countByRole($role)
 {
     return ProjectUsers::count(array('role_id = ?', $role->getId()));
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:10,代码来源:ProjectUsers.class.php

示例13: hasRole

 public static function hasRole(Role $role, $targetObject, $user = null)
 {
     $retval = false;
     $db = AbstractDb::getObject();
     $object_class = get_class($targetObject);
     $table = strtolower($object_class) . '_stakeholders';
     $object_id = $db->escapeString($targetObject->getId());
     $roleIdStr = $db->escapeString($role->getId());
     if (!$user) {
         $user = User::getCurrentUser();
     }
     if ($user) {
         $sql = "SELECT * FROM {$table} WHERE object_id = '{$object_id}' AND user_id='{$user->getId()}' AND role_id = '{$roleIdStr}';";
         $rows = null;
         $db->execSql($sql, $rows, false);
         if ($rows) {
             $retval = true;
         }
     }
     return $retval;
 }
开发者ID:cnlangzi,项目名称:wifidog-auth,代码行数:21,代码来源:Security.php

示例14: execute

 /**
  * @see Form::execute()
  */
 function execute($request)
 {
     $userGroupId = $this->getUserGroupId();
     $userGroupDao =& DAORegistry::getDAO('UserGroupDAO');
     // Check if we are editing an existing user group or creating another one.
     if ($userGroupId == null) {
         $userGroup = $userGroupDao->newDataObject();
         $role = new Role($this->getData('roleId'));
         $userGroup->setRoleId($role->getId());
         $userGroup->setContextId($this->getPressId());
         $userGroup->setPath($role->getPath());
         $userGroup->setDefault(false);
         $userGroup = $this->_setUserGroupLocaleFields($userGroup, $request);
         $userGroupId = $userGroupDao->insertUserGroup($userGroup);
     } else {
         $userGroup = $userGroupDao->getById($userGroupId);
         $userGroup = $this->_setUserGroupLocaleFields($userGroup, $request);
         $userGroupDao->updateLocaleFields($userGroup);
     }
     // After we have created/edited the user group, we assign/update its stages.
     if ($this->getData('assignedStages')) {
         $this->_setOnDbUserGroupStageAssignment($userGroupId);
     }
 }
开发者ID:jerico-dev,项目名称:omp,代码行数:27,代码来源:UserGroupForm.inc.php

示例15: addInstanceToPool

 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      Role $value A Role object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(Role $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
开发者ID:lejacome,项目名称:hospital-mgt,代码行数:22,代码来源:BaseRolePeer.php


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