本文整理汇总了PHP中PHPWS_DB::addValue方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPWS_DB::addValue方法的具体用法?PHP PHPWS_DB::addValue怎么用?PHP PHPWS_DB::addValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPWS_DB
的用法示例。
在下文中一共展示了PHPWS_DB::addValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: save
public function save()
{
$result = parent::save();
if (PHPWS_Error::isError($result)) {
return $result;
}
$db = new PHPWS_DB('analytics_tracker_piwik');
$db->addWhere('id', $this->id);
$result = $db->select();
if (PHPWS_Error::logIfError($result)) {
return $result;
}
$db = new PHPWS_DB('analytics_tracker_piwik');
$db->addValue('id', $this->id);
$db->addValue('piwik_url', $this->piwik_url);
$db->addValue('piwik_id', $this->piwik_id);
if (count($result) < 1) {
$result = $db->insert(false);
} else {
$result = $db->update();
}
if (PHPWS_Error::logIfError($result)) {
return $result;
}
}
示例3: layout_install
/**
* @author Matthew McNaney <mcnaney at gmail dot com>
* @version $Id$
*/
function layout_install(&$content, $branchInstall = FALSE)
{
$page_title = 'Change this Site Name in Layout Meta Tags';
$default_theme = 'bootstrap';
if (!isset($error)) {
$db = new PHPWS_DB('layout_config');
$db->addValue('default_theme', $default_theme);
$db->addValue('page_title', $page_title);
$db->update();
$content[] = dgettext('layout', 'Layout settings updated.');
return true;
} else {
return $error;
}
}
示例4: saveObject
public static function saveObject(DbStorable $o)
{
$vars = $o->extractVars();
$tableName = $o::getTableName();
// Check if the key already exists
$query = "SELECT * FROM {$tableName} WHERE id = {$vars['id']}";
$result = \PHPWS_DB::getAll($query);
if (count($result) > 0) {
$exists = true;
} else {
$exists = false;
}
$db = new \PHPWS_DB($o->getTableName());
foreach ($vars as $key => $value) {
$db->addValue($key, $value);
}
if ($exists) {
$db->addWhere('id', $vars['id']);
$result = $db->update();
} else {
$result = $db->insert(false);
}
if (\PHPWS_Error::logIfError($result)) {
throw new \Exception($result->toString());
}
}
示例5: save
/**
* Saves the current activity log object to the db.
* Returns TRUE upon succes or a PEAR error object otherwise.
*/
public function save()
{
if ($this->id != 0) {
return FALSE;
}
$db = new PHPWS_DB('hms_activity_log');
$db->addValue('user_id', $this->get_user_id());
$db->addValue('timestamp', $this->get_timestamp());
$db->addValue('activity', $this->get_activity());
$db->addValue('actor', $this->get_actor());
$db->addValue('notes', $this->get_notes());
$result = $db->insert();
if (PHPWS_Error::logIfError($result)) {
throw new DatabaseException($result->toString());
} else {
return TRUE;
}
}
示例6: filecabinet_unregister
/**
* @version $Id$
* @author Matthew McNaney <mcnaney at gmail dot com>
*/
function filecabinet_unregister($module, &$content)
{
$db = new PHPWS_DB('folders');
$db->addValue('module_created', null);
$db->addWhere('module_created', $module);
PHPWS_Error::logIfError($db->update());
$content[] = dgettext('filecabinet', 'Unregistered from File Cabinet.');
return true;
}
示例7: save
public function save()
{
$result = parent::save();
if (PHPWS_Error::isError($result)) {
return $result;
}
$db = new PHPWS_DB('analytics_tracker_owa');
$db->addWhere('id', $this->id);
$result = $db->select();
if (PHPWS_Error::logIfError($result)) {
return $result;
}
$db = new PHPWS_DB('analytics_tracker_owa');
$db->addValue('id', $this->id);
$db->addValue('owa_url', $this->owa_url);
$db->addValue('owa_site_id', $this->owa_site_id);
$db->addValue('owa_track_page_view', $this->owa_track_page_view);
$db->addValue('owa_track_clicks', $this->owa_track_clicks);
$db->addValue('owa_track_domstream', $this->owa_track_domstream);
if (count($result) < 1) {
$result = $db->insert(false);
} else {
$result = $db->update();
}
if (PHPWS_Error::logIfError($result)) {
return $result;
}
}
示例8: addUser
public function addUser($username, $classname, $instance = null)
{
$db = new PHPWS_DB('users');
$db->addWhere('username', $username);
$result = $db->select('row');
if (PHPWS_Error::logIfError($result)) {
throw new DatabaseException($result->toString());
}
if (is_null($result['id'])) {
throw new InvalidArgumentException('User name "' . $username . '" does not exist.');
}
$user_id = $result['id'];
$db = new PHPWS_DB('hms_user_role');
$db->addValue('user_id', $user_id);
$db->addValue('role', $this->id);
$db->addValue('class', strtolower($classname));
$db->addValue('instance', $instance);
$result = $db->insert();
if (PHPWS_Error::logIfError($result)) {
throw new DatabaseException($result->toString());
}
return true;
}
示例9: 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();
}
}
示例10: fixDocumentDirectories
public function fixDocumentDirectories()
{
$directory = PHPWS_Settings::get('filecabinet', 'base_doc_directory');
$db = new PHPWS_DB('documents');
$db->addColumn('id');
$db->addColumn('file_directory');
$result = $db->select();
if (empty($result) || PHPWS_Error::logIfError($result)) {
return;
}
foreach ($result as $doc) {
$db->reset();
$db->addWhere('id', $doc['id']);
$old_dir = $doc['file_directory'];
$old_dir_array = explode('/', $old_dir);
// space usually at end of array, but just in case
$last_dir = array_pop($old_dir_array);
if (empty($last_dir)) {
$last_dir = array_pop($old_dir_array);
}
$new_dir = $directory . $last_dir . '/';
if (!empty($last_dir)) {
$db->addWhere('id', $doc['id']);
$db->addValue('file_directory', $new_dir);
PHPWS_Error::logIfError($db->update());
}
}
}
示例11: createLocalAuthScript
function createLocalAuthScript()
{
/*
if (PHPWS_Settings::get('users', 'local_script')) {
return true;
}
*
*/
$db = new PHPWS_DB('users_auth_scripts');
$db->addValue('display_name', dgettext('users', 'Local'));
$db->addValue('filename', 'local.php');
$authorize_id = $db->insert();
if (PHPWS_Error::logIfError($authorize_id)) {
return false;
}
PHPWS_Settings::set('users', 'default_authorization', $authorize_id);
PHPWS_Settings::set('users', 'local_script', $authorize_id);
PHPWS_Settings::save('users');
return true;
}
示例12: lottery_reserve
public function lottery_reserve($username, $requestor, $timestamp)
{
if ($this->is_lottery_reserved()) {
return FALSE;
}
$db = new PHPWS_DB('hms_lottery_reservation');
$db->addValue('asu_username', $username);
$db->addValue('requestor', $requestor);
$db->addValue('term', $this->term);
$db->addValue('bed_id', $this->id);
$db->addValue('expires_on', $timestamp);
$result = $db->insert();
if (PHPWS_Error::logIfError($result)) {
throw new DatabaseException($result->toString());
} else {
return TRUE;
}
}
示例13: calendar_update
//.........这里部分代码省略.........
+ Fixed call to absent function in Event.php</pre>';
case version_compare($version, '1.6.2', '<'):
$content[] = '<pre>';
calendarUpdateFiles(array('conf/config.php', 'javascript/check_date/head.js'), $content);
$content[] = '1.6.2 changes
-------------
+ Added a upcoming date format
+ Fixed: Day view doesn\'t allow you to add an event until you create a schedule.
+ Deleting the default public calendar resets the selection.
+ Fixed: Bug #1879356 - Events spanning multiple days do not autocorrect time.
</pre>';
case version_compare($version, '1.6.3', '<'):
$content[] = '<pre>1.6.3 changes
-------------
+ Added missing repeatYearly function.</pre>';
case version_compare($version, '1.6.4', '<'):
$content[] = '<pre>';
calendarUpdateFiles(array('templates/admin/schedules.tpl'), $content);
$content[] = '1.6.4 changes
-------------
+ Added missing pager navigation tags to schedule listing.</pre>';
case version_compare($version, '1.7.0', '<'):
$db = new PHPWS_DB('calendar_schedule');
$db->addColumn('id');
$schedules = $db->select('col');
if (!empty($schedules)) {
foreach ($schedules as $id) {
$event_db = new PHPWS_DB('calendar_event_' . $id);
$event_db->addColumn('key_id');
$keys = $event_db->select('col');
if (!empty($keys)) {
$key_db = new PHPWS_DB('phpws_key');
$key_db->addWhere('id', $keys);
$key_db->addValue('item_name', 'event' . $id);
PHPWS_Error::logIfError($key_db->update());
}
}
}
$content[] = '<pre>';
$files = array('img/', 'templates/admin/schedules.tpl', 'templates/view/month/grid.tpl', 'templates/view/month/list.tpl', 'templates/view/day.tpl', 'templates/view/event.tpl', 'templates/view/week.tpl', 'templates/ical.tpl', 'templates/style.css', 'templates/upload.tpl', 'templates/admin/settings.tpl');
calendarUpdateFiles($files, $content);
$content[] = '1.7.0 changes
-------------
+ Added ability to hide the mini grid calendar.
+ Increased edit event popup default size.
+ Moved some frequent functions closer to top of switch
+ Added ability to upload and download events using iCal format
+ Fixed: Calendar was saving all events from all schedules using the same item name.
+ Deleting a schedule will remove event keys as well.
+ Deleting an event clears the cache to prevent ghosts in grid view.
+ If a non existing event is accessed, calendar forwards to day view instead of 404.
+ Added check that removes the default public calendar if it is
changed to private.
+ Fixed events showing on multiple schedules.
+ php 5 formatted.
</pre>';
case version_compare($version, '1.7.1', '<'):
$content[] = '<pre>';
$files = array('templates/admin/settings.tpl');
calendarUpdateFiles($files, $content);
$content[] = '1.7.1 changes
------------------
+ Added option to enable rel="nofollow" on date links</pre>';
case version_compare($version, '1.7.2', '<'):
$content[] = '<pre>1.7.2 changes
------------------
示例14: saveDependencies
public function saveDependencies()
{
if (!$this->_dependency) {
return true;
}
$db = new PHPWS_DB('dependencies');
$db->addWhere('source_mod', $this->title);
$db->delete();
$db->reset();
$dep_list = $this->getDependencies();
if (empty($dep_list)) {
return null;
}
foreach ($dep_list['MODULE'] as $stats) {
$db->addValue('source_mod', $this->title);
$db->addValue('depended_on', $stats['TITLE']);
$db->addValue('version', $stats['VERSION']);
$result = $db->insert();
if (PHPWS_Error::isError($result)) {
return $result;
}
}
}
示例15: checkin_update
/**
* @version $Id$
* @author Matthew McNaney <mcnaney at gmail dot com>
*/
function checkin_update(&$content, $current_version)
{
switch (1) {
case version_compare($current_version, '1.0.1', '<'):
$content[] = '<pre>';
$db = new PHPWS_DB('checkin_staff');
if (PHPWS_Error::logIfError($db->addTableColumn('view_order', 'smallint not null default 0'))) {
$content[] = 'Unable to create checkin_staff.view_order column.</pre>';
return false;
} else {
$content[] = 'Created checkin_staff.view_order column.';
}
$db->addColumn('id');
$staff_list = $db->select('col');
if (!empty($staff_list)) {
$count = 1;
foreach ($staff_list as $staff_id) {
$db->reset();
$db->addWhere('id', $staff_id);
$db->addValue('view_order', $count);
PHPWS_Error::logIfError($db->update());
$count++;
}
}
checkinUpdateFiles(array('templates/visitors.tpl', 'templates/waiting.tpl', 'templates/queue.tpl', 'templates/settings.tpl'), $content);
$content[] = '1.0.1 changes
------------------
+ Fixed bug with pulling current staff member
+ Added refresh link to waiting and assignment page
+ Fixed report
</pre>';
case version_compare($current_version, '1.0.2', '<'):
$content[] = '<pre>';
checkinUpdateFiles(array('templates/visitors.tpl', 'templates/waiting.tpl', 'templates/style.css'), $content);
$content[] = '1.0.2 changes
--------------------
+ Fixed translation typo.
+ Added "Send back" condition</pre>';
case version_compare($current_version, '1.0.3', '<'):
$content[] = '<pre>';
checkinUpdateFiles(array('templates/report.tpl'), $content);
$content[] = '1.0.3 changes
--------------------
+ Removed error message from report if no reasons created
+ Added the time of arrival to the report
+ Changed report date entry interface
+ Upper cased names.
</pre>';
case version_compare($current_version, '1.0.4', '<'):
$content[] = '<pre>1.0.4 changes
---------------------
+ Fixed waiting time setting</pre>';
case version_compare($current_version, '1.1.0', '<'):
$content[] = '<pre>1.1.0 changes
---------------------
+ Added code to prevent refreshed duplicates
+ Fixed possible error in admin view
+ Added monthly and student reports
+ Added report for number of times a visitor has visited within 30 days.
+ PHP 5 Strict changes</pre>';
case version_compare($current_version, '1.1.1', '<'):
$content[] = '<pre>1.1.1 changes
---------------------
+ Reports limited to admins</pre>';
case version_compare($current_version, '1.2', '<'):
$db = new PHPWS_DB('checkin_staff');
$db->addTableColumn('active', 'smallint not null default 1');
$content[] = '<pre>1.2 changes
--------------
+ Fixed blue button on admin menu
+ Staff can now be deactivated so they appear on reports but do not receive visitors</pre>';
case version_compare($current_version, '1.3', '<'):
$db = new PHPWS_DB('checkin_visitor');
$db->addTableColumn('email', 'varchar(255) NULL');
$content[] = '<pre>1.3 changes
---------------
+ Option to collect visitor email addresses.</pre>';
case version_compare($current_version, '1.4.0', '<'):
$content[] = '<pre>1.4.0 changes
---------------
+ May now report by visitor name.</pre>';
case version_compare($current_version, '1.5.0', '<'):
$content[] = '<pre>';
// Make changes to checkin_visitor table
$db = new PHPWS_DB('checkin_visitor');
if (PHPWS_Error::logIfError($db->addTableColumn('gender', 'varchar(20) default NULL'))) {
$content[] = 'Unable to create checkin_visitor.gender column.</pre>';
return false;
} else {
$content[] = 'Created checkin_visitor.gender column.';
}
if (PHPWS_Error::logIfError($db->addTableColumn('birthdate', 'varchar(20) default NULL'))) {
$content[] = 'Unable to create checkin_visitor.birthdate column.</pre>';
return false;
} else {
$content[] = 'Created checkin_visitor.birthdate column.';
//.........这里部分代码省略.........