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


PHP Roles::select方法代码示例

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


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

示例1: findRolesCandidats

 function findRolesCandidats($annee)
 {
     $t = new Roles();
     $db = $t->getAdapter();
     $s = $t->select()->setIntegrityCheck(false)->from('unite_role')->join('unite_type', 'unite_type.id = unite_role.type', array())->join('unite', 'unite.type = unite_type.id', array())->joinLeft('appartenance', 'appartenance.role = unite_role.id AND ' . 'appartenance.unite = unite.id AND ' . ('(' . $db->quoteInto('appartenance.debut < ?', Strass_Controller_Action_Helper_Annee::dateFin($annee)) . ' AND ' . $db->quoteInto('(appartenance.fin IS NULL OR appartenance.fin < ?)', Strass_Controller_Action_Helper_Annee::dateFin($annee)) . ')'), array())->where('unite.id = ?', $this->id)->where('appartenance.id IS NULL');
     return $t->fetchAll($s);
 }
开发者ID:bersace,项目名称:strass,代码行数:7,代码来源:Unites.php

示例2: editAction

 function editAction()
 {
     $request = new Bolts_Request($this->getRequest());
     $roles_table = new Roles();
     $role = null;
     if ($request->has('id')) {
         if (!is_null($request->id)) {
             $role = $roles_table->fetchRow($roles_table->select()->where("id = ?", $request->id));
             if (!is_null($role)) {
                 // we do not edit the guest role
                 if ($role->shortname == "guest") {
                     $this->_redirect("/bolts/role");
                 }
                 $this->view->role = $role->toArray();
                 $this->view->role_tree = $roles_table->getRoleTree(null, $role->id);
                 $this->view->inherited_ids = $roles_table->getInheritedRoles($role->id);
             }
         }
     }
     if (is_null($role)) {
         $this->view->role_tree = $roles_table->getRoleTree();
     }
     if ($this->getRequest()->isPost()) {
         $errors = array();
         if ($request->has('inherit_role')) {
             $parents = array();
             foreach ($request->inherit_role as $inherit_role) {
                 $parents = array_merge($parents, $roles_table->getAllAncestors($inherit_role));
             }
             $inherit_ids = array();
             foreach ($request->inherit_role as $inherit_role) {
                 if (!in_array($inherit_role, $parents)) {
                     $inherit_ids[] = $inherit_role;
                 }
             }
         }
         if ($request->has('shortname')) {
             $shortname = $request->shortname;
             if (!Bolts_Validate::checkLength($request->shortname, 1, 255)) {
                 $errors[] = $this->_T("Shortname must be between 1 and 255 chars.");
             }
         } else {
             $errors[] = $this->_T("Shortname is a requried field.");
         }
         $description = $request->description;
         $isadmin = (int) $request->checkbox('isadmin');
         if (count($errors) == 0) {
             $data = array('shortname' => $shortname, 'description' => $description, 'isadmin' => $isadmin);
             //If we have an id, this is an update.
             $id = (int) $this->_request->getPost('id');
             if ($id != 0) {
                 $where = 'id = ' . $id;
                 $roles_table->update($data, $where);
             } else {
                 //We don't, this is an insert.
                 $id = $roles_table->insert($data);
             }
             $roles_table->removeInheritedRole($id);
             foreach ($inherit_ids as $in_id) {
                 $roles_table->setInheritedRole($id, $in_id);
             }
             $this->_redirect("/bolts/role");
         } else {
             $this->view->errors = $errors;
         }
     }
     if ($request->has('id')) {
         // this is an edit
         $id = $request->id;
         if ($id > 0) {
             $this->view->role = $roles_table->fetchRow('id = ' . $id)->toArray();
         }
         $this->view->inherited_ids = $roles_table->getInheritedRoles($id);
     } else {
         foreach ($roles_table->fetchAll()->toArray() as $role) {
             $role_choices[$role['id']] = $role['shortname'];
         }
         $this->view->role_choices = $role_choices;
     }
 }
开发者ID:jaybill,项目名称:Bolts,代码行数:80,代码来源:RoleController.php

示例3: findRolesCandidats

 function findRolesCandidats($unite, $filter_current = true)
 {
     $t = new Roles();
     $db = $t->getAdapter();
     $s = $t->select()->setIntegrityCheck(false)->from('unite_role')->join('unite_type', 'unite_type.id = unite_role.type', array())->join('unite', 'unite.type = unite_type.id', array())->where('unite.id = ?', $unite->id);
     if ($filter_current) {
         $s->joinLeft('appartenance', 'appartenance.role = unite_role.id AND ' . 'appartenance.unite = unite.id AND ' . $db->quoteInto('appartenance.individu', $this->id), array())->where('appartenance.id IS NULL');
     }
     return $t->fetchAll($s);
 }
开发者ID:bersace,项目名称:strass,代码行数:10,代码来源:Individus.php


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