本文整理汇总了PHP中source\LuLu::getPostValue方法的典型用法代码示例。如果您正苦于以下问题:PHP LuLu::getPostValue方法的具体用法?PHP LuLu::getPostValue怎么用?PHP LuLu::getPostValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类source\LuLu
的用法示例。
在下文中一共展示了LuLu::getPostValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndex
/**
* Lists all Relation models.
* @return mixed
*/
public function actionIndex($role)
{
if (\Yii::$app->request->isPost) {
$selectedPermissions = LuLu::getPostValue('Permission');
Relation::AddBatchItems($role, $selectedPermissions);
return $this->redirect(['index', 'role' => $role]);
}
$allPermissions = Permission::getAllPermissionsGroupedByCategory();
$rolePermissions = Relation::find()->select(['permission', 'value'])->where(['role' => $role])->indexBy('permission')->all();
$categories = Permission::getCategoryItems();
$role = Role::findOne(['id' => $role]);
return $this->render('index', ['rolePermissions' => $rolePermissions, 'allPermissions' => $allPermissions, 'categories' => $categories, 'role' => $role]);
}
示例2: actionRole
public function actionRole($user)
{
$userRoles = Assignment::find()->select('role')->where(['user' => $user])->indexBy('role')->all();
if (\Yii::$app->request->isPost) {
$selectedRoles = LuLu::getPostValue('roles', []);
Assignment::deleteAll(['and', 'user=\'' . $user . '\'', ['not in', 'role', $selectedRoles]]);
foreach ($selectedRoles as $selectedRole) {
if ($userRoles != null && isset($userRoles[$selectedRole])) {
continue;
}
$newAssignment = new Assignment();
$newAssignment->user = $user;
$newAssignment->role = $selectedRole;
$newAssignment->save();
}
return $this->redirect(['role', 'user' => $user]);
}
$allRoles = Role::findAll();
return $this->render('role', ['userRoles' => $userRoles, 'allRoles' => $allRoles]);
}
示例3: actionIndex
/**
* Lists all Relation models.
* @return mixed
*/
public function actionIndex($role)
{
$rolePermissions = Relation::find()->select(['permission', 'value'])->where(['role' => $role])->indexBy('permission')->all();
if (\Yii::$app->request->isPost) {
var_dump(LuLu::getPostValue('Permission'));
$selectedPermissions = LuLu::getPostValue('Permission');
$keys = array_keys($selectedPermissions);
Relation::deleteAll(['role' => $role]);
foreach ($selectedPermissions as $key => $value) {
$newRelation = new Relation();
$newRelation->role = $role;
$newRelation->permission = $key;
$newRelation->value = is_string($value) ? $value : implode(',', $value);
$newRelation->save();
}
return $this->redirect(['index', 'role' => $role]);
}
$allPermissions = Permission::findAll();
return $this->render('index', ['rolePermissions' => $rolePermissions, 'allPermissions' => $allPermissions]);
}
示例4: insertAdmin
private function insertAdmin($db)
{
$username = LuLu::getPostValue('username');
$password = LuLu::getPostValue('password');
$email = LuLu::getPostValue('email');
$tbPre = $db->tablePrefix;
$user = new \source\models\User();
$user->scenario = 'create';
$user->username = $username;
$user->password = $password;
$user->email = $email;
$user->role = 'administrator';
$user->status = Constants::Status_Enable;
$user->save();
//$db->createCommand("INSERT INTO `" . $tbPre . "user`(`username`, `password`,`group_id`, `email`,`create_time`) VALUES('" . $username . "','" . md5($password) . "','1','" . $email . "', " . time() . ");")->execute();
}