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


PHP UserModule::model方法代码示例

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


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

示例1: actionSave

 public function actionSave()
 {
     $id = $_POST['id'];
     $ha = UserModule::model()->deleteAllByAttributes(array("user_level_id" => $id));
     $q = $_POST['q'];
     $arr = explode(";;", $q);
     $num = 1;
     foreach ($arr as $elem) {
         $ha = new UserModule();
         $ha->user_level_id = $id;
         $ha->module_id = $elem;
         $ha->save();
         $num++;
     }
 }
开发者ID:phpsong,项目名称:hotel-information-system,代码行数:15,代码来源:UserLevelController.php

示例2: isAda

function isAda($level, $module_id)
{
    $h = UserModule::model()->findByAttributes(array("user_level_id" => $level, "module_id" => $module_id));
    if ($h) {
        return TRUE;
    } else {
        return FALSE;
    }
}
开发者ID:phpsong,项目名称:hotel-information-system,代码行数:9,代码来源:main.php

示例3: actionView

 public function actionView()
 {
     // Check if id was submitted via GET
     if (!isset($_GET['id']) && !isset($_GET['username'])) {
         $this->_sendResponse(500, 'Error: Parameter <b>id</b> or <b>username</b> is missing');
     }
     switch ($_GET['model']) {
         // Find respective model
         case 'detailuser':
             $model['user'] = User::model()->findByPk($_GET['id']);
             $model['dealer'] = $model['user']->dealer;
             $model['modules'] = $model['user']->modules;
             $rooms = $model['user']->rooms;
             $i = 0;
             foreach ($rooms as $room) {
                 $roominfo[$i] = $room->attributes;
                 $roominfo[$i]['lights'] = $room->lights;
                 $j = 0;
                 foreach ($roominfo[$i]['lights'] as $light) {
                     $roominfo[$i]['lights'][$j] = $light->attributes;
                     $roominfo[$i]['lights'][$j]['module'] = $light->module;
                     $j++;
                 }
                 $roominfo[$i]['motors'] = $room->motors;
                 $j = 0;
                 foreach ($roominfo[$i]['motors'] as $motor) {
                     $roominfo[$i]['motors'][$j] = $motor->attributes;
                     $roominfo[$i]['motors'][$j]['module'] = $motor->module;
                     $j++;
                 }
                 $roominfo[$i]['airConditions'] = $room->airConditions;
                 $j = 0;
                 foreach ($roominfo[$i]['airConditions'] as $airCondition) {
                     $roominfo[$i]['airConditions'][$j] = $airCondition->attributes;
                     $roominfo[$i]['airConditions'][$j]['module'] = $airCondition->module;
                     $j++;
                 }
                 $roominfo[$i]['roomScenes'] = $room->roomScenes;
                 $j = 0;
                 foreach ($roominfo[$i]['roomScenes'] as $roomScene) {
                     $roominfo[$i]['roomScenes'][$j] = $roomScene->attributes;
                     $roominfo[$i]['roomScenes'][$j]['roomSceneCommands'] = $roomScene->roomSceneCommands;
                     $j++;
                 }
                 $i++;
             }
             $model['rooms'] = $roominfo;
             $model['modules'] = $model['user']->modules;
             $model['houseScenes'] = $model['user']->houseScenes;
             $i = 0;
             foreach ($model['houseScenes'] as $houseScene) {
                 $model['houseScenes'][$i] = $houseScene->attributes;
                 $model['houseScenes'][$i]['houseSceneCommands'] = $houseScene->houseSceneCommands;
                 $i++;
             }
             $model['nuvo6s'] = $model['user']->nuvo6s;
             break;
         case 'user':
             //                $user = User::model()->findByPk($_GET['id']);
             $user = User::model()->find('username=:username', array(':username' => $_GET['username']));
             if ($_GET['password'] != $user->password) {
                 $this->_sendResponse(404, 'wrong password');
             }
             $model['user'] = $user;
             $model['dealer'] = $user->dealer;
             $model['modules'] = UserModule::model()->findAll('user_id=:user_id', array(':user_id' => $user->id));
             $model['rooms'] = UserRoom::model()->findAll('user_id=:user_id', array(':user_id' => $user->id));
             $model['lights'] = UserLight::model()->findAll('user_id=:user_id', array(':user_id' => $user->id));
             $model['macros'] = UserMacro::model()->findAll('user_id=:user_id', array(':user_id' => $user->id));
             $model['motors'] = UserMotor::model()->findAll('user_id=:user_id', array(':user_id' => $user->id));
             $model['g4motors'] = UserG4Motor::model()->findAll('user_id=:user_id', array(':user_id' => $user->id));
             $model['acs'] = UserAirCondition::model()->findAll('user_id=:user_id', array(':user_id' => $user->id));
             $model['nuvo6s'] = UserNuvo6::model()->findAll('user_id=:user_id', array(':user_id' => $user->id));
             $model['security'] = UserSecurityControl::model()->findAll('user_id=:user_id', array(':user_id' => $user->id));
             $model['housescenes'] = UserHouseScene::model()->findAll('user_id=:user_id', array(':user_id' => $user->id));
             $model['roomscenes'] = UserRoomScene::model()->findAll('user_id=:user_id', array(':user_id' => $user->id));
             $model['messages'] = UserInbox::model()->findAll('user_id=:user_id AND status<:status', array(':user_id' => $user->id, ':status' => 2));
             break;
         default:
             $this->_sendResponse(501, sprintf('Mode <b>view</b> is not implemented for model <b>%s</b>', $_GET['model']));
             Yii::app()->end();
     }
     // Did we find the requested model? If not, raise an error
     if (is_null($model) || is_null($user)) {
         $this->_sendResponse(404, 'No Item found with id ' . $_GET['id']);
     } else {
         $this->_sendResponse(200, CJSON::encode($model));
     }
 }
开发者ID:raedhamam,项目名称:automation-server,代码行数:89,代码来源:ApiController.php


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