本文整理汇总了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();
}
示例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;
}
示例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;
}
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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();
}
}
示例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;
}
示例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();
}
}