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


PHP PHPWS_DB::delete方法代码示例

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


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

示例1: execute

 public function execute(CommandContext $context)
 {
     // Check for report ID
     $reportId = $context->get('reportId');
     if (!isset($reportId) || is_null($reportId)) {
         throw new InvalidArgumentException('Missing report id.');
     }
     PHPWS_Core::initModClass('hms', 'ReportFactory.php');
     // Load the report to get its class
     try {
         $report = ReportFactory::getReportById($reportId);
     } catch (InvalidArgumentException $e) {
         NQ::simple('hms', hms\NotificationView::SUCCESS, 'Report canceled.');
         $context->goBack();
     }
     $db = new PHPWS_DB('hms_report');
     $db->addWhere('id', $reportId);
     $result = $db->delete();
     if (PHPWS_Error::logIfError($result)) {
         throw new DatabaseException($result->toString());
     }
     NQ::simple('hms', hms\NotificationView::SUCCESS, 'Report canceled.');
     $cmd = CommandFactory::getCommand('ShowReportDetail');
     $cmd->setReportClass($report->getClass());
     $cmd->redirect();
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:26,代码来源:CancelReportCommand.php

示例2: menu_unregister_key

/**
 * unregisters deleted keys from menu
 *
 * @author Matthew McNaney <mcnaney at gmail dot com>
 * @version $Id$
 */
function menu_unregister_key(Key $key)
{
    PHPWS_Core::initModClass('menu', 'Menu_Link.php');
    if (empty($key) || empty($key->id)) {
        return FALSE;
    }
    $db = new PHPWS_DB('menu_links');
    $db->addWhere('key_id', $key->id);
    $result = $db->delete();
    if (PHPWS_Error::isError($result)) {
        PHPWS_Error::log($result);
    }
    $db2 = new PHPWS_DB('menu_assoc');
    $db2->addWhere('key_id', $key->id);
    $result = $db2->delete();
    if (PHPWS_Error::isError($result)) {
        PHPWS_Error::log($result);
    }
    $db3 = new PHPWS_DB('menus');
    $db3->addWhere('assoc_key', $key->id);
    $db3->addValue('assoc_key', 0);
    $db3->addValue('assoc_url', null);
    $db3->update();
    return true;
}
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:31,代码来源:key.php

示例3: delete

 public function delete()
 {
     $db = new PHPWS_DB('analytics_tracker');
     $db->addWhere('id', $this->id);
     $result = $db->delete();
     if (PHPWS_Error::logIfError($result)) {
         return $result;
     }
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:9,代码来源:Tracker.php

示例4: search_unregister_key

/**
 * unregisters deleted keys from search
 *
 * @author Matthew McNaney <mcnaney at gmail dot com>
 * @version $Id$
 */
function search_unregister_key(Key $key)
{
    if (empty($key->id)) {
        return FALSE;
    }
    $db = new PHPWS_DB('search');
    $db->addWhere('key_id', (int) $key->id);
    return $db->delete();
}
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:15,代码来源:key.php

示例5: calendar_uninstall

/**
 * @author Matthew McNaney <mcnaney at gmail dot com>
 * @version $Id$
 */
function calendar_uninstall(&$content)
{
    PHPWS_Core::initModClass('calendar', 'Schedule.php');
    // Need functions to remove old event tables
    $db = new PHPWS_DB('calendar_schedule');
    $schedules = $db->getObjects('Calendar_Schedule');
    if (PHPWS_Error::isError($schedules)) {
        return $schedules;
    } elseif (empty($schedules)) {
        $result = PHPWS_DB::dropTable('calendar_schedule');
        if (PHPWS_Error::isError($result)) {
            return $result;
        }
        $result = PHPWS_DB::dropTable('calendar_notice');
        if (PHPWS_Error::isError($result)) {
            return $result;
        }
        $result = PHPWS_DB::dropTable('calendar_suggestions');
        if (PHPWS_Error::isError($result)) {
            return $result;
        }
        return true;
    }
    $error = false;
    foreach ($schedules as $sch) {
        $result = $sch->delete();
        if (PHPWS_Error::isError($result)) {
            PHPWS_Error::log($result);
            $error = true;
        }
    }
    $result = PHPWS_DB::dropTable('calendar_schedule');
    if (PHPWS_Error::isError($result)) {
        return $result;
    }
    $result = PHPWS_DB::dropTable('calendar_notice');
    if (PHPWS_Error::isError($result)) {
        return $result;
    }
    $result = PHPWS_DB::dropTable('calendar_suggestions');
    if (PHPWS_Error::isError($result)) {
        return $result;
    }
    if (PHPWS_DB::isTable('converted')) {
        $db2 = new PHPWS_DB('converted');
        $db2->addWhere('convert_name', array('schedule', 'calendar'));
        $db2->delete();
        $content[] = dgettext('calendar', 'Removed convert flag.');
    }
    if (!$error) {
        $content[] = dgettext('calendar', 'Calendar tables removed.');
    } else {
        $content[] = dgettext('calendar', 'Some errors occurred when uninstalling Calendar.');
    }
    return true;
}
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:60,代码来源:uninstall.php

示例6: delete

 /**
  * Deletes this item from the queue
  */
 public function delete()
 {
     $db = new PHPWS_DB('hms_banner_queue');
     $db->addWhere('id', $this->id);
     $result = $db->delete();
     if (PHPWS_Error::logIfError($result)) {
         throw new DatabaseException($result->toString());
     }
     return TRUE;
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:13,代码来源:BannerQueueItem.php

示例7: delete

 public function delete()
 {
     $db = new PHPWS_DB('hms_movein_time');
     $db->addWhere('id', $this->id);
     $result = $db->delete();
     if (!$result || PHPWS_Error::logIfError($result)) {
         return false;
     }
     return true;
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:10,代码来源:HMS_Movein_Time.php

示例8: delete

 public function delete()
 {
     $db = new PHPWS_DB('hms_roommate');
     $db->addWhere('id', $this->id);
     $result = $db->delete();
     if (PHPWS_Error::logIfError($result)) {
         throw new DatabaseException($result->toString());
     }
     $this->id = 0;
     return true;
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:11,代码来源:HMS_Roommate.php

示例9: delete

 public function delete()
 {
     $db = new PHPWS_DB('checkin_reasons');
     $db->addWhere('id', $this->id);
     $result = !PHPWS_Error::logIfError($db->delete());
     if ($result) {
         $db = new PHPWS_DB('checkin_rtos');
         $db->addWhere('reason_id', $this->id);
         return !PHPWS_Error::logIfError($db->delete());
     }
     return false;
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:12,代码来源:Reasons.php

示例10: delete

 public function delete()
 {
     $db = new PHPWS_DB('hms_summer_application');
     $db->addWhere('id', $this->id);
     $result = $db->delete();
     if (!$result || PHPWS_Error::logIfError($result)) {
         return $result;
     }
     if (!parent::delete()) {
         return false;
     }
     return TRUE;
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:13,代码来源:SummerApplication.php

示例11: delete

 /**
  * Deletes the passed in EmergencyContact from the database.
  * @param EmergencyContact $contact
  * @throws InvalidArgumentException
  * @throws Exception
  */
 public static function delete(EmergencyContact $contact)
 {
     $contactId = $contact->getId();
     if (is_null($contactId) || !isset($contactId)) {
         throw new \InvalidArgumentException('Missing contact id.');
     }
     $db = new \PHPWS_DB('intern_emergency_contact');
     $db->addWhere('id', $contactId);
     $result = $db->delete();
     if (\PHPWS_Error::logIfError($result)) {
         throw new \Exception($result->toString());
     }
     return true;
 }
开发者ID:jlbooker,项目名称:InternshipInventory,代码行数:20,代码来源:EmergencyContactFactory.php

示例12: rss_unregister

/**
 * @author Matthew McNaney <mcnaney at gmail dot com>
 * @version $Id$
 */
function rss_unregister($module, &$content)
{
    $db = new PHPWS_DB('rssfeeds');
    $db->addWhere('module', $module);
    $result = $db->delete();
    if (PHPWS_Error::isError($result)) {
        PHPWS_Error::log($result);
        $content[] = dgettext('rss', 'An error occurred trying to unregister this module from RSSFeeds.');
        return FALSE;
    } else {
        $content[] = dgettext('rss', 'Module unregistered from RSSFeeds.');
        return TRUE;
    }
}
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:18,代码来源:unregister.php

示例13: purgeProperties

function purgeProperties()
{
    $last_purge = \PHPWS_Settings::get('properties', 'last_purge') + 86400;
    $current_time = time();
    if ($last_purge < $current_time) {
        \PHPWS_Settings::set('properties', 'last_purge', $current_time);
        \PHPWS_Settings::save('properties');
        $db = new PHPWS_DB('properties');
        $db->addWhere('timeout', time(), '<');
        $db->addValue('active', 0);
        $db->update();
        $db = new PHPWS_DB('prop_roommate');
        $db->addWhere('timeout', time(), '<');
        $db->delete();
    }
}
开发者ID:par-orillonsoft,项目名称:phpwebsite,代码行数:16,代码来源:runtime.php

示例14: delete

 public function delete()
 {
     if (!Current_User::allow('hms', 'remove_rlc_members')) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         throw new PermissionException('You do not have permission to remove RLC members.');
     }
     if (!isset($this->id)) {
         return FALSE;
     }
     $db = new PHPWS_DB('hms_learning_community_assignment');
     $db->addWhere('id', $this->id);
     $result = $db->delete();
     if (PHPWS_Error::logIfError($result)) {
         return FALSE;
     }
     $this->id = 0;
     return TRUE;
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:18,代码来源:HMS_RLC_Assignment.php

示例15: queueRemoveAssignment

 /**
  * Queues a Remove Assignment
  *
  * NOTE: If the queue contains a Create Assignment for the same
  * user to the same room, this will NOT queue a room assignment,
  * but rather will delete the original assignment, UNLESS the
  * $force_queue flag is set.  The $force_queue flag being true will
  * queue a removal no matter what.
  *
  * MORE NOTE: If this requires immediate processing because banner
  * commits are enabled, the it will be sent straight to Banner,
  * and so the force_queue flag will be ignored.
  */
 public static function queueRemoveAssignment(Student $student, $term, HMS_Residence_Hall $hall, HMS_Bed $bed, $refund)
 {
     $entry = new BannerQueueItem(0, BANNER_QUEUE_REMOVAL, $student, $term, $hall, $bed, null, null, $refund);
     if (BannerQueue::processImmediately($term)) {
         return $entry->process();
     }
     // Otherwise, look for an corresponding assignment
     $db = new PHPWS_DB('hms_banner_queue');
     $db->addWhere('type', BANNER_QUEUE_ASSIGNMENT);
     $db->addWhere('asu_username', $student->getUsername());
     $db->addWhere('building_code', $hall->getBannerBuildingCode());
     $db->addWhere('bed_code', $bed->getBannerId());
     $db->addWhere('term', $term);
     $result = $db->count();
     if (PHPWS_Error::logIfError($result)) {
         throw new DatabaseException($result->toString());
     }
     if ($result == 0) {
         return $entry->save();
     } else {
         return $db->delete();
     }
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:36,代码来源:BannerQueue.php


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