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


PHP PHPWS_DB::resetValues方法代码示例

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


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

示例1: save

 public function save($item_id, $table, $total_backups = 5)
 {
     if (!PHPWS_DB::isTable($table)) {
         return FALSE;
     }
     $backupTable = Backup::getBackupTable($table);
     if (PHPWS_Error::isError($backupTable)) {
         return $backupTable;
     }
     $db = new PHPWS_DB($table);
     $db->addWhere('id', $item_id);
     $source_row = $db->select('row');
     $db2 = new PHPWS_DB($backupTable);
     $db2->addWhere('backup_id', $source_row['id']);
     $db2->addOrder('backup_order');
     $past_rows = $db2->select();
     $past_row_count = count($past_rows);
     if (empty($past_rows) || $past_row_count < $total_backups) {
         $db2->reset();
         $source_row['backup_id'] = $source_row['id'];
         unset($source_row['id']);
         $source_row['backup_order'] = $past_row_count + 1;
         $db2->addValue($source_row);
         $result = $db2->insert();
     } else {
         $db2->delete();
         $db2->reset();
         unset($past_rows[0]);
         $source_row['backup_id'] = $source_row['id'];
         unset($source_row['id']);
         $past_rows[] = $source_row;
         foreach ($past_rows as $key => $row) {
             $row['backup_order'] = $key;
             $db2->addValue($row);
             $db2->insert();
             $db2->resetValues();
         }
     }
 }
开发者ID:par-orillonsoft,项目名称:phpwebsite,代码行数:39,代码来源:Backup.php

示例2: savePermissions

 public function savePermissions()
 {
     if (!$this->id) {
         return false;
     }
     $db = new PHPWS_DB('phpws_key');
     $db->addValue('restricted', $this->restricted);
     if (PHPWS_Error::logIfError($db->saveObject($this))) {
         return false;
     }
     $view_db = new PHPWS_DB('phpws_key_view');
     $view_db->addWhere('key_id', $this->id);
     $result = $view_db->delete();
     if (PHPWS_Error::isError($result)) {
         return $result;
     }
     $edit_db = new PHPWS_DB('phpws_key_edit');
     $edit_db->addWhere('key_id', $this->id);
     $result = $edit_db->delete();
     if (PHPWS_Error::isError($result)) {
         return $result;
     }
     // we don't care if restricted is 0 because everyone can view
     // we don't care if it is KEY_LOGGED_RESTRICTED either because
     // just checking log status covers it
     if ($this->restricted == KEY_GROUP_RESTRICTED) {
         if (!empty($this->_view_groups) && is_array($this->_view_groups)) {
             $view_db->reset();
             $this->_view_groups = array_unique($this->_view_groups);
             foreach ($this->_view_groups as $group_id) {
                 $view_db->resetValues();
                 $view_db->addValue('key_id', $this->id);
                 $view_db->addValue('group_id', $group_id);
                 PHPWS_Error::logIfError($view_db->insert());
             }
         }
     }
     if (!empty($this->_edit_groups) && is_array($this->_edit_groups)) {
         $edit_db->reset();
         $this->_edit_groups = array_unique($this->_edit_groups);
         foreach ($this->_edit_groups as $group_id) {
             $edit_db->resetValues();
             $edit_db->addValue('key_id', $this->id);
             $edit_db->addValue('group_id', $group_id);
             PHPWS_Error::logIfError($edit_db->insert());
         }
     }
     return true;
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:49,代码来源:Key.php

示例3: save

 public function save()
 {
     $db = new PHPWS_DB('users_groups');
     $result = $db->saveObject($this);
     $members = $this->getMembers();
     if (isset($members)) {
         $this->dropAllMembers();
         $db = new PHPWS_DB('users_members');
         foreach ($members as $member) {
             $db->addValue('group_id', $this->getId());
             $db->addValue('member_id', $member);
             PHPWS_Error::logIfError($db->insert());
             $db->resetValues();
         }
     }
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:16,代码来源:Group.php


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