當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。