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


PHP Role::setName方法代码示例

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


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

 public function executeProcessNewOrgRoleForm(sfWebRequest $request)
 {
     $o = Doctrine::getTable('Organization')->find($request->getParameter('id'));
     $this->forward404Unless($o->isMy());
     $r = new Role();
     $r->setName($request->getParameter("name"));
     $r->setOrganizationId($o->getId());
     $r->setDescription($request->getParameter("description"));
     $r->save();
     $this->redirect("show/index?id=" . $o->getId());
 }
开发者ID:br00k,项目名称:yavom,代码行数:11,代码来源:actions.class.php

示例3: getRoleById

 public function getRoleById($bdd, $id)
 {
     $req = $bdd->prepare("SELECT * FROM role WHERE id = :id");
     $req->execute(array(":id" => $id));
     $cloneRole = new Role();
     while ($array = $req->fetch()) {
         $cloneRole->setId($array['id']);
         $cloneRole->setName($array['name']);
     }
     return $cloneRole;
 }
开发者ID:JuanTrochez,项目名称:enote,代码行数:11,代码来源:Role.php

示例4: edit

 /**
  * Update role
  *
  * @param void
  * @return null
  */
 function edit()
 {
     $this->wireframe->print_button = false;
     if ($this->active_role->isNew()) {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     if ($this->active_role->getType() == ROLE_TYPE_PROJECT) {
         $permissions = array_keys(Permissions::findProject());
     } else {
         $permissions = Permissions::findSystem();
     }
     // if
     $role_data = $this->request->post('role');
     if (!is_array($role_data)) {
         $role_data = array('name' => $this->active_role->getName(), 'permissions' => $this->active_role->getPermissions());
     }
     // if
     // if it's admin role and if the user editing it is the only administrator in the system
     // we need to protect removing system or admin access from that role
     $protect_admin_role = $this->logged_user->isOnlyAdministrator() && $this->logged_user->getRoleId() == $this->active_role->getId();
     $this->smarty->assign(array('role_data' => $role_data, 'permissions' => $permissions, 'protect_admin_role' => $protect_admin_role));
     if ($this->request->isSubmitted()) {
         $old_name = $this->active_role->getName();
         $permission_values = array_var($role_data, 'permissions');
         if (!is_array($permission_values)) {
             $permission_values = array();
         }
         // if
         if ($protect_admin_role) {
             // in case that someone removes "disabled" attribute, use brute force!
             $permission_values['admin_access'] = 1;
             $permission_values['system_access'] = 1;
         }
         // if
         $this->active_role->setName(array_var($role_data, 'name'));
         $this->active_role->setPermissions($permission_values);
         $save = $this->active_role->save();
         if ($save && !is_error($save)) {
             clean_permissions_cache();
             flash_success("Role ':name' has been updated", array('name' => $old_name));
             $this->redirectTo('admin_roles');
         } else {
             $this->smarty->assign('errors', $save);
         }
         // if
     }
     // if
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:55,代码来源:RolesAdminController.class.php

示例5: setName

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

示例6: update

 /**
  * {@inheritdoc}
  * @param \Role $role
  */
 public function update($form, $role)
 {
     $role->setName($form->get('name')->getData())->setDisplayAsLeader($form->get('display_as_leader')->getData())->setDisplayIcon($form->get('display_icon')->getData())->setDisplayColor($form->get('display_color')->getData())->setDisplayName($form->get('display_name')->getData())->setDisplayOrder($form->get('display_order')->getData())->setPerms($form->get('permissions')->getData());
 }
开发者ID:allejo,项目名称:bzion,代码行数:8,代码来源:RoleFormCreator.php

示例7: createDashboard

 public function createDashboard()
 {
     $role = new Role();
     $role->setDecisionId($this->id);
     $role->setName('Collect everything');
     $role->setComment('Collect everything is linked to the Overview -page reporting table. <br><br>If you delete this survey your responses on the overview page will be removed.');
     $role->setUpdateable(true);
     $role->setDashboard(true);
     $role->setActive(true);
     $response = new Response();
     $response->setDecisionId($this->id);
     $response->setIpAddress('127.0.0.1');
     $response->setEmailAddress('dashboard');
     $role->Response->add($response);
     $role->Response->save();
     if ($this->Template->name == 'Default') {
         $role_estimates = new Role();
         $role_estimates->setDecisionId($this->id);
         $role_estimates->setName('Collect Estimates');
         $role_estimates->setUpdateable(false);
         $role_estimates->setActive(true);
         $role_estimates->save();
         $role_value = new Role();
         $role_value->setDecisionId($this->id);
         $role_value->setName('Collect input on Value');
         $role_value->setUpdateable(false);
         $role_value->setActive(true);
         $role_value->save();
         $role_usability = new Role();
         $role_usability->setDecisionId($this->id);
         $role_usability->setName('Collect input on Usability');
         $role_usability->setUpdateable(false);
         $role_usability->setActive(true);
         $role_usability->save();
         $role_feasibility = new Role();
         $role_feasibility->setDecisionId($this->id);
         $role_feasibility->setName('Collect input on Feasibility');
         $role_feasibility->setUpdateable(false);
         $role_feasibility->setActive(true);
         $role_feasibility->save();
         // create the default item for project
         $alternative = new Alternative();
         $alternative->setDecisionId($this->id);
         $alternative->setName('Sample item');
         $alternative->setStatus('Reviewed');
         $alternative->save();
         $popularCriteria = PopularCriterionTable::getInstance()->getDashboardDefaultList();
         foreach ($popularCriteria as $popularCriterion) {
             $criterion = new Criterion();
             $criterion->setName($popularCriterion->name);
             $criterion->setMeasurement($popularCriterion->measurement);
             $criterion->setDescription($popularCriterion->description);
             $criterion->setVariableType($popularCriterion->variable_type);
             $criterion->setDecisionId($this->id);
             $criterion->save();
             // set default response as 3 for default item
             if ($popularCriterion->measurement == 'five point scale') {
                 $alternative_measurement = new AlternativeMeasurement();
                 $alternative_measurement->setAlternativeHeadId($alternative->id);
                 $alternative_measurement->setScore(3);
                 $alternative_measurement->setResponseId($response->id);
                 $alternative_measurement->setRatingMethod($criterion->getMeasurement());
                 $alternative_measurement->setCriterionId($criterion->id);
                 $alternative_measurement->save();
             }
             // show by default in the Survey (create default matrix of the default roles)
             $array = array('Hour Estimate' => $role_estimates->id, 'Feasibility' => $role_feasibility->id, 'Usability' => $role_usability->id, 'Value' => $role_value->id);
             if (isset($array[$popularCriterion->name])) {
                 $planned = new PlannedAlternativeMeasurement();
                 $planned->setRoleId($array[$popularCriterion->name]);
                 $planned->setAlternativeId($alternative->id);
                 $planned->setCriterionId($criterion->id);
                 $planned->save();
                 $cplanned = new PlannedCriterionPrioritization();
                 $cplanned->setCriterionId($criterion->id);
                 $cplanned->setRoleId($array[$popularCriterion->name]);
                 $cplanned->save();
             }
         }
     } else {
         foreach ($this->Template->CriteriaTemplate as $criterionTemplate) {
             $criterion = new Criterion();
             $criterion->setDecisionId($this->id);
             $criterion->setName($criterionTemplate->name);
             $criterion->setMeasurement($criterionTemplate->measurement);
             $criterion->setVariableType($criterionTemplate->variable_type);
             $criterion->save();
         }
         foreach ($this->Template->RoleTemplate as $roleTemplate) {
             $role = new Role();
             $role->setDecisionId($this->id);
             $role->setName($roleTemplate->name);
             $role->save();
         }
     }
 }
开发者ID:sensorsix,项目名称:app,代码行数:96,代码来源:Decision.class.php

示例8: Group

$user->setPassword("test");
$ds->save($user);
//var_dump($user);
// read
$user2 = $ds->getEntity(User, $user->getId());
//var_dump($user2);
// many to one
$group = new Group();
$group->setName("test");
$ds->save($group);
$user->getGroupRelation($ds)->setEntity($group);
$user = new User();
$user->setName("test 2");
$ds->save($user);
$user->getGroupRelation($ds)->setEntity($group);
//var_dump($user->getGroupRelation($ds)->getEntity($group));
// one to many
//var_dump($group->getUsersRelation($ds)->getEntities());
// many to many
$role = new Role();
$role->setName('Test Role 1');
$ds->save($role);
$user->getRolesRelation($ds)->addEntity($role);
$role = new Role();
$role->setName('Test Role 2');
$ds->save($role);
$user->getRolesRelation($ds)->addEntity($role);
var_dump($user->getRolesRelation($ds)->getEntities());
var_dump($role->getUsersRelation($ds)->getEntities());
$user->getRolesRelation($ds)->removeEntity($role);
var_dump($user->getRolesRelation($ds)->getEntities());
开发者ID:codegooglecom,项目名称:lworm,代码行数:31,代码来源:index.php

示例9: initRoles

 function initRoles()
 {
     $roleFunctionViewFund = new Rolefunction();
     $roleFunctionViewFund->setName("VIEW_FUND");
     $this->em->persist($roleFunctionViewFund);
     $roleFunctionAddFund = new Rolefunction();
     $roleFunctionAddFund->setName("ADD_FUND");
     $this->em->persist($roleFunctionAddFund);
     $roleFunctionAddProject = new Rolefunction();
     $roleFunctionAddProject->setName("ADD_PROJECT");
     $this->em->persist($roleFunctionAddProject);
     $roleFunctionViewTechSanction = new Rolefunction();
     $roleFunctionViewTechSanction->setName("VIEW_TECH_SANCTION");
     $this->em->persist($roleFunctionViewTechSanction);
     $roleFunctionViewTechSanctionApprove = new Rolefunction();
     $roleFunctionViewTechSanctionApprove->setName("APPROVE_TECH_SANCTION");
     $this->em->persist($roleFunctionViewTechSanctionApprove);
     $roleFunctionTenderView = new Rolefunction();
     $roleFunctionTenderView->setName("VIEW_TENDER");
     $this->em->persist($roleFunctionTenderView);
     $roleFunctionTenderApprove = new Rolefunction();
     $roleFunctionTenderApprove->setName("APPROVE_TENDER");
     $this->em->persist($roleFunctionTenderApprove);
     $roleFunctionWorkOrderView = new Rolefunction();
     $roleFunctionWorkOrderView->setName("VIEW_WORK_ORDER");
     $this->em->persist($roleFunctionWorkOrderView);
     $roleFunctionWorkOrderApprove = new Rolefunction();
     $roleFunctionWorkOrderApprove->setName("APPROVE_WORK_ORDER");
     $this->em->persist($roleFunctionWorkOrderApprove);
     $roleFunctionBillView = new Rolefunction();
     $roleFunctionBillView->setName("VIEW_BILL");
     $this->em->persist($roleFunctionBillView);
     $roleFunctionBillApprove = new Rolefunction();
     $roleFunctionBillApprove->setName("APPROVE_BILL");
     $this->em->persist($roleFunctionBillApprove);
     $roleFunctionCompleteView = new Rolefunction();
     $roleFunctionCompleteView->setName("VIEW_COMPLETED");
     $this->em->persist($roleFunctionCompleteView);
     $roleFunctionManageContractor = new Rolefunction();
     $roleFunctionManageContractor->setName("MANAGE_CONTRACTOR");
     $this->em->persist($roleFunctionManageContractor);
     $roleFunctionManageUser = new Rolefunction();
     $roleFunctionManageUser->setName("MANAGE_USER");
     $this->em->persist($roleFunctionManageUser);
     $roleFunctionAdminApproval = new Rolefunction();
     $roleFunctionAdminApproval->setName("VIEW_ADMIN_APPROVAL");
     $this->em->persist($roleFunctionAdminApproval);
     //Adding Roles
     $admin = new Role();
     $admin->setName("ADMIN");
     $admin->setLabel("Administrator");
     $admin->getRoleFunction()->add($roleFunctionViewFund);
     $admin->getRoleFunction()->add($roleFunctionAddFund);
     $admin->getRoleFunction()->add($roleFunctionAddProject);
     $admin->getRoleFunction()->add($roleFunctionViewTechSanction);
     $admin->getRoleFunction()->add($roleFunctionViewTechSanctionApprove);
     $admin->getRoleFunction()->add($roleFunctionTenderView);
     $admin->getRoleFunction()->add($roleFunctionTenderApprove);
     $admin->getRoleFunction()->add($roleFunctionWorkOrderView);
     $admin->getRoleFunction()->add($roleFunctionWorkOrderApprove);
     $admin->getRoleFunction()->add($roleFunctionBillView);
     $admin->getRoleFunction()->add($roleFunctionBillApprove);
     $admin->getRoleFunction()->add($roleFunctionCompleteView);
     $admin->getRoleFunction()->add($roleFunctionManageContractor);
     $admin->getRoleFunction()->add($roleFunctionManageUser);
     $admin->getRoleFunction()->add($roleFunctionAdminApproval);
     $this->em->persist($admin);
     $technical = new Role();
     $technical->setName("TECHNICAL");
     $technical->setLabel("Technical Approval");
     $technical->getRoleFunction()->add($roleFunctionViewTechSanction);
     $technical->getRoleFunction()->add($roleFunctionViewTechSanctionApprove);
     $this->em->persist($technical);
     $tendor = new Role();
     $tendor->setName("TENDOR");
     $tendor->setLabel("Tendor Approval");
     $tendor->getRoleFunction()->add($roleFunctionTenderView);
     $tendor->getRoleFunction()->add($roleFunctionTenderApprove);
     $tendor->getRoleFunction()->add($roleFunctionManageContractor);
     $this->em->persist($tendor);
     $deptEngineer = new Role();
     $deptEngineer->setName("DEPT_ENGINEER");
     $deptEngineer->setLabel("Dept. Engineer");
     $deptEngineer->getRoleFunction()->add($roleFunctionWorkOrderView);
     $deptEngineer->getRoleFunction()->add($roleFunctionWorkOrderApprove);
     $deptEngineer->getRoleFunction()->add($roleFunctionCompleteView);
     $deptEngineer->getRoleFunction()->add($roleFunctionBillView);
     $this->em->persist($deptEngineer);
     $this->em->flush();
     echo "Roles Created..!";
 }
开发者ID:digvijaymohite,项目名称:e-tender,代码行数:91,代码来源:Schema.php


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