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


PHP Access::save方法代码示例

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


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

示例1: save

 public function save()
 {
     $Access = new Access($this->data->Access);
     $Access->save();
     $go = '>auth/Access/formObject/' . $Access->getId();
     $this->renderPrompt('information', 'OK', $go);
 }
开发者ID:elymatos,项目名称:expressive_fnbr,代码行数:7,代码来源:AccessController.php

示例2: addAdmin

 public function addAdmin($entity)
 {
     if (\Auth::check()) {
         if (is_object($entity)) {
             $acl = new \Access();
             $acl->user_id = \Auth::user()->id;
             $acl->entity_name = get_class($entity);
             $acl->entity_id = $entity->id;
             $acl->save();
             return;
         }
     }
     return;
 }
开发者ID:CalinB,项目名称:web-directory,代码行数:14,代码来源:Acl.php

示例3: privilegeAction

 function privilegeAction()
 {
     $model = new User();
     $model->allFIelds = true;
     $id = AF::get($this->params, 'id', 0);
     if (!$id) {
         throw new AFHttpException(0, 'no_id');
     }
     if (!$model->setByID($id)) {
         throw new AFHttpException(0, 'incorrect_id');
     }
     $access = new Access();
     $access->fillFromUser($model);
     $userAccess = $access->getUserUpdateAccess();
     ksort($userAccess);
     if (isset($_POST['ajax'])) {
         $newAcces = AF::get($_POST, 'array');
         if ($newAcces) {
             $access->setUserAccess($newAcces);
             // hack to get the uesrs_access table to update instead of insert
             $msql = SafeMySQL::getInstance();
             $sql = "SELECT * FROM ?n WHERE user_id = ?i";
             $result = $msql->getRow($sql, $access->tableName(), $access->user_id);
             if (!empty($result)) {
                 $access->setIsNewRecord(0);
             }
             if ($access->save()) {
                 $model->user_id_updated = $this->user->user_id;
                 $model->updated = 'NOW():sql';
                 $model->IsNewRecord = false;
                 $model->save();
                 Message::echoJsonSuccess(__('user_access_updated'));
             } else {
                 Message::echoJsonError(__('user_access_not_updated'));
             }
         } else {
             Message::echoJsonError(__('user_access_not_updated'));
         }
     }
     Assets::js('jquery.form');
     $this->addToPageTitle('User privilege');
     $this->render('privilege', array('userAccess' => $userAccess, 'model' => $model));
 }
开发者ID:,项目名称:,代码行数:43,代码来源:

示例4: actionCreate

 public function actionCreate()
 {
     $assetsUrl = Yii::app()->getAssetManager()->publish(dirname(__FILE__) . '/../assets/');
     Yii::app()->getClientScript()->registerScriptFile($assetsUrl . '/accessForm.js');
     $model = new Access();
     if (isset($_POST['Access'])) {
         $model->setAttributes($_POST['Access']);
         if (isset($_POST['Access']['roles'])) {
             $model->roles = $_POST['Access']['roles'];
         }
         try {
             if ($model->save()) {
                 if (isset($_GET['returnUrl'])) {
                     $this->redirect($_GET['returnUrl']);
                 } else {
                     $this->redirect(array('/role/access'));
                 }
             }
         } catch (Exception $e) {
             $model->addError('', $e->getMessage());
         }
     } elseif (isset($_GET['Access'])) {
         $model->attributes = $_GET['Access'];
     }
     $model->module = isset($_GET['module']) ? $_GET['module'] : '';
     //if controller is selected from dropdown set it to model
     if (isset($_GET['controller'])) {
         $model->controller = $_GET['controller'];
     } else {
         //find the first one
         $controllers = Awecms::getControllers($model->module);
         if (count($controllers)) {
             $model->controller = reset($controllers);
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:awecode,项目名称:awecms,代码行数:37,代码来源:AccessController.php

示例5: afterSave

 public function afterSave()
 {
     parent::afterSave();
     $accessModel = new Access();
     $accessModel->user_id = $this->user_id;
     $accessModel->save();
 }
开发者ID:,项目名称:,代码行数:7,代码来源:

示例6: foreach

 $u = User::where('username', $usuario)->get();
 if (count($u) > 0) {
     if (helpers::getParam('senha', $senha)) {
         $us = User::where('username', $usuario)->where('password', md5(md5($senha)))->get();
         if (count($us) > 0) {
             foreach ($us as $r) {
                 try {
                     $keyAcesso = md5($r->username . date(DATE_ATOM));
                     $keyAcesso = $keyAcesso . md5($r->password . date(DATE_ATOM));
                     if (count($acesso = Access::where('id_user', $r->id)->get()) > 0) {
                         Access::where('id_user', $r->id)->update(['accesskey' => $keyAcesso]);
                     } else {
                         $acesso = new Access();
                         $acesso->accesskey = $keyAcesso;
                         $acesso->id_user = $r->id;
                         $acesso->save();
                     }
                     $x = User::where('users.id', $r->id)->join('accesses AS a', 'a.id_user', '=', 'users.id')->select('users.*', 'a.accesskey')->get();
                     helpers::send(false, '', $x);
                 } catch (Exception $e) {
                     helpers::send(true, 'Ocorreu um erro ao gerar a key' . $e->getMessage(), '');
                 }
             }
         } else {
             helpers::send(true, 'Senha inválida', '');
         }
     } else {
         helpers::send(true, 'Senha em branco', '');
     }
 } else {
     helpers::send(true, 'Usuário inválido', '');
开发者ID:avneto,项目名称:painelAdministrativo,代码行数:31,代码来源:UserController.php


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