本文整理汇总了PHP中w2p_Database_Query类的典型用法代码示例。如果您正苦于以下问题:PHP w2p_Database_Query类的具体用法?PHP w2p_Database_Query怎么用?PHP w2p_Database_Query使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了w2p_Database_Query类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: deleteByObject
public function deleteByObject($object_id)
{
$q = new w2p_Database_Query();
$q->setDelete('custom_fields_values');
$q->addWhere('value_object_id=' . (int) $object_id);
$q->exec();
}
开发者ID:illuminate3,项目名称:web2project,代码行数:7,代码来源:CustomField.class.php
示例2: delete
public function delete()
{
$q = new w2p_Database_Query();
$q->setDelete('custom_fields_lists');
$q->addWhere('field_id = ' . (int) $this->field_id);
$q->addWhere('list_option_id = ' . (int) $this->list_option_id);
return $q->exec();
}
开发者ID:illuminate3,项目名称:web2project,代码行数:8,代码来源:CustomOptionList.class.php
示例3: loadFull
public function loadFull(CAppUI $AppUI, $holidayId)
{
$q = new w2p_Database_Query();
$q->addTable('holiday');
$q->addQuery('holiday.*');
$q->addWhere('holiday.holiday_id = ' . (int) $holidayId);
$q->loadObject($this, true, false);
}
开发者ID:Raithlin,项目名称:web2project-holiday,代码行数:8,代码来源:holiday.class.php
示例4: getStructure
public function getStructure($moduleName)
{
$q = new w2p_Database_Query();
$q->addTable('custom_fields_struct');
$q->addWhere("field_module = '{$moduleName}'");
$q->addOrder('field_order ASC');
return $q->loadList();
}
开发者ID:viniciusbudines,项目名称:sisnuss,代码行数:8,代码来源:CustomFieldManager.class.php
示例5: remove
public function remove(CAppUI $AppUI = null)
{
global $AppUI;
$q = new w2p_Database_Query();
$q->dropTable('history');
$q->exec();
$perms = $AppUI->acl();
return $perms->unregisterModule('history');
}
开发者ID:eureka2,项目名称:web2project,代码行数:9,代码来源:setup.php
示例6: bind
public function bind($hash)
{
if (!is_array($hash)) {
return get_class($this) . "::bind failed";
} else {
$q = new w2p_Database_Query();
$q->bindHashToObject($hash, $this);
$q->clear();
return null;
}
}
开发者ID:,项目名称:,代码行数:11,代码来源:
示例7: store
/**
* @todo refactor
*/
public function store()
{
$q = $this->_getQuery();
if ($msg = $this->delete()) {
return 'CPreference::store-delete failed ' . $msg;
}
$q = new w2p_Database_Query();
if (!$q->insertObject('user_preferences', $this)) {
return 'CPreference::store failed ' . db_error();
} else {
return null;
}
}
开发者ID:illuminate3,项目名称:web2project,代码行数:16,代码来源:Preferences.class.php
示例8: _fetchPreviousData
public function _fetchPreviousData()
{
$q = new w2p_Database_Query();
$q->addTable($this->table_name);
$q->addQuery($this->field_name);
$q->addWhere($this->id_field_name . ' = ' . $this->row_id);
$previous_data = $q->loadResult();
if ($previous_data != '') {
$previous_data = unserialize($previous_data);
$previous_data = !is_array($previous_data) ? array() : $previous_data;
} else {
$previous_data = array();
}
$this->previous_data = $previous_data;
}
开发者ID:illuminate3,项目名称:web2project,代码行数:15,代码来源:CustomFieldsParser.class.php
示例9: upgrade
public function upgrade($old_version)
{
switch ($old_version) {
case '1.0':
$q = new w2p_Database_Query();
$q->addTable('resources');
$q->addField('resource_key', 'varchar(64) not null default ""');
$q->exec();
if (db_error()) {
return false;
}
// FALLTHROUGH
// FALLTHROUGH
case '1.0.1':
break;
}
return true;
}
开发者ID:viniciusbudines,项目名称:sisnuss,代码行数:18,代码来源:setup.php
示例10: store
public function store(CAppUI $AppUI = null)
{
global $AppUI;
$perms = $AppUI->acl();
$stored = false;
$this->_error = $this->check();
if (count($this->_error)) {
return $this->_error;
}
$q = new w2p_Database_Query();
if ($this->message_id && $perms->checkModuleItem('forums', 'edit', $this->forum_id)) {
$q->setDelete('forum_visits');
$q->addWhere('visit_message = ' . (int) $this->message_id);
$q->exec();
if ($msg = parent::store()) {
return $msg;
}
$stored = true;
}
if (0 == $this->message_id && $perms->checkModuleItem('forums', 'add')) {
$this->message_date = $q->dbfnNowWithTZ();
if ($msg = parent::store()) {
return $msg;
}
$q->addTable('forum_messages');
$q->addQuery('count(message_id), MAX(message_date)');
$q->addWhere('message_forum = ' . (int) $this->message_forum);
$reply = $q->fetchRow();
//update forum descriptor
$forum = new CForum();
$forum->load($AppUI, $this->message_forum);
$forum->forum_message_count = $reply[0];
/*
* Note: the message_date here has already been adjusted for the
* timezone above, so don't do it again!
*/
$forum->forum_last_date = $this->message_date;
$forum->forum_last_id = $this->message_id;
$forum->store($AppUI);
$this->sendWatchMail(false);
$stored = true;
}
return $stored;
}
开发者ID:viniciusbudines,项目名称:sisnuss,代码行数:44,代码来源:forummessage.class.php
示例11: install
public function install()
{
global $AppUI;
$q = new w2p_Database_Query();
$q->createTable('links');
$q->createDefinition('(
link_id int( 11 ) NOT NULL AUTO_INCREMENT ,
link_url varchar( 255 ) NOT NULL default "",
link_project int( 11 ) NOT NULL default "0",
link_task int( 11 ) NOT NULL default "0",
link_name varchar( 255 ) NOT NULL default "",
link_parent int( 11 ) default "0",
link_description text,
link_owner int( 11 ) default "0",
link_date datetime default NULL ,
link_icon varchar( 20 ) default "obj/",
link_category int( 11 ) NOT NULL default "0",
PRIMARY KEY ( link_id ) ,
KEY idx_link_task ( link_task ) ,
KEY idx_link_project ( link_project ) ,
KEY idx_link_parent ( link_parent )
) ENGINE = MYISAM DEFAULT CHARSET=utf8 ');
$q->exec($sql);
$i = 0;
$linkTypes = array('Unknown', 'Document', 'Application');
foreach ($linkTypes as $linkType) {
$q->clear();
$q->addTable('sysvals');
$q->addInsert('sysval_key_id', 1);
$q->addInsert('sysval_title', 'LinkType');
$q->addInsert('sysval_value', $linkType);
$q->addInsert('sysval_value_id', $i);
$q->exec();
$i++;
}
$perms = $AppUI->acl();
return $perms->registerModule('Links', 'links');
}
开发者ID:,项目名称:,代码行数:38,代码来源:
示例12: authenticate
public function authenticate($username, $password)
{
global $db, $AppUI;
$this->username = $username;
$q = new w2p_Database_Query();
$q->addTable('users');
$q->addQuery('user_id, user_password');
$q->addWhere("user_username = '{$username}'");
$q->addWhere("user_password = '" . MD5($password) . "'");
$q->exec();
if ($row = $q->fetchRow()) {
$this->user_id = $row['user_id'];
return true;
}
return false;
}
开发者ID:,项目名称:,代码行数:16,代码来源:
示例13: authenticate
public function authenticate($username, $password)
{
global $db, $AppUI;
$this->username = $username;
$q = new w2p_Database_Query();
$q->addTable('users');
$q->addQuery('user_id, user_password');
$q->addWhere('user_username = \'' . $username . '\'');
if (!($rs = $q->exec())) {
$q->clear();
return false;
}
if (!($row = $q->fetchRow())) {
$q->clear();
return false;
}
$this->user_id = $row['user_id'];
$q->clear();
if (MD5($password) == $row['user_password']) {
return true;
}
return false;
}
开发者ID:viniciusbudines,项目名称:sisnuss,代码行数:23,代码来源:SQL.class.php
示例14: w2p_Database_Query
$q->addQuery('ut.user_task_priority');
$q->addQuery('task_priority, task_percent_complete');
$q->addQuery('task_duration, task_duration_type');
$q->addQuery('task_project, task_represents_project');
$q->addQuery('task_description, task_owner, task_status');
$q->addQuery('usernames.user_username, usernames.user_id');
$q->addQuery('assignees.user_username as assignee_username');
$q->addQuery('count(distinct assignees.user_id) as assignee_count');
$q->addQuery('co.contact_first_name, co.contact_last_name');
$q->addQuery('CONCAT(co.contact_first_name,\' \', co.contact_last_name) AS owner');
$q->addQuery('task_milestone');
$q->addQuery('count(distinct f.file_task) as file_count');
$q->addQuery('tlog.task_log_problem');
$q->addQuery('task_access');
//subquery the parent state
$sq = new w2p_Database_Query();
$sq->addTable('tasks', 'stasks');
$sq->addQuery('COUNT(stasks.task_id)');
$sq->addWhere('stasks.task_id <> tasks.task_id AND stasks.task_parent = tasks.task_id');
$subquery = $sq->prepare();
$sq->clear();
$q->addQuery('(' . $subquery . ') AS task_nr_of_children');
$q->addTable('tasks');
$mods = $AppUI->getActiveModules();
if (!empty($mods['history']) && canView('history')) {
$q->addQuery('MAX(history_date) as last_update');
$q->leftJoin('history', 'h', 'history_item = tasks.task_id AND history_table=\'tasks\'');
}
$q->addJoin('projects', 'p', 'p.project_id = task_project', 'inner');
$q->leftJoin('users', 'usernames', 'task_owner = usernames.user_id');
$q->leftJoin('user_tasks', 'ut', 'ut.task_id = tasks.task_id');
开发者ID:eureka2,项目名称:web2project,代码行数:31,代码来源:tasks.php
示例15: array
** Load department info for the case where one
** wants to see the ProjectsWithOwnerInDeparment (PwOiD)
** instead of the projects related to the given department.
*/
if ($addPwOiD && $department > 0) {
$owner_ids = array();
$q = new w2p_Database_Query();
$q->addTable('users');
$q->addQuery('user_id');
$q->addJoin('contacts', 'c', 'c.contact_id = user_contact', 'inner');
$q->addWhere('c.contact_department = ' . (int) $department);
$owner_ids = $q->loadColumn();
$q->clear();
}
// pull valid projects and their percent complete information
$q = new w2p_Database_Query();
$q->addTable('projects', 'pr');
$q->addQuery('DISTINCT pr.project_id, project_color_identifier, project_name, project_start_date, project_end_date,
max(t1.task_end_date) AS project_actual_end_date, project_percent_complete,
project_status, project_active');
$q->addJoin('tasks', 't1', 'pr.project_id = t1.task_project');
$q->addJoin('companies', 'c1', 'pr.project_company = c1.company_id');
if ($department > 0 && !$addPwOiD) {
$q->addWhere('project_departments.department_id = ' . (int) $department);
}
if ($project_type > -1) {
$q->addWhere('pr.project_type = ' . (int) $project_type);
}
if ($owner > 0) {
$q->addWhere('pr.project_owner = ' . (int) $owner);
}
开发者ID:viniciusbudines,项目名称:sisnuss,代码行数:31,代码来源:gantt.php
示例16: testAddReminder
/**
* Tests adding a reminder to a task
*/
public function testAddReminder()
{
global $AppUI;
global $w2Pconfig;
$this->obj->load(1);
// Ensure our global setting for task_reminder_control is set properly for this
$old_task_reminder_control = $w2Pconfig['task_reminder_control'];
$w2Pconfig['task_reminder_control'] = true;
$this->obj->addReminder();
$this->obj->task_percent_complete = 50;
$xml_file_dataset = $this->createXMLDataset($this->getDataSetPath() . 'tasksTestAddReminder.xml');
$xml_file_filtered_dataset = new PHPUnit_Extensions_Database_DataSet_DataSetFilter($xml_file_dataset, array('event_queue' => array('queue_start')));
$xml_db_dataset = $this->getConnection()->createDataSet();
$xml_db_filtered_dataset = new PHPUnit_Extensions_Database_DataSet_DataSetFilter($xml_db_dataset, array('event_queue' => array('queue_start')));
$this->assertTablesEqual($xml_file_filtered_dataset->getTable('event_queue'), $xml_db_filtered_dataset->getTable('event_queue'));
$now_secs = time();
$min_time = $now_secs - 10;
/**
* Get updated dates to test against
*/
$q = new w2p_Database_Query();
$q->addTable('event_queue');
$q->addQuery('queue_start');
$q->addWhere('queue_id = 2');
$results = $q->loadColumn();
foreach ($results as $queue_start) {
$this->assertGreaterThanOrEqual($min_time, $queue_start);
$this->assertLessThanOrEqual($now_secs, $queue_start);
}
$w2Pconfig['task_reminder_control'] = $old_task_reminder_control;
}
开发者ID:eureka2,项目名称:web2project,代码行数:34,代码来源:tasks.test.php
示例17: styleRenderBoxTop
}
echo '<br />';
if (function_exists('styleRenderBoxTop')) {
echo styleRenderBoxTop();
}
echo '<table cellspacing="0" cellpadding="4" border="0" width="100%" class="std">
<tr>
<td>';
// Let's figure out which users we have
$user_list = w2PgetUsersHashList();
// Now which tasks will we need and the real allocated hours (estimated time / number of users)
// Also we will use tasks with duration_type = 1 (hours) and those that are not marked
// as milstones
// GJB: Note that we have to special case duration type 24 and this refers to the hours in a day, NOT 24 hours
$working_hours = $w2Pconfig['daily_working_hours'];
$q = new w2p_Database_Query();
$q->addTable('tasks', 't');
$q->addTable('user_tasks', 'ut');
$q->addJoin('projects', '', 'project_id = task_project', 'inner');
$q->addQuery('t.task_id, round(t.task_duration * IF(t.task_duration_type = 24, ' . $working_hours . ', t.task_duration_type)/count(ut.task_id),2) as hours_allocated');
$q->addWhere('t.task_id = ut.task_id');
$q->addWhere('t.task_milestone = 0');
$q->addWhere('project_active = 1');
if (($template_status = w2PgetConfig('template_projects_status_id')) != '') {
$q->addWhere('project_status <> ' . (int) $template_status);
}
if ($project_id != 0) {
$q->addWhere('t.task_project = ' . (int) $project_id);
}
if (!$log_all) {
$q->addWhere('t.task_start_date >= \'' . $start_date->format(FMT_DATETIME_MYSQL) . '\'');
开发者ID:eureka2,项目名称:web2project,代码行数:31,代码来源:userperformance.php
示例18: canView
global $m, $a, $project_id, $f, $task_status, $min_view, $query_string, $durnTypes, $tpl;
global $task_sort_item1, $task_sort_type1, $task_sort_order1;
global $task_sort_item2, $task_sort_type2, $task_sort_order2;
global $user_id, $w2Pconfig, $currentTabId, $currentTabName, $canEdit, $showEditCheckbox;
global $history_active;
if (empty($query_string)) {
$query_string = '?m=' . $m . '&a=' . $a;
}
$mods = $AppUI->getActiveModules();
$history_active = !empty($mods['history']) && canView('history');
// Number of columns (used to calculate how many columns to span things through)
$cols = 13;
/****
// Let's figure out which tasks are selected
*/
$q = new w2p_Database_Query();
$pinned_only = (int) w2PgetParam($_GET, 'pinned', 0);
if (isset($_GET['pin'])) {
$pin = (int) w2PgetParam($_GET, 'pin', 0);
$msg = '';
// load the record data
if ($pin) {
$q->addTable('user_task_pin');
$q->addInsert('user_id', $AppUI->user_id);
$q->addInsert('task_id', $task_id);
} else {
$q->setDelete('user_task_pin');
$q->addWhere('user_id = ' . (int) $AppUI->user_id);
$q->addWhere('task_id = ' . (int) $task_id);
}
if (!$q->exec()) {
开发者ID:,项目名称:,代码行数:31,代码来源:
示例19: __construct
public function __construct($prefix = null, $query_db = null)
{
parent::__construct($prefix, $query_db);
trigger_error("DBQuery has been deprecated in v2.0 and will be removed by v4.0. Please use w2p_Database_Query instead.", E_USER_NOTICE);
}
开发者ID:,项目名称:,代码行数:5,代码来源:
示例20: updateHoursWorked
public static function updateHoursWorked($taskId, $totalHours)
{
$q = new w2p_Database_Query();
$q->addTable('tasks');
$q->addUpdate('task_hours_worked', $totalHours + 0);
$q->addWhere('task_id = ' . $taskId);
$q->exec();
$q->clear();
$q->addTable('tasks');
$q->addQuery('task_project');
$q->addWhere('task_id = ' . $taskId);
$project_id = $q->loadResult();
CProject::updateHoursWorked($project_id);
}
开发者ID:eureka2,项目名称:web2project,代码行数:14,代码来源:tasks.class.php
注:本文中的w2p_Database_Query类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论