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


PHP Roles::validate方法代码示例

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


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

示例1: actionCreate

 public function actionCreate()
 {
     $this->breadcrumbs = array($this->ID . ' Manager' => array('index'), 'Create' => array('create'));
     $model = new Roles();
     if (isset($_POST['Roles'])) {
         $model->attributes = $_POST['Roles'];
         if ($model->validate()) {
             $model->save();
             Yii::app()->db->createCommand('insert into authitem(name, type, description) values(:name, 2, :description)')->execute(array(':name' => $model->alias, ':description' => $model->title));
             $this->redirect(array('roles/index'));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:hson91,项目名称:posnail,代码行数:14,代码来源:RolesController.php

示例2: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new User();
     $profile = new Profile();
     $roles = new Roles();
     $this->performAjaxValidation(array($model, $profile));
     if (isset($_POST['User'])) {
         $model->attributes = $_POST['User'];
         $model->activkey = Yii::app()->controller->module->encrypting(microtime() . $model->password);
         $profile->attributes = $_POST['Profile'];
         $roles->attributes = $_POST['Roles'];
         $profile->user_id = 0;
         if ($model->validate() && $profile->validate() && $roles->validate()) {
             $model->password = Yii::app()->controller->module->encrypting($model->password);
             if ($model->save()) {
                 $profile->user_id = $model->id;
                 $profile->save();
                 $roles->save();
             }
             $this->redirect(array('view', 'id' => $model->id));
         } else {
             $profile->validate();
         }
     }
     $this->render('_form', array('model' => $model, 'profile' => $profile, 'roles' => $roles));
 }
开发者ID:blrtromax,项目名称:seobility,代码行数:30,代码来源:AdminController.php

示例3: createRole

 function createRole($aData)
 {
     $con = Propel::getConnection(RolesPeer::DATABASE_NAME);
     try {
         $con->begin();
         $sRolCode = $aData['ROL_CODE'];
         $sRolSystem = $aData['ROL_SYSTEM'];
         $status = $fields['ROL_STATUS'] = 1 ? 'ACTIVE' : 'INACTIVE';
         $oCriteria = new Criteria('rbac');
         $oCriteria->add(RolesPeer::ROL_CODE, $sRolCode);
         $oCriteria->add(RolesPeer::ROL_SYSTEM, $sRolSystem);
         $oDataset = RolesPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         $aRow = $oDataset->getRow();
         if (is_array($aRow)) {
             return $aRow;
         }
         if (!isset($aData['ROL_NAME'])) {
             $aData['ROL_NAME'] = '';
         }
         $rol_name = $aData['ROL_NAME'];
         unset($aData['ROL_NAME']);
         $obj = new Roles();
         $obj->fromArray($aData, BasePeer::TYPE_FIELDNAME);
         if ($obj->validate()) {
             $result = $obj->save();
             $con->commit();
             $obj->setRolName($rol_name);
             G::auditLog("CreateRole", "Role Name: " . $rol_name . " - Role Code: " . $aData['ROL_CODE'] . " - Role Status: " . $status);
         } else {
             $e = new Exception("Failed Validation in class " . get_class($this) . ".");
             $e->aValidationFailures = $this->getValidationFailures();
             throw $e;
         }
         return $result;
     } catch (exception $e) {
         $con->rollback();
         throw $e;
     }
 }
开发者ID:emildev35,项目名称:processmaker,代码行数:41,代码来源:Roles.php


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