本文整理汇总了PHP中role::save方法的典型用法代码示例。如果您正苦于以下问题:PHP role::save方法的具体用法?PHP role::save怎么用?PHP role::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类role
的用法示例。
在下文中一共展示了role::save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
function edit($id = 0)
{
$role = new role($id);
if ($_SERVER['REQUEST_METHOD'] == "GET") {
} else {
$role->name_vietnamese = $this->input->post('name_vietnamese');
$role->name_english = $this->input->post('name_english');
$role->fieldname = $this->input->post('fieldname');
if ($role->save()) {
redirect($this->admin . 'roles/list_all/');
}
}
$dis['base_url'] = base_url();
$dis['title'] = "Menu";
$dis['menu_active'] = "Role";
$dis['view'] = "role/edit";
$dis['object'] = $role;
$this->viewadmin($dis);
}
示例2: role
if ($_POST['roles_name'] == '') {
$_POST['action'] = 'enter_data';
$error_level = 1;
// No roles_name
} else {
if ($_POST['categories_id'] == '') {
$_POST['action'] = 'enter_data';
$error_level = 2;
// No categories_id
} else {
/******************************/
/*** OK, entry can be saved ***/
/******************************/
$administration_role = new role($_POST['roles_id']);
$administration_role->fill($_POST['roles_name'], $_POST['roles_description'], $_POST['roles_mandatory_ticket_entry'], $_POST['projects_id'], $_POST['categories_id']);
$administration_role->save();
// Clear all values except mPath and projects_id
foreach ($_POST as $key => $value) {
if ($key != 'mPath' && $key != 'projects_id') {
unset($_POST[$key]);
}
}
}
}
break;
case 'delete_entry':
// Check for dependencies
$administration_role = new role($_POST['roles_id']);
if ($administration_role->has_dependencies()) {
$error_level = 3;
// Related employee-role(s) exist