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


PHP UserStatus::model方法代码示例

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


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

示例1: beforeLogout

 public function beforeLogout()
 {
     $uid = $this->getId();
     Session::model()->deleteAllByAttributes(array("uid" => $uid));
     UserStatus::model()->updateByPk($uid, array("invisible" => 0));
     return true;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:7,代码来源:ICUser.php

示例2: get_user_status

 public static function get_user_status($id)
 {
     $value = UserStatus::model()->findByAttributes(array('id' => $id));
     if (empty($value->status)) {
         return 'All';
     } else {
         return $value->status;
     }
 }
开发者ID:optimosolution,项目名称:jasorbd,代码行数:9,代码来源:UserStatus.php

示例3: actionAdd

 public function actionAdd()
 {
     MainUtil::checkLicenseLimit();
     if (EnvUtil::submitCheck("userSubmit")) {
         $origPass = filter_input(INPUT_POST, "password", FILTER_SANITIZE_STRING);
         $_POST["salt"] = StringUtil::random(6);
         $_POST["password"] = !empty($origPass) ? md5(md5($origPass) . $_POST["salt"]) : "";
         $_POST["createtime"] = TIMESTAMP;
         $_POST["guid"] = StringUtil::createGuid();
         $this->dealWithSpecialParams();
         $data = User::model()->create();
         $newId = User::model()->add($data, true);
         if ($newId) {
             UserCount::model()->add(array("uid" => $newId));
             $ip = Ibos::app()->setting->get("clientip");
             UserStatus::model()->add(array("uid" => $newId, "regip" => $ip, "lastip" => $ip));
             UserProfile::model()->add(array("uid" => $newId));
             if (!empty($_POST["auxiliarydept"])) {
                 $deptIds = StringUtil::getId($_POST["auxiliarydept"]);
                 $this->handleAuxiliaryDept($newId, $deptIds, $_POST["deptid"]);
             }
             if (!empty($_POST["auxiliarypos"])) {
                 $posIds = StringUtil::getId($_POST["auxiliarypos"]);
                 $this->handleAuxiliaryPosition($newId, $posIds, $_POST["positionid"]);
             }
             $newUser = User::model()->fetchByPk($newId);
             $users = UserUtil::loadUser();
             $users[$newId] = UserUtil::wrapUserInfo($newUser);
             User::model()->makeCache($users);
             OrgUtil::update();
             OrgUtil::hookSyncUser($newId, $origPass, 1);
             $this->success(Ibos::lang("Save succeed", "message"), $this->createUrl("user/index"));
         } else {
             $this->error(Ibos::lang("Add user failed"), $this->createUrl("user/index"));
         }
     } else {
         $deptid = "";
         $manager = "";
         $account = Ibos::app()->setting->get("setting/account");
         if ($account["mixed"]) {
             $preg = "[0-9]+[A-Za-z]+|[A-Za-z]+[0-9]+";
         } else {
             $preg = "^[A-Za-z0-9\\!\\@\\#\$\\%\\^\\&\\*\\.\\~]{" . $account["minlength"] . ",32}\$";
         }
         if ($deptid = EnvUtil::getRequest("deptid")) {
             $deptid = StringUtil::wrapId(EnvUtil::getRequest("deptid"), "d");
             $manager = StringUtil::wrapId(Department::model()->fetchManagerByDeptid(EnvUtil::getRequest("deptid")), "u");
         }
         $this->setPageTitle(Ibos::lang("Add user"));
         $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Organization"), "url" => $this->createUrl("department/index")), array("name" => Ibos::lang("User manager"), "url" => $this->createUrl("user/index")), array("name" => Ibos::lang("Add user"))));
         $this->render("add", array("deptid" => $deptid, "manager" => $manager, "passwordLength" => $account["minlength"], "preg" => $preg));
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:53,代码来源:UserController.php

示例4: actionIndex

 public function actionIndex()
 {
     $status = UserStatus::model()->findByPk(Yii::app()->user->userId);
     $refreshTime = $status->refreshTime;
     $result = Plan::model()->findAllByAttributes(array('userId' => Yii::app()->user->userId));
     $primaryKeys = array();
     foreach ($result as $value) {
         array_push($primaryKeys, $value->primaryKey);
     }
     $criteria = new CDbCriteria();
     $criteria->addInCondition('planId', $primaryKeys);
     $criteria->addCondition('createTime>=' . $refreshTime);
     $inbox = PlanComment::model()->findAll($criteria);
     $count = count($inbox);
     if ($count > 0) {
         $this->send(ERROR_NONE, $inbox, false, array('count' => $count), false);
     }
     //传递一个已读未读的标志位
     if (isset($_POST['read'])) {
         $status->refreshTime = time();
         $status->save();
     }
     $this->render('index');
 }
开发者ID:tiger2soft,项目名称:travelman,代码行数:24,代码来源:MessageController.php

示例5: handleInitSession

 public function handleInitSession($event)
 {
     $global = Ibos::app()->setting->toArray();
     Ibos::app()->session->load($global["cookie"]["sid"], $global["clientip"], Ibos::app()->user->isGuest ? 0 : Ibos::app()->user->uid);
     $global["sid"] = Ibos::app()->session->sid;
     $global["session"] = Ibos::app()->session->var;
     if (!empty($global["sid"]) && $global["sid"] != $global["cookie"]["sid"]) {
         MainUtil::setCookie("sid", $global["sid"], 86400);
     }
     Ibos::app()->setting->copyFrom($global);
     $isNewSession = Ibos::app()->session->isNew;
     if ($isNewSession) {
         if (EnvUtil::ipBanned($global["clientip"])) {
             Ibos::error(Ibos::lang("User banned", "message"));
         }
     }
     if (!Ibos::app()->user->isGuest && ($isNewSession || Ibos::app()->session->getKey("lastactivity") + 600 < TIMESTAMP)) {
         Ibos::app()->session->setKey("lastactivity", TIMESTAMP);
         if ($isNewSession) {
             UserStatus::model()->updateByPk(Ibos::app()->user->uid, array("lastip" => $global["clientip"], "lastvisit" => TIMESTAMP));
         }
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:23,代码来源:InitMainModuleBehavior.php

示例6: updateSession

 public function updateSession()
 {
     static $updated = false;
     if (!$updated) {
         $global = Ibos::app()->setting->toArray();
         if (!Ibos::app()->user->isGuest) {
             if (isset($global["cookie"]["ulastactivity"])) {
                 $userLastActivity = StringUtil::authCode($global["cookie"]["ulastactivity"], "DECODE");
             } else {
                 $userLastActivity = UserUtil::getUserProfile("lastactivity");
                 MainUtil::setCookie("ulastactivity", StringUtil::authCode($userLastActivity, "ENCODE"), 31536000);
             }
         }
         $onlineTimeSpan = 10;
         $lastOnlineUpdate = $this->var["lastolupdate"];
         $onlineTimeOffset = $lastOnlineUpdate ? $lastOnlineUpdate : $userLastActivity;
         $allowUpdateOnlineTime = $onlineTimeSpan * 60 < TIMESTAMP - $onlineTimeOffset;
         if (!Ibos::app()->user->isGuest && $allowUpdateOnlineTime) {
             $updateStatus = OnlineTime::model()->updateOnlineTime(Ibos::app()->user->uid, $onlineTimeSpan, $onlineTimeSpan, TIMESTAMP);
             if ($updateStatus === false) {
                 $onlineTime = new OnlineTime();
                 $onlineTime->uid = Ibos::app()->user->uid;
                 $onlineTime->thismonth = $onlineTimeSpan;
                 $onlineTime->total = $onlineTimeSpan;
                 $onlineTime->lastupdate = $global["timestamp"];
                 $onlineTime->save();
             }
             $this->setKey("lastolupdate", TIMESTAMP);
         }
         $this->var["invisible"] = UserUtil::getUserProfile("invisible");
         foreach ($this->var as $key => $value) {
             if (Ibos::app()->user->hasState($key) && $key != "lastactivity") {
                 $this->setKey($key, Ibos::app()->user->{$key});
             }
         }
         Ibos::app()->session->update();
         if (!Ibos::app()->user->isGuest) {
             $updateStatusField = array("lastip" => $global["clientip"], "lastactivity" => TIMESTAMP, "lastvisit" => TIMESTAMP, "invisible" => 1);
             if (21600 < TIMESTAMP - $userLastActivity) {
                 if ($onlineTimeSpan && 43200 < TIMESTAMP - $userLastActivity) {
                     $onlineTime = OnlineTime::model()->fetchByPk(Ibos::app()->user->uid);
                     UserCount::model()->updateByPk(Ibos::app()->user->uid, array("oltime" => round(intval($onlineTime["total"]) / 60)));
                 }
                 MainUtil::setCookie("ulastactivity", StringUtil::authCode(TIMESTAMP, "ENCODE"), 31536000);
                 UserStatus::model()->updateByPk(Ibos::app()->user->uid, $updateStatusField);
             }
         }
         $updated = true;
     }
     return $updated;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:51,代码来源:ICSession.php

示例7: array

        <h5>Manage Admin User</h5>
        <div class="widget-toolbar">
            <a data-action="settings" href="#"><i class="icon-cog"></i></a>
            <a data-action="reload" href="#"><i class="icon-refresh"></i></a>
            <a data-action="collapse" href="#"><i class="icon-chevron-up"></i></a>
            <a data-action="close" href="#"><i class="icon-remove"></i></a>
        </div>
        <div class="widget-toolbar">
            <?php 
echo CHtml::link('<i class="icon-search"></i>', '#', array('class' => 'search-button', 'data-rel' => 'tooltip', 'title' => 'Search', 'data-placement' => 'bottom'));
?>
        </div>
        <div class="widget-toolbar">
            <?php 
echo CHtml::link('<i class="icon-plus"></i>', array('create'), array('data-rel' => 'tooltip', 'title' => 'Add', 'data-placement' => 'bottom'));
?>
        </div>
    </div><!--/.widget-header -->
    <div class="widget-body">
        <div class="widget-main">
            <div class="search-form" style="display:none">
                <?php 
$this->renderPartial('_search', array('model' => $model));
?>
            </div><!-- search-form -->
            <?php 
$this->widget('bootstrap.widgets.TbGridView', array('type' => TbHtml::GRID_TYPE_HOVER, 'id' => 'user-admin-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('name' => 'profile_picture', 'type' => 'raw', 'value' => 'CHtml::link(UserAdmin::get_picture_grid($data->id), array("view","id"=>$data->id))', 'htmlOptions' => array('style' => "text-align:left;width:50px;", 'title' => 'Picture', 'class' => 'ace-thumbnails')), array('name' => 'name', 'type' => 'raw', 'value' => 'CHtml::link(CHtml::encode($data->name), array("view","id"=>$data->id))', 'htmlOptions' => array('style' => "text-align:left;", 'title' => 'Name')), 'username', array('name' => 'email', 'type' => 'raw', 'value' => 'CHtml::mailto(CHtml::encode($data->email), $email=CHtml::encode($data->name)." <".CHtml::encode($data->email).">")', 'htmlOptions' => array('style' => "text-align:left;", 'rel' => 'tooltip', 'data-original-title' => 'Email')), array('name' => 'registerDate', 'value' => 'UserAdmin::get_date($data->registerDate)', 'filter' => $this->widget('zii.widgets.jui.CJuiDatePicker', array('model' => $model, 'attribute' => 'registerDate', 'htmlOptions' => array('id' => 'datepicker1', 'size' => '10'), 'i18nScriptFile' => 'jquery.ui.datepicker-en.js', 'defaultOptions' => array('showOn' => 'focus', 'dateFormat' => 'yy-mm-dd', 'showOtherMonths' => true, 'selectOtherMonths' => true, 'changeMonth' => true, 'changeYear' => true, 'showButtonPanel' => false)), true), 'htmlOptions' => array('style' => "text-align:center;")), array('header' => 'Group', 'name' => 'title', 'type' => 'raw', 'filter' => CHtml::activeDropDownList($model, 'group_id', CHtml::listData(UserGroup::model()->findAll(array('order' => 'id')), 'id', 'title'), array('empty' => 'All')), 'value' => '$data->UserGroup->title', 'htmlOptions' => array('style' => 'text-align:left;', 'title' => 'Group')), array('name' => 'status', 'type' => 'raw', 'filter' => CHtml::activeDropDownList($model, 'status', CHtml::listData(UserStatus::model()->findAll(array("order" => "status")), 'id', 'status'), array('empty' => 'All')), 'value' => '$data->UserStatus->status', 'htmlOptions' => array('style' => "text-align:left;", 'title' => 'Status')), array('header' => 'Actions', 'class' => 'bootstrap.widgets.TbButtonColumn'))));
?>
        </div>
    </div><!--/.widget-body -->
</div><!--/.widget-box -->
开发者ID:optimosolution,项目名称:jasorbd,代码行数:31,代码来源:admin.php

示例8: array

?>
            <?php 
echo $form->textFieldControlGroup($model, 'name', array('class' => 'span5', 'maxlength' => 255));
?>
            <?php 
echo $form->textFieldControlGroup($model, 'username', array('class' => 'span5', 'maxlength' => 150));
?>
            <?php 
echo $form->textFieldControlGroup($model, 'email', array('class' => 'span5', 'maxlength' => 100));
?>
            
            <?php 
echo $form->dropDownListControlGroup($model, 'group_id', CHtml::listData(UserGroup::model()->findAll(array("order" => "id")), 'id', 'title'), array('empty' => '--please select--', 'class' => 'span5'));
?>
            <?php 
echo $form->dropDownListControlGroup($model, 'status', CHtml::listData(UserStatus::model()->findAll(array("order" => "status")), 'id', 'status'), array('empty' => '--please select--', 'class' => 'span5'));
?>
        </div>        
        <div id="tab2" class="tab-pane">          
            <?php 
echo $form->dropDownListControlGroup($model_profile, 'country_id', CHtml::listData(Country::model()->findAll(array('condition' => 'published=1', "order" => "country_name")), 'id', 'country_name'), array('empty' => '--please select--', 'class' => 'span5', 'options' => array('18' => array('selected' => true))));
?>
            <?php 
echo $form->dropDownListControlGroup($model_profile, 'state_id', CHtml::listData(State::model()->findAll(array('condition' => 'published=1', "order" => "state_name")), 'id', 'state_name'), array('empty' => '--please select--', 'class' => 'span5', 'options' => array()));
?>
            <?php 
echo $form->dropDownListControlGroup($model_profile, 'city_id', CHtml::listData(City::model()->findAll(array('condition' => 'published=1', "order" => "city_name")), 'id', 'city_name'), array('empty' => '--please select--', 'class' => 'span5', 'options' => array()));
?>
            <?php 
echo $form->textFieldControlGroup($model_profile, 'address', array('class' => 'span5', 'maxlength' => 255));
?>
开发者ID:optimosolution,项目名称:jasorbd,代码行数:31,代码来源:_form_update.php

示例9: loadModel

 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = UserStatus::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:optimosolution,项目名称:jasorbd,代码行数:13,代码来源:UserStatusController.php

示例10: addUser

 private function addUser()
 {
     if (Ibos::app()->request->isAjaxRequest) {
         $fields = array("username", "password", "realname", "mobile", "deptid", "positionid", "email");
         if (empty($_POST["username"]) || empty($_POST["password"])) {
             $this->ajaxReturn(array("isSuccess" => false, "msg" => Ibos::lang("Username or password not empty")));
         }
         foreach ($fields as $field) {
             if (isset($_POST[$field]) && !empty($_POST[$field])) {
                 $_POST[$field] = StringUtil::filterDangerTag($_POST[$field]);
             }
         }
         $salt = StringUtil::random(6);
         $userData = array("salt" => $salt, "username" => $_POST["username"], "password" => !empty($_POST["password"]) ? md5(md5($_POST["password"]) . $salt) : "", "realname" => $_POST["realname"], "mobile" => $_POST["mobile"], "createtime" => TIMESTAMP, "deptid" => intval($_POST["deptid"]), "positionid" => intval($_POST["positionid"]), "email" => $_POST["email"]);
         $newId = User::model()->add($userData, true);
         if ($newId) {
             UserCount::model()->add(array("uid" => $newId));
             $ip = Ibos::app()->setting->get("clientip");
             UserStatus::model()->add(array("uid" => $newId, "regip" => $ip, "lastip" => $ip));
             UserProfile::model()->add(array("uid" => $newId));
             $newUser = User::model()->fetchByPk($newId);
             $users = UserUtil::loadUser();
             $users[$newId] = UserUtil::wrapUserInfo($newUser);
             User::model()->makeCache($users);
             OrgUtil::update();
             $res["isSuccess"] = true;
         } else {
             $res["isSuccess"] = false;
             $res["msg"] = Ibos::lang("Add user failed");
         }
         $this->ajaxReturn($res);
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:33,代码来源:DefaultController.php


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