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


PHP Permission::update方法代码示例

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


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

示例1: Permission

<?php

include $_SERVER['DOCUMENT_ROOT'] . '/ControlBalneario/Models/Permission.php';
if ($_GET['action'] == "getAll") {
    $p = new Permission();
    $all = $p->getAll_json();
    print_r($all);
} else {
    if ($_GET['action'] == "update") {
        $p = new Permission();
        $p->create(json_decode($_GET['data'], true));
        $p->update();
        print "success";
    } else {
        if ($_GET['action'] == "save") {
        }
    }
}
开发者ID:lasplamas,项目名称:Sitio,代码行数:18,代码来源:PermissionWS.php

示例2: update

 public function update()
 {
     $db = DB::Instance();
     $db->StartTrans();
     $new_position = $this->_data['position'];
     // load sibling permissions
     $permissions = new PermissionCollection(new Permission());
     $sh = new SearchHandler($permissions, FALSE);
     // build the query based on whether a parent_id is available
     if (isset($this->_data['parent_id']) && !empty($this->_data['parent_id'])) {
         $sh->addConstraint(new Constraint('parent_id', '=', $this->_data['parent_id']));
     } else {
         $this->_data['parent_id'] = 'null';
         $sh->addConstraint(new Constraint('parent_id', 'IS', 'NULL'));
     }
     // finally, always ignore the current permission
     $sh->addConstraint(new Constraint('id', '!=', $this->_data['permission_id']));
     $permissions->load($sh);
     //***********************************
     // CHECK + UPDATE SIBLING PERMISSIONS
     $count = 0;
     $position_errors = FALSE;
     foreach ($permissions as $model) {
         // normal increment
         $count++;
         if ($new_position == $count) {
             // we've come across our new item
             // increment again, so we make a gap for the new permission
             $count++;
         }
         // there's no point in updating the record if it's already in the correct position
         if ($model->position != $count) {
             if (!$model->update($model->id, array('position'), array($count))) {
                 $position_errors = TRUE;
                 continue;
             }
         }
     }
     // no point in proceeding is we've got errors
     if ($position_errors === TRUE) {
         $db->FailTrans();
         $db->CompleteTrans();
         echo json_encode(array('success' => FALSE, 'errors' => '<li>Error updating sibling positions</li>'));
         exit;
     }
     $permission = new Permission();
     // update the current permission position
     if (!$permission->update($this->_data['permission_id'], array('position', 'parent_id'), array($new_position, $this->_data['parent_id']))) {
         $db->FailTrans();
         $db->CompleteTrans();
         echo json_encode(array('success' => FALSE, 'errors' => '<li>Error updating desired position</li>'));
         exit;
     }
     // must have been successful
     $db->CompleteTrans();
     echo json_encode(array('success' => TRUE));
     exit;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:58,代码来源:PermissionsController.php

示例3: Permission

<?php

session_start();
include_once "../php/Permission.php";
if (isset($_POST['save'])) {
    $permission = new Permission();
    $permission->lockSerial($_POST['lock']);
    $permission->recipientIdentification($_POST['recipient']);
    $permission->startDateHour($_POST['startDateHour']);
    $permission->endDateHour($_POST['endDateHour']);
    echo "tt";
    $permission->insert();
} elseif (isset($_POST['update'])) {
    $permission = new Permission();
    $permission->lockSerial($_POST['lock']);
    $permission->recipientIdentification($_POST['recipient']);
    $permission->startDateHour($_POST['startDateHour']);
    $permission->endDateHour($_POST['endDateHour']);
    $permission->update();
} elseif (isset($_POST['delete'])) {
    Permission::delete($_POST['lock'], $_POST['recipient']);
}
header("location: showPermissions.php");
开发者ID:smartlockmed,项目名称:smartlock,代码行数:23,代码来源:managePermissions.php


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